Labsco
tonybentley logo

ENC Charts MCP Server

โ˜… 1

from tonybentley

Programmatically access and parse NOAA Electronic Navigational Charts (ENC) in S-57 format.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

ENC Charts MCP Server

An MCP (Model Context Protocol) server for Electronic Navigational Charts (ENC) data, providing programmatic access to NOAA electronic navigational charts with S-57 format parsing capabilities.

Overview

This MCP server enables AI assistants to access and analyze electronic navigational charts from NOAA. It automatically downloads, caches, and parses S-57 format chart data, making it available through a standardized API. The server supports coordinate-based chart discovery, feature extraction, and navigation-focused queries.

Features

  • S-57 Chart Parsing: Full support for IHO S-57 format electronic navigational charts
  • NOAA Integration: Automatic chart discovery and downloading from NOAA REST APIs
  • Coordinate-Based Queries: Find and retrieve charts based on GPS coordinates
  • Smart Caching: Efficient local caching with configurable size and age limits
  • Feature Filtering: Extract specific navigation features (lights, buoys, depths, etc.)
  • 172 Object Classes: Complete support for S-57 object catalog
  • Depth Analysis: Filter features by depth ranges for navigation safety
  • Spatial Queries: Bounding box filtering for area-specific data

Available Tools

get_chart

Retrieve chart features for a specific area by chart ID or coordinates.

Parameters:

  • chartId (string, optional): Chart identifier (e.g., "US5CA12M")
  • coordinates (object, optional): GPS coordinates
    • lat (number): Latitude (-90 to 90)
    • lon (number): Longitude (-180 to 180)
  • boundingBox (object, optional): Geographic bounds filter
    • minLat, maxLat, minLon, maxLon (numbers)
  • featureTypes (array, optional): S-57 object classes to include
  • depthRange (object, optional): Depth filter in meters
    • min, max (numbers)
  • includeNearby (boolean, optional): Include nearby features
  • limit (integer, optional): Maximum features to return (default: 100, max: 1000)
  • offset (integer, optional): Number of features to skip for pagination (default: 0)

Example Request:

{
  "coordinates": { "lat": 37.8, "lon": -122.5 },
  "featureTypes": ["LIGHTS", "BOYLAT", "DEPARE"],
  "depthRange": { "min": 0, "max": 20 }
}

Example Response:

{
  "chartId": "US5CA12M",
  "features": [
    {
      "id": "LIGHTS.123",
      "type": "LIGHTS",
      "geometry": {
        "type": "Point",
        "coordinates": [-122.5295, 37.8156]
      },
      "properties": {
        "COLOUR": ["1"],
        "LITCHR": 8,
        "SIGPER": 4,
        "VALNMR": 18
      }
    }
  ],
  "featureCount": 42,
  "totalFeatures": 150,
  "hasMore": true,
  "limit": 100,
  "offset": 0,
  "source": "NOAA ENC"
}

search_charts

Search available charts by various criteria.

Parameters:

  • query (string, optional): Search by name or area
  • scale (object, optional): Scale range filter
    • min, max (numbers)
  • boundingBox (object, optional): Geographic search area
  • format (string, optional): Chart format ("S-57" or "S-101")
  • limit (integer, optional): Maximum charts to return (default: 50, max: 100)
  • offset (integer, optional): Number of charts to skip for pagination (default: 0)

get_chart_metadata

Get detailed information about a specific chart.

Parameters:

  • chartId (string, optional): Chart identifier
  • coordinates (object, optional): GPS coordinates to find chart

get_object_classes

Get information about S-57 object classes and their representations.

Parameters:

  • category (string, optional): Filter by category
    • Options: "navAids", "depths", "areas", "infrastructure", "natural", "hazards"
  • search (string, optional): Search by acronym or description
  • includeAttributes (boolean, optional): Include standard attributes

Data Sources

NOAA ENC Online

The server integrates with NOAA's Electronic Navigational Chart services:

  • XML Product Catalog: Charts metadata from https://www.charts.noaa.gov/ENCs/ENCProdCat.xml
  • Chart Downloads: Individual S-57 format ZIP files from https://www.charts.noaa.gov/ENCs/
  • Update Frequency: Weekly for most charts
  • Coverage: US waters and territories
  • No Authentication Required: All NOAA resources are publicly accessible

Charts are automatically downloaded on-demand when queried by coordinates and cached locally for performance. The XML catalog is cached for 24 hours to reduce API calls.

