@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.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
Public Hosted Server: https://openstreetmap.caseyjhand.com/mcp
Overview
OpenStreetMap data through Nominatim and the Overpass API. Geocode places and addresses, resolve coordinates to the nearest address, look up known OSM objects, and query features by tag around a point, inside a bounding box, or inside an OSM boundary.
Tools
Tool | Description |
| Convert a place name or address to coordinates and structured place data |
| Convert latitude/longitude to the nearest address or place name |
| Fetch address records for known OSM objects by ID |
| Find OSM features within a radius of a point |
| Find OSM features inside a bounding box or an OSM boundary such as a city, park, or region |
| Run a raw Overpass QL query for anything the other tools cannot express |
Related MCP server: geocoding-mcp
Capability reference
The openstreetmap-guide skill covers place resolution, spatial queries, paging, and interpreting coverage and tag results.
Argument aliases are accepted before canonical validation: latitude / longitude for lat / lon on nearby and reverse queries, radius_m for nearby's radius_meters, and q for search's query. Send either spelling, never both. radius, tag, and tags remain invalid; advertised schemas use canonical names.
openstreetmap_search_places tool
Free-form
queryor the structured fieldsstreet,city,county,state,country,postalcode, never both; up to 40 results (limit, default 5; a largerlimitis served as 40 with alimitNotice), narrowed bycountrycodes,layer,featureType, and aviewbox(restricting withbounded: true)language(here and on the reverse and lookup tools) is one language tag or a comma-separated, optionally weighted list (en,zh-Hant,fr,en;q=0.8), sent to Nominatim with an_script and region, the POSIX and ICU spelling, as-(en_USasen-US,zh_Hant_TWaszh-Hant-TW), its primary subtag and script in the casing OSM name keys use (ENasen,sr-latnassr-Latn) and the rest of each tag as written, cut before its first subtag carrying a digit (es-419ases); anything else, such as the nameEnglishor a locale with an encoding or modifier (en_US.UTF-8,sr_RS@latin), is rejected rather than answered in the local languageResults carry coordinates, structured
address,addresstype,boundingbox,importance, andosm_type+osm_id;addresstypeis Nominatim's address label, the level of an administrative boundary (state,county,city), so a state, its counties, and a same-name city tell apart;extratagsadds contact and physical-attribute tags; an empty first page fails asno_results, naming anycountrycodes,layer,featureType, or boundedviewboxthat was sentEvery page with results returns
nextExcludeIdsto pass back asexclude_place_ids, since a page shorter thanlimitcan still have more; once results run out you get zero results and a notice, not an error, and a walk too long for the instance's URL limit fails asrequest_too_long
openstreetmap_reverse_geocode tool
lat/lonpluszoomfrom 3 (country) to 18 (building, the default);layerdefaults toaddress,poiReturns the nearest indexed object with structured
address,addresstype,osm_type+osm_id, andboundingbox; a point with no result at the zoom and layers sent fails asno_coverage, whose hint names zoom 18 (a lower zoom never finds a result where a higher one found none) and, whenlayerleaves it out, theaddresslayer
openstreetmap_lookup_objects tool
Up to 500
osm_idsentries, each one OSM ref:N,W, orRplus the id (["N240109189"], either case), the pathnode/240109189, or its openstreetmap.org URL; an entry in any other form, or an id above 9223372036854775807, fails the call asinvalid_id_formatThe first 50 unique IDs are looked up; the rest come back as
deferred_idsfor the next callReturns address records, with
addresstype, for the objects found and lists the rest undernot_found, each in canonical form such asN240109189(including objects Nominatim does not index, such as street lamps); anoticecarries anopenstreetmap_query_rawquery to check which exist
openstreetmap_query_nearby tool
lat/lonwithradius_metersup to 50,000 (default 1,000); one primary tag,amenityortag_keywith an optionaltag_value, plus up to five ANDedfilters; up to 500 features per page (a largerlimitis served as 500 with alimitNotice)element_typessearches nodes, ways, and relations unless set;["node", "way"]leaves relations outA value matches exactly by default;
list_itemmode (tag_value_match, ormatchon a filter) matches one item of a semicolon list, socuisine=pizzaalso findscuisine=pizza;italianAn
amenityvalue that OpenStreetMap tags under another key (amenity: "museum"; museums aretourism=museum) gets anoticenaming the key to retry with. A primary feature key or value sent capitalized or spaced (amenity: "Fast Food") gets anoticenaming the lowercase, underscored spelling (amenity=fast_food), since tags match exactly. An exactname(orname:*) value that matched nothing gets anoticecarrying anopenstreetmap_search_placescall and anopenstreetmap_query_rawquery that search by name (the raw query alone when the radius crosses the antimeridian; the search call alone when the radius's bounding box covers one square degree or more, as a 50 km radius does above latitude 36° and a radius past about 300 m does at a pole; no name search when a box that crosses the antimeridian has a side that large)Features carry
osm_type+osm_id, coordinates,distance_meters(to the feature's nearest point), and the full tag set unlesstag_keyscuts it, sorted nearest-first;effectiveTagechoes the filter chaintag_keys(up to 50) cuts each feature'stagsto the keys listed, matched exactly and returned in the order listed, andeffectiveTagKeysechoes them; matching,distance_meters, and paging still read every tag, and a key a feature lacks is absent from itstags. Listingadmin_levelandwikidatashrinks a page of boundary relations, which can carry hundreds of tags eachWith ways or relations searched, an area containing the point, such as the park or city it lies in, matches at
distance_meters0 whatever the radius, andareasTimestampsays how old the area data is. An endpoint that cannot run the area lookup is asked again without it, and thenoticesays areas containing the point were not checked
openstreetmap_query_bbox tool
One scope per call: the corners
south,west,north,east, orwithinand one way or relation ref:R/Wplus the id (R237385, either case),relation/237385, or its openstreetmap.org URL, built from a geocoding result'sosm_type+osm_id; a node is never an area, so a node ref in any form is rejected; the same tag filters, list-item matching,tag_keys, retry notices (strayamenity, capitalized or spaced keys and values, an exact name that matched nothing; for a box crossing the antimeridian, or for a zero-width or zero-height box the name search is the raw query alone, for a box of one square degree or more, height times width in degrees, it is the search call alone, and a box crossing the antimeridian with a side that large gets none; underwithinthe raw query prints only while the boundary's bounds cover at most 12 Overpass index blocks, a larger boundary gets the search call alone over its bounds rounded outward to 4 decimals, and a larger boundary whose bounds cross the antimeridian gets none; that viewbox is the boundary's bounding box, not its outline, so the search can return matches just outside the boundary), and 500-per-page cap asopenstreetmap_query_nearbyelement_typessearches nodes, ways, and relations unless set;["node", "way"]leaves relations outFeatures arrive nodes, then ways, then relations, each by ascending OSM id, which is not a ranking.
sort_by: { key, order }(orderdescby default, orasc) ranks the whole match set by a tag's numeric value beforeoffsetandlimitcut the page, sonatural=peakwithsort_by: { key: "ele" }returns the highest peaks first. Only plain decimals such as4392rank; a value with a unit, comma, range, or list (8280ft,849;871) and a feature lacking the tag follow the ranked ones in default order, counted inunrankedCount. The sort key need not be intag_keyseffectiveAreanames the boundarywithinreached by itsname,boundary, andadmin_leveltags, then the Overpass area it mapped to, so a mistyped ref shows;areasTimestampsays how old the area data is; a ref that maps to no area returns an empty page with a notice, andeffectiveAreathen reads<ref> → no Overpass areaA
westgreater thaneastis a box crossing the antimeridian;southgreater thannorthfails asinvalid_bbox
openstreetmap_query_raw tool
Any Overpass QL containing
[out:json];[timeout:N]comes fromtimeout_seconds(up to 180, default 30) and[maxsize:268435456](256 MiB) is added when the query sets none; up to 500 elements per page (a largerlimitis served as 500 with alimitNotice)Returns raw elements (ways carry
nodes[], relationsmembers[]), plustotal_elementsand theeffectiveQueryas sent; malformed QL fails asquery_errorwith Overpass's parse errorEvery element arrives whole unless
max_element_bytes(minimum 1,000, no default) is set; an element over it has itsmembers,nodes, orgeometrywithheld, listed underwithheld_keys, andwithheldNoticenames the budget that returns the page whole, thenwithheldElementsthe offset and budget that fetch each element alone
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:
Nominatim requests are spaced 1,050 ms apart to respect its one-request-per-second policy, and each call has a 50 s budget covering its wait in line, attempts, and retries, ending as
upstream_errorwhen it runs out;OSM_USER_AGENTidentifies the server to both upstreamsOverpass queries are limited per endpoint by
OSM_OVERPASS_MAX_CONCURRENCY, with opt-in failover acrossOSM_OVERPASS_ENDPOINTS(see Overpass endpoint failover)Overpass tools page with
limitandoffsetand reporttotalFound,truncated, andnextOffset; results are cached for 10 minutes (Nominatim for 60), so re-paging makes no new upstream request; a result over 100,000 elements, or an unranked one whose Overpass response is over 25 MiB, is served uncached and each page re-queriesAn Overpass response over 64 MiB fails as
result_too_largeOSM_NOMINATIM_BASE_URLandOSM_OVERPASS_BASE_URLpoint the server at a self-hosted or mirror instance
Agent-friendly output:
effectiveQueryandeffectiveTagecho what was sent, andeffectiveAreanames the boundary awithinref reached; Overpass responses adddata_timestampandservingEndpoint, and every response carries the ODbLattributionosm_type+osm_idfrom any tool feedopenstreetmap_lookup_objects, and a geocoded relation or way becomes awithinref foropenstreetmap_query_bboxThe Nominatim tools never select by tag, and
tagSelectionCaveatsays so; regex, alternation, and negation go throughopenstreetmap_query_rawNames, tag values, and caller text quoted in a
noticeare escaped in the Markdown output;structuredContentkeeps the raw text
Getting started
Connect to the hosted instance, no install:
claude mcp add --transport http openstreetmap-mcp-server https://openstreetmap.caseyjhand.com/mcpOr run it locally:
claude mcp add openstreetmap-mcp-server -- npx -y @cyanheads/openstreetmap-mcp-serverFor other clients, add this to the MCP config file:
{
"mcpServers": {
"openstreetmap-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/openstreetmap-mcp-server"]
}
}
}No API key is required. For heavy use, point OSM_NOMINATIM_BASE_URL and OSM_OVERPASS_BASE_URL at your own instances. For Docker or a source build, see Running the server.
Configuration
Variable | Description | Default |
| Nominatim base URL. A path prefix such as |
|
| Pins every query to one Overpass endpoint and disables failover. | unset |
| Comma-separated, ordered Overpass endpoints; more than one enables failover. Ignored when |
|
| Max Overpass queries in flight per endpoint. Public instances allow one per user. |
|
| User-Agent sent to Nominatim and Overpass. Required by usage policy. |
|
| Transport: |
|
| HTTP server port. |
|
| HTTP session mode: |
|
| Authentication: |
|
| Log level ( |
|
| Storage backend: |
|
| Enable OpenTelemetry. |
|
See .env.example for the full list of optional overrides. An invalid value for any OSM_* variable stops the server at startup with a message naming the variable.
Overpass endpoint failover
By default every Overpass query goes to one endpoint, the FOSSGIS-operated main instance. List more in OSM_OVERPASS_ENDPOINTS and a failed call moves to the next entry in order:
OSM_OVERPASS_ENDPOINTS="https://overpass-api.de/api/interpreter,https://overpass.private.coffee/api/interpreter"Endpoints that fail repeatedly are skipped for a while (30 seconds, doubling up to 10 minutes)
When every endpoint fails, the call fails with
rate_limited,upstream_error,overpass_unavailable,endpoints_rejected,endpoints_exhausted, orendpoints_unavailable, with each endpoint's outcome in the message;openstreetmap_query_rawaddsquery_unsupportedwhen no endpoint holds the attic data a[date:],[diff:], or[adiff:]query reads or the metadataout metaprints, and an endpoint without that data is skipped for the callEndpoints are reported by origin only (
https://overpass-api.de) inservingEndpoint, error messages, and logsExtra entries are failover only and never add concurrency. For an instance that allows parallel queries, append
|Nto its entry (https://mirror.example/api/interpreter|4) for N slots; write a literal|in a URL as%7C. Never size a public instance (the FOSSGIS servers, maps.mail.ru, overpass.private.coffee)Calls waiting for a slot fail with
pacer_shedand aretryAfterof at least 30 seconds after 30 seconds in line
Adding an endpoint sends your queries to a third party. Check its usage policy on the OSM wiki instance list, confirm it holds global data (a regional instance answers out-of-extract queries with an empty HTTP 200), and expect mirrors to lag the main instance; servingEndpoint and data_timestamp show which host answered and how fresh its data was.
Running the server
Local development
Requires Bun v1.4.4 or higher (or Node.js v24+).
git clone https://github.com/cyanheads/openstreetmap-mcp-server.git
cd openstreetmap-mcp-server && bun install
cp .env.example .env
# edit .env to override endpoints or the User-Agent as neededBuild 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
Docker
docker run --rm -p 3010:3010 ghcr.io/cyanheads/openstreetmap-mcp-server:latest
# or build locally
docker build -t openstreetmap-mcp-server .
docker run --rm -p 3010:3010 openstreetmap-mcp-serverThe image serves HTTP at http://localhost:3010/mcp in stateless session mode and logs to /var/log/openstreetmap-mcp-server. OpenTelemetry peer dependencies are installed by default; build with --build-arg OTEL_ENABLED=false to omit them. Runtime telemetry stays off until you pass -e OTEL_ENABLED=true.
Project structure
Directory | Purpose |
| Tool definitions ( |
| Nominatim service: paced API client for search, reverse, and lookup, plus error parsing. |
| Overpass service: query builder, endpoint failover and executor, element normalizer, error parsing. |
| Server-specific environment variable parsing and validation with Zod. |
| Unit and integration tests for tools, services, and security. |
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 in the
createApp()arrays insrc/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
Map data from OpenStreetMap contributors, available under the Open Database License (ODbL).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Unofficial 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
Unofficial OpenTripMap MCP — wraps the OpenTripMap Places API (dev.opentripmap.org)
Related MCP Servers
- AlicenseAqualityFmaintenanceAn 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
- AlicenseBqualityDmaintenanceAn MCP server for forward geocoding via the Nominatim API (OpenStreetMap) with no API key required.1MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for geocoding, reverse geocoding, place/POI search, and distance calculation using OpenStreetMap Nominatim, with no API key required.87 npm1MIT
- AlicenseAqualityDmaintenanceMCP server providing structured access to OpenStreetMap data through Overpass and Nominatim APIs, enabling geocoding, nearby place searches, element queries, and tag counting without API keys.7MIT