Back to Browse

Osm MCP Server

by Ni C
Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

Geocoding, walking/driving/cycling distances, route optimization, isochrones and POI search on OSM

About

Geocoding, walking/driving/cycling distances, route optimization, isochrones and POI search on OSM

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (2 strong, 1 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry. Trust signals: trusted author (20/20 approved).

6 files analyzed ยท 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

HTTP Network Access

Connects to external APIs or services over the internet.

file_system

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Identifying User-Agent sent to all OSM services (Nominatim requires one)Optional

Environment variable: OSM_USER_AGENT

Optional OpenRouteService key; switches routing/matrix/isochrones to ORSRequired

Environment variable: ORS_API_KEY

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-ni-c-osm-mcp": {
      "env": {
        "ORS_API_KEY": "your-ors-api-key-here",
        "OSM_USER_AGENT": "your-osm-user-agent-here"
      },
      "args": [
        "-y",
        "osm-mcp"
      ],
      "command": "npx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

osm-mcp

CI npm version npm downloads node Container license Docs

An MCP server for OpenStreetMap: geocoding, walking/driving/cycling distances and durations, multi-stop route optimization, isochrones and POI search โ€” built for travel planning with AI assistants.

11 tools, all read-only. All backends are free public OpenStreetMap services; no API key is required. An OpenRouteService key can be supplied optionally to switch the routing engine.

๐Ÿ“– Full documentation: https://osm-mcp.ni-c.de

Why another OSM MCP server?

  • 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-car path 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 an Overpass mirror on 429/5xx.
  • 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.

Requirements

  • Node.js โ‰ฅ 22
  • Internet access to the public OpenStreetMap services (see table below)

Configuration

Every variable is optional โ€” the server works out of the box.

VariableDefaultDescription
OSM_USER_AGENTosm-mcp/<version> (+https://github.com/ni-c/osm-mcp)User-Agent sent to every service. Nominatim requires a real, identifying one.
NOMINATIM_BASE_URLhttps://nominatim.openstreetmap.orgGeocoding / reverse geocoding
PHOTON_BASE_URLhttps://photon.komoot.ioTypo-tolerant geocoding
OSRM_BASE_URLhttps://routing.openstreetmap.deRouting, matrices, trip optimization. Must serve the routed-{car,bike,foot} path prefixes (the FOSSGIS layout).
OVERPASS_BASE_URLhttps://overpass-api.de/api/interpreter,https://overpass.private.coffee/api/interpreterComma-separated Overpass endpoints, tried in order on 429/5xx
VALHALLA_BASE_URLhttps://valhalla1.openstreetmap.deIsochrones
ORS_API_KEYโ€“Optional OpenRouteService key (secret). When set, routes, matrices and isochrones use ORS instead of OSRM/Valhalla. Free tier: 2000 directions/day, 40/minute.
ORS_BASE_URLhttps://api.openrouteservice.orgOpenRouteService endpoint
OSM_CACHE_TTL3600Seconds identical upstream responses are served from the in-memory cache (0 disables caching)

Install

claude mcp add osm -- npx -y osm-mcp

Claude 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"]

Container (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.

Tools

ToolDescription
geocodePlace name/address โ†’ coordinates (Nominatim or Photon)
reverse_geocodeCoordinates โ†’ nearest address
routeDistance and duration between 2+ waypoints, foot/car/bike; optional turn-by-turn summary
route_matrixTravel time/distance from every origin to every destination in one call
optimize_routeBest visiting order for a set of stops (traveling-salesman, OSRM trip)
isochroneReachable area within a time or distance budget (Valhalla, or ORS with key)
find_nearby_poisPOIs around a location by category or raw OSM tag, sorted by distance (Overpass)
poi_detailsFull OSM record of one element: opening hours, website, phone, โ€ฆ
suggest_meeting_pointFair meeting venue for 2โ€“8 people (balanced travel times)
straight_line_distanceGreat-circle distance, computed offline
map_linkopenstreetmap.org marker / directions links, computed offline

Every place input accepts either a name/address (geocoded automatically) or literal coordinates as "lat,lon".

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.

Safety

  • All tools are read-only; the server never writes to OpenStreetMap.
  • No credentials are required; the optional ORS_API_KEY is 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.
  • Redirects are never followed; all requests time out.

Development

npm install
npm run lint          # eslint + 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 services

Releasing

Tag-driven, no manual publish step:

  1. Move the [Unreleased] entries into a new ## [x.y.z] - YYYY-MM-DD section in CHANGELOG.md and bump package.json.
  2. npm run lint && npm run build && npm run test:coverage.
  3. Commit, then a signed annotated tag: git tag -s vx.y.z -m "vx.y.z".
  4. 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.

License

MIT

Reviews

No reviews yet

Be the first to review this server!

Osm MCP Server - Geocoding, walking/driving/cycling distances, route | MCP Marketplace