bbox-mcp-server 1.2.5 → 1.3.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 +320 -274
- package/dist/index.js +18 -7
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -1,274 +1,320 @@
|
|
|
1
|
-
# 🌍 bbox-mcp-server
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
|
160
|
-
|
|
161
|
-
| `
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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
|
+
[](https://nodejs.org/) [](./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
|
+
}
|
|
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
|
+
|
|
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
|
+
---
|
|
229
|
+
|
|
230
|
+
### `aggregate_overpass_h3`
|
|
231
|
+
|
|
232
|
+
Run an Overpass query and bin results into H3 hexagons for spatial density analysis. Returns counts per cell and GeoJSON hex boundaries.
|
|
233
|
+
|
|
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 |
|
|
239
|
+
|
|
240
|
+
**💡 Prompt:** *"Aggregate all hospitals in Seattle into H3 bins at resolution 7"*
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
### `generate_share_url`
|
|
245
|
+
|
|
246
|
+
Generate a shareable link to visualize a bounding box on the interactive map at vibhorsingh.com/boundingbox.
|
|
247
|
+
|
|
248
|
+
| Param | Type | Description |
|
|
249
|
+
|---|---|---|
|
|
250
|
+
| `bbox` | string | Input geometry |
|
|
251
|
+
|
|
252
|
+
**💡 Prompt:** *"Generate a share link for bbox 40.7128,-74.0060,40.7580,-73.9855"*
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Supported Input Formats
|
|
257
|
+
|
|
258
|
+
All tools auto-detect the input format. No need to specify which one you're using.
|
|
259
|
+
|
|
260
|
+
| Format | Example |
|
|
261
|
+
|---|---|
|
|
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
|
+
---
|
|
270
|
+
|
|
271
|
+
## 🤖 For AI Agent Developers
|
|
272
|
+
|
|
273
|
+
### Response structure
|
|
274
|
+
|
|
275
|
+
Every tool returns two content blocks:
|
|
276
|
+
|
|
277
|
+
1. **Human-readable text** — formatted output with the map verification link
|
|
278
|
+
2. **Structured JSON** — all computed data, machine-parseable
|
|
279
|
+
|
|
280
|
+
Example `get_bounds` JSON response:
|
|
281
|
+
|
|
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
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
|
|
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
|
|
313
|
+
|
|
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.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
## License
|
|
318
|
+
MIT
|
|
319
|
+
|
|
320
|
+
[](https://lobehub.com/mcp/iamvibhorsingh-bbox-mcp-server)
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import proj4 from "proj4";
|
|
|
7
7
|
import proj4defs from "./proj4defs.json" with { type: "json" };
|
|
8
8
|
import { wktToGeoJSON as parseWKT } from "@terraformer/wkt";
|
|
9
9
|
const SERVER_NAME = "bbox-mcp-server";
|
|
10
|
-
const SERVER_VERSION = "1.2.
|
|
10
|
+
const SERVER_VERSION = "1.2.6";
|
|
11
11
|
const MAX_H3_CELLS = process.env.MAX_H3_CELLS ? parseInt(process.env.MAX_H3_CELLS, 10) : 50000;
|
|
12
12
|
const MAPBOX_ACCESS_TOKEN = process.env.MAPBOX_ACCESS_TOKEN;
|
|
13
13
|
const MAX_INPUT_LENGTH = 1_000_000; // 1 MB input size guard
|
|
@@ -619,6 +619,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
619
619
|
limit: {
|
|
620
620
|
type: "number",
|
|
621
621
|
description: "Maximum number of elements to return. Default is 100. Increase if you need more results."
|
|
622
|
+
},
|
|
623
|
+
return_geometry: {
|
|
624
|
+
type: "boolean",
|
|
625
|
+
description: "If true, returns the full geometry (polygon/polyline) for ways and relations instead of just the center point. Necessary for area or length calculations. Defaults to false."
|
|
622
626
|
}
|
|
623
627
|
},
|
|
624
628
|
required: ["query"],
|
|
@@ -843,6 +847,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
843
847
|
const queryRaw = args.query;
|
|
844
848
|
const limit = args.limit || 100;
|
|
845
849
|
const radiusMeters = args.radius_meters;
|
|
850
|
+
const returnGeometry = args.return_geometry || false;
|
|
846
851
|
const useCircle = typeof radiusMeters === 'number' && radiusMeters > 0;
|
|
847
852
|
if (!queryRaw) {
|
|
848
853
|
return { content: [{ type: "text", text: "Error: 'query' is required (e.g. `node[\"amenity\"=\"restaurant\"]`)." }], isError: true };
|
|
@@ -881,7 +886,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
881
886
|
else {
|
|
882
887
|
return { content: [{ type: "text", text: "Error: Either 'location' or 'bbox' argument must be provided." }], isError: true };
|
|
883
888
|
}
|
|
884
|
-
|
|
889
|
+
const outDirective = returnGeometry ? "out geom;" : "out center;";
|
|
890
|
+
overpassQuery = `[out:json][timeout:25];\n(${queryRaw}(around:${radiusMeters},${centerPoint.lat},${centerPoint.lng}););\n${outDirective}`;
|
|
885
891
|
searchModeLabel = `circle — ${radiusMeters}m radius around (${centerPoint.lat.toFixed(5)}, ${centerPoint.lng.toFixed(5)})`;
|
|
886
892
|
}
|
|
887
893
|
else {
|
|
@@ -906,7 +912,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
906
912
|
else {
|
|
907
913
|
return { content: [{ type: "text", text: "Error: Either 'location' or 'bbox' argument must be provided." }], isError: true };
|
|
908
914
|
}
|
|
909
|
-
|
|
915
|
+
const outDirective = returnGeometry ? "out geom;" : "out center;";
|
|
916
|
+
overpassQuery = `[out:json][timeout:25][bbox:${bboxObj.lat1},${bboxObj.lng1},${bboxObj.lat2},${bboxObj.lng2}];\n(${queryRaw};);\n${outDirective}`;
|
|
910
917
|
searchModeLabel = `bounding box`;
|
|
911
918
|
}
|
|
912
919
|
log('info', `search_overpass starting`, { query: queryRaw, mode: useCircle ? 'circle' : 'bbox', radius_meters: radiusMeters });
|
|
@@ -961,16 +968,20 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
961
968
|
if (seenIds.has(e.id))
|
|
962
969
|
return acc;
|
|
963
970
|
seenIds.add(e.id);
|
|
964
|
-
const lat = e.lat ?? e.center?.lat;
|
|
965
|
-
const lon = e.lon ?? e.center?.lon;
|
|
971
|
+
const lat = e.lat ?? e.center?.lat ?? e.geometry?.[0]?.lat;
|
|
972
|
+
const lon = e.lon ?? e.center?.lon ?? e.geometry?.[0]?.lon;
|
|
966
973
|
if (lat !== undefined && lon !== undefined) {
|
|
967
|
-
|
|
974
|
+
const el = {
|
|
968
975
|
id: e.id,
|
|
969
976
|
type: e.type,
|
|
970
977
|
name: e.tags?.name || "Unnamed",
|
|
971
978
|
coordinates: { lat, lon },
|
|
972
979
|
tags: e.tags || {}
|
|
973
|
-
}
|
|
980
|
+
};
|
|
981
|
+
if (returnGeometry && e.geometry) {
|
|
982
|
+
el.geometry = e.geometry;
|
|
983
|
+
}
|
|
984
|
+
acc.push(el);
|
|
974
985
|
}
|
|
975
986
|
return acc;
|
|
976
987
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bbox-mcp-server",
|
|
3
3
|
"mcpName": "io.github.iamvibhorsingh/bbox-mcp-server",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "1.3.0",
|
|
5
|
+
"description": "The geospatial toolkit for AI agents — query, convert, and verify spatial data with zero config. 6 tools for bounding boxes, coordinate projection, H3 indexing, OpenStreetMap queries, and shareable map verification links.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "Vibhor Singh",
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
"model-context-protocol",
|
|
18
18
|
"bounding-box",
|
|
19
19
|
"bbox",
|
|
20
|
+
"location",
|
|
21
|
+
"maps",
|
|
22
|
+
"spatial",
|
|
23
|
+
"geocoding",
|
|
24
|
+
"ai-agents",
|
|
25
|
+
"verification",
|
|
20
26
|
"gis",
|
|
21
27
|
"geospatial",
|
|
22
28
|
"coordinates",
|