How It Works

  1. Chart Discovery: The server queries NOAA's XML product catalog to find charts based on coordinates or search criteria
  2. Automatic Download: Charts are downloaded on-demand from NOAA when requested
  3. Local Caching: Downloaded charts are cached locally to improve performance
  4. S-57 Parsing: Chart data is parsed from S-57 format using GDAL Python bindings
  5. Feature Extraction: Navigation features (lights, buoys, depths, etc.) are extracted and returned as GeoJSON

S-57 Object Classes

The server supports all 172 standard S-57 object classes. Key categories include:

  • LIGHTS - All lighted aids (lighthouses, beacons, lit buoys)
  • BOYLAT - Lateral buoys (port/starboard markers)
  • BOYSAW - Safe water buoys
  • BCNLAT - Lateral beacons
  • DAYMAR - Day marks

Depth Information

  • DEPARE - Depth areas with ranges
  • DEPCNT - Depth contour lines
  • SOUNDG - Individual soundings
  • DRGARE - Dredged areas

Areas & Boundaries

  • FAIRWY - Navigation channels
  • ANCHRG - Anchorage areas
  • RESARE - Restricted areas
  • TSSLPT - Traffic separation schemes

Hazards

  • OBSTRN - Underwater obstructions
  • WRECKS - Shipwrecks
  • ROCKS - Rocks and reefs

Common Use Cases

1. Navigation Planning

Find charts and extract navigation aids for route planning:

// Get charts for Golden Gate area
{
  "coordinates": { "lat": 37.8199, "lon": -122.4783 },
  "featureTypes": ["LIGHTS", "BOYLAT", "BOYSAW", "BCNLAT"],
  "includeNearby": true
}

2. Anchorage Analysis

Find suitable anchoring spots with depth information:

// Search for anchorages with specific depth range
{
  "chartId": "US5CA12M",
  "featureTypes": ["DEPARE", "ANCHRG", "SOUNDG"],
  "depthRange": { "min": 5, "max": 15 },
  "boundingBox": {
    "minLat": 37.8,
    "maxLat": 37.82,
    "minLon": -122.52,
    "maxLon": -122.5
  }
}

3. Hazard Detection

Identify navigation hazards in an area:

// Get all hazards near a route
{
  "coordinates": { "lat": 32.7157, "lon": -117.1611 },
  "featureTypes": ["OBSTRN", "WRECKS", "ROCKS", "UWTROC"],
  "includeNearby": true
}

4. Chart Discovery

Find all available charts for a region:

// Search charts between San Diego and Los Angeles
{
  "boundingBox": {
    "minLat": 32.5,
    "maxLat": 34.0,
    "minLon": -118.5,
    "maxLon": -117.0
  },
  "scale": { "max": 50000 }  // Detailed charts only
}

Development

Running Locally

# Clone the repository
git clone https://github.com/tonybentley/enc-charts-mcp.git
cd enc-charts-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode (with hot reload)
npm run dev

# Run production build
npm start

Development Commands

  • npm run dev - Run in development mode with hot reload
  • npm run build - Build TypeScript to JavaScript
  • npm run test - Run unit tests
  • npm run test:e2e - Run end-to-end tests
  • npm run test:all - Run all test suites
  • npm run lint - Run ESLint
  • npm run typecheck - Run TypeScript type checking
  • npm run format - Format code with Prettier

GDAL Validation

  • npm run gdal:detect - Check if GDAL is properly installed
  • npm run gdal:validate - Validate GDAL installation and environment
  • npm run test:integration:check - Verify GDAL before running integration tests

Performance Considerations

  • Charts can be 10-100MB each
  • Initial downloads may take time
  • Cache warming recommended for frequently accessed areas
  • Spatial queries optimized for bounding boxes

Pagination

To prevent response size issues, the get_chart and search_charts tools implement pagination:

  • get_chart: Returns up to 100 features by default (max: 1000)
  • search_charts: Returns up to 50 charts by default (max: 100)

Use the limit and offset parameters to page through large result sets:

// First page
{ "chartId": "US5CA12M", "limit": 100, "offset": 0 }

// Next page
{ "chartId": "US5CA12M", "limit": 100, "offset": 100 }

The response includes pagination metadata:

  • totalFeatures or totalCount: Total number of available items
  • hasMore: Boolean indicating if more results exist
  • limit: Number of items returned
  • offset: Number of items skipped

Source Code

The source code is available on GitHub.