Integration patterns for Mapbox MCP Server in AI applications and agent frameworks. Covers runtime integration with pydantic-ai, mastra, LangChain, and custom agents. Use when building AI-powered applications that need geospatial capabilities.
npx skills add https://github.com/mapbox/mapbox-agent-skills --skill mapbox-mcp-runtime-patterns
This skill provides patterns for integrating the Mapbox MCP Server into AI applications for production use with geospatial capabilities.
The Mapbox MCP Server is a Model Context Protocol (MCP) server that provides AI agents with geospatial tools:
Offline Tools (Turf.js):
Mapbox API Tools:
Utility Tools:
Key benefit: Give your AI application geospatial superpowers without manually integrating multiple APIs.
Before integrating, understand the key distinctions between tools to help your LLM choose correctly:
Straight-line distance (offline, instant):
distance_tool, bearing_tool, midpoint_tooldistance_toolRoute distance (API, traffic-aware):
directions_tool, matrix_tooldirections_toolCategory/type search:
category_search_toolcategory_search_toolSpecific place/address:
search_and_geocode_tool, reverse_geocode_toolsearch_and_geocode_toolReachable area (what's within reach):
isochrone_toolisochrone_toolSpecific route (how to get there):
directions_tooldirections_toolOffline tools (free, instant):
distance_tool, point_in_polygon_tool, area_toolAPI tools (requires token, counts against usage):
directions_tool, category_search_tool, isochrone_toolBest practice: Prefer offline tools when possible, use API tools when you need real-time data or routing.
Easiest integration - Use Mapbox's hosted MCP server at:
https://mcp.mapbox.com/mcp
No installation required. Simply pass your Mapbox access token in the Authorization header.
Benefits:
Authentication:
Use token-based authentication (standard for programmatic access):
Authorization: Bearer your_mapbox_token
Note: The hosted server also supports OAuth, but that's primarily for interactive flows (coding assistants, not production apps).
For custom deployments or development:
npm install @mapbox/mcp-server
Or use directly via npx:
npx @mapbox/mcp-server
Environment setup:
export MAPBOX_ACCESS_TOKEN="your_token_here"
Detailed integration patterns and production guidance are organized into reference files. Load the ones relevant to your task.
Load: references/pydantic-ai.md
Load: references/crewai.md
Load: references/smolagents.md
Load: references/mastra.md
Load: references/langchain.md
Load: references/custom-agent.md
Load: references/use-cases.md
Load: references/production.md
Invoke this skill when:
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Replace with description of the skill and when Claude should use it.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Take mapbox/mapbox-mcp-runtime-patterns from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm, npx.
Without those the skill loads but fails at the first command.