bbox-mcp-server 1.3.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,110 +1,24 @@
1
1
  # 🌍 bbox-mcp-server
2
2
 
3
- **Ask AI about anything, anywhere β€” and verify the answer on a map. For Free**
3
+ **FREE Geospatial tools for AI agents, with results you can inspect on a map.**
4
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.
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/).
8
6
 
9
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)
10
8
 
9
+ ## Try asking
11
10
 
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>
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?”
90
17
 
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>
18
+ ## Quick start
103
19
 
104
- <details>
105
- <summary><b>Windsurf</b> <i>(Click to expand)</i></summary>
20
+ Requires **Node.js 18+**. Add this to your MCP client configuration:
106
21
 
107
- Add to `~/.codeium/windsurf/mcp_config.json`:
108
22
  ```json
109
23
  {
110
24
  "mcpServers": {
@@ -115,206 +29,84 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
115
29
  }
116
30
  }
117
31
  ```
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
- }
152
- }
153
- }
154
- }
155
- ```
156
-
157
- | Variable | Default | Description |
158
- |---|---|---|
159
- | `MAPBOX_ACCESS_TOKEN` | β€” | Enables natural language location search (e.g. *"San Francisco"*) |
160
- | `OVERPASS_API_URL` | auto | Custom Overpass endpoint. By default, rotates between `overpass-api.de` and `kumi.systems`. |
161
- | `MAX_H3_CELLS` | `50000` | Safety cap for H3 grid generation |
162
-
163
- *Or install globally: `npm install -g bbox-mcp-server`*
164
-
165
- ---
166
-
167
- ## Tool Reference
168
-
169
- ### `get_bounds`
170
-
171
- 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.
172
-
173
- | Param | Type | Default | Description |
174
- |---|---|---|---|
175
- | `bbox` | string | β€” | Input geometry (coordinates, WKT, GeoJSON, ogrinfo extent) |
176
- | `epsg` | string | `"4326"` | Target projection. Unknown codes auto-fetched from epsg.io. |
177
- | `format` | string | `"csv"` | Output: `csv`, `wkt`, `geojson-bbox`, `geojson-polygon`, `leaflet`, `overpass`, `ogc-bbox`, `kml`, `stac-bbox` |
178
- | `coord_order` | string | `"lng,lat"` | Swap to `"lat,lng"` for APIs that expect latitude first |
179
- | `zoom` | number | `15` | Zoom level for tile coordinate calculation |
180
- | `precision` | number | `6` | Decimal places in formatted output |
181
-
182
- **πŸ’‘ Prompt:** *"Get the bounding box for Central Park in WKT format projected to EPSG:32618"*
183
-
184
- ---
185
-
186
- ### `get_h3_indices`
187
-
188
- Generate Uber H3 hexagonal cell indices covering a bounding box.
189
32
 
190
- | Param | Type | Default | Description |
191
- |---|---|---|---|
192
- | `bbox` | string | β€” | Input geometry |
193
- | `resolution` | number | β€” | H3 resolution (0–15) |
194
- | `compact` | boolean | `false` | Merge cells into coarser parents where possible |
195
- | `return_geometry` | boolean | `false` | Include GeoJSON hex boundaries |
196
-
197
- **πŸ’‘ Prompt:** *"Give me H3 cells at resolution 7 for downtown Chicago, include the hex geometries"*
198
-
199
- ---
200
-
201
- ### `search_overpass`
202
-
203
- 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.
204
-
205
- | Param | Type | Default | Description |
206
- |---|---|---|---|
207
- | `bbox` | string | β€” | Input geometry |
208
- | `query` | string | β€” | Overpass QL (e.g. `nwr["amenity"="cafe"]`). The server wraps it in the appropriate spatial filter automatically. |
209
- | `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. |
210
- | `limit` | number | `100` | Max elements returned |
211
-
212
- **πŸ’‘ Prompt:** *"Find all parking within 2km of JFK airport"*
213
-
214
- **πŸ’‘ Prompt:** *"Search for hospitals in Manhattan, limit 50"*
215
-
216
- ---
217
-
218
- ### `list_osm_tags`
219
-
220
- Look up the correct OpenStreetMap tags for a category before writing an Overpass query.
221
-
222
- | Param | Type | Description |
223
- |---|---|---|
224
- | `category` | string | Broad category (e.g. `"food"`, `"health"`, `"transport"`) |
225
-
226
- **πŸ’‘ Prompt:** *"What are the correct OSM tags for supermarkets?"*
227
-
228
- ---
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` |
229
39
 
230
- ### `aggregate_overpass_h3`
40
+ ## Tools
231
41
 
232
- Run an Overpass query and bin results into H3 hexagons for spatial density analysis. Returns counts per cell and GeoJSON hex boundaries.
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. |
233
54
 
234
- | Param | Type | Default | Description |
235
- |---|---|---|---|
236
- | `bbox` | string | β€” | Input geometry |
237
- | `query` | string | β€” | Overpass QL core query |
238
- | `resolution` | number | `8` | H3 resolution for binning |
55
+ Your MCP client discovers each tool's full parameter and output schemas automatically. H3 tools use `resolution` (0–15).
239
56
 
240
- **πŸ’‘ Prompt:** *"Aggregate all hospitals in Seattle into H3 bins at resolution 7"*
57
+ ## Inputs and outputs
241
58
 
242
- ---
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.
243
60
 
244
- ### `generate_share_url`
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.
245
62
 
246
- Generate a shareable link to visualize a bounding box on the interactive map at vibhorsingh.com/boundingbox.
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`.
247
64
 
