Metadata-Version: 2.5
Name: osmkit-mcp
Version: 0.1.0
Summary: Unofficial OpenStreetMap MCP server: geocoding (Nominatim), place search (Overpass), routing, travel times, stop ordering and GPS map matching (OSRM) as GeoJSON, with the usage policies built in. No API key.
Project-URL: Homepage, https://github.com/srikrishnaL/kitforge/tree/main/packages/osmkit
Project-URL: Source, https://github.com/srikrishnaL/kitforge
Project-URL: Issues, https://github.com/srikrishnaL/kitforge/issues
Project-URL: Changelog, https://github.com/srikrishnaL/kitforge/blob/main/packages/osmkit/CHANGELOG.md
Author: Sri Krishna Lingamaneni
License-Expression: MIT
License-File: LICENSE
Keywords: claude,directions,geocoding,geojson,gis,gps,map matching,maps,mcp,mcp server,model context protocol,nominatim,openstreetmap,osm,osrm,overpass,places,points of interest,reverse geocoding,routing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: GIS
Requires-Python: >=3.10
Requires-Dist: mcp>=1.10
Provides-Extra: test
Requires-Dist: pytest-mcp-server>=0.2; extra == 'test'
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# osmkit-mcp: unofficial OpenStreetMap MCP server

<!-- mcp-name: io.github.srikrishnal/osmkit-mcp -->

**Give Claude, Cursor, VS Code or any MCP client real maps without an API key: geocoding,
"what's near here", search inside a city's boundary, routing by car, bike or foot, travel-time
matrices, stop ordering and GPS map matching, all from OpenStreetMap.** Most OpenStreetMap MCP
servers ignore the public servers' usage policies and get their users blocked; osmkit-mcp
throttles, caches, sends a real User-Agent and attribution, and works with your own servers too.

