OpenStreetMap — Claude Code MCP server: what it does, how to install
OpenStreetMap is an MCP server that integrates geographic data and routing tools into your AI agent. It handles travel planning, geocoding, and location queries via OSM services.
MIT ★ 6 updated 2026-11-17
claude mcp add --env OSM_USER_AGENT=<OSM_USER_AGENT> --env ORS_API_KEY=<ORS_API_KEY> --env OSM_ALLOW_TOOLS=<OSM_ALLOW_TOOLS> --env OSM_DENY_TOOLS=<OSM_DENY_TOOLS> --transport stdio openstreetmap -- npx -y osm-mcpWhat OpenStreetMap does
The server provides 11 read-only tools for geocoding, distance calculations, route optimization, and POI search. It differentiates between walking, cycling, and driving profiles, ensuring accurate travel times for non-car routes. To maintain compliance with service policies, it implements rate limiting, request caching, and automatic failover for API calls.
Running this requires Node.js 24 or later and an active internet connection. While it works out of the box using public OpenStreetMap backends, you can optionally provide an ORS_API_KEY to utilize alternative routing engines. You may also limit the toolset to six core functions via OSM_ALLOW_TOOLS for improved model reliability.
What it helps with
- calculate walking route distances
- geocode addresses to coordinates
- optimize multi-stop travel paths
- retrieve isochrone data for locations
Example prompts for the agent
- Find a walking route between the train station and the city center.
- Estimate driving time for the planned route.
- List all coffee shops within 1km of my current location.
How to install OpenStreetMap
Platform CLI
claude mcp add --env OSM_USER_AGENT=<OSM_USER_AGENT> --env ORS_API_KEY=<ORS_API_KEY> --env OSM_ALLOW_TOOLS=<OSM_ALLOW_TOOLS> --env OSM_DENY_TOOLS=<OSM_DENY_TOOLS> --transport stdio openstreetmap -- npx -y osm-mcpReplace <…> with your own values
Platform CLI
codex mcp add openstreetmap --env OSM_USER_AGENT=<OSM_USER_AGENT> --env ORS_API_KEY=<ORS_API_KEY> --env OSM_ALLOW_TOOLS=<OSM_ALLOW_TOOLS> --env OSM_DENY_TOOLS=<OSM_DENY_TOOLS> -- npx -y osm-mcpReplace <…> with your own values
Config file
{
"mcpServers": {
"openstreetmap": {
"command": "npx",
"args": [
"-y",
"osm-mcp"
],
"env": {
"OSM_USER_AGENT": "<OSM_USER_AGENT>",
"ORS_API_KEY": "<ORS_API_KEY>",
"OSM_ALLOW_TOOLS": "<OSM_ALLOW_TOOLS>",
"OSM_DENY_TOOLS": "<OSM_DENY_TOOLS>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"openstreetmap": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"osm-mcp"
],
"env": {
"OSM_USER_AGENT": "<OSM_USER_AGENT>",
"ORS_API_KEY": "<ORS_API_KEY>",
"OSM_ALLOW_TOOLS": "<OSM_ALLOW_TOOLS>",
"OSM_DENY_TOOLS": "<OSM_DENY_TOOLS>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e OSM_USER_AGENT=<OSM_USER_AGENT> -e ORS_API_KEY=<ORS_API_KEY> -e OSM_ALLOW_TOOLS=<OSM_ALLOW_TOOLS> -e OSM_DENY_TOOLS=<OSM_DENY_TOOLS> openstreetmap npx -y osm-mcpReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about OpenStreetMap
How to install OpenStreetMap in Claude Code?
Run claude mcp add osm-mcp -e ORS_API_KEY=<ORS_API_KEY> -- npx -y osm-mcp in your terminal.
What does OpenStreetMap do?
It enables your AI agent to perform geocoding, calculate travel distances, generate routes, and search for points of interest using OpenStreetMap data.
What do I need to run OpenStreetMap?
You need Node.js 24+ and internet access. No API key is required, though you can provide an optional ORS_API_KEY for advanced routing.