
Mapbox Mcp Runtime Patterns
Wire Mapbox MCP geospatial tools into Claude/Cursor agents for directions, geocoding, isochrones, and offline Turf.js geometry without reinventing integration patterns.
Overview
Mapbox MCP Runtime Patterns is an agent skill for the Build phase that documents how to integrate the Mapbox MCP Server geospatial tool catalog into AI applications for production use.
Install
npx skills add https://github.com/mapbox/mapbox-agent-skills --skill mapbox-mcp-runtime-patternsWhat is this skill?
- Catalog splits offline Turf.js tools (distance, buffer, area, simplify—free, instant) from paid Mapbox API tools (direct
- Points to the official mapbox/mcp-server repo as the runtime server for AI applications.
- Includes utility tools: version_tool and category_list_tool for discovery.
- Quick-reference layout for choosing free vs API-cost tools before agent tool registration.
- 9 offline Turf.js MCP tools listed as free and instant
- 9 Mapbox API MCP tools where API costs apply
- 2 free utility tools (version and category list)
Adoption & trust: 608 installs on skills.sh; 64 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want map, routing, and geometry capabilities inside an agent but do not know which MCP tools are free, which hit Mapbox APIs, or how the server is organized.
Who is it for?
Solo builders adding MCP-based maps, geocoding, routing, or Turf geometry to an agent stack already targeting Mapbox.
Skip if: Teams that only need a static map embed in a marketing page with no MCP agent, or builders who will not run an MCP runtime at all.
When should I use this skill?
Integrating Mapbox MCP Server into AI applications for production geospatial agent tooling.
What do I get? / Deliverables
After using it, you can register the right Mapbox MCP tools in your agent with clear cost expectations and category boundaries aligned to the official server.
- Tool category map aligned to Mapbox MCP server
- Cost-aware tool selection for agent registration
Recommended Skills
Journey fit
Runtime MCP integration patterns belong on the Build shelf where solo builders connect external tool servers to coding agents. Agent-tooling is the canonical home for Model Context Protocol server usage, tool catalogs, and production wiring—not one-off app UI work.
How it compares
Reference skill for MCP tool wiring—not a replacement for Mapbox SDK docs or a hosted MCP marketplace listing.
Common Questions / FAQ
Who is mapbox-mcp-runtime-patterns for?
Indie developers and agent builders who use Claude Code, Cursor, or Codex and need a structured Mapbox MCP tool map before implementation.
When should I use mapbox-mcp-runtime-patterns?
During Build when connecting the Mapbox MCP server, scoping agent tools for logistics or map UX, or deciding between free Turf.js tools and billed Mapbox API tools.
Is mapbox-mcp-runtime-patterns safe to install?
It is documentation-only guidance; review the Security Audits panel on this Prism page and treat Mapbox API keys and network access as your own operational risk.
SKILL.md
READMESKILL.md - Mapbox Mcp Runtime Patterns
# Mapbox MCP Runtime Patterns Quick reference for integrating Mapbox MCP Server into AI applications for production use. ## What is MCP Server? Runtime server providing geospatial tools to AI agents via Model Context Protocol. **Repo:** <https://github.com/mapbox/mcp-server> ## Tools Available | Category | Tools | Cost | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------- | | **Offline (Turf.js)** | `distance_tool`, `bearing_tool`, `midpoint_tool`, `point_in_polygon_tool`, `area_tool`, `buffer_tool`, `centroid_tool`, `bbox_tool`, `simplify_tool` | Free, instant | | **Mapbox APIs** | `directions_tool`, `search_and_geocode_tool`, `reverse_geocode_tool`, `category_search_tool`, `isochrone_tool`, `matrix_tool`, `static_map_image_tool`, `map_matching_tool`, `optimization_tool` | API costs apply | | **Utility** | `version_tool`, `category_list_tool` | Free | ## Coordinate Formats All tools use `{longitude, latitude}` object format — **not** arrays. **Object format** `{longitude: lng, latitude: lat}`: - `directions_tool` - `coordinates` array of objects - `isochrone_tool` - `coordinates` parameter - `reverse_geocode_tool` - `coordinates` parameter - `category_search_tool` - `proximity` parameter - `distance_tool` - `from`/`to` parameters - `bearing_tool` - `from`/`to` parameters - `midpoint_tool` - `from`/`to` parameters - `point_in_polygon_tool` - `point` parameter **Exception — GeoJSON geometry** (arrays only): - `buffer_tool` - `geometry` parameter uses `[longitude, latitude]` arrays (GeoJSON format) - `point_in_polygon_tool` - `polygon` rings use `[longitude, latitude]` arrays **Note:** All coordinates use `longitude` before `latitude` order. ## Installation ### Hosted (Recommended) Use Mapbox's hosted server - no installation needed: ``` https://mcp.mapbox.com/mcp ``` Connect with your token in the `Authorization: Bearer <token>` header. **Note:** Hosted server supports OAuth for interactive flows (coding assistants), but use token auth for programmatic runtime access. ### Self-Hosted ```bash npm install @mapbox/mcp-server # Or: npx @mapbox/mcp-server export MAPBOX_ACCESS_TOKEN="your_token" ``` ## Framework Integration ### Pydantic AI ```python from pydantic_ai import Agent import subprocess # Start MCP server mcp = subprocess.Popen(['npx', '@mapbox/mcp-server'], env={'MAPBOX_ACCESS_TOKEN': token}) agent = Agent( model='gateway/openai:gpt-5.2', tools=[ lambda from_loc, to_loc: call_mcp('directions_tool', { 'origin': from_loc, 'destination': to_loc }) ] ) ``` ### Mastra ```typescript import { spawn } from 'child_process'; const mcp = spawn('npx', ['@mapbox/mcp-server'], { env: { MAPBOX_ACCESS_TOKEN: process.env.MAPBOX_ACCESS_TOKEN } }); const mastra = new Mastra({ workflows: { findRestaurants: { steps: [ { tool: 'mapbox.category_search_tool', input: {...} }, { tool: 'mapbox.matrix_tool', input: {...} } ] } } }); ``` ### LangChain ```typescript import { DynamicTool } from '@langchain/core/tools'; const tools = [ new DynamicTool({ name: 'directions_tool', description: 'Get driving directions', func: async (input) => { const { origin, destination } = JSON.parse(input); return await callMCP('directions_tool', { origin, destination }); } }) ]