Introducing the Mapbox MCP Server: Location Intelligence for AI Agents
Source: Dev.to
Introduction
AI agents are getting smarter every day – they can write code, analyze data, and answer complex questions.
But when it comes to understanding where things are, most agents hit a wall. They can tell you about restaurants in San Francisco, but they can’t:
- Geocode an address
- Calculate a route
- Determine if two locations are within walking distance
That’s where the Mapbox Model Context Protocol (MCP) Server comes in. It gives AI agents access to Mapbox’s powerful location services through a simple, standardized interface. No custom API integration is required – just connect your agent to the MCP server and it can instantly:
- Geocode addresses
- Plan routes
- Analyze travel times
- Create maps
Example
An AI agent built with MCP can naturally handle location queries and display results visually.
What Is the Model Context Protocol?
The Model Context Protocol is an open standard created by Anthropic for connecting AI models to external tools and data sources. Think of it as USB for AI agents – a universal connector that works across different frameworks and platforms.
Instead of writing custom code for each API, you:
- Connect your agent to an MCP server
- The server exposes its tools in a standardized format
- Your agent discovers and uses those tools automatically
MCP is supported by popular frameworks such as CrewAI, LangGraph, Pydantic AI, and Mastra, as well as AI assistants like GitHub Copilot and Claude Desktop.
Mapbox MCP Server – Geospatial Tools
The Mapbox MCP Server exposes nine powerful geospatial tools that give your agents comprehensive location intelligence.
| Tool | Purpose | Example Use |
|---|---|---|
search_and_geocode_tool | Convert addresses/places to coordinates | “Find coordinates for ‘1600 Pennsylvania Ave, Washington DC’” |
reverse_geocoding_tool | Convert coordinates to addresses | “What’s the address at 38.8977, ‑77.0365?” |
directions_tool | Calculate routes between points | “Driving directions from Boston to New York with traffic” |
matrix_tool | Travel times between multiple points | “Calculate delivery times from 3 warehouses to 10 addresses” |
isochrone_tool | Areas reachable within time/distance | “Show everywhere I can drive in 30 minutes from downtown” |
static_image_tool | Generate map images | “Create a map showing my delivery route” |
category_search_tool | Find POIs by category | “Find all museums near Central Park” |
resource_reader_tool | Access reference data | “Get list of available POI categories” |
search_and_geocode_tool (Unified) | Forward geocoding + POI search in one tool | Handles “123 Main St”, “Starbucks near Times Square”, “Eiffel Tower”, etc. |
Highlights
- Traffic‑Aware Routing –
directions_toolsupports real‑time traffic, alternative routes, and multiple transportation modes (driving, walking, cycling). - Multi‑Point Optimization –
matrix_toolefficiently calculates travel times for dozens of locations – essential for logistics and service‑area analysis. - Reachability Analysis –
isochrone_toolgenerates polygons showing areas reachable within specific time or distance thresholds. - Visual Output –
static_image_toolcreates customizable map images with markers, routes, and overlays – perfect for reports or notifications.
Using the Mapbox MCP Server
You have two ways to use the server:
1. Hosted MCP Endpoint
Mapbox provides a hosted MCP endpoint that’s always available:
https://mcp.mapbox.com/mcp
Authentication
| Client Type | Method |
|---|---|
| Interactive (Claude Desktop, VS Code, etc.) | OAuth flow with browser‑based login |
| Programmatic (agent frameworks) | Bearer‑token authentication using your Mapbox access token |
Setup – Interactive Tools
Add the following to your MCP settings (usually settings.json or a similar config file):
{
"mcpServers": {
"mapbox": {
"url": "https://mcp.mapbox.com/mcp"
}
}
}
Claude Desktop config locations
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
The first time you connect, a browser window will open asking you to log in to your Mapbox account and authorize access via OAuth.
Setup – Programmatic Access
- Create a Mapbox account (free tier) – Sign up here.
- Generate an access token from your account dashboard.
Use the token as a Bearer token in your code (see framework‑specific tutorials for examples).
Reference: Hosted MCP Server Guide – detailed setup for different clients.
Pros & Cons
| Pros | Cons |
|---|---|
| No local setup or dependencies | Additional network hop (your machine → hosted MCP → Mapbox APIs) |
| Managed infrastructure by Mapbox | Requires stable internet connection |
| Always available & automatically updated | Less control over configuration |
2. Run MCP Server Locally
Running the server locally gives you full control – ideal for development, debugging, or customization.
Prerequisites
- Node.js LTS+ (for
npxmethod) or Python 3.10+ withuv(foruvxmethod) - A Mapbox account (free tier) – Sign up here
- Your Mapbox access token
Setup – Interactive Tools
Add the following to your MCP settings:
{
"mcpServers": {
"mapbox": {
"command": "npx",
"args": ["-y", "@mapbox/mcp-server"],
"env": {
"MAPBOX_ACCESS_TOKEN": "your_token_here"
}
}
}
}
Claude Desktop config locations
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
Running the Server (Node)
npx -y @mapbox/mcp-server
Running the Server (Python/uv)
uvx @mapbox/mcp-server
Pros & Cons
| Pros | Cons |
|---|---|
| Full control over configuration and dependencies | Requires local installation and maintenance |
| No extra network hop – direct calls to Mapbox APIs | Must keep the server running and updated |
| Ideal for offline or highly customized environments | Slightly higher setup effort |
Note on the DevKit MCP Server
Mapbox also offers the DevKit MCP Server (hosted at https://mcp-devkit.mapbox.com/mcp). It is designed to help developers build Mapbox applications by providing:
- Code examples
- Documentation search
- Development assistance
This post focuses on the main MCP server for location intelligence. The DevKit will be covered in a future post.
Quick‑Start Guide
Configuration File
| Platform | Path |
|---|---|
| Claude Desktop | ort/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
Running the Server (Command‑Line)
-
Set your Mapbox access token
export MAPBOX_ACCESS_TOKEN="your_token_here" -
Start the server
Node.js (recommended)
npx -y @mapbox/mcp-serverPython (via
uvx)pip install uv # if you don’t have uv yet uvx mapbox-mcp -
Test with MCP Inspector
npx @modelcontextprotocol/inspector npx -y @mapbox/mcp-serverA web UI opens, letting you explore the exposed tools and try them interactively.
Sample Natural‑Language Requests
The agent will automatically discover the right tools, call them, and return a concise answer (no manual API handling required).
| Request | What the agent does |
|---|---|
| “Find coffee shops within walking distance of the Empire State Building.” | Geocode the Empire State Building → Search for coffee shops → Return list |
| “Show me gas stations along the route from Boston to New York.” | Geocode both cities → Get driving directions → Search for gas stations along the polyline |
| “What restaurants are near Times Square?” | Geocode Times Square → Search for restaurants → Return results |
| “Get driving directions from LAX to Hollywood with current traffic.” | Geocode LAX & Hollywood → Directions (traffic aware) → Return route |
| “How long would it take to walk from Central Park to Times Square?” | Geocode both locations → Walking directions → Return duration |
| “Calculate travel time from my hotel (Four Seasons) to JFK Airport by taxi.” | Geocode hotel & airport → Taxi profile directions → Return duration |
| “What’s the fastest route visiting Salesforce Tower, Twitter HQ, and Uber headquarters?” | Geocode three locations → Optimize order → Directions → Return route |
| “Create a map image showing the route from Golden Gate Bridge to Fisherman’s Wharf.” | Directions → Static map generation → Return image URL |
| “Show me a satellite view of Manhattan with key landmarks marked.” | Static map (satellite) + markers → Return image |
| “Generate a map highlighting all Starbucks locations within a mile of downtown Seattle.” | Search → Filter by distance → Static map with markers |
| “Show me areas reachable within 30 minutes of downtown Portland by car.” | Isochrone generation → Return polygon |
| “Calculate a travel‑time matrix between 3 hotel locations and the convention center.” | Matrix API → Return matrix |
| “Find the optimal route visiting 3 tourist attractions in San Francisco.” | Geocode → Optimize → Directions |
| “I’m staying at the Fairmont. Show me everywhere I can reach by walking in 15 minutes.” | Geocode → Isochrone (walking) → Return polygon |
| “How long does it take to drive from the Space Needle to Pike Place Market?” | 1. search_and_geocode_tool → Space Needle 2. search_and_geocode_tool → Pike Place Market 3. directions_tool (driving) → Returns ≈ 8 minutes, 1.2 mi |
Compatibility – MCP‑Ready Clients
| Framework / Tool | Language | Typical Use |
|---|---|---|
| CrewAI | Python | Multi‑agent collaboration |
| LangGraph | Python | Stateful agent workflows |
| Pydantic AI | Python | Type‑safe agent development |
| Mastra | TypeScript | Production AI applications |
| Smolagents | Python | Lightweight agents (🤗 Hub) |
| Claude Desktop | – | Anthropic’s AI assistant |
| ChatGPT | – | OpenAI desktop app |
| Gemini CLI | – | Google’s command‑line tool |
| VS Code | – | MCP extensions |
| Cursor | – | AI‑powered IDE |
| Goose | – | Terminal‑based AI assistant |
All follow the same basic flow:
- Configure the MCP server connection.
- Add the configuration to your agent.
- The agent discovers available tools automatically.
- Use natural language to invoke tools.
Detailed tutorials for each framework are coming soon.
Why Use MCP Instead of a Custom API Integration?
| Traditional Approach | MCP Approach |
|---|---|
| Write geocoding logic, format coordinates, handle errors, chain calls manually. | Describe the goal in plain language; the agent handles everything. |
| Manual tool discovery & configuration. | Automatic tool discovery via standardized MCP schema. |
| Framework‑specific code. | Write once, run everywhere (framework‑agnostic). |
| Hard‑coded tool chaining. | Intelligent, dynamic tool chaining based on task dependencies. |
Real‑World Use Cases
- Hotel concierge bots (directions, local recommendations)
- Trip‑planning assistants (multi‑stop itinerary optimization)
- Event coordinators (travel‑time calculations for attendees)
- Delivery‑fleet route optimization
- Service‑area analysis for expansion planning
- Warehouse location analysis (customer distribution)
- Commute‑time calculators for real‑estate listings
- School‑district & amenity proximity analysis
- Neighborhood boundary visualizations
- Technician dispatch optimization
- Emergency‑response time calculations
- Store locators with accurate directions
- Coverage‑area mapping for service offerings
- Competitive location analysis
Resources
- Mapbox MCP Server – GitHub (source & docs)
- Hosted MCP Server Guide – Setup for different clients
- Model Context Protocol (MCP) Spec – Standard documentation
- Mapbox API Docs – Underlying API reference
- Support –
mcp-feedback@mapbox.com - Issues – GitHub Issues
- Community – Join discussions in the MCP community
Pricing (Standard Mapbox API Rates)
| Service | Free Tier |
|---|---|
| Geocoding | 100 k requests / month |
| Directions | 5 k requests / month |
| Matrix | Counts as origins × destinations requests |
| Static Maps | 50 k requests / month |
The free tier is generous for development and small projects. For production, review the full Mapbox pricing page.
Get Started
- Sign up for Mapbox – Get a free access token at the sign‑up page.
- Run the server (see “Running the Server” above).
- Try the MCP Inspector to explore tools.
- Pick a framework and start building location‑aware AI agents!
Happy mapping! 🚀
Getting Started
- Start with CrewAI, LangGraph, or your preferred agent framework.
- Build something: Check out our framework‑specific tutorials (coming soon!).
What’s Next
- In our next post, we’ll dive deep into building a multi‑agent travel planning system with CrewAI and Mapbox MCP, complete with working code you can run and customize.
Coming Soon
- A guide to the Mapbox DevKit MCP Server, which helps AI assistants write Mapbox code by providing documentation, examples, and API guidance—perfect for developers building Mapbox applications.
Get In Touch
- Have questions or want to share what you’re building? Reach out to mcp-feedback@mapbox.com or open an issue on GitHub.