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
6 tools for geocoding and spatial queries against OpenStreetMap data:
| 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 within a rectangular bounding box |
openstreetmap_query_raw | Execute a raw Overpass QL query for advanced spatial operations |
openstreetmap_search_placesConvert a place name or address to geographic coordinates via Nominatim/OpenStreetMap.
"Space Needle Seattle") or structured address fields (street, city, state, country, postal code) — mutually exclusivecountrycodes)openstreetmap_lookup_objectsextratags decorates the matched object and cannot select one, so an absent tag describes that object rather than OpenStreetMap. Selecting or enumerating by tag is Overpass-only (openstreetmap_query_nearby, openstreetmap_query_bbox, openstreetmap_query_raw)openstreetmap_reverse_geocodeConvert latitude/longitude to the nearest address or named place.
extratags decorates the matched object and cannot select one. To find the objects in an area carrying a given tag, use openstreetmap_query_nearby, openstreetmap_query_bbox, or openstreetmap_query_rawopenstreetmap_lookup_objectsFetch full Nominatim address records for known OSM object IDs.
["N240109189"]"N240109189", "W50637691", "R146656"not_found list for IDs that returned no resultosm_ids — extratags decorates them and cannot select them. Discover objects by tag with openstreetmap_query_nearby, openstreetmap_query_bbox, or openstreetmap_query_raw, then pass their IDs hereopenstreetmap_query_nearbyFind OSM features within a radius around a point via the Overpass API.
amenity shortcut for common POI types (hospital, pharmacy, restaurant, cafe, school, atm) or tag_key + tag_value for any OSM category (leisure=park, shop=supermarket, natural=peak)truncated flag signals when more existopenstreetmap_query_bboxFind OSM features within a rectangular geographic bounding box.
amenity / tag_key + tag_value interface as openstreetmap_query_nearbywest greater than east is a box crossing the antimeridian, covering west..180 plus -180..east; only south greater than north is rejectedtruncated flagopenstreetmap_query_rawExecute arbitrary Overpass QL for queries the convenience tools don't cover.
[out:json]; server injects [timeout:N] if absenttotalFound / truncated / nextOffset disclosure; page the rest with offsettimeout_seconds up to 180 is honored client-side, so a long-running query is not cut off earlyBuilt on @cyanheads/mcp-ts-core:
none, jwt, oauth)in-memory, filesystem, Supabase, Cloudflare KV/R2/D1Nominatim/Overpass-specific:
User-Agent via OSM_USER_AGENT, rate-limit-aware request handlingOSM_OVERPASS_MAX_CONCURRENCY, and a throttled endpoint is never re-submitted to — the call advances to the next endpoint instead, and fails only once every one has refused itOSM_OVERPASS_ENDPOINTS and a transient failure advances to the next one inside the same call. Deterministic failures (malformed query, result too large) stay on one endpoint, and every response reports the endpoint that served itData © OpenStreetMap contributors, ODbL 1.0)OSM_NOMINATIM_BASE_URL and OSM_OVERPASS_BASE_URL for self-hosted or mirror endpointsno_results, no_coverage, conflicting_query_mode, missing_query_mode, invalid_id_format, invalid_tag, invalid_bbox, query_timeout, rate_limited, upstream_error, query_error, result_too_large, overpass_gateway_timeout, overpass_unavailable, endpoints_exhausted — all with actionable recovery hintsruntime error: ... remark on every Overpass tool, and a malformed openstreetmap_query_raw query its line N: parse error: ... detail, instead of a bare statusAgent-friendly output:
osm_type + osm_id that feed directly into openstreetmap_lookup_objects for full address recordsAdd 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"
}
}
}
}
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_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 transient failure (5xx, HTML throttle page, connection timeout) 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 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 transient failure advances to the next entry inside the same tool call, and the list is tried in order so the first entry stays preferred. Throttling counts — an endpoint that answers HTTP 429 or a throttle page is skipped for the rest of the call rather than re-asked, so the query reaches a mirror with a free slot.
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 — surfacing endpoints_exhausted rather than multiplying a per-attempt deadline by the retry budget. 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.
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() arraysIssues and pull requests are welcome. Run checks and tests before submitting:
bun run devcheck
bun run test
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Map data from OpenStreetMap contributors, available under the Open Database License (ODbL).
cyanheads/pubchem-mcp-server-495646fa
cyanheads/socrata-mcp-server-9996f211
cyanheads/sports-mcp-server
cyanheads/usaspending-mcp-server-83b0720b
cyanheads/usgs-water-mcp-server
daedalus/mcp-metar