@cyanheads/openstreetmap-mcp-server
Provides tools for geocoding, reverse geocoding, and spatial queries against OpenStreetMap data, enabling agents to search places, query nearby features, and execute Overpass QL queries.
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., "@@cyanheads/openstreetmap-mcp-serverGeocode the address of the White House"
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.
Public Hosted Server: https://openstreetmap.caseyjhand.com/mcp
Overview
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.
Tools
Tool | Description |
| Convert a place name or address to geographic coordinates and structured place data |
| Convert latitude/longitude coordinates to the nearest address or place name |
| Fetch address details for one or more known OSM objects by their IDs |
| Find OSM features within a radius around a geographic point |
| Find OSM features inside a rectangular bounding box, or inside a named OSM boundary — a city, park, or region |
| Execute a raw Overpass QL query for advanced spatial operations |
Related MCP server: Overture Maps MCP
Capability reference
openstreetmap_search_places tool
Two input modes: free-form
queryor structured address fields (street,city,county,state,country,postalcode), mutually exclusive;countrycodes(ISO 3166-1 alpha-2) andlayer(address, poi, railway, natural, manmade) narrow results,featureTyperestricts to country/state/city/settlementviewbox(west/south/east/north) biases results, or withbounded: truehard-restricts to the area — finer-grained thancountrycodes, cannot cross the antimeridian; the effective box and restriction mode are echoed backUp to 40 results (
limit), ordered by Nominatim importance score;extratagsadds contact/metadata and physical-attribute tags on the matched object,languagesets a BCP 47 preferred languageConfirmed truncation via a same-call probe one result past
limit; a full page carriesnextExcludeIdsto page toward further matches withexclude_place_idsResults carry coordinates, structured address, bounding box, and OSM type/ID for chaining into
openstreetmap_lookup_objectsMatches on name and address relevance only —
extratagsdecorates the matched object but never selects it; use the Overpass tools to filter or enumerate by tag
openstreetmap_reverse_geocode tool
Zoom-level control for address detail: 18=building, 16=street, 14=neighbourhood, 12=town, 10=city, 8=county, 5=state, 3=country
Layer filtering for the matched OSM object type
Optional extra OSM tags (contact, metadata, physical attributes) and language preference
Returns structured address breakdown, OSM type/ID, and bounding box
Matches on proximity and layer, never on an OSM attribute tag —
extratagsdecorates the matched object and cannot select one
openstreetmap_lookup_objects tool
Accepts an array of up to 50 IDs, each prefixed N (node), W (way), or R (relation), e.g.
["N240109189"]; a single ID is still wrapped in an arrayEfficient alternative to a full geocoding round-trip when OSM IDs are already known (e.g., from an Overpass result)
Reports a
not_foundlist for IDs that returned no resultOptional extra OSM tags (contact, metadata, physical attributes) and language preference
Returns exactly the objects named in
osm_ids—extratagsdecorates them and cannot select them; discover objects by tag with the Overpass tools, then pass their IDs here
openstreetmap_query_nearby tool
Primary tool for "what's near X?" spatial queries; the
amenityshortcut covers common POI types (hospital, pharmacy, restaurant, cafe, school, atm), or usetag_keywith an optionaltag_valuefor other categories — omittag_valueto match any feature carrying that keyUp to five additional
filters: [{ 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 (",\,[,],;,(,)) — useopenstreetmap_query_rawfor regex, alternation, or negationeffectiveTagechoes the complete filter chain on every responseConfigurable
radius_metersup to 50km (keep under 5km for dense urban POI queries);element_typesfilters node/way/relationUp to 500 results (
limit) with offset paging and atruncatedflagReturns OSM type/ID, coordinates, name, distance from the center point, and full tag set per feature, sorted nearest-first
openstreetmap_query_bbox tool
Useful for area surveys where proximity to a single point isn't the goal
Two scopes, one per call: the four corner fields, or
within— a single OSM boundary ref (R237385for Seattle,W13800188for a park), which is theosm_typeplusosm_idthe geocoding tools already returnA boundary scopes to the boundary itself, where its bounding box overcovers with water and neighbouring places;
effectiveAreaechoes how the ref resolved andareasTimestampreports how stale the Overpass area database isA ref that maps to no Overpass area — a nonexistent id, an unclosed way, a relation without an area-forming tag — returns an empty page whose notice names that cause, rather than a bare zero
Same primary tag, key-existence, and bounded
filtersinterface asopenstreetmap_query_nearby, including trimming, blank-value, and duplicate-key validationA
westgreater thaneastis a box crossing the antimeridian, coveringwest..180plus-180..east; onlysouthgreater thannorthis rejectedConfigurable timeout for large bounding boxes or dense areas
Up to 500 results (
limit) with atruncatedflag
openstreetmap_query_raw tool
Full Overpass QL expressiveness — multi-type queries, union queries, relation membership, historical queries; the query must include
[out:json], and the server injects[timeout:N]if absentReturns a raw element array — structure varies by query type (nodes carry lat/lon, ways carry
nodes[], relations carrymembers[])Up to 500 elements per call (
limit) withtotalFound/truncated/nextOffsetdisclosure; page the rest withoffsetPer-element
max_element_bytesbudget (default 20000 UTF-8 bytes, ceiling 10000000) withholds an over-budget element'smembers/nodes/geometryarrays whole rather than truncating them, listed underwithheld_keyswithheldElements/withheldNoticegive the one-call retrieval path for a withheld element — the same query withlimit: 1, that element's offset, and a raisedmax_element_bytestimeout_secondsup to 180 is honored client-side; validate complex queries at overpass-turbo.eu before use
Features
Built 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:
Configurable
OSM_USER_AGENTand rate-limit-aware request handling honor Nominatim's usage policyOverpass slot budget respected client-side via
OSM_OVERPASS_MAX_CONCURRENCY; a throttled endpoint is never re-submitted to — the call advances to the next endpoint insteadOpt-in Overpass endpoint failover via
OSM_OVERPASS_ENDPOINTS— a failure advances to the next mirror inside the same call, and every response reports the endpoint that served itPrivate instance support — override
OSM_NOMINATIM_BASE_URLandOSM_OVERPASS_BASE_URLfor self-hosted or mirror endpointsOverpass rejections carry the upstream cause verbatim — a 5xx surfaces its
runtime error: ...remark, a malformedopenstreetmap_query_rawquery itsline N: parse error: ...detail
Agent-friendly output:
Attribution on every response — agents can surface the ODbL license notice as required
Structured output contracts — coordinates, OSM IDs, address fields, and tag maps in consistent shapes
Cross-tool chaining — Overpass results carry
osm_type+osm_idthat feed directly intoopenstreetmap_lookup_objectsfor full address recordsCommunity-edited OSM text is escaped for literal display in the Markdown surface, so a name or tag value cannot open a heading, forge emphasis, or inject a line of its own into a tool's response — the structured surface keeps the raw bytes
Getting started
Public Hosted Instance
A 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"
}
}
}Self-Hosted / Local
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/mcpPrerequisites
Bun v1.4.0 or higher (or Node.js ≥24.0.0).
No API key required — Nominatim and Overpass are public APIs. For heavy use, consider pointing
OSM_NOMINATIM_BASE_URLandOSM_OVERPASS_BASE_URLat self-hosted or mirror instances.
Installation
Clone the repository:
git clone https://github.com/cyanheads/openstreetmap-mcp-server.gitNavigate into the directory:
cd openstreetmap-mcp-serverInstall dependencies:
bun installConfiguration
All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:
Variable | Description | Default |
| Transport: |
|
| HTTP server port |
|
| HTTP session handling: |
|
| HTTP endpoint path where the MCP server is mounted |
|
| Public origin override for TLS-terminating reverse-proxy deployments | none |
| Authentication: |
|
| Log level ( |
|
| Opt-in Bun-only forced-GC pressure loop (ms). Recommended starting point if heap growth is observed: |
|
| Storage backend: |
|
| Nominatim API base URL. Override for a private or mirror instance. A path prefix is supported for instances proxied under a subpath (e.g. |
|
| 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 | unset |
| 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, 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 |
|
| Maximum Overpass queries submitted at once; queries past the cap queue locally. Match the slot budget the endpoint advertises at |
|
| User-Agent sent to Nominatim and Overpass. Required by usage policy. |
|
| Enable OpenTelemetry |
|
Overpass endpoint failover
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. Four outcomes count as that kind of refusal: an HTTP 429 or throttle page, 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, 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:
Confirm the operator welcomes general client use. The OSM wiki instance list records each instance's stated usage policy, and they differ sharply — some grant open use, others require an API key or payment, others ask you to contact the operator first.
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.Check the data coverage. Region-scoped instances answer a query outside their extract with HTTP 200 and an empty element list — a silent wrong answer rather than an error — so they are unfit as a general-purpose fallback no matter how healthy they are. The wiki list separates global instances from regional ones.
Check the freshness. Mirrors can lag the main instance, sometimes by weeks. Every response reports which endpoint served it in the
servingEndpointenrichment field alongside thedata_timestampoutput 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.
Running the server
Docker
Run the published image:
docker run --rm -p 3010:3010 ghcr.io/cyanheads/openstreetmap-mcp-server:latestOr build and run locally:
docker build -t openstreetmap-mcp-server .
docker run --rm -p 3010:3010 openstreetmap-mcp-serverThe 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.
Local development
Build and run the production version:
# One-time build bun run rebuild # Run the built server bun run start:http # or bun run start:stdioRun checks and tests:
bun run devcheck # Lints, formats, type-checks, and more bun run test # Runs the test suite
Project structure
Directory | Purpose |
| Tool definitions ( |
| Nominatim service layer — API client, search, reverse, lookup. |
| Overpass service layer — query builder, executor, element normalizer. |
| Server-specific environment variable parsing and validation with Zod. |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor logging,ctx.statefor storageRegister new tools and resources in the
createApp()arrays
Data attribution
Map data from OpenStreetMap contributors, available under the Open Database License (ODbL).
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
Nominatim MCP — wraps OpenStreetMap Nominatim geocoding API (free, no auth)
Geo MCP — geographic utilities from free public APIs
OpenStreetMap Overpass MCP — programmatic queries against the OSM database
Geocodio MCP — wraps the Geocodio geocoding API (geocod.io)
Related MCP Servers
- AlicenseAqualityCmaintenanceAn MCP server providing geocoding and place discovery services via Nominatim and OpenStreetMap. It enables users to perform forward and reverse geocoding, extract bounding boxes, and find nearby places or administrative hierarchies.10Apache 2.0
- FlicenseNot gradedqualityCmaintenancePython MCP server for querying Overture Maps building footprint data via address search, building lookups, and nearby building listings.-
- AlicenseBqualityDmaintenanceAn MCP server for forward geocoding via the Nominatim API (OpenStreetMap) with no API key required.18 npmMIT
- FlicenseNot gradedqualityAmaintenanceAn MCP server providing geocoding, routing, isochrones, and POI-by-proximity search through self-hosted OpenStreetMap backends.-