Geocode, reverse geocode, and run Overpass spatial queries on OpenStreetMap data.
Geocode, reverse geocode, and run Overpass spatial queries on OpenStreetMap data via MCP. STDIO or Streamable HTTP.
Public Hosted Server: https://openstreetmap.caseyjhand.com/mcp
Geocoding, reverse geocoding, and spatial queries over OpenStreetMap data via Nominatim and the Overpass API. Search places, resolve coordinates to addresses, and query nearby or bounded features by tag from any MCP client. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
| Tool | Description |
|---|---|
openstreetmap_search_places | Convert a place name or address to geographic coordinates and structured place data |
openstreetmap_reverse_geocode | Convert latitude/longitude coordinates to the nearest address or place name |
openstreetmap_lookup_objects | Fetch address details for one or more known OSM objects by their IDs |
openstreetmap_query_nearby | Find OSM features within a radius around a geographic point |
openstreetmap_query_bbox | Find OSM features inside a rectangular bounding box, or inside a named OSM boundary — a city, park, or region |
openstreetmap_query_raw | Execute a raw Overpass QL query for advanced spatial operations |
openstreetmap_search_places toolquery or structured address fields (street, city, county, state, country, postalcode), mutually exclusive; countrycodes (ISO 3166-1 alpha-2) and layer (address, poi, railway, natural, manmade) narrow results, featureType restricts to country/state/city/settlementviewbox (west/south/east/north) biases results, or with bounded: true hard-restricts to the area — finer-grained than countrycodes, cannot cross the antimeridian; the effective box and restriction mode are echoed backlimit), ordered by Nominatim importance score; extratags adds contact/metadata and physical-attribute tags on the matched object, language sets a BCP 47 preferred languagelimit; a full page carries nextExcludeIds to page toward further matches with exclude_place_idsopenstreetmap_lookup_objectsextratags decorates the matched object but never selects it; use the Overpass tools to filter or enumerate by tagopenstreetmap_reverse_geocode toolextratags decorates the matched object and cannot select oneopenstreetmap_lookup_objects tool["N240109189"]; a single ID is still wrapped in an arraynot_found list for IDs that returned no resultosm_ids — extratags decorates them and cannot select them; discover objects by tag with the Overpass tools, then pass their IDs hereopenstreetmap_query_nearby toolamenity shortcut covers common POI types (hospital, pharmacy, restaurant, cafe, school, atm), or use tag_key with an optional tag_value for other categories — omit tag_value to match any feature carrying that keyfilters: [{ key, value? }], ANDed with the primary tag in input order; blank values and duplicate keys are rejected, and tags must be literal text without Overpass QL metacharacters (", \, [, ], ;, (, )) — use openstreetmap_query_raw for regex, alternation, or negationeffectiveTag echoes the complete filter chain on every responseradius_meters up to 50km (keep under 5km for dense urban POI queries); element_types filters node/way/relationlimit) with offset paging and a truncated flagopenstreetmap_query_bbox toolwithin — a single OSM boundary ref (R237385 for Seattle, W13800188 for a park), which is the osm_type plus osm_id the geocoding tools already returneffectiveArea echoes how the ref resolved and areasTimestamp reports how stale the Overpass area database isfilters interface as openstreetmap_query_nearby, including trimming, blank-value, and duplicate-key validationwest greater than east is a box crossing the antimeridian, covering west..180 plus -180..east; only south greater than north is rejectedlimit) with a truncated flagopenstreetmap_query_raw tool[out:json], and the server injects [timeout:N] if absentnodes[], relations carry members[])limit) with totalFound/truncated/nextOffset disclosure; page the rest with offsetmax_element_bytes budget (default 20000 UTF-8 bytes, ceiling 10000000) withholds an over-budget element's members/nodes/geometry arrays whole rather than truncating them, listed under withheld_keyswithheldElements/withheldNotice give the one-call retrieval path for a withheld element — the same query with limit: 1, that element's offset, and a raised max_element_bytestimeout_seconds up to 180 is honored client-side; validate complex queries at overpass-turbo.eu before useBuilt on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
OpenStreetMap-specific:
OSM_USER_AGENT and rate-limit-aware request handling honor Nominatim's usage policyOSM_OVERPASS_MAX_CONCURRENCY; a throttled endpoint is never re-submitted to — the call advances to the next endpoint insteadOSM_OVERPASS_ENDPOINTS — a failure advances to the next mirror inside the same call, and every response reports the endpoint that served itOSM_NOMINATIM_BASE_URL and OSM_OVERPASS_BASE_URL for self-hosted or mirror endpointsruntime error: ... remark, a malformed openstreetmap_query_raw query its line N: parse error: ... detailAgent-friendly output:
osm_type + osm_id that feed directly into openstreetmap_lookup_objects for full address recordsA public instance is available at https://openstreetmap.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"openstreetmap-mcp-server": {
"type": "streamable-http",
"url": "https://openstreetmap.caseyjhand.com/mcp"
}
}
}
Add the following to your MCP client configuration file.
{
"mcpServers": {
"openstreetmap-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/openstreetmap-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or with npx (no Bun required):
{
"mcpServers": {
"openstreetmap-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/openstreetmap-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}
Or with Docker:
{
"mcpServers": {
"openstreetmap-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/openstreetmap-mcp-server:latest"
]
}
}
}
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp
OSM_NOMINATIM_BASE_URL and OSM_OVERPASS_BASE_URL at self-hosted or mirror instances.git clone https://github.com/cyanheads/openstreetmap-mcp-server.git
cd openstreetmap-mcp-server
bun install
All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:
| Variable | Description | Default |
|---|---|---|
MCP_TRANSPORT_TYPE | Transport: stdio or http | stdio |
MCP_HTTP_PORT | HTTP server port | 3010 |
MCP_SESSION_MODE | HTTP session handling: stateless, stateful, or auto (auto resolves to stateful). Unset, this server runs stateless: it declares that in code because no tool keeps per-session state or asks the client for input mid-call. An explicit value still overrides it. | stateless |
MCP_HTTP_ENDPOINT_PATH | HTTP endpoint path where the MCP server is mounted | /mcp |
MCP_PUBLIC_URL | Public origin override for TLS-terminating reverse-proxy deployments | none |
MCP_AUTH_MODE | Authentication: none, jwt, or oauth | none |
MCP_LOG_LEVEL | Log level (debug, info, warning, error, etc.) | info |
MCP_GC_PRESSURE_INTERVAL_MS | Opt-in Bun-only forced-GC pressure loop (ms). Recommended starting point if heap growth is observed: 60000. | 0 (disabled) |
STORAGE_PROVIDER_TYPE | Storage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1 | in-memory |
OSM_NOMINATIM_BASE_URL | Nominatim API base URL. Override for a private or mirror instance. A path prefix is supported for instances proxied under a subpath (e.g. https://maps.example.com/nominatim), with or without a trailing slash. | https://nominatim.openstreetmap.org |
OSM_OVERPASS_BASE_URL | Overpass API endpoint URL. When set, pins every query to this one endpoint and disables mirror failover — what a private-instance deployment wants. Leave unset to use OSM_OVERPASS_ENDPOINTS. | unset |
OSM_OVERPASS_ENDPOINTS | Comma-separated ordered list of Overpass endpoints. On a failure the same tool call advances to the next entry, so a degraded endpoint costs latency instead of the answer; the first entry stays the preferred one. A host that refused the call on its own account — a throttle, an HTTP refusal such as 401/403/404, a refused or unresolvable connection, an instance fault, or no answer inside its attempt window — is skipped for the rest of that call rather than asked again. A single entry means no failover. Ignored when OSM_OVERPASS_BASE_URL is set. See Overpass endpoint failover. | https://overpass-api.de/api/interpreter |
OSM_OVERPASS_MAX_CONCURRENCY | Maximum Overpass queries submitted at once; queries past the cap queue locally. Match the slot budget the endpoint advertises at /api/status. The endpoint keeps a slot reserved for the full [timeout:N] after answering, so a burst can still draw an HTTP 429 — that endpoint is then skipped for the rest of the call rather than re-submitted to, and rate_limited surfaces once every configured endpoint has refused. | 2 |
OSM_USER_AGENT | User-Agent sent to Nominatim and Overpass. Required by usage policy. | openstreetmap-mcp-server/<package version> |
OTEL_ENABLED | Enable OpenTelemetry | false |
Out of the box the server queries one Overpass endpoint, the FOSSGIS-operated main instance. A degraded endpoint therefore fails the call — openstreetmap_query_nearby, openstreetmap_query_bbox, and openstreetmap_query_raw all depend on it.
Listing more than one endpoint in OSM_OVERPASS_ENDPOINTS turns on failover: a failure advances to the next entry inside the same tool call, and the list is tried in order so the first entry stays preferred.
An endpoint that refuses the call on its own account is skipped for the rest of that call rather than re-asked, so the query reaches a host that has not already turned it down. Five outcomes count as that kind of refusal: an HTTP 429 or throttle page, an HTTP status such as 401, 403, or 404 that names the host rather than the query (a mirror at the wrong path, retired, or blocking this client), a connection that is refused or whose host does not resolve, an OSM3S dispatcher or database fault, and an attempt that went unanswered for its whole window — a host given a full window and no answer would only be re-asked with whatever the budget has left, which cannot succeed where the full window did not. An HTTP 5xx is not one of them: that is the endpoint shedding load, so it stays eligible for a retry.
Once every configured endpoint has refused, the call stops submitting and reports what each one did — rate_limited when they all throttled, the HTTP status itself when they all answered one, endpoints_exhausted when they all went unanswered, and endpoints_unavailable for a refused or unreachable host or any mix, whose message names each endpoint and its outcome so "every host was unavailable" is distinguishable from "every host was too slow for this query".
OSM_OVERPASS_ENDPOINTS="https://overpass-api.de/api/interpreter,https://overpass.private.coffee/api/interpreter"
Failover is opt-in rather than the default because adding an endpoint sends your queries to a third party, on their terms and their bandwidth. Before listing one:
overpass.private.coffee, for one, publishes a grant covering any project including commercial use, alongside prohibited-use terms and a request to be told in advance about large-scale use.servingEndpoint enrichment field alongside the data_timestamp output field, so a stale or unexpected result stays attributable.OSM_USER_AGENT is sent to every endpoint, and its default identifies this server and its version, which is what the main instance's policy asks for. An endpoint you add is governed by its own policy as well.
Two other behaviors bound what a failover can cost. OSM_OVERPASS_MAX_CONCURRENCY is one budget across all endpoints, so rotating never raises the number of submissions in flight. And one tool call stops submitting once it has spent its time budget — per-attempt deadline, queue wait, and retry backoff all count against that — so a long endpoint list cannot multiply one attempt window by its length. The budget is at least 120 seconds and widens with the [timeout:N] a query carries, so a long openstreetmap_query_raw timeout is honored without lengthening every other call.
Setting OSM_OVERPASS_BASE_URL pins that single endpoint and disables failover, unchanged from previous releases: a private or self-hosted instance is not interchangeable with a public mirror.
Run the published image:
docker run --rm -p 3010:3010 ghcr.io/cyanheads/openstreetmap-mcp-server:latest
Or build and run locally:
docker build -t openstreetmap-mcp-server .
docker run --rm -p 3010:3010 openstreetmap-mcp-server
The image serves HTTP at 0.0.0.0:3010/mcp with stateless sessions and logs under /var/log/openstreetmap-mcp-server. Connect at http://localhost:3010/mcp. To use host port 8011, map -p 8011:3010; the container port stays 3010.
Builds include the optional telemetry packages by default. Add --build-arg OTEL_ENABLED=false to docker build to omit them. Runtime telemetry remains controlled separately by the OTEL_ENABLED environment variable (default false); enable it with -e OTEL_ENABLED=true on an image built with those packages.
Build and run the production version:
# One-time build
bun run rebuild
# Run the built server
bun run start:http
# or
bun run start:stdio
Run checks and tests:
bun run devcheck # Lints, formats, type-checks, and more
bun run test # Runs the test suite
| Directory | Purpose |
|---|---|
src/mcp-server/tools | Tool definitions (*.tool.ts). Six tools across Nominatim and Overpass. |
src/services/nominatim | Nominatim service layer — API client, search, reverse, lookup. |
src/services/overpass | Overpass service layer — query builder, executor, element normalizer. |
src/config | Server-specific environment variable parsing and validation with Zod. |
See CLAUDE.md for development guidelines and architectural rules. The short version:
try/catch in tool logicctx.log for logging, ctx.state for storagecreateApp() arraysMap data from OpenStreetMap contributors, available under the Open Database License (ODbL).
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
Apache-2.0 — see LICENSE for details.
Source-derived launch command. Check the maintainer’s required arguments and credentials before running:
npx -y @cyanheads/openstreetmap-mcp-serverMerge this template into ~/Library/Application Support/Claude/claude_desktop_config.json. Keep existing servers. Add any arguments, credentials, and permissions required by the maintainer; this template has not been install-tested.
{
"mcpServers": {
"io-github-cyanheads-openstreetmap-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/openstreetmap-mcp-server"
]
}
}
}Restart Claude Desktop completely for changes to take effect. Confirm the server appears connected in the client’s tool list, then try a read-only example from its documentation.
Claude Desktop setup referenceio.github.cyanheads/openstreetmap-mcp-server works with any MCP-compatible client. Copy the config snippet from the Configuration section above and add it to the file shown for your client, then restart the application.
~/Library/Application Support/Claude/claude_desktop_config.jsonRestart Claude Desktop completely for changes to take effect.~/.cursor/mcp.jsonRestart Cursor for changes to take effect..vscode/mcp.jsonReload VS Code window for changes to take effect.~/.codeium/windsurf/mcp_config.jsonRestart Windsurf for changes to take effect..mcp.jsonSave at the project root, then start Claude Code in that project and review the MCP server approval prompt. Keep real credentials out of shared files.