bbox-mcp-server 1.4.0 β†’ 1.5.0

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.
package/README.md CHANGED
@@ -1,322 +1,112 @@
1
- # 🌍 bbox-mcp-server
2
-
3
- **Ask AI about anything, anywhere β€” and verify the answer on a map. For Free**
4
-
5
- The geospatial toolkit for AI agents. **6 tools, zero config** β€” give any LLM the ability to find, query, convert, and aggregate spatial data using open data. No API keys or signups required to start.
6
-
7
- Every response includes a shareable verification link to **[vibhorsingh.com/boundingbox](https://vibhorsingh.com/boundingbox/)** β€” click it to visually confirm results on an interactive map. No other MCP server does this.
8
-
9
- [![Node.js](https://img.shields.io/badge/node-%3E%3D18-green)](https://nodejs.org/) [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
10
-
11
-
12
- ---
13
-
14
- ## What Can You Do With This?
15
-
16
- **You don't have to be a GIS professional to make use of this.** Any AI agent with this MCP server can answer spatial questions using real OpenStreetMap data and not spit out hallucinated garbage.
17
-
18
- | Ask your AI agent... | What happens under the hood |
19
- |---|---|
20
- | *"How many EV chargers are in downtown Denver?"* | Overpass query β†’ H3 hex binning β†’ density analysis |
21
- | *"Is there a hospital near this Airbnb?"* | POI search with structured tags β†’ map verification link |
22
- | *"Find all playgrounds within 1km of this address*"* | Overpass query + radius filter β†’ pinned results on a shareable map |
23
- | *"Convert this WKT to GeoJSON in EPSG:3857"* | Format conversion across 6 inputs, 9 outputs, 3,900+ projections |
24
- | *"Show me all bike-share stations in Amsterdam"* | Curated OSM tags β†’ Overpass query β†’ results on map |
25
- | *"Compare park density across Seattle neighborhoods"* | Overpass + H3 aggregation β†’ hex-binned spatial analysis |
26
-
27
- Every answer comes with a link. Click it, see if the AI got it right and you can also share it with someone else.
28
-
29
- ---
30
-
31
- ## What Makes This Different
32
-
33
- Most AI tools give you text you have to trust. This one gives you an interactive map you can check and verify!
34
-
35
- - **Verifiable** β€” Every response includes a public URL where you (or anyone) can visually confirm the results. This is the only MCP server that does this in any domain.
36
- - **Deterministic** β€” Queries hit real OpenStreetMap data and return real coordinates. The AI interprets your question. The data comes from all the hard work done by all the awesome OSM volunteers.
37
- - **Free** β€” No paid services. Overpass API is free, OSM data is free, the tool is free. A Mapbox token (free tier, no payment info) unlocks natural language location search but isn't required.
38
- - **Zero config** β€” `npx -y bbox-mcp-server` and you're running.
39
-
40
- ---
41
-
42
- ## Why This Exists
43
-
44
- | The problem | How bbox-mcp solves it |
45
- |---|---|
46
- | *"I have WKT but the API needs a GeoJSON bbox in EPSG:3857."* | Parses 6 input formats, projects to 3,900+ EPSG codes, outputs in 9 formats β€” in one call. |
47
- | *"I keep getting the wrong OSM tags for Overpass queries."* | `list_osm_tags` returns curated tag combos. No more hallucinated `amenity=grocery`. |
48
- | *"How many hospitals are in this district?"* | `aggregate_overpass_h3` queries Overpass and bins results into H3 hexagons server-side. |
49
- | *"Is this bounding box actually correct?"* | Every response includes a clickable map link for visual verification. |
50
-
51
- ---
52
-
53
- ## Tools at a Glance
54
-
55
- | Tool | What it does | Key params |
56
- |---|---|---|
57
- | `get_bounds` | Convert and project a bbox across formats and coordinate systems | `bbox`, `epsg`, `format`, `coord_order`, `zoom` |
58
- | `get_h3_indices` | Generate H3 hex cell indices covering a bbox | `bbox`, `resolution`, `compact` |
59
- | `generate_share_url` | Create a shareable map link for a bbox | `bbox` |
60
- | `search_overpass` | Query OpenStreetMap via Overpass QL within a bbox or radius | `bbox`, `query`, `limit`, `radius_meters` |
61
- | `list_osm_tags` | Look up correct OSM tags for a category | `category` |
62
- | `aggregate_overpass_h3` | Run an Overpass query and bin results into H3 hexagons | `bbox`, `query`, `resolution` |
63
-
64
- All tools accept `location` (natural language, requires Mapbox token) or `bbox` (coordinates, WKT, GeoJSON, etc).
65
-
66
- ---
67
-
68
- ## Quick Start
69
-
70
- Add to your MCP client config:
71
-
72
- <details>
73
- <summary><b>Claude Desktop</b> <i>(Click to expand)</i></summary>
74
-
75
- Add to `claude_desktop_config.json`:
76
- ```json
77
- {
78
- "mcpServers": {
79
- "bbox": {
80
- "command": "npx",
81
- "args": ["-y", "bbox-mcp-server"]
82
- }
83
- }
84
- }
85
- ```
86
- </details>
87
-
88
- <details>
89
- <summary><b>Cursor</b> <i>(Click to expand)</i></summary>
90
-
91
- Add to `.cursor/mcp.json`:
92
- ```json
93
- {
94
- "mcpServers": {
95
- "bbox": {
96
- "command": "npx",
97
- "args": ["-y", "bbox-mcp-server"]
98
- }
99
- }
100
- }
101
- ```
102
- </details>
103
-
104
- <details>
105
- <summary><b>Windsurf</b> <i>(Click to expand)</i></summary>
106
-
107
- Add to `~/.codeium/windsurf/mcp_config.json`:
108
- ```json
109
- {
110
- "mcpServers": {
111
- "bbox": {
112
- "command": "npx",
113
- "args": ["-y", "bbox-mcp-server"]
114
- }
115
- }
116
- }
117
- ```
118
- </details>
119
-
120
- <details>
121
- <summary><b>VS Code (GitHub Copilot) or Google Antigravity</b> <i>(Click to expand)</i></summary>
122
-
123
- Add to `.vscode/mcp.json` in your workspace:
124
- ```json
125
- {
126
- "servers": {
127
- "bbox": {
128
- "command": "npx",
129
- "args": ["-y", "bbox-mcp-server"]
130
- }
131
- }
132
- }
133
- ```
134
- </details>
135
-
136
- <br/>
137
-
138
- > Try: *"Find all coffee shops within 500m of Times Square"*
139
-
140
- ### Optional Configuration
141
-
142
- ```json
143
- {
144
- "mcpServers": {
145
- "bbox": {
146
- "command": "npx",
147
- "args": ["-y", "bbox-mcp-server"],
148
- "env": {
149
- "MAPBOX_ACCESS_TOKEN": "pk.your-token-here",
150
- "OVERPASS_API_URL": "https://your.custom.overpass.instance/api/interpreter",
151
- "NOMINATIM_API_URL": "https://your.custom.nominatim.instance"
152
- }
153
- }
154
- }
155
- }
156
- ```
157
-
158
- | Variable | Default | Description |
159
- |---|---|---|
160
- | `MAPBOX_ACCESS_TOKEN` | β€” | Enables natural language location search (e.g. *"San Francisco"*) |
161
- | `OVERPASS_API_URL` | auto | Custom Overpass endpoint. By default, rotates between `overpass-api.de` and `kumi.systems`. |
162
- | `NOMINATIM_API_URL` | `https://nominatim.openstreetmap.org` | Custom Nominatim endpoint. Set this if hosting as a shared/remote MCP server or using a commercial provider. |
163
- | `MAX_H3_CELLS` | `50000` | Safety cap for H3 grid generation |
164
-
165
- *Or install globally: `npm install -g bbox-mcp-server`*
166
-
167
- ---
168
-
169
- ## Tool Reference
170
-
171
- ### `get_bounds`
172
-
173
- Convert and project a bounding box across 6 input formats, 9 output formats, and 3,900+ coordinate systems. Returns the center point and tile coordinates for the centroid.
174
-
175
- | Param | Type | Default | Description |
176
- |---|---|---|---|
177
- | `bbox` | string | β€” | Input geometry (coordinates, WKT, GeoJSON, ogrinfo extent) |
178
- | `epsg` | string | `"4326"` | Target projection. Unknown codes auto-fetched from epsg.io. |
179
- | `format` | string | `"csv"` | Output: `csv`, `wkt`, `geojson-bbox`, `geojson-polygon`, `leaflet`, `overpass`, `ogc-bbox`, `kml`, `stac-bbox` |
180
- | `coord_order` | string | `"lng,lat"` | Swap to `"lat,lng"` for APIs that expect latitude first |
181
- | `zoom` | number | `15` | Zoom level for tile coordinate calculation |
182
- | `precision` | number | `6` | Decimal places in formatted output |
183
-
184
- **πŸ’‘ Prompt:** *"Get the bounding box for Central Park in WKT format projected to EPSG:32618"*
185
-
186
- ---
187
-
188
- ### `get_h3_indices`
189
-
190
- Generate Uber H3 hexagonal cell indices covering a bounding box.
191
-
192
- | Param | Type | Default | Description |
193
- |---|---|---|---|
194
- | `bbox` | string | β€” | Input geometry |
195
- | `resolution` | number | β€” | H3 resolution (0–15) |
196
- | `compact` | boolean | `false` | Merge cells into coarser parents where possible |
197
- | `return_geometry` | boolean | `false` | Include GeoJSON hex boundaries |
198
-
199
- **πŸ’‘ Prompt:** *"Give me H3 cells at resolution 7 for downtown Chicago, include the hex geometries"*
200
-
201
- ---
202
-
203
- ### `search_overpass`
204
-
205
- Execute an Overpass query within a bounding box or radius. Returns structured results with names, coordinates, and tags. The verification link plots each result as a pin on the map.
206
-
207
- | Param | Type | Default | Description |
208
- |---|---|---|---|
209
- | `bbox` | string | β€” | Input geometry |
210
- | `query` | string | β€” | Overpass QL (e.g. `nwr["amenity"="cafe"]`). The server wraps it in the appropriate spatial filter automatically. |
211
- | `radius_meters` | number | β€” | Search radius in metres. Use only when the user specifies an explicit distance (e.g. `2000` for "within 2km"). Omit for area/region queries. |
212
- | `limit` | number | `100` | Max elements returned |
213
-
214
- **πŸ’‘ Prompt:** *"Find all parking within 2km of JFK airport"*
215
-
216
- **πŸ’‘ Prompt:** *"Search for hospitals in Manhattan, limit 50"*
217
-
218
- ---
219
-
220
- ### `list_osm_tags`
221
-
222
- Look up the correct OpenStreetMap tags for a category before writing an Overpass query.
223
-
224
- | Param | Type | Description |
225
- |---|---|---|
226
- | `category` | string | Broad category (e.g. `"food"`, `"health"`, `"transport"`) |
227
-
228
- **πŸ’‘ Prompt:** *"What are the correct OSM tags for supermarkets?"*
229
-
230
- ---
231
-
232
- ### `aggregate_overpass_h3`
233
-
234
- Run an Overpass query and bin results into H3 hexagons for spatial density analysis. Returns counts per cell and GeoJSON hex boundaries.
235
-
236
- | Param | Type | Default | Description |
237
- |---|---|---|---|
238
- | `bbox` | string | β€” | Input geometry |
239
- | `query` | string | β€” | Overpass QL core query |
240
- | `resolution` | number | `8` | H3 resolution for binning |
241
-
242
- **πŸ’‘ Prompt:** *"Aggregate all hospitals in Seattle into H3 bins at resolution 7"*
243
-
244
- ---
245
-
246
- ### `generate_share_url`
247
-
248
- Generate a shareable link to visualize a bounding box on the interactive map at vibhorsingh.com/boundingbox.
249
-
250
- | Param | Type | Description |
251
- |---|---|---|
252
- | `bbox` | string | Input geometry |
253
-
254
- **πŸ’‘ Prompt:** *"Generate a share link for bbox 40.7128,-74.0060,40.7580,-73.9855"*
255
-
256
- ---
257
-
258
- ## Supported Input Formats
259
-
260
- All tools auto-detect the input format. No need to specify which one you're using.
261
-
262
- | Format | Example |
263
- |---|---|
264
- | Raw coordinates | `40.7128,-74.0060,40.7580,-73.9855` |
265
- | WKT | `POLYGON((-74.006 40.712, -73.985 40.712, ...))` |
266
- | GeoJSON | `{"type":"Feature","geometry":{...}}` |
267
- | GeoJSON bbox | `{"bbox":[-74.006,40.712,-73.985,40.758]}` |
268
- | ogrinfo extent | `Extent: (-74.006, 40.712) - (-73.985, 40.758)` |
269
- | Space-separated | `40.7128 -74.0060 40.7580 -73.9855` |
270
-
271
- ---
272
-
273
- ## πŸ€– For AI Agent Developers
274
-
275
- ### Response structure
276
-
277
- Every tool returns two content blocks:
278
-
279
- 1. **Human-readable text** β€” formatted output with the map verification link
280
- 2. **Structured JSON** β€” all computed data, machine-parseable
281
-
282
- Example `get_bounds` JSON response:
283
-
284
- ```json
285
- {
286
- "original_wgs84": { "lat1": 40.7128, "lng1": -74.006, "lat2": 40.758, "lng2": -73.9855 },
287
- "projected": { "xmin": -8238310.23, "ymin": 4970241.32, "xmax": -8235527.11, "ymax": 4976491.56 },
288
- "center": { "lat": 40.7354, "lng": -73.99575 },
289
- "tile_indices": { "z": 15, "x": 9660, "y": 12284 },
290
- "epsg": "3857",
291
- "coord_order": "lng,lat",
292
- "area_km2": 8.681,
293
- "dimensions": { "width_km": 1.714, "height_km": 5.066 },
294
- "share_url": "https://vibhorsingh.com/boundingbox/#40.712800,-74.006000,40.758000,-73.985500"
295
- }
296
- ```
297
-
298
-
299
- ### Error handling
300
-
301
- All errors return `isError: true` with a descriptive message. Invalid coordinates, unknown EPSG codes, and oversized H3 requests all return clean errors β€” the server never crashes on bad input.
302
-
303
- ### Logging
304
-
305
- Structured JSON logs go to **stderr** (stdout is reserved for MCP protocol). Each entry includes timestamp, level, and context.
306
-
307
- ---
308
- ## Acknowledgments & Fair Use
309
-
310
- ### OpenStreetMap
311
-
312
- This tool is built on [OpenStreetMap](https://www.openstreetmap.org/): A global dataset created and maintained by millions of volunteers. Every query you run returns data that someone walked, mapped, or verified by hand. If you find this useful, consider [contributing to OSM](https://wiki.openstreetmap.org/wiki/How_to_contribute).
313
-
314
- ### Responsible Usage
315
-
316
- The public Overpass and Nominatim API instances are free community resources with limited capacity. Avoid tight loops, excessive polling, or bulk-scraping. If hosting this as a shared/remote MCP server, point `NOMINATIM_API_URL` and `OVERPASS_API_URL` at your own instance or a commercial provider (see [Overpass API installation](https://wiki.openstreetmap.org/wiki/Overpass_API/Installation) and [Nominatim installation](https://nominatim.org/release-docs/latest/admin/Installation/)). The default server rotation for Overpass helps spread load, but it's not a substitute for responsible usage.
317
-
318
- ---
319
- ## License
320
- MIT
321
-
322
- [![MCP Badge](https://lobehub.com/badge/mcp-full/iamvibhorsingh-bbox-mcp-server)](https://lobehub.com/mcp/iamvibhorsingh-bbox-mcp-server)
1
+ # 🌍 bbox-mcp-server
2
+
3
+ **FREE Geospatial tools for AI agents, with results you can inspect on a map.**
4
+
5
+ Search OpenStreetMap, convert coordinates, generate H3 grids, calculate routes, and sample terrain elevation. **10 MCP tools, no API keys required to get started.** Spatial results include shareable links to the [interactive map](https://vibhorsingh.com/boundingbox/).
6
+
7
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18-green)](https://nodejs.org/) [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
8
+
9
+ ## Try asking
10
+
11
+ - β€œFind cafes near Times Square.”
12
+ - β€œFind me pizza near the Colosseum?”
13
+ - β€œEiffel Tower to the Louvre: walk or bike? Compare the routes.”
14
+ - β€œWhere are Manhattan’s coffee hotspots?”
15
+ - β€œEV road trip: find chargers within 5km of Monterey.”
16
+ - β€œHow high up is Denver, really?”
17
+
18
+ ## Quick start
19
+
20
+ Requires **Node.js 18+**. Add this to your MCP client configuration:
21
+
22
+ ```json
23
+ {
24
+ "mcpServers": {
25
+ "bbox": {
26
+ "command": "npx",
27
+ "args": ["-y", "bbox-mcp-server"]
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ | Client | Configuration file |
34
+ |---|---|
35
+ | Claude Desktop | `claude_desktop_config.json` |
36
+ | Cursor | `.cursor/mcp.json` |
37
+ | Windsurf | `~/.codeium/windsurf/mcp_config.json` |
38
+ | VS Code (GitHub Copilot) | `.vscode/mcp.json` - use `servers` instead of `mcpServers` |
39
+
40
+ ## Tools
41
+
42
+ | Tool | What it does |
43
+ |---|---|
44
+ | `get_bounds` | Find, buffer, convert, and project bounding boxes across formats and coordinate systems. |
45
+ | `get_h3_indices` | Generate H3 cells for a bounding box or exact polygon boundary, including holes. |
46
+ | `generate_share_url` | Create a shareable map link for a bounding box. |
47
+ | `reverse_geocode` | Resolve coordinates to an address and OpenStreetMap details. |
48
+ | `search_overpass` | Find or count OSM features within an area, bounding box, or radius. |
49
+ | `list_osm_tags` | Find OSM tags by category using curated suggestions and Taginfo fallback. |
50
+ | `aggregate_overpass_h3` | Group OSM query results into H3 hexagons for density analysis. |
51
+ | `calculate_route` | Get driving, walking, or cycling distance, duration, and route geometry. |
52
+ | `get_elevation` | Get elevation for points or sample a terrain grid using the 90m Copernicus DEM. |
53
+ | `spatial_calc` | Calculate geometry relations, point containment, distance/bearing, and grid subdivisions offline. |
54
+
55
+ Your MCP client discovers each tool's full parameter and output schemas automatically. H3 tools use `resolution` (0–15).
56
+
57
+ ## Inputs and outputs
58
+
59
+ Tools with a `location` parameter accept place names. Tools with a `bbox` parameter auto-detect raw coordinates, single points, `z/x/y` tiles, WKT, GeoJSON, GeoJSON bboxes, and `ogrinfo` extents.
60
+
61
+ **Coordinate order:** raw bboxes default to `lat1,lng1,lat2,lng2`; points use `lat,lng`. Use GeoJSON or WKT to avoid ambiguity, for example `{"bbox":[-74.006,40.712,-73.985,40.758]}` in west/south/east/north order. `coord_order` on `get_bounds` controls formatted output only.
62
+
63
+ `get_bounds` supports 3,900+ bundled projections via `epsg` and nine output formats: `csv`, `wkt`, `geojson-bbox`, `geojson-polygon`, `leaflet`, `overpass`, `ogc-bbox`, `kml`, and `stac-bbox`.
64
+
65
+ For Overpass searches, supply a selector such as `nwr["amenity"="cafe"]`; the server adds spatial filters. Set `radius_meters` for an explicit distance or omit it to search the area. Use `list_osm_tags` to find selectors by category.
66
+
67
+ ## Configuration
68
+
69
+ Place search uses Nominatim with Photon fallback; a Mapbox token is optional. Defaults work without configuration.
70
+
71
+ <details>
72
+ <summary>Optional environment variables</summary>
73
+
74
+ Add an `env` object alongside `command` and `args` in your server configuration.
75
+
76
+ | Variable | Purpose / default |
77
+ |---|---|
78
+ | `OSM_USER_AGENT` | Identify your application and contact; defaults to the server name, version, and repository URL. |
79
+ | `NOMINATIM_EMAIL` | Optional contact email for Nominatim requests. |
80
+ | `NOMINATIM_API_URL` | Geocoder endpoint; defaults to `https://nominatim.openstreetmap.org`. |
81
+ | `PHOTON_API_URL` | Fallback geocoder; defaults to `https://photon.komoot.io`. |
82
+ | `MAPBOX_ACCESS_TOKEN` | Optional additional geocoding fallback. |
83
+ | `OVERPASS_API_URL` | Custom Overpass endpoint(s); defaults rotate across public instances. |
84
+ | `OSRM_API_URL` | Preferred routing endpoint; defaults use public OSRM services. |
85
+ | `ELEVATION_API_URL` | Elevation endpoint; defaults to `https://api.open-meteo.com/v1/elevation`. |
86
+ | `MAX_H3_CELLS` | H3 generation cap; defaults to `50000`. |
87
+
88
+ </details>
89
+
90
+ ## For developers
91
+
92
+ Successful calls return readable `content` and `structuredContent` matching the tool's output schema, including `provenance`, `complete`, and `warnings`. Spatial tools also return `share_url`. Errors use `isError: true`; structured logs go to stderr, keeping stdout reserved for MCP.
93
+
94
+ To run from source:
95
+
96
+ ```sh
97
+ npm install
98
+ npm test
99
+ npm start
100
+ ```
101
+
102
+ `npm test` builds the server and runs the test suite.
103
+
104
+ ## Data and service use
105
+
106
+ Data Β© [OpenStreetMap contributors](https://www.openstreetmap.org/copyright). Public services have usage limits: avoid bulk scraping and frequent polling, and configure your own endpoints for shared or heavy workloads.
107
+
108
+ - [Nominatim](https://operations.osmfoundation.org/policies/nominatim/) and [FOSSGIS routing](https://routing.openstreetmap.de/about.html) limit requests to 1 per second. Nominatim also requires application identification, caching, and attribution. The server's per-process queue does not cover traffic across multiple instances.
109
+ - [Photon's public endpoint](https://github.com/komoot/photon#demo-server) is a demo service without availability guarantees.
110
+ - [Open-Meteo's free API](https://open-meteo.com/en/terms) is for non-commercial use. Elevation grids return sample statistics, not guaranteed terrain-wide extrema or slopes.
111
+
112
+ [MIT License](./LICENSE)