bbox-mcp-server 1.1.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/LICENSE +21 -0
- package/README.md +221 -0
- package/dist/index.js +692 -0
- package/dist/proj4defs.json +3911 -0
- package/package.json +59 -0
- package/proj4defs.json +3911 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vibhor Singh
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# bbox-mcp-server
|
|
2
|
+
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io/) server that gives AI agents geospatial superpowers — coordinate conversion, EPSG projections, H3 indexing, and shareable map links.
|
|
4
|
+
|
|
5
|
+
Every response includes a link to [vibhorsingh.com/boundingbox](https://vibhorsingh.com/boundingbox/) so you can visually verify results on an interactive map.
|
|
6
|
+
|
|
7
|
+
[](https://nodejs.org/) [](./LICENSE)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why use this?
|
|
12
|
+
|
|
13
|
+
- **Parse any coordinate format** — raw coords, WKT, GeoJSON, or `ogrinfo` output
|
|
14
|
+
- **Project to 3900+ coordinate systems** — unknown codes auto-fetched from [epsg.io](https://epsg.io)
|
|
15
|
+
- **Generate H3 hex grids** — cell IDs + optional GeoJSON boundaries
|
|
16
|
+
- **Visual verification** — every response links to the [Bounding Box tool](https://vibhorsingh.com/boundingbox/) with coords pre-loaded
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
Add the server to your MCP client config — **no install, no API keys required**.
|
|
23
|
+
|
|
24
|
+
### Claude Desktop
|
|
25
|
+
|
|
26
|
+
Add to `claude_desktop_config.json`:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"bbox": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "bbox-mcp-server"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Cursor
|
|
40
|
+
|
|
41
|
+
Add to `.cursor/mcp.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"bbox": {
|
|
47
|
+
"command": "npx",
|
|
48
|
+
"args": ["-y", "bbox-mcp-server"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Windsurf
|
|
55
|
+
|
|
56
|
+
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"mcpServers": {
|
|
61
|
+
"bbox": {
|
|
62
|
+
"command": "npx",
|
|
63
|
+
"args": ["-y", "bbox-mcp-server"]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### VS Code
|
|
70
|
+
|
|
71
|
+
Add to `.vscode/mcp.json` in your workspace (requires [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)):
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"servers": {
|
|
76
|
+
"bbox": {
|
|
77
|
+
"command": "npx",
|
|
78
|
+
"args": ["-y", "bbox-mcp-server"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
That's it — start prompting. Try: *"Get the bounding box for Central Park in WKT format"*
|
|
85
|
+
|
|
86
|
+
### Optional: enable location search
|
|
87
|
+
|
|
88
|
+
By default, you pass coordinates directly via the `bbox` parameter. To enable natural-language location search (e.g. *"San Francisco"*), add a [Mapbox access token](https://account.mapbox.com/access-tokens/):
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
"bbox": {
|
|
94
|
+
"command": "npx",
|
|
95
|
+
"args": ["-y", "bbox-mcp-server"],
|
|
96
|
+
"env": {
|
|
97
|
+
"MAPBOX_ACCESS_TOKEN": "pk.your-token-here"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Other options
|
|
105
|
+
|
|
106
|
+
| Variable | Default | Description |
|
|
107
|
+
|---|---|---|
|
|
108
|
+
| `MAX_H3_CELLS` | `50000` | Safety cap for H3 grid generation at high resolutions |
|
|
109
|
+
|
|
110
|
+
### Install globally (alternative to npx)
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install -g bbox-mcp-server
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Then use `"command": "bbox-mcp-server"` instead of the npx command in any of the configs above.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Tools
|
|
121
|
+
|
|
122
|
+
### `get_bounds`
|
|
123
|
+
|
|
124
|
+
Convert and project a bounding box across formats and coordinate systems.
|
|
125
|
+
|
|
126
|
+
**Input** (one of `location` or `bbox` required):
|
|
127
|
+
|
|
128
|
+
| Param | Type | Description |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| `location` | string | Text search (e.g. `"San Francisco"`). Requires `MAPBOX_ACCESS_TOKEN`. |
|
|
131
|
+
| `bbox` | string | Any parseable geometry — `"lat1,lng1,lat2,lng2"`, WKT, GeoJSON, or ogrinfo extent. |
|
|
132
|
+
| `epsg` | string | Target EPSG code (default `"4326"`). Unknown codes auto-fetched from epsg.io. |
|
|
133
|
+
| `format` | string | Output format: `csv`, `wkt`, `geojson-bbox`, `geojson-polygon`, `leaflet`, `overpass`, `ogc-bbox`, `kml`, `stac-bbox` |
|
|
134
|
+
| `precision` | number | Decimal places (default `6`) |
|
|
135
|
+
|
|
136
|
+
**Example prompt:** *"Get the bounding box for Central Park in WKT format projected to EPSG:32618"*
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### `get_h3_indices`
|
|
141
|
+
|
|
142
|
+
Generate Uber H3 hexagonal cell indices covering a bounding box.
|
|
143
|
+
|
|
144
|
+
**Input** (one of `location` or `bbox` required):
|
|
145
|
+
|
|
146
|
+
| Param | Type | Description |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| `location` | string | Text search. Requires `MAPBOX_ACCESS_TOKEN`. |
|
|
149
|
+
| `bbox` | string | Any parseable geometry. |
|
|
150
|
+
| `resolution` | number | **Required.** H3 resolution `0`–`15`. |
|
|
151
|
+
| `compact` | boolean | Compact mixed-resolution output (default `false`) |
|
|
152
|
+
| `return_geometry` | boolean | Include GeoJSON hex boundaries (default `false`) |
|
|
153
|
+
|
|
154
|
+
**Example prompt:** *"Give me H3 cells at resolution 7 for downtown Chicago, include the hex geometries"*
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### `generate_share_url`
|
|
159
|
+
|
|
160
|
+
Generate a shareable link to visualize a bounding box on the interactive map tool.
|
|
161
|
+
|
|
162
|
+
| Param | Type | Description |
|
|
163
|
+
|---|---|---|
|
|
164
|
+
| `bbox` | string | **Required.** Any parseable geometry. |
|
|
165
|
+
|
|
166
|
+
**Example prompt:** *"Generate a share link for bbox 40.7128,-74.0060,40.7580,-73.9855"*
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Supported Input Formats
|
|
171
|
+
|
|
172
|
+
All tools accept these formats through the `bbox` parameter:
|
|
173
|
+
|
|
174
|
+
| Format | Example |
|
|
175
|
+
|---|---|
|
|
176
|
+
| **Raw coordinates** | `40.7128,-74.0060,40.7580,-73.9855` |
|
|
177
|
+
| **WKT** | `POLYGON((-74.006 40.712, -73.985 40.712, ...))` |
|
|
178
|
+
| **GeoJSON** | `{"type":"Feature","geometry":{...}}` |
|
|
179
|
+
| **GeoJSON bbox** | `{"bbox":[-74.006,40.712,-73.985,40.758]}` |
|
|
180
|
+
| **ogrinfo extent** | `Extent: (-74.006, 40.712) - (-73.985, 40.758)` |
|
|
181
|
+
| **Space-separated (GDAL)** | `40.7128 -74.0060 40.7580 -73.9855` |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## For AI Agent Developers
|
|
186
|
+
|
|
187
|
+
### What agents get back
|
|
188
|
+
|
|
189
|
+
Every tool response includes two content blocks:
|
|
190
|
+
|
|
191
|
+
1. **Human-readable text** — formatted for display, includes the map link
|
|
192
|
+
2. **Structured JSON** — machine-parseable with all computed data
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"original_wgs84": { "lat1": 40.7128, "lng1": -74.006, "lat2": 40.758, "lng2": -73.9855 },
|
|
197
|
+
"projected": { "xmin": -8238310.23, "ymin": 4970241.32, "xmax": -8235527.11, "ymax": 4976491.56 },
|
|
198
|
+
"epsg": "3857",
|
|
199
|
+
"area_km2": 8.681,
|
|
200
|
+
"dimensions": { "width_km": 1.714, "height_km": 5.066 },
|
|
201
|
+
"share_url": "https://vibhorsingh.com/boundingbox/#40.712800,-74.006000,40.758000,-73.985500"
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Verification pattern
|
|
206
|
+
|
|
207
|
+
The `share_url` in every response opens the visual BBox Finder tool with the exact coordinates pre-loaded. Agents can present this link to users for visual confirmation.
|
|
208
|
+
|
|
209
|
+
### Error handling
|
|
210
|
+
|
|
211
|
+
All errors return `isError: true` with a descriptive message. The server never crashes on bad input — invalid coordinates, unknown EPSG codes, and oversized H3 areas all return clean error responses.
|
|
212
|
+
|
|
213
|
+
### Logging
|
|
214
|
+
|
|
215
|
+
Structured JSON logs are written to **stderr** (not stdout, which is reserved for the MCP protocol). Each log entry includes timestamp, level, and context data.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
MIT
|