This is an **unofficial** project. It is not made or endorsed by the OpenStreetMap Foundation,
Nominatim, Overpass API or OSRM. Map data © [OpenStreetMap contributors](https://www.openstreetmap.org/copyright),
available under the [ODbL](https://opendatacommons.org/licenses/odbl/).

```bash
uvx osmkit-mcp            # or: pip install osmkit-mcp
```

## Set up

**Claude Code**

```bash
claude mcp add osm -e OSMKIT_EMAIL=you@example.com -- uvx osmkit-mcp
```

**Claude Desktop, Cursor, VS Code and others** (the usual `mcpServers` JSON):

```json
{
  "mcpServers": {
    "osm": {
      "command": "uvx",
      "args": ["osmkit-mcp"],
      "env": { "OSMKIT_EMAIL": "you@example.com" }
    }
  }
}
```

No key is needed. `OSMKIT_EMAIL` is optional, but the Nominatim policy asks for a contact
address for anything beyond light use. Test the setup with `uvx osmkit-mcp check`.

Then ask things like:

- "What's the address at 48.8584, 2.2945?"
- "Find pharmacies open on Sunday within 1 km of Alexanderplatz."
- "How many EV chargers are there in Amsterdam?"
- "How long is the bike ride from Brandenburger Tor to Tempelhofer Feld, step by step?"
- "Which of our three warehouses is closest by car to each of these customers?"
- "What's the fastest order to visit these 8 addresses, starting and ending at the depot?"
- "Snap this GPS log to the roads and tell me which streets it used."

## Tools

All tools are read-only. Places can be names, addresses or `lat,lon` (latitude first);
results are GeoJSON (`[lon, lat]` order) with an `attribution` member.

| Tool | Service | What it does |
| --- | --- | --- |
| `geocode` | Nominatim | Address or place name to coordinates, address parts, OSM id, bbox; `outline=true` returns the full polygon or line |
| `reverse_geocode` | Nominatim | Coordinate to address, or to the street, suburb, city or country it is in |
| `place_details` | Nominatim | Opening hours, website, phone, wheelchair access, Wikidata... for OSM ids |
| `find_nearby` | Overpass | Places of a kind around a place, nearest first, with distance |
| `search_area` | Overpass | Places of a kind inside a city, district, park or bbox (its real boundary), with the total count |
| `overpass_query` | Overpass | Any Overpass QL query, answered as GeoJSON |
| `route` | OSRM | Directions by car, bike or foot: distance, time, route line, optional turn-by-turn steps and alternatives |
| `travel_matrix` | OSRM | Travel time and distance from every origin to every destination |
| `optimize_stop_order` | OSRM | Fastest order to visit up to 50 stops (round trip or one way) |
| `match_gps_trace` | OSRM | Map matching: snap a GPS trace to the roads used, drop noisy points |
| `snap_to_road` | OSRM | Nearest point on a road for a profile |

`what` in `find_nearby` and `search_area` takes plain words (`cafe`, `pharmacy`,
`ev charging`, `supermarket`, `bus stop`...), any OSM tag (`amenity=cafe`, `shop=bakery`,
`cuisine~pizza`, `wheelchair=*`), tags that must all match (`cafe, diet:vegan=yes`) or
alternatives (`cafe | restaurant | bar`).

A `find_nearby` answer looks like this ("cafes within 300 m of Brandenburger Tor", second
cafe left out):

```json
{
  "type": "FeatureCollection",
  "center": {"type": "Point", "coordinates": [13.377704, 52.516275]},
  "place": "Brandenburger Tor, Pariser Platz, Mitte, Berlin, 10117, Deutschland",
  "radius_m": 300,
  "total": 2,
  "shown": 2,
  "source": "Overpass",
  "features": [
    {
      "type": "Feature",
      "geometry": {"type": "Point", "coordinates": [13.3789, 52.5161]},
      "properties": {
        "osm": "node/101",
        "name": "Café Tor",
        "category": "amenity=cafe",
        "distance_m": 83,
        "address": "Pariser Platz 1, 10117 Berlin",
        "tags": {"amenity": "cafe", "name": "Café Tor", "opening_hours": "Mo-Su 08:00-20:00"}
      }
    }
  ],
  "attribution": "© OpenStreetMap contributors, ODbL 1.0 (https://www.openstreetmap.org/copyright)"
}
```

## Usage policies, built in

The public servers are run by volunteers. osmkit-mcp follows their rules by default:

- **At most 1 request per second** to each public server (nominatim.openstreetmap.org,
  overpass-api.de, routing.openstreetmap.de, router.project-osrm.org and the other well-known
  public instances). This is enforced even if you lower `OSMKIT_MIN_INTERVAL`.
- **Caching:** identical requests within 24 hours are answered from memory (`OSMKIT_CACHE_TTL`).
- **A real User-Agent** (`osmkit-mcp/<version> (+homepage; your email)`), as the
  [Nominatim policy](https://operations.osmfoundation.org/policies/nominatim/) requires.
- **Attribution** in every result, as the ODbL requires.
- **Real bike and foot routing.** The default OSRM server is
  [routing.openstreetmap.de](https://routing.openstreetmap.de/), the FOSSGIS servers behind
  openstreetmap.org's directions, with a separate car, bike and foot profile. The often used
  router.project-osrm.org demo has only the car profile and silently answers bike and foot
  requests with car routes; osmkit-mcp warns you if you point it there.

Not for bulk geocoding or heavy use. For that, run your own servers and point osmkit-mcp at
them (no throttle unless you set one).

## Settings

| Setting | Meaning |
| --- | --- |
| `OSMKIT_EMAIL` | Your contact address, sent to Nominatim and in the User-Agent. Recommended. |
| `OSMKIT_NOMINATIM_URL` | Nominatim server (default `https://nominatim.openstreetmap.org`). |
| `OSMKIT_OVERPASS_URL` | Overpass interpreter URL (default `https://overpass-api.de/api/interpreter`). |
| `OSMKIT_OSRM_URL` | OSRM server; `{profile}` becomes `car`, `bike` or `foot` (default `https://routing.openstreetmap.de/routed-{profile}`). |
| `OSMKIT_OSRM_CAR_URL`, `OSMKIT_OSRM_BIKE_URL`, `OSMKIT_OSRM_FOOT_URL` | One OSRM server per profile (self-hosted setups with one profile per port). |
| `OSMKIT_LANGUAGE` | Preferred language for names, e.g. `en` (default: local names). |
| `OSMKIT_USER_AGENT` | Replace the User-Agent completely. |
| `OSMKIT_CACHE_TTL` | Seconds to cache answers (default 86400; 0 turns caching off). |
| `OSMKIT_MIN_INTERVAL` | Seconds between requests to your own servers (default 0). |
| `OSMKIT_TIMEOUT` | Seconds per request (default 30). |

Self-hosted example (Nominatim, Overpass and OSRM in Docker):

```bash
OSMKIT_NOMINATIM_URL=http://localhost:8080 \
OSMKIT_OVERPASS_URL=http://localhost:12345/api/interpreter \
OSMKIT_OSRM_CAR_URL=http://localhost:5000 \
OSMKIT_OSRM_FOOT_URL=http://localhost:5001 \
uvx osmkit-mcp check
```

## Use it from Python

```python
from osmkit import OSM

osm = OSM()
print(osm.find_nearby("Alexanderplatz, Berlin", "pharmacy", radius_m=1000)["features"][0])
print(osm.route(["52.5163,13.3777", "52.4730,13.4040"], profile="bike")["features"][0]["properties"])
```

## Limits

- Public servers: 1 request per second, so a `route` through 5 named places takes about 6
  seconds (5 geocodes, then the route). Give `lat,lon` to skip geocoding.
- `match_gps_trace` takes up to 100 points per call (OSRM's default); split longer traces.
- `travel_matrix` takes up to 50 places in all; `optimize_stop_order` up to 50 stops.
- Outlines from `geocode(outline=true)` over 2,000 points come back as the center point only.
- `find_nearby` sorts at most 500 results by distance; use a smaller radius in dense areas.
- Overpass queries time out after 25 seconds (60 for `search_area`); large areas with common
  tags (every building in a country) will not finish on the public server.
- The cache is in memory and per process.

## Why this exists

People keep wiring OpenStreetMap into AI assistants, and the existing servers keep hitting the
same problems:

- The most-starred OpenStreetMap MCP server (237 stars) has not been updated since July 2025;
  its category search fails with HTTP 400 when subcategories are given
  ([open-streetmap-mcp#5](https://github.com/jagan-shanmugam/open-streetmap-mcp/issues/5)).
- Bike and foot directions that are really car routes, because router.project-osrm.org has
  only the car profile ([skill-library-mcp#40](https://github.com/modbender/skill-library-mcp/issues/40)).
- Geocoding that returns only a point when people need the outline
  ([osm-mcp#4](https://github.com/wiseman/osm-mcp/issues/4)).
- Tag search that can't be limited to a city's or park's boundary
  ([openstreetmap-mcp-server#71](https://github.com/cyanheads/openstreetmap-mcp-server/issues/71)),
  and tool lists so wordy they cost 15,000 tokens per session
  ([openstreetmap-mcp-server#72](https://github.com/cyanheads/openstreetmap-mcp-server/issues/72));
  osmkit-mcp's eleven tools list in under 10 KB.
- Few servers respect the Nominatim usage policy, which gets users' IP addresses blocked.

Listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/) as
`io.github.srikrishnal/osmkit-mcp` (see [`server.json`](server.json)).

## License

MIT for the code. Data returned by the tools comes from OpenStreetMap under the ODbL: credit
"© OpenStreetMap contributors" wherever you show it.
