A Model Context Protocol (MCP) server that provides AI assistants with direct access to Mapbox developer APIs. This server enables AI models to interact with Mapbox services, helping developers build Mapbox applications more efficiently.
Mapbox-Developer-MCP.Server-demo.mp4
- Mapbox Developer MCP Server
Get started by integrating with your preferred AI development environment:
- Claude Code Integration - Command-line development with Claude
- Claude Desktop Integration - Desktop application integration
- Cursor Integration - Cursor IDE integration
- VS Code Integration - Visual Studio Code with GitHub Copilot
This MCP server can be packaged as a DXT (Desktop Extension) file for easy distribution and installation. DXT is a standardized format for distributing local MCP servers, similar to browser extensions.
To create a DXT package:
# Install the DXT CLI tool
npm install -g @anthropic-ai/dxt
# Build the server first
npm run build
# Create the DXT package
npx @anthropic-ai/dxt packThis will generate mcp-devkit-server.dxt using the configuration in manifest.json.
The DXT package includes:
- Pre-built server code (
dist/esm/index.js) - Server metadata and configuration
- User configuration schema for the Mapbox access token
- Automatic environment variable setup
For quick access, you can use our hosted MCP endpoint:
Endpoint: https://mcp-devkit.mapbox.com/mcp
For detailed setup instructions for different clients and API usage, see the Hosted MCP Server Guide. Note: This guide references the standard MCP endpoint - you'll need to update the endpoint URL to use the devkit endpoint above.
A Mapbox access token is required to use this MCP server.
- Sign up for a free Mapbox account at mapbox.com/signup
- Navigate to your Account page
- Create a new token with the required scopes for your use case
For more information about Mapbox access tokens, see the Mapbox documentation on access tokens.
The MAPBOX_ACCESS_TOKEN environment variable is required. Each tool requires specific token scopes/privileges to function properly. For example:
- Reading styles requires
styles:readscope - Creating styles requires
styles:writescope - Managing tokens requires
tokens:readandtokens:writescopes - Accessing feedback requires
user-feedback:readscope
get_latest_mapbox_docs_tool - Access the latest official Mapbox documentation directly from the source. This tool fetches comprehensive, up-to-date information about all Mapbox APIs, SDKs, and developer resources from docs.mapbox.com/llms.txt.
Example prompts:
- "What are the latest Mapbox APIs available for developers?"
- "Show me all current Mapbox services and SDKs"
- "I need up-to-date Mapbox documentation for my project"
- "What mapping solutions does Mapbox offer for my tech stack?"
- "Give me an overview of Mapbox's navigation and routing capabilities"
- "Compare Mapbox web SDKs versus mobile SDKs"
- "What's new in the Mapbox ecosystem?"
📖 See more examples and interactive demo →
get_reference_tool - Access static Mapbox reference documentation and schemas. This tool provides essential reference information that helps AI assistants understand Mapbox concepts and build correct styles and tokens.
Note: This tool exists as a workaround for Claude Desktop's current limitation with MCP resources. Claude Desktop can see resources (via
resources/list) but doesn't automatically callresources/readto fetch their content. This tool provides the same reference data through the tool interface, which Claude Desktop does support. Other MCP clients that fully support the resources protocol can access this data directly as MCP Resources (see Resources section below).
Available References:
resource://mapbox-style-layers- Mapbox GL JS style specification reference guide covering all layer types (fill, line, symbol, circle, fill-extrusion) and their propertiesresource://mapbox-streets-v8-fields- Complete field definitions for all Mapbox Streets v8 source layers, including enumerated values for each field (useful for building filters)resource://mapbox-token-scopes- Comprehensive token scope reference explaining what each scope allows and which scopes are needed for different operationsresource://mapbox-layer-type-mapping- Mapping of Mapbox Streets v8 source layers to compatible GL JS layer types, with common usage patterns
Example prompts:
- "What fields are available for the landuse layer?"
- "Show me the token scopes reference"
- "What layer type should I use for roads?"
- "Get the Streets v8 fields reference"
- "What scopes do I need to display a map?"
Complete set of tools for managing Mapbox styles via the Styles API:
Style Builder Tool - Create and modify Mapbox styles programmatically through conversational prompts
📖 See the Style Builder documentation for detailed usage and examples →
ListStylesTool - List all styles for a Mapbox account
- Input:
limit(optional - max number of styles),start(optional - pagination token) - Returns: Array of style metadata with optional pagination info
CreateStyleTool - Create a new Mapbox style
- Input:
name,style(Mapbox style specification) - Returns: Created style details with ID
RetrieveStyleTool - Retrieve a specific style by ID
- Input:
styleId - Returns: Complete style specification
UpdateStyleTool - Update an existing style
- Input:
styleId,name(optional),style(optional) - Returns: Updated style details
DeleteStyleTool - Delete a style by ID
- Input:
styleId - Returns: Success confirmation
PreviewStyleTool - Generate preview URL for a Mapbox style using an existing public token
- Input:
styleId,title(optional),zoomwheel(optional),zoom(optional),center(optional),bearing(optional),pitch(optional) - Returns: URL to open the style preview in browser
- Note: This tool automatically fetches the first available public token from your account for the preview URL. Requires at least one public token with
styles:readscope.
All style tools require a valid Mapbox access token with specific scopes. Using a token without the correct scope will result in authentication errors.
- ListStylesTool: Requires
styles:listscope - CreateStyleTool: Requires
styles:writescope - RetrieveStyleTool: Requires
styles:downloadscope - UpdateStyleTool: Requires
styles:writescope - DeleteStyleTool: Requires
styles:writescope - PreviewStyleTool: Requires
tokens:readscope (to list tokens) and at least one public token withstyles:readscope
Note: The username is automatically extracted from the JWT token payload.
Example prompts:
- "Can you create a Christmas themed Style for me?"
- "Please generate a preview link for this style"
- "Can you change the background to snow style?"
Create a new Mapbox access token with specified scopes and optional URL restrictions.
Parameters:
note(string, required): Description of the tokenscopes(array of strings, required): Array of scopes/permissions for the token. Must be valid Mapbox scopes (see below)allowedUrls(array of strings, optional): URLs where the token can be used (max 100)expires(string, optional): Expiration time in ISO 8601 format (maximum 1 hour in the future)
Available Scopes:
Available scopes for public tokens:
styles:tiles- Read styles as raster tilesstyles:read- Read stylesfonts:read- Read fontsdatasets:read- Read datasetsvision:read- Read Vision API
Example:
{
"note": "Development token for my app",
"scopes": ["styles:read", "fonts:read"],
"allowedUrls": ["https://myapp.com"]
}Example prompts:
- "Create a new Mapbox token for my web app with styles:read and fonts:read permissions"
- "Generate a token that expires in 30 minutes with styles:tiles and vision:read scopes"
- "Create a restricted token that only works on https://myapp.com with styles:read, fonts:read, and datasets:read"
List Mapbox access tokens for the authenticated user with optional filtering and pagination.
Parameters:
default(boolean, optional): Filter to show only the default public tokenlimit(number, optional): Maximum number of tokens to return per page (1-100)sortby(string, optional): Sort tokens by "created" or "modified" timestampstart(string, optional): The token ID after which to start the listing (when provided, auto-pagination is disabled)usage(string, optional): Filter by token type: "pk" (public)
Pagination behavior:
- When no
startparameter is provided, the tool automatically fetches all pages of results - When a
startparameter is provided, only the requested page is returned (for manual pagination control)
Example:
{
"limit": 10,
"sortby": "created",
"usage": "pk"
}Example prompts:
- "List all my Mapbox tokens"
- "Show me my public tokens sorted by creation date"
- "Find my default public token"
- "List the 5 most recently modified tokens"
- "Show all public tokens in my account"
Access user feedback items from the Mapbox Feedback API. These tools allow you to retrieve and view user-reported issues, suggestions, and feedback about map data, routing, and POI details.
list_feedback_tool - List user feedback items with comprehensive filtering, sorting, and pagination options.
Parameters:
feedback_ids(array of UUIDs, optional): Filter by one or more feedback item IDsafter(string, optional): Cursor from a previous response for paginationlimit(number, optional): Maximum number of items to return (1-1000, default varies)sort_by(string, optional): Sort field -received_at(default),created_at, orupdated_atorder(string, optional): Sort direction -asc(default) ordescstatus(array, optional): Filter by status -received,fixed,reviewed,out_of_scopecategory(array, optional): Filter by feedback categoriessearch(string, optional): Search phrase to match against feedback texttrace_id(array, optional): Filter by trace IDscreated_before,created_after(ISO 8601 string, optional): Filter by creation date rangereceived_before,received_after(ISO 8601 string, optional): Filter by received date rangeupdated_before,updated_after(ISO 8601 string, optional): Filter by update date rangeformat(string, optional): Output format -formatted_text(default) orjson_string
Returns: Paginated list of feedback items with pagination cursors.
get_feedback_tool - Get a single user feedback item by its unique ID.
Parameters:
feedback_id(UUID, required): The unique identifier of the feedback itemformat(string, optional): Output format -formatted_text(default) orjson_string
Returns: Single feedback item with details including status, category, feedback text, location, and timestamps.
- Both feedback tools: Require
user-feedback:readscope on the access token
Example prompts:
- "List all feedback items with status 'fixed'"
- "Show me feedback items in the 'poi_details' category created after July 1st"
- "Get feedback item with ID 40eae4c7-b157-4b49-a091-7e1099bba77e"
- "Find feedback items containing 'apartment building' in the feedback text"
- "List all routing issue feedback from the last month"
Generate a geojson.io URL to visualize GeoJSON data. This tool:
- Validates GeoJSON format (Point, LineString, Polygon, Feature, FeatureCollection, etc.)
- Returns a direct URL to geojson.io for instant visualization
- Supports both GeoJSON objects and JSON strings as input
Example usage:
{
"geojson": {
"type": "Point",
"coordinates": [-122.4194, 37.7749]
}
}Returns: A single URL string that can be opened in a browser to view the GeoJSON data.
Note: This is a beta feature currently optimized for small to medium-sized GeoJSON files. Large GeoJSON files may result in very long URLs and slower performance. We plan to optimize this in future versions by implementing alternative approaches for handling large datasets.
Example prompts:
- "Generate a preview URL for this GeoJSON data"
- "Create a geojson.io link for my uploaded route.geojson file"
Convert coordinates between different coordinate reference systems (CRS), specifically between WGS84 (EPSG:4326) and Web Mercator (EPSG:3857).
Parameters:
coordinates(array, required): Array of coordinate pairs to convert. Each coordinate pair should be[longitude, latitude]for WGS84 or[x, y]for Web MercatorfromCRS(string, required): Source coordinate reference system. Supported values:"EPSG:4326"(WGS84),"EPSG:3857"(Web Mercator)toCRS(string, required): Target coordinate reference system. Supported values:"EPSG:4326"(WGS84),"EPSG:3857"(Web Mercator)
Returns:
An array of converted coordinate pairs in the target CRS format.
Example:
{
"coordinates": [
[-122.4194, 37.7749],
[-74.006, 40.7128]
],
"fromCRS": "EPSG:4326",
"toCRS": "EPSG:3857"
}Example prompts:
- "Convert these coordinates from WGS84 to Web Mercator: [-122.4194, 37.7749] and [-74.006, 40.7128]"
- "Convert the coordinates [-13627361.0, 4544761.0] from Web Mercator to WGS84"
Calculates the bounding box of given GeoJSON content, returning coordinates as [minX, minY, maxX, maxY].
Parameters:
geojson(string or object, required): GeoJSON content to calculate bounding box for. Can be provided as:- A JSON string that will be parsed
- A GeoJSON object
Supported GeoJSON types:
- Point
- LineString
- Polygon
- MultiPoint
- MultiLineString
- MultiPolygon
- GeometryCollection
- Feature
- FeatureCollection
Returns:
An array of four numbers representing the bounding box: [minX, minY, maxX, maxY]
minX: Western-most longitudeminY: Southern-most latitudemaxX: Eastern-most longitudemaxY: Northern-most latitude
Example:
{
"geojson": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-73.9857, 40.7484]
},
"properties": {}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-74.006, 40.7128]
},
"properties": {}
}
]
}
}Example prompts:
- "Calculate the bounding box of this GeoJSON file" (then upload a .geojson file)
- "What's the bounding box for the coordinates in the uploaded parks.geojson file?"
This server exposes static reference documentation as MCP Resources. While these are primarily accessed through the get_reference_tool, MCP clients that fully support the resources protocol can access them directly.
Available Resources:
-
Mapbox Style Specification Guide (
resource://mapbox-style-layers)- Complete reference for Mapbox GL JS layer types and properties
- Covers fill, line, symbol, circle, and fill-extrusion layers
- Includes paint and layout properties for each layer type
-
Mapbox Streets v8 Fields Reference (
resource://mapbox-streets-v8-fields)- Field definitions for all Streets v8 source layers
- Enumerated values for filterable fields
- Essential for building accurate style filters
- Example:
landuselayer hasclassfield with values likepark,cemetery,hospital, etc.
-
Mapbox Token Scopes Reference (
resource://mapbox-token-scopes)- Comprehensive documentation of token scopes
- Explains public vs. secret token scopes
- Common scope combinations for different use cases
- Best practices for token management
-
Mapbox Layer Type Mapping (
resource://mapbox-layer-type-mapping)- Maps Streets v8 source layers to compatible GL JS layer types
- Organized by geometry type (polygon, line, point)
- Includes common usage patterns and examples
- Helps avoid incompatible layer type/source layer combinations
Accessing Resources:
- Claude Desktop & Most MCP Clients: Use the
get_reference_toolto access these references - Future MCP Clients: May support direct resource access via the MCP resources protocol
Note: Resources provide static reference data that doesn't change frequently, while tools provide dynamic, user-specific data (like listing your styles or tokens) and perform actions (like creating styles or tokens).
This server includes comprehensive distributed tracing using OpenTelemetry (OTEL) for production-ready observability.
- Opt-in Configuration: Tracing is disabled by default, enabling it requires only setting an OTLP endpoint
- Tool Execution Tracing: Automatic instrumentation of all tool executions with timing, success/failure status, and error details
- HTTP Request Instrumentation: Complete request/response tracing for Mapbox API calls with CloudFront correlation IDs
- Configuration Tracing: Startup configuration loading with error tracking
- Security: Input/output sizes logged but content is protected
- Low Overhead: <1% CPU impact, ~10MB memory for trace buffers
# 1. Start Jaeger (Docker required)
npm run tracing:jaeger:start
# 2. Configure environment
cp .env.example .env
# Edit .env to add MAPBOX_ACCESS_TOKEN
# OTEL_EXPORTER_OTLP_ENDPOINT is already set to http://localhost:4318
# 3. Run the server
npm run inspect:build
# 4. View traces at http://localhost:16686
# 5. Stop Jaeger when done
npm run tracing:jaeger:stopThe server supports any OTLP-compatible backend including:
- Development: Jaeger (local Docker)
- Cloud Providers: AWS X-Ray, Azure Monitor, Google Cloud Trace
- SaaS Platforms: Datadog, New Relic, Honeycomb
See .env.example for configuration examples for each platform.
- Complete Tracing Guide - Detailed configuration, features, and integration examples
- Verification Guide - Step-by-step verification and troubleshooting
# Enable tracing (required)
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
# Optional configuration
OTEL_SERVICE_NAME=mapbox-mcp-devkit-server
OTEL_TRACES_SAMPLER=traceidratio
OTEL_TRACES_SAMPLER_ARG=0.1 # Sample 10% for high-volumeThe project includes snapshot tests to ensure tool integrity and prevent accidental additions or removals of tools. These tests automatically discover all tools and create a snapshot of their metadata.
What the snapshot test covers:
- Tool class names
- Tool names (must follow
snake_case_toolnaming convention) - Tool descriptions
When to update snapshots:
-
Adding a new tool: After creating a new tool, run the test with snapshot update flag:
npm test -- test/tools/tool-naming-convention.test.ts --updateSnapshot -
Removing a tool: After removing a tool, update the snapshot:
npm test -- src/tools/tool-naming-convention.test.ts --updateSnapshot -
Modifying tool metadata: If you change a tool's name or description, update the snapshot:
npm test -- src/tools/tool-naming-convention.test.ts --updateSnapshot
Running snapshot tests:
# Run all tests (snapshot will fail if tools have changed)
npm test
# Update snapshots after intentional changes
npm test -- --updateSnapshotImportant: Only update snapshots when you have intentionally added, removed, or modified tools. Unexpected snapshot failures indicate accidental changes to the tool structure.
# Run the built image
npm run inspect:build# Build the Docker image
docker build -t mapbox-mcp-devkit .
# Run and inspect the server
npx @modelcontextprotocol/inspector docker run -i --rm --env MAPBOX_ACCESS_TOKEN="YOUR_TOKEN" mapbox-mcp-devkitnpx plop create-tool
# 1. Choose tool type:
# - Mapbox tool (makes API calls to Mapbox services)
# - Local tool (local processing, no API calls)
# 2. Provide tool name without suffix using PascalCase (e.g. Search)Generated file structure:
The plop generator creates three files for each new tool:
src/tools/your-tool-name-tool/
├── YourToolNameTool.schema.ts # Input schema definition and types
├── YourToolNameTool.ts # Main tool implementation
└── YourToolNameTool.test.ts # Unit tests
After creating a new tool:
-
Update the input schema in
YourToolNameTool.schema.ts:- Define the input parameters using Zod schema
- Export both the schema and the inferred TypeScript type
-
Update the tool description in
YourToolNameTool.ts:- Provide a clear description of what the tool does
-
Implement the tool logic in the
executemethod -
Update test cases with actual test data in
YourToolNameTool.test.ts -
Update the snapshot test to include the new tool:
npm test -- src/tools/tool-naming-convention.test.ts --updateSnapshot -
Run all tests to ensure everything works:
npm test
Schema separation benefits:
- Better code organization with separate schema files
- Easier maintenance when schema changes
- Consistent with existing tools in the project
- Enhanced TypeScript type safety
Set VERBOSE_ERRORS=true to get detailed error messages from the MCP server. This is useful for debugging issues when integrating with MCP clients.
By default, the server returns generic error messages. With verbose errors enabled, you'll receive the actual error details, which can help diagnose API connection issues, invalid parameters, or other problems.
Issue: Tools fail with authentication errors
Solution: Check that your MAPBOX_ACCESS_TOKEN has the required scopes for the tool you're using. See the token scopes section above.
Issue: Large GeoJSON files cause slow performance
Solution: The GeoJSON preview tool may be slow with very large files. Consider simplifying geometries or using smaller datasets for preview purposes.
We welcome contributions to the Mapbox Development MCP Server! Please review our standards and guidelines before contributing:
- Engineering Standards (CLAUDE.md) - Code quality, testing, documentation, and collaboration standards for all contributors
- AI Agent Instructions (AGENTS.md) - Comprehensive guide for AI agents working with this codebase
- GitHub Copilot Guidelines - Best practices for using GitHub Copilot responsibly in this project