osmkit-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .venv/
5
+ venv/
6
+ dist/
7
+ build/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ node_modules/
11
+ coverage/
12
+ .DS_Store
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-12-04)
4
+
5
+ First release.
6
+
7
+ - Unofficial OpenStreetMap MCP server on the official MCP Python SDK (1.10+, 1.x, 2.x), stdio
8
+ transport, run with `uvx osmkit-mcp`. No API key.
9
+ - Eleven read-only tools: `geocode` (optional full outline), `reverse_geocode`, `place_details`
10
+ (Nominatim); `find_nearby`, `search_area` (inside a named area's real boundary, with the
11
+ total count), `overpass_query` (Overpass); `route`, `travel_matrix`, `optimize_stop_order`,
12
+ `match_gps_trace`, `snap_to_road` (OSRM).
13
+ - Results are compact GeoJSON with OpenStreetMap attribution.
14
+ - Usage policies built in: at most 1 request per second to each public server, a 24-hour
15
+ in-memory cache, a real User-Agent with an optional contact address (`OSMKIT_EMAIL`).
16
+ - Real car, bike and foot routing by default (routing.openstreetmap.de), and a warning when
17
+ bike or foot is asked of router.project-osrm.org, which only routes cars.
18
+ - Every endpoint configurable for self-hosted Nominatim, Overpass and OSRM, including one OSRM
19
+ server per profile.
20
+ - Places as names, addresses or `lat,lon`; swapped coordinates are caught with a hint.
21
+ - Plain-word search (`pharmacy`, `ev charging`) as well as OSM tags, AND and OR filters.
22
+ - Errors written for the model: rate limits, blocked requests, Overpass syntax errors and
23
+ timeouts, no route, unmatched traces.
24
+ - `osmkit-mcp check` tests each endpoint. `OSM` answers the same questions from Python.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sri Krishna Lingamaneni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,226 @@
1
+ Metadata-Version: 2.5
2
+ Name: osmkit-mcp
3
+ Version: 0.1.0
4
+ 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.
5
+ Project-URL: Homepage, https://github.com/srikrishnaL/kitforge/tree/main/packages/osmkit
6
+ Project-URL: Source, https://github.com/srikrishnaL/kitforge
7
+ Project-URL: Issues, https://github.com/srikrishnaL/kitforge/issues
8
+ Project-URL: Changelog, https://github.com/srikrishnaL/kitforge/blob/main/packages/osmkit/CHANGELOG.md
9
+ Author: Sri Krishna Lingamaneni
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ 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
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Topic :: Scientific/Engineering :: GIS
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: mcp>=1.10
22
+ Provides-Extra: test
23
+ Requires-Dist: pytest-mcp-server>=0.2; extra == 'test'
24
+ Requires-Dist: pytest>=7; extra == 'test'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # osmkit-mcp: unofficial OpenStreetMap MCP server
28
+
29
+ <!-- mcp-name: io.github.srikrishnal/osmkit-mcp -->
30
+
31
+ **Give Claude, Cursor, VS Code or any MCP client real maps without an API key: geocoding,
32
+ "what's near here", search inside a city's boundary, routing by car, bike or foot, travel-time
33
+ matrices, stop ordering and GPS map matching, all from OpenStreetMap.** Most OpenStreetMap MCP
34
+ servers ignore the public servers' usage policies and get their users blocked; osmkit-mcp
35
+ throttles, caches, sends a real User-Agent and attribution, and works with your own servers too.
36
+
37
+ This is an **unofficial** project. It is not made or endorsed by the OpenStreetMap Foundation,
38
+ Nominatim, Overpass API or OSRM. Map data © [OpenStreetMap contributors](https://www.openstreetmap.org/copyright),
39
+ available under the [ODbL](https://opendatacommons.org/licenses/odbl/).
40
+
41
+ ```bash
42
+ uvx osmkit-mcp # or: pip install osmkit-mcp
43
+ ```
44
+
45
+ ## Set up
46
+
47
+ **Claude Code**
48
+
49
+ ```bash
50
+ claude mcp add osm -e OSMKIT_EMAIL=you@example.com -- uvx osmkit-mcp
51
+ ```
52
+
53
+ **Claude Desktop, Cursor, VS Code and others** (the usual `mcpServers` JSON):
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "osm": {
59
+ "command": "uvx",
60
+ "args": ["osmkit-mcp"],
61
+ "env": { "OSMKIT_EMAIL": "you@example.com" }
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ No key is needed. `OSMKIT_EMAIL` is optional, but the Nominatim policy asks for a contact
68
+ address for anything beyond light use. Test the setup with `uvx osmkit-mcp check`.
69
+
70
+ Then ask things like:
71
+
72
+ - "What's the address at 48.8584, 2.2945?"
73
+ - "Find pharmacies open on Sunday within 1 km of Alexanderplatz."
74
+ - "How many EV chargers are there in Amsterdam?"
75
+ - "How long is the bike ride from Brandenburger Tor to Tempelhofer Feld, step by step?"
76
+ - "Which of our three warehouses is closest by car to each of these customers?"
77
+ - "What's the fastest order to visit these 8 addresses, starting and ending at the depot?"
78
+ - "Snap this GPS log to the roads and tell me which streets it used."
79
+
80
+ ## Tools
81
+
82
+ All tools are read-only. Places can be names, addresses or `lat,lon` (latitude first);
83
+ results are GeoJSON (`[lon, lat]` order) with an `attribution` member.
84
+
85
+ | Tool | Service | What it does |
86
+ | --- | --- | --- |
87
+ | `geocode` | Nominatim | Address or place name to coordinates, address parts, OSM id, bbox; `outline=true` returns the full polygon or line |
88
+ | `reverse_geocode` | Nominatim | Coordinate to address, or to the street, suburb, city or country it is in |
89
+ | `place_details` | Nominatim | Opening hours, website, phone, wheelchair access, Wikidata... for OSM ids |
90
+ | `find_nearby` | Overpass | Places of a kind around a place, nearest first, with distance |
91
+ | `search_area` | Overpass | Places of a kind inside a city, district, park or bbox (its real boundary), with the total count |
92
+ | `overpass_query` | Overpass | Any Overpass QL query, answered as GeoJSON |
93
+ | `route` | OSRM | Directions by car, bike or foot: distance, time, route line, optional turn-by-turn steps and alternatives |
94
+ | `travel_matrix` | OSRM | Travel time and distance from every origin to every destination |
95
+ | `optimize_stop_order` | OSRM | Fastest order to visit up to 50 stops (round trip or one way) |
96
+ | `match_gps_trace` | OSRM | Map matching: snap a GPS trace to the roads used, drop noisy points |
97
+ | `snap_to_road` | OSRM | Nearest point on a road for a profile |
98
+
99
+ `what` in `find_nearby` and `search_area` takes plain words (`cafe`, `pharmacy`,
100
+ `ev charging`, `supermarket`, `bus stop`...), any OSM tag (`amenity=cafe`, `shop=bakery`,
101
+ `cuisine~pizza`, `wheelchair=*`), tags that must all match (`cafe, diet:vegan=yes`) or
102
+ alternatives (`cafe | restaurant | bar`).
103
+
104
+ A `find_nearby` answer looks like this ("cafes within 300 m of Brandenburger Tor", second
105
+ cafe left out):
106
+
107
+ ```json
108
+ {
109
+ "type": "FeatureCollection",
110
+ "center": {"type": "Point", "coordinates": [13.377704, 52.516275]},
111
+ "place": "Brandenburger Tor, Pariser Platz, Mitte, Berlin, 10117, Deutschland",
112
+ "radius_m": 300,
113
+ "total": 2,
114
+ "shown": 2,
115
+ "source": "Overpass",
116
+ "features": [
117
+ {
118
+ "type": "Feature",
119
+ "geometry": {"type": "Point", "coordinates": [13.3789, 52.5161]},
120
+ "properties": {
121
+ "osm": "node/101",
122
+ "name": "Café Tor",
123
+ "category": "amenity=cafe",
124
+ "distance_m": 83,
125
+ "address": "Pariser Platz 1, 10117 Berlin",
126
+ "tags": {"amenity": "cafe", "name": "Café Tor", "opening_hours": "Mo-Su 08:00-20:00"}
127
+ }
128
+ }
129
+ ],
130
+ "attribution": "© OpenStreetMap contributors, ODbL 1.0 (https://www.openstreetmap.org/copyright)"
131
+ }
132
+ ```
133
+
134
+ ## Usage policies, built in
135
+
136
+ The public servers are run by volunteers. osmkit-mcp follows their rules by default:
137
+
138
+ - **At most 1 request per second** to each public server (nominatim.openstreetmap.org,
139
+ overpass-api.de, routing.openstreetmap.de, router.project-osrm.org and the other well-known
140
+ public instances). This is enforced even if you lower `OSMKIT_MIN_INTERVAL`.
141
+ - **Caching:** identical requests within 24 hours are answered from memory (`OSMKIT_CACHE_TTL`).
142
+ - **A real User-Agent** (`osmkit-mcp/<version> (+homepage; your email)`), as the
143
+ [Nominatim policy](https://operations.osmfoundation.org/policies/nominatim/) requires.
144
+ - **Attribution** in every result, as the ODbL requires.
145
+ - **Real bike and foot routing.** The default OSRM server is
146
+ [routing.openstreetmap.de](https://routing.openstreetmap.de/), the FOSSGIS servers behind
147
+ openstreetmap.org's directions, with a separate car, bike and foot profile. The often used
148
+ router.project-osrm.org demo has only the car profile and silently answers bike and foot
149
+ requests with car routes; osmkit-mcp warns you if you point it there.
150
+
151
+ Not for bulk geocoding or heavy use. For that, run your own servers and point osmkit-mcp at
152
+ them (no throttle unless you set one).
153
+
154
+ ## Settings
155
+
156
+ | Setting | Meaning |
157
+ | --- | --- |
158
+ | `OSMKIT_EMAIL` | Your contact address, sent to Nominatim and in the User-Agent. Recommended. |
159
+ | `OSMKIT_NOMINATIM_URL` | Nominatim server (default `https://nominatim.openstreetmap.org`). |
160
+ | `OSMKIT_OVERPASS_URL` | Overpass interpreter URL (default `https://overpass-api.de/api/interpreter`). |
161
+ | `OSMKIT_OSRM_URL` | OSRM server; `{profile}` becomes `car`, `bike` or `foot` (default `https://routing.openstreetmap.de/routed-{profile}`). |
162
+ | `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). |
163
+ | `OSMKIT_LANGUAGE` | Preferred language for names, e.g. `en` (default: local names). |
164
+ | `OSMKIT_USER_AGENT` | Replace the User-Agent completely. |
165
+ | `OSMKIT_CACHE_TTL` | Seconds to cache answers (default 86400; 0 turns caching off). |
166
+ | `OSMKIT_MIN_INTERVAL` | Seconds between requests to your own servers (default 0). |
167
+ | `OSMKIT_TIMEOUT` | Seconds per request (default 30). |
168
+
169
+ Self-hosted example (Nominatim, Overpass and OSRM in Docker):
170
+
171
+ ```bash
172
+ OSMKIT_NOMINATIM_URL=http://localhost:8080 \
173
+ OSMKIT_OVERPASS_URL=http://localhost:12345/api/interpreter \
174
+ OSMKIT_OSRM_CAR_URL=http://localhost:5000 \
175
+ OSMKIT_OSRM_FOOT_URL=http://localhost:5001 \
176
+ uvx osmkit-mcp check
177
+ ```
178
+
179
+ ## Use it from Python
180
+
181
+ ```python
182
+ from osmkit import OSM
183
+
184
+ osm = OSM()
185
+ print(osm.find_nearby("Alexanderplatz, Berlin", "pharmacy", radius_m=1000)["features"][0])
186
+ print(osm.route(["52.5163,13.3777", "52.4730,13.4040"], profile="bike")["features"][0]["properties"])
187
+ ```
188
+
189
+ ## Limits
190
+
191
+ - Public servers: 1 request per second, so a `route` through 5 named places takes about 6
192
+ seconds (5 geocodes, then the route). Give `lat,lon` to skip geocoding.
193
+ - `match_gps_trace` takes up to 100 points per call (OSRM's default); split longer traces.
194
+ - `travel_matrix` takes up to 50 places in all; `optimize_stop_order` up to 50 stops.
195
+ - Outlines from `geocode(outline=true)` over 2,000 points come back as the center point only.
196
+ - `find_nearby` sorts at most 500 results by distance; use a smaller radius in dense areas.
197
+ - Overpass queries time out after 25 seconds (60 for `search_area`); large areas with common
198
+ tags (every building in a country) will not finish on the public server.
199
+ - The cache is in memory and per process.
200
+
201
+ ## Why this exists
202
+
203
+ People keep wiring OpenStreetMap into AI assistants, and the existing servers keep hitting the
204
+ same problems:
205
+
206
+ - The most-starred OpenStreetMap MCP server (237 stars) has not been updated since July 2025;
207
+ its category search fails with HTTP 400 when subcategories are given
208
+ ([open-streetmap-mcp#5](https://github.com/jagan-shanmugam/open-streetmap-mcp/issues/5)).
209
+ - Bike and foot directions that are really car routes, because router.project-osrm.org has
210
+ only the car profile ([skill-library-mcp#40](https://github.com/modbender/skill-library-mcp/issues/40)).
211
+ - Geocoding that returns only a point when people need the outline
212
+ ([osm-mcp#4](https://github.com/wiseman/osm-mcp/issues/4)).
213
+ - Tag search that can't be limited to a city's or park's boundary
214
+ ([openstreetmap-mcp-server#71](https://github.com/cyanheads/openstreetmap-mcp-server/issues/71)),
215
+ and tool lists so wordy they cost 15,000 tokens per session
216
+ ([openstreetmap-mcp-server#72](https://github.com/cyanheads/openstreetmap-mcp-server/issues/72));
217
+ osmkit-mcp's eleven tools list in under 10 KB.
218
+ - Few servers respect the Nominatim usage policy, which gets users' IP addresses blocked.
219
+
220
+ Listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/) as
221
+ `io.github.srikrishnal/osmkit-mcp` (see [`server.json`](server.json)).
222
+
223
+ ## License
224
+
225
+ MIT for the code. Data returned by the tools comes from OpenStreetMap under the ODbL: credit
226
+ "© OpenStreetMap contributors" wherever you show it.
@@ -0,0 +1,200 @@
1
+ # osmkit-mcp: unofficial OpenStreetMap MCP server
2
+
3
+ <!-- mcp-name: io.github.srikrishnal/osmkit-mcp -->
4
+
5
+ **Give Claude, Cursor, VS Code or any MCP client real maps without an API key: geocoding,
6
+ "what's near here", search inside a city's boundary, routing by car, bike or foot, travel-time
7
+ matrices, stop ordering and GPS map matching, all from OpenStreetMap.** Most OpenStreetMap MCP
8
+ servers ignore the public servers' usage policies and get their users blocked; osmkit-mcp
9
+ throttles, caches, sends a real User-Agent and attribution, and works with your own servers too.
10
+
11
+ This is an **unofficial** project. It is not made or endorsed by the OpenStreetMap Foundation,
12
+ Nominatim, Overpass API or OSRM. Map data © [OpenStreetMap contributors](https://www.openstreetmap.org/copyright),
13
+ available under the [ODbL](https://opendatacommons.org/licenses/odbl/).
14
+
15
+ ```bash
16
+ uvx osmkit-mcp # or: pip install osmkit-mcp
17
+ ```
18
+
19
+ ## Set up
20
+
21
+ **Claude Code**
22
+
23
+ ```bash
24
+ claude mcp add osm -e OSMKIT_EMAIL=you@example.com -- uvx osmkit-mcp
25
+ ```
26
+
27
+ **Claude Desktop, Cursor, VS Code and others** (the usual `mcpServers` JSON):
28
+
29
+ ```json
30
+ {
31
+ "mcpServers": {
32
+ "osm": {
33
+ "command": "uvx",
34
+ "args": ["osmkit-mcp"],
35
+ "env": { "OSMKIT_EMAIL": "you@example.com" }
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ No key is needed. `OSMKIT_EMAIL` is optional, but the Nominatim policy asks for a contact
42
+ address for anything beyond light use. Test the setup with `uvx osmkit-mcp check`.
43
+
44
+ Then ask things like:
45
+
46
+ - "What's the address at 48.8584, 2.2945?"
47
+ - "Find pharmacies open on Sunday within 1 km of Alexanderplatz."
48
+ - "How many EV chargers are there in Amsterdam?"
49
+ - "How long is the bike ride from Brandenburger Tor to Tempelhofer Feld, step by step?"
50
+ - "Which of our three warehouses is closest by car to each of these customers?"
51
+ - "What's the fastest order to visit these 8 addresses, starting and ending at the depot?"
52
+ - "Snap this GPS log to the roads and tell me which streets it used."
53
+
54
+ ## Tools
55
+
56
+ All tools are read-only. Places can be names, addresses or `lat,lon` (latitude first);
57
+ results are GeoJSON (`[lon, lat]` order) with an `attribution` member.
58
+
59
+ | Tool | Service | What it does |
60
+ | --- | --- | --- |
61
+ | `geocode` | Nominatim | Address or place name to coordinates, address parts, OSM id, bbox; `outline=true` returns the full polygon or line |
62
+ | `reverse_geocode` | Nominatim | Coordinate to address, or to the street, suburb, city or country it is in |
63
+ | `place_details` | Nominatim | Opening hours, website, phone, wheelchair access, Wikidata... for OSM ids |
64
+ | `find_nearby` | Overpass | Places of a kind around a place, nearest first, with distance |
65
+ | `search_area` | Overpass | Places of a kind inside a city, district, park or bbox (its real boundary), with the total count |
66
+ | `overpass_query` | Overpass | Any Overpass QL query, answered as GeoJSON |
67
+ | `route` | OSRM | Directions by car, bike or foot: distance, time, route line, optional turn-by-turn steps and alternatives |
68
+ | `travel_matrix` | OSRM | Travel time and distance from every origin to every destination |
69
+ | `optimize_stop_order` | OSRM | Fastest order to visit up to 50 stops (round trip or one way) |
70
+ | `match_gps_trace` | OSRM | Map matching: snap a GPS trace to the roads used, drop noisy points |
71
+ | `snap_to_road` | OSRM | Nearest point on a road for a profile |
72
+
73
+ `what` in `find_nearby` and `search_area` takes plain words (`cafe`, `pharmacy`,
74
+ `ev charging`, `supermarket`, `bus stop`...), any OSM tag (`amenity=cafe`, `shop=bakery`,
75
+ `cuisine~pizza`, `wheelchair=*`), tags that must all match (`cafe, diet:vegan=yes`) or
76
+ alternatives (`cafe | restaurant | bar`).
77
+
78
+ A `find_nearby` answer looks like this ("cafes within 300 m of Brandenburger Tor", second
79
+ cafe left out):
80
+
81
+ ```json
82
+ {
83
+ "type": "FeatureCollection",
84
+ "center": {"type": "Point", "coordinates": [13.377704, 52.516275]},
85
+ "place": "Brandenburger Tor, Pariser Platz, Mitte, Berlin, 10117, Deutschland",
86
+ "radius_m": 300,
87
+ "total": 2,
88
+ "shown": 2,
89
+ "source": "Overpass",
90
+ "features": [
91
+ {
92
+ "type": "Feature",
93
+ "geometry": {"type": "Point", "coordinates": [13.3789, 52.5161]},
94
+ "properties": {
95
+ "osm": "node/101",
96
+ "name": "Café Tor",
97
+ "category": "amenity=cafe",
98
+ "distance_m": 83,
99
+ "address": "Pariser Platz 1, 10117 Berlin",
100
+ "tags": {"amenity": "cafe", "name": "Café Tor", "opening_hours": "Mo-Su 08:00-20:00"}
101
+ }
102
+ }
103
+ ],
104
+ "attribution": "© OpenStreetMap contributors, ODbL 1.0 (https://www.openstreetmap.org/copyright)"
105
+ }
106
+ ```
107
+
108
+ ## Usage policies, built in
109
+
110
+ The public servers are run by volunteers. osmkit-mcp follows their rules by default:
111
+
112
+ - **At most 1 request per second** to each public server (nominatim.openstreetmap.org,
113
+ overpass-api.de, routing.openstreetmap.de, router.project-osrm.org and the other well-known
114
+ public instances). This is enforced even if you lower `OSMKIT_MIN_INTERVAL`.
115
+ - **Caching:** identical requests within 24 hours are answered from memory (`OSMKIT_CACHE_TTL`).
116
+ - **A real User-Agent** (`osmkit-mcp/<version> (+homepage; your email)`), as the
117
+ [Nominatim policy](https://operations.osmfoundation.org/policies/nominatim/) requires.
118
+ - **Attribution** in every result, as the ODbL requires.
119
+ - **Real bike and foot routing.** The default OSRM server is
120
+ [routing.openstreetmap.de](https://routing.openstreetmap.de/), the FOSSGIS servers behind
121
+ openstreetmap.org's directions, with a separate car, bike and foot profile. The often used
122
+ router.project-osrm.org demo has only the car profile and silently answers bike and foot
123
+ requests with car routes; osmkit-mcp warns you if you point it there.
124
+
125
+ Not for bulk geocoding or heavy use. For that, run your own servers and point osmkit-mcp at
126
+ them (no throttle unless you set one).
127
+
128
+ ## Settings
129
+
130
+ | Setting | Meaning |
131
+ | --- | --- |
132
+ | `OSMKIT_EMAIL` | Your contact address, sent to Nominatim and in the User-Agent. Recommended. |
133
+ | `OSMKIT_NOMINATIM_URL` | Nominatim server (default `https://nominatim.openstreetmap.org`). |
134
+ | `OSMKIT_OVERPASS_URL` | Overpass interpreter URL (default `https://overpass-api.de/api/interpreter`). |
135
+ | `OSMKIT_OSRM_URL` | OSRM server; `{profile}` becomes `car`, `bike` or `foot` (default `https://routing.openstreetmap.de/routed-{profile}`). |
136
+ | `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). |
137
+ | `OSMKIT_LANGUAGE` | Preferred language for names, e.g. `en` (default: local names). |
138
+ | `OSMKIT_USER_AGENT` | Replace the User-Agent completely. |
139
+ | `OSMKIT_CACHE_TTL` | Seconds to cache answers (default 86400; 0 turns caching off). |
140
+ | `OSMKIT_MIN_INTERVAL` | Seconds between requests to your own servers (default 0). |
141
+ | `OSMKIT_TIMEOUT` | Seconds per request (default 30). |
142
+
143
+ Self-hosted example (Nominatim, Overpass and OSRM in Docker):
144
+
145
+ ```bash
146
+ OSMKIT_NOMINATIM_URL=http://localhost:8080 \
147
+ OSMKIT_OVERPASS_URL=http://localhost:12345/api/interpreter \
148
+ OSMKIT_OSRM_CAR_URL=http://localhost:5000 \
149
+ OSMKIT_OSRM_FOOT_URL=http://localhost:5001 \
150
+ uvx osmkit-mcp check
151
+ ```
152
+
153
+ ## Use it from Python
154
+
155
+ ```python
156
+ from osmkit import OSM
157
+
158
+ osm = OSM()
159
+ print(osm.find_nearby("Alexanderplatz, Berlin", "pharmacy", radius_m=1000)["features"][0])
160
+ print(osm.route(["52.5163,13.3777", "52.4730,13.4040"], profile="bike")["features"][0]["properties"])
161
+ ```
162
+
163
+ ## Limits
164
+
165
+ - Public servers: 1 request per second, so a `route` through 5 named places takes about 6
166
+ seconds (5 geocodes, then the route). Give `lat,lon` to skip geocoding.
167
+ - `match_gps_trace` takes up to 100 points per call (OSRM's default); split longer traces.
168
+ - `travel_matrix` takes up to 50 places in all; `optimize_stop_order` up to 50 stops.
169
+ - Outlines from `geocode(outline=true)` over 2,000 points come back as the center point only.
170
+ - `find_nearby` sorts at most 500 results by distance; use a smaller radius in dense areas.
171
+ - Overpass queries time out after 25 seconds (60 for `search_area`); large areas with common
172
+ tags (every building in a country) will not finish on the public server.
173
+ - The cache is in memory and per process.
174
+
175
+ ## Why this exists
176
+
177
+ People keep wiring OpenStreetMap into AI assistants, and the existing servers keep hitting the
178
+ same problems:
179
+
180
+ - The most-starred OpenStreetMap MCP server (237 stars) has not been updated since July 2025;
181
+ its category search fails with HTTP 400 when subcategories are given
182
+ ([open-streetmap-mcp#5](https://github.com/jagan-shanmugam/open-streetmap-mcp/issues/5)).
183
+ - Bike and foot directions that are really car routes, because router.project-osrm.org has
184
+ only the car profile ([skill-library-mcp#40](https://github.com/modbender/skill-library-mcp/issues/40)).
185
+ - Geocoding that returns only a point when people need the outline
186
+ ([osm-mcp#4](https://github.com/wiseman/osm-mcp/issues/4)).
187
+ - Tag search that can't be limited to a city's or park's boundary
188
+ ([openstreetmap-mcp-server#71](https://github.com/cyanheads/openstreetmap-mcp-server/issues/71)),
189
+ and tool lists so wordy they cost 15,000 tokens per session
190
+ ([openstreetmap-mcp-server#72](https://github.com/cyanheads/openstreetmap-mcp-server/issues/72));
191
+ osmkit-mcp's eleven tools list in under 10 KB.
192
+ - Few servers respect the Nominatim usage policy, which gets users' IP addresses blocked.
193
+
194
+ Listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/) as
195
+ `io.github.srikrishnal/osmkit-mcp` (see [`server.json`](server.json)).
196
+
197
+ ## License
198
+
199
+ MIT for the code. Data returned by the tools comes from OpenStreetMap under the ODbL: credit
200
+ "© OpenStreetMap contributors" wherever you show it.
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "osmkit-mcp"
7
+ version = "0.1.0"
8
+ description = "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."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ authors = [{ name = "Sri Krishna Lingamaneni" }]
14
+ keywords = [
15
+ "openstreetmap", "osm", "mcp", "mcp server", "model context protocol", "nominatim", "overpass",
16
+ "osrm", "geocoding", "reverse geocoding", "routing", "directions", "map matching", "gps",
17
+ "geojson", "maps", "places", "points of interest", "claude", "gis",
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 4 - Beta",
21
+ "Intended Audience :: Developers",
22
+ "Intended Audience :: Science/Research",
23
+ "Operating System :: OS Independent",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3 :: Only",
26
+ "Topic :: Scientific/Engineering :: GIS",
27
+ ]
28
+ dependencies = ["mcp>=1.10"]
29
+
30
+ [project.optional-dependencies]
31
+ test = ["pytest>=7", "pytest-mcp-server>=0.2"]
32
+
33
+ [project.scripts]
34
+ osmkit-mcp = "osmkit.server:main"
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/srikrishnaL/kitforge/tree/main/packages/osmkit"
38
+ Source = "https://github.com/srikrishnaL/kitforge"
39
+ Issues = "https://github.com/srikrishnaL/kitforge/issues"
40
+ Changelog = "https://github.com/srikrishnaL/kitforge/blob/main/packages/osmkit/CHANGELOG.md"
41
+
42
+ [tool.hatch.build.targets.wheel]
43
+ packages = ["src/osmkit"]
44
+
45
+ [tool.pytest.ini_options]
46
+ testpaths = ["tests"]
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.srikrishnal/osmkit-mcp",
4
+ "title": "OpenStreetMap (unofficial, osmkit)",
5
+ "description": "Unofficial OpenStreetMap: geocode, nearby search, routing, travel times, GPS map matching",
6
+ "version": "0.1.0",
7
+ "repository": {
8
+ "url": "https://github.com/srikrishnaL/kitforge",
9
+ "source": "github",
10
+ "subfolder": "packages/osmkit"
11
+ },
12
+ "websiteUrl": "https://github.com/srikrishnaL/kitforge/tree/main/packages/osmkit",
13
+ "packages": [
14
+ {
15
+ "registryType": "pypi",
16
+ "registryBaseUrl": "https://pypi.org",
17
+ "identifier": "osmkit-mcp",
18
+ "version": "0.1.0",
19
+ "runtimeHint": "uvx",
20
+ "transport": { "type": "stdio" },
21
+ "environmentVariables": [
22
+ {
23
+ "name": "OSMKIT_EMAIL",
24
+ "description": "Your contact address, sent to Nominatim as its usage policy asks",
25
+ "isRequired": false,
26
+ "format": "string"
27
+ },
28
+ {
29
+ "name": "OSMKIT_NOMINATIM_URL",
30
+ "description": "Your own Nominatim server (default: nominatim.openstreetmap.org)",
31
+ "isRequired": false,
32
+ "format": "string"
33
+ },
34
+ {
35
+ "name": "OSMKIT_OVERPASS_URL",
36
+ "description": "Your own Overpass interpreter URL (default: overpass-api.de)",
37
+ "isRequired": false,
38
+ "format": "string"
39
+ },
40
+ {
41
+ "name": "OSMKIT_OSRM_URL",
42
+ "description": "Your own OSRM server; {profile} becomes car, bike or foot",
43
+ "isRequired": false,
44
+ "format": "string"
45
+ },
46
+ {
47
+ "name": "OSMKIT_LANGUAGE",
48
+ "description": "Preferred language for names, e.g. en",
49
+ "isRequired": false,
50
+ "format": "string"
51
+ }
52
+ ]
53
+ }
54
+ ]
55
+ }
@@ -0,0 +1,14 @@
1
+ """osmkit: an unofficial OpenStreetMap MCP server.
2
+
3
+ Geocoding and reverse geocoding (Nominatim), searches for places and features (Overpass), and
4
+ routing, travel-time matrices, stop ordering and GPS trace matching (OSRM), as GeoJSON, with
5
+ the public servers' usage policies (1 request per second, caching, a real User-Agent,
6
+ attribution) built in. Not affiliated with the OpenStreetMap Foundation.
7
+ """
8
+
9
+ __version__ = "0.1.0"
10
+
11
+ from .errors import OSMError # noqa: E402
12
+ from .osm import OSM, Settings # noqa: E402
13
+
14
+ __all__ = ["OSM", "OSMError", "Settings", "__version__"]
@@ -0,0 +1,5 @@
1
+ import sys
2
+
3
+ from .server import main
4
+
5
+ sys.exit(main())
@@ -0,0 +1,38 @@
1
+ """The one exception osmkit raises.
2
+
3
+ It subclasses the MCP SDK's own ``ToolError`` (whichever SDK is installed), so the server sends
4
+ its message to the model as the tool's error result instead of hiding it as an internal error.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import importlib
10
+ from typing import Optional, Tuple, Type
11
+
12
+
13
+ def _tool_error_bases() -> Tuple[Type[Exception], ...]:
14
+ bases = []
15
+ for module in (
16
+ "mcp.server.mcpserver.exceptions", # MCP Python SDK 2.x (MCPServer)
17
+ "mcp.server.fastmcp.exceptions", # MCP Python SDK 1.x (FastMCP)
18
+ ):
19
+ try:
20
+ cls = getattr(importlib.import_module(module), "ToolError")
21
+ except Exception: # not installed, or a version without it
22
+ continue
23
+ if isinstance(cls, type) and issubclass(cls, Exception) and cls not in bases:
24
+ bases.append(cls)
25
+ bases = [b for b in bases if not any(o is not b and issubclass(o, b) for o in bases)]
26
+ return tuple(bases) or (Exception,)
27
+
28
+
29
+ class OSMError(*_tool_error_bases()): # type: ignore[misc]
30
+ """A request to Nominatim, Overpass or OSRM failed, or the input was wrong.
31
+
32
+ The message says what happened and what to do about it.
33
+ """
34
+
35
+ def __init__(self, message: str, *, status: Optional[int] = None):
36
+ super().__init__(message)
37
+ #: The HTTP status, when the server answered.
38
+ self.status = status