248
- | Param | Type | Description |
249
- |---|---|---|
250
- | `bbox` | string | Input geometry |
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.
251
66
 
252
- **πŸ’‘ Prompt:** *"Generate a share link for bbox 40.7128,-74.0060,40.7580,-73.9855"*
67
+ ## Configuration
253
68
 
254
- ---
69
+ Place search uses Nominatim with Photon fallback; a Mapbox token is optional. Defaults work without configuration.
255
70
 
256
- ## Supported Input Formats
71
+ <details>
72
+ <summary>Optional environment variables</summary>
257
73
 
258
- All tools auto-detect the input format. No need to specify which one you're using.
74
+ Add an `env` object alongside `command` and `args` in your server configuration.
259
75
 
260
- | Format | Example |
76
+ | Variable | Purpose / default |
261
77
  |---|---|
262
- | Raw coordinates | `40.7128,-74.0060,40.7580,-73.9855` |
263
- | WKT | `POLYGON((-74.006 40.712, -73.985 40.712, ...))` |
264
- | GeoJSON | `{"type":"Feature","geometry":{...}}` |
265
- | GeoJSON bbox | `{"bbox":[-74.006,40.712,-73.985,40.758]}` |
266
- | ogrinfo extent | `Extent: (-74.006, 40.712) - (-73.985, 40.758)` |
267
- | Space-separated | `40.7128 -74.0060 40.7580 -73.9855` |
268
-
269
- ---
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`. |
270
87
 
271
- ## πŸ€– For AI Agent Developers
272
-
273
- ### Response structure
88
+ </details>
274
89
 
275
- Every tool returns two content blocks:
90
+ ## For developers
276
91
 
277
- 1. **Human-readable text** β€” formatted output with the map verification link
278
- 2. **Structured JSON** β€” all computed data, machine-parseable
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.
279
93
 
280
- Example `get_bounds` JSON response:
94
+ To run from source:
281
95
 
282
- ```json
283
- {
284
- "original_wgs84": { "lat1": 40.7128, "lng1": -74.006, "lat2": 40.758, "lng2": -73.9855 },
285
- "projected": { "xmin": -8238310.23, "ymin": 4970241.32, "xmax": -8235527.11, "ymax": 4976491.56 },
286
- "center": { "lat": 40.7354, "lng": -73.99575 },
287
- "tile_indices": { "z": 15, "x": 9660, "y": 12284 },
288
- "epsg": "3857",
289
- "coord_order": "lng,lat",
290
- "area_km2": 8.681,
291
- "dimensions": { "width_km": 1.714, "height_km": 5.066 },
292
- "share_url": "https://vibhorsingh.com/boundingbox/#40.712800,-74.006000,40.758000,-73.985500"
293
- }
96
+ ```sh
97
+ npm install
98
+ npm test
99
+ npm start
294
100
  ```
295
101
 
102
+ `npm test` builds the server and runs the test suite.
296
103
 
297
- ### Error handling
298
-
299
- 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.
300
-
301
- ### Logging
302
-
303
- Structured JSON logs go to **stderr** (stdout is reserved for MCP protocol). Each entry includes timestamp, level, and context.
304
-
305
- ---
306
- ## Acknowledgments & Fair Use
307
-
308
- ### OpenStreetMap
309
-
310
- 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).
311
-
312
- ### Responsible Usage
104
+ ## Data and service use
313
105
 
314
- The public Overpass API instances are free community resources with limited capacity. Avoid tight loops, excessive polling, or bulk-scraping. For heavy workloads, set `OVERPASS_API_URL` to your own instance, see [Overpass API installation](https://wiki.openstreetmap.org/wiki/Overpass_API/Installation). The default server rotation helps spread load, but it's not a substitute for responsible usage.
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.
315
107
 
316
- ---
317
- ## License
318
- MIT
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.
319
111
 
320
- [![MCP Badge](https://lobehub.com/badge/mcp-full/iamvibhorsingh-bbox-mcp-server)](https://lobehub.com/mcp/iamvibhorsingh-bbox-mcp-server)
112
+ [MIT License](./LICENSE)