osm-mcp
You can use osm-mcp to geocode places, calculate travel routes and times, explore nearby POIs, and generate map links using read-only OpenStreetMap services.
Geocode place names/addresses with Nominatim or Photon, and reverse-geocode coordinates.
Route between 2+ waypoints by foot, car, or bike, optionally with turn-by-turn steps.
Compute travel time/distance matrices between many origins and destinations.
Optimize multi-stop visit order and suggest fair meeting points.
Summarize reachable areas (isochrones) by time or distance.
Find nearby POIs by category or OSM tag and fetch full POI details.
Calculate straight-line distances and create openstreetmap.org marker/directions links.
All tools are read-only; no API key is required, with optional OpenRouteService support and tool allow/deny filtering.
Provides typo-tolerant geocoding via komoot's Photon service for better LLM-driven place searches.
Provides geocoding, reverse geocoding, routing (walking, driving, cycling), distance matrices, multi-stop route optimization, isochrones, and POI search using OpenStreetMap data through services like Nominatim, Photon, OSRM, Valhalla, and Overpass.
Offers typo-tolerant geocoding as an alternative to Nominatim for more interactive place name lookups.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@osm-mcp plan a walking tour from the Louvre to the Eiffel Tower with 3 scenic stops along the Seine"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
osm-mcp
A Model Context Protocol (MCP) server for OpenStreetMap, built for travel planning.
Lets MCP clients like Claude Code, Claude Desktop or Codex answer questions about places: geocoding, walking, driving and cycling distances and durations, multi-stop route optimization, isochrones and POI search — 11 tools, all read-only.
Eleven tools is the ceiling, not the floor: OSM_ALLOW_TOOLS=essential
registers a curated six instead, and a model picks the right tool far more
reliably from six than from eleven — see
choosing which tools load.
All backends are free public OpenStreetMap services, so no API key is required. An OpenRouteService key can be supplied optionally to switch the routing engine.
What makes it different
Correct walking/cycling routes. The public OSRM demo servers ignore the profile segment inside the OSRM URL path and always return car routes unless the FOSSGIS
routed-foot/routed-bike/routed-carpath prefixes are used. Most existing OSM MCP servers get this wrong and silently return driving times for walking queries. This server uses the prefixes and its live smoke test asserts that foot routes are much slower than car routes.Policy-compliant by construction. Per-service rate limiting (Nominatim and OSRM: 1 request/second), an identifying User-Agent on every request (required by the Nominatim usage policy), response caching, capped Overpass concurrency (2 slots) and automatic failover to the next Overpass endpoint on anything but a malformed query, within one 50-second budget per call.
Photon support. Optional typo-tolerant geocoding via komoot's Photon, which is designed for interactive use — a better fit for LLM-driven lookups than hammering Nominatim.
Related MCP server: Geo MCP Worker
Requirements
Node.js ≥ 24
Internet access to the public OpenStreetMap services (see table below)
Configuration
Every variable is optional — the server works out of the box.
Variable | Default | Description |
|
| User-Agent sent to every service. Nominatim requires a real, identifying one. |
|
| Geocoding / reverse geocoding |
|
| Typo-tolerant geocoding |
|
| Routing, matrices, trip optimization. Must serve the |
|
| Comma-separated Overpass endpoints, tried in order until one answers (a malformed query stops the walk) |
|
| Isochrones |
| – | Optional OpenRouteService key (secret). When set, routes, matrices and isochrones use ORS instead of OSRM/Valhalla. Free tier: 2000 directions/day, 40/minute. |
|
| OpenRouteService endpoint |
|
| Seconds identical upstream responses are served from the in-memory cache ( |
| no | Comma-separated tool names, |
| no | Same syntax; removed from whatever |
Choosing which tools load
OSM_ALLOW_TOOLS and OSM_DENY_TOOLS take comma-separated tool names;
a trailing * matches a whole family. essential is a curated preset of
six: geocode, reverse_geocode, find_nearby_pois, poi_details, route, map_link.
OSM_ALLOW_TOOLS=essential
OSM_ALLOW_TOOLS=geocode,route,find_nearby_pois
OSM_DENY_TOOLS=isochrone,optimize_routeAn entry that matches no tool aborts startup and names it, so a typo cannot
silently hide a tool — an absent tool is not something anyone traces back to an
environment variable. A filtered tool is never registered, so it is absent from
tools/list and unknown to tools/call alike.
If you run several of these servers at once, mcp-hub
is the other answer — its /hub endpoint replaces every server's tools with six
meta-tools.
Installation
Claude Code
claude mcp add osm -- npx -y osm-mcpClaude Desktop
claude_desktop_config.json:
{
"mcpServers": {
"osm": {
"command": "npx",
"args": ["-y", "osm-mcp"]
}
}
}Codex
~/.codex/config.toml:
[mcp_servers.osm]
command = "npx"
args = ["-y", "osm-mcp"]Docker
Multi-arch, with SBOM and build provenance:
docker run -i --rm ghcr.io/ni-c/osm-mcp-i is required — the protocol runs over stdin and stdout. There is no port to
publish. More client recipes are in the
client guide.
Through mcp-hub
A client that cannot spawn a local process — ChatGPT connectors, Claude on the web,
Cursor, LibreChat — reaches osm-mcp through mcp-hub: one
container serves many stdio MCP servers over Streamable HTTP, with an OAuth 2.1 login
behind a single password and long-lived tokens for the clients that cannot do OAuth. Its
/hub endpoint puts every server behind six meta-tools, so one connector reaches all of
them without N×tool schemas in the model's context, and it speaks both protocol revisions
— a question this server asks travels through it to the person at the far end.
Its /config/mcp.json uses Claude Code's format, so the entry is the one you already
have:
{
"mcpServers": {
"osm": {
"command": "npx",
"args": ["-y", "osm-mcp"],
"env": { "OSM_ALLOW_TOOLS": "essential" },
"denyTools": ["isochrone"]
}
}
}allowTools and denyTools there are the hub's own per-server filter, which is not
the same thing as *_ALLOW_TOOLS in env — the difference, and the mistake it invites,
are in the client guide.
Tools
Tool | Description |
| Place name/address → coordinates (Nominatim or Photon) |
| Coordinates → nearest address |
| Distance and duration between 2+ waypoints, |
| Travel time/distance from every origin to every destination in one call |
| Best visiting order for a set of stops (traveling-salesman, OSRM trip) |
| Reachable area within a time or distance budget (Valhalla, or ORS with key) |
| POIs around a location by category or raw OSM tag, sorted by distance (Overpass) |
| Full OSM record of one element: opening hours, website, phone, … |
| Fair meeting venue for 2–8 people (balanced travel times) |
| Great-circle distance, computed offline |
| openstreetmap.org marker / directions links, computed offline |
Every place input accepts either a name/address (geocoded automatically) or
literal coordinates as "lat,lon".
Structured output
Every tool declares an outputSchema and answers with structuredContent
alongside the text block, so a client can use the result without parsing prose:
{
"untrusted": true,
"source": "openstreetmap",
"profile": "foot",
"engine": "osrm",
"waypoints": ["Berlin Hauptbahnhof", "Brandenburger Tor"],
"distance": "2.3 km",
"distance_m": 2317,
"duration": "29 min",
"duration_s": 1740,
}Every tool carries untrusted: true and source: "openstreetmap" — there
is no exception list, because OpenStreetMap is editable by anyone on earth and
no tool here answers with anything else. A client that reads only the structured
half would otherwise get a mapper's free text with no framing at all.
What this server computes — distances, durations, coordinates, which routing
engine ran — is described exactly. What comes out of OSM is described but left
open: the tag namespace has no schema, and a mapper adding payment:bitcoin
must not take poi_details out of service. The SDK validates every result
against its schema before it goes out, so a stricter shape would do exactly
that.
The control-character and BiDi stripping this server has always done to its text now runs over the structured value too, key by key. It used to happen on the serialized JSON, which reached every string in it for free.
Usage policies & attribution
This server talks to shared community infrastructure. It enforces the published limits client-side, but the operator asks users to keep overall usage light and non-commercial:
Data: © OpenStreetMap contributors, licensed under ODbL 1.0.
Nominatim: max 1 request/second, identifying User-Agent mandatory, results cached (policy).
OSRM / Valhalla (FOSSGIS): reasonable, non-commercial use; max 1 request/second (about).
Overpass: ~2 concurrent slots per IP, <10 000 queries/day (wiki).
Photon: fair use (photon.komoot.io).
For heavy or commercial use, self-host the services and point the
*_BASE_URL variables at your instances.
Not exposed, on purpose
No editing. All eleven tools are read-only against OpenStreetMap; the editing API is not wired up at all, so there is no write mode to switch off.
No rendering and no tracking. Results are structured data plus links rather
than images — map_link hands you a URL to look at the map yourself — and there
is no state between calls.
No offline mode. Every answer comes from the public OpenStreetMap services, under their usage policies.
Safety
All tools are read-only; the server never writes to OpenStreetMap.
No credentials are required; the optional
ORS_API_KEYis removed from the process environment after loading and redacted from error messages.OSM-sourced content (names, addresses, tags) is marked as untrusted data in tool results so the model treats it as data, not instructions.
Upstream error bodies are truncated and HTML error pages dropped before they reach the model context; the HTTP status is decided before a body is read.
Every value a service answers is shaped before it reaches a result: finite numbers, bounded strings, one malformed element dropped rather than the whole listing.
Redirects are never followed; all requests time out.
Documentation
The full guide, tool reference and security notes live at
osm-mcp.ni-c.de (source in docs/).
Development
npm install
npm run lint # oxlint + prettier
npm test # unit tests (all upstream APIs mocked)
npm run test:coverage
npm run build
npm run smoke # opt-in LIVE test against the real public servicesReleasing
Tag-driven, no manual publish step:
Move the
[Unreleased]entries into a new## [x.y.z] - YYYY-MM-DDsection inCHANGELOG.mdand bumppackage.json.npm run lint && npm run build && npm run test:coverage.Commit, then a signed annotated tag:
git tag -s vx.y.z -m "vx.y.z".git push origin main vx.y.z.
release.yml then runs the tests, publishes to npm with provenance via Trusted
Publishing (no token secret involved), creates the GitHub release from the
CHANGELOG section, and publishes to the
MCP registry as
io.github.ni-c/osm-mcp. ci.yml pushes the multi-arch image to GHCR on the
same tag.
If the registry step fails, fix it on main and dispatch the
Publish to MCP Registry workflow — do not re-run the tag job, which would
check out the old tree.
Contributing
Issues, discussions and pull requests are welcome — see CONTRIBUTING.md. For vulnerabilities please use private reporting rather than a public issue; the policy is in SECURITY.md.
License
MIT © Willi Thiel
Available Tools
11 toolsfind_nearby_poisFind nearby places (POIs)ARead-onlyIdempotent
Finds points of interest near a location, sorted by distance. Category shortcuts: restaurant, cafe, bar, pub, fast_food, ice_cream, hotel, hostel, guest_house, apartment, camp_site, attraction, museum, gallery, viewpoint, information, artwork, castle, monument, ruins, supermarket, bakery, convenience, pharmacy, hospital, doctors, police, atm, bank, fuel, charging_station, parking, toilets, drinking_water, bus_stop, train_station, tram_stop, ferry_terminal, bicycle_rental, car_rental, playground, park, beach, swimming_pool. Any other OSM tag works as "key" or "key=value" (e.g. "diet:vegan=yes"). Use poi_details for the full record of one result.
Inputs: near (required), category (required), limit, language, +1 more. Returns: near, note, count, source, +3 more
geocodeGeocode a place or addressARead-onlyIdempotent
Converts a place name or address into coordinates using OpenStreetMap. Returns matching places with lat/lon, a display label and the OSM id. Provider "nominatim" (default) is best for addresses; "photon" is typo-tolerant and better for fuzzy place names.
Inputs: query (required), limit, language, provider, +1 more. Returns: note, source, results, provider, +1 more
isochroneReachable area (isochrone)ARead-onlyIdempotent
Shows how far you can get from a place within a time or distance budget ("what is reachable in 15 minutes on foot?"). Returns a compact summary of the reachable area: bounding box and reach per compass direction. Give exactly one of minutes or kilometers.
Inputs: center (required), profile (required), minutes, language, +1 more. Returns: reach, budget, center, engine, +4 more
map_linkGenerate map linksARead-onlyIdempotent
Generates openstreetmap.org links to open in a browser: a marker link for a single place, or a directions link when from and to are given. Provide either "place", or both "from" and "to".
Inputs: to, from, place, profile, +1 more. Returns: to, from, place, marker, +4 more
optimize_routeOptimize stop orderARead-onlyIdempotent
Finds the best order to visit a set of stops (traveling-salesman optimization) and returns the optimized itinerary with total distance and time. With roundtrip (default) the tour returns to the first stop; without it the first stop is the start and the last stop the end.
Inputs: stops (required), profile (required), language, roundtrip. Returns: legs, engine, source, profile, +4 more
poi_detailsGet POI detailsARead-onlyIdempotent
Fetches the full OpenStreetMap record of one element — all tags (opening hours, website, phone, …), coordinates and a map link. Takes an OSM id as returned by find_nearby_pois or geocode, e.g. "node/240109189".
Inputs: osm_id (required). Returns: lat, lon, map, osm, +4 more
reverse_geocodeReverse geocode coordinatesARead-onlyIdempotent
Converts coordinates into the nearest address or place name (Nominatim).
Inputs: latitude (required), longitude (required), language. Returns: note, result, source, untrusted
routeRoute between placesARead-onlyIdempotent
Calculates the real-world travel distance and time between two or more places, walking, driving or cycling, on OpenStreetMap data. Waypoints are visited in the given order. Set include_steps for a turn-by-turn summary. Use route_matrix to compare many pairs, optimize_route to reorder stops.
Inputs: profile (required), waypoints (required), language, include_steps. Returns: legs, steps, engine, source, +8 more
route_matrixTravel time/distance matrixARead-onlyIdempotent
Computes travel times and distances from every origin to every destination in one call — ideal for comparing options (e.g. 5 hotels against 3 sights). Cells are null where no route exists.
Inputs: origins (required), profile (required), destinations (required), language. Returns: engine, source, origins, profile, +4 more
straight_line_distanceStraight-line distanceARead-onlyIdempotent
Great-circle ("as the crow flies") distance between two places. Instant and independent of any road network — use route for real travel distances.
Inputs: to (required), from (required), language. Returns: to, from, source, distance, +2 more
suggest_meeting_pointSuggest a meeting pointARead-onlyIdempotent
Suggests a fair place to meet for people starting from different locations: finds venues around the geographic midpoint and picks the one with the most balanced travel times for everyone.
Inputs: locations (required), profile, language, venue_category, +1 more. Returns: note, source, profile, midpoint, +4 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a clearly distinct purpose: geocode/reverse_geocode handle place-coordinate conversion, route/route_matrix/optimize_route are tightly differentiated by use case, and find_nearby_pois/poi_details form a clear list-to-detail flow. The routing tools could feel similar at first glance, but their descriptions explicitly disambiguate single ordered routes, many-to-many matrices, and stop reordering.
Most multi-word names use a predictable snake_case style: reverse_geocode, route_matrix, find_nearby_pois, straight_line_distance. The set does mix verb-led names like find_nearby_pois and optimize_route with noun-led names like isochrone, poi_details, and map_link, but the overall pattern is still clear and readable.
With 11 tools, the server is well within the ideal range and each tool earns its place by covering a distinct geospatial capability. None of the tools feel redundant, and the count is appropriate for a domain spanning geocoding, routing, POI search, and map links.
The tool set covers the full common workflow for an OSM-based location server: forward and reverse geocoding, routes, matrices, route optimization, isochrones, POI discovery and details, meeting-point suggestions, straight-line distance, and shareable map links. Results from earlier tools feed naturally into later tools, such as POI ids into poi_details and places into route or map_link, leaving no obvious dead ends.
Maintenance
Related MCP Connectors
Geocoding, routing, isochrones, traffic, weather, and place search for AI agents. 19 MCP tools.
Maps, geocoding and time zones for AI coding agents, on OpenStreetMap, with hard prepaid spend caps.
Hosted MCP for live place search, geocoding & turn-by-turn routes. No Maps API key to manage.
Geocoding, static maps and privacy-safe area maps from OpenStreetMap data. Hard caps, no overage.
Related MCP Servers
- AlicenseBqualityDmaintenanceA comprehensive MCP server providing 30 tools for geocoding, routing, and OpenStreetMap data analysis. It enables AI assistants to search for locations, calculate travel routes, and perform quality assurance checks on map data.306MIT
- AlicenseNot gradedqualityCmaintenanceFree geospatial MCP server for AI agents, providing geocoding, reverse geocoding, POI search, and route planning using OpenStreetMap data via Nominatim, Overpass, and OSRM.GPL 3.0
- FlicenseNot gradedqualityBmaintenanceAn MCP server providing geocoding, routing, isochrones, and POI-by-proximity search through self-hosted OpenStreetMap backends.-
- AlicenseNot gradedqualityCmaintenanceMCP server for geocoding, reverse geocoding, place/POI search, and distance calculation using OpenStreetMap Nominatim, with no API key required.87 npm1MIT