@shyzus/mcp-geocrafter 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 +51 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# πΊοΈ GeoCrafter - Geocoding Server
|
|
1
|
+
# πΊοΈ GeoCrafter - Multi-Provider Geocoding MCP Server
|
|
2
2
|
|
|
3
|
-
GeoCrafter is a clean, modular MCP server for geocoding and reverse geocoding -
|
|
3
|
+
GeoCrafter is a clean, modular MCP server for geocoding and reverse geocoding with **multi-provider support** β Google Geocoding API and Photon API (OpenStreetMap). The LLM intelligently picks the best provider per query, or the user can force one.
|
|
4
4
|
|
|
5
5
|
[](https://github.com/Shyzkanza/mcp-location/actions/workflows/ci.yml)
|
|
6
6
|
[](https://github.com/Shyzkanza/mcp-location/actions/workflows/release.yml)
|
|
@@ -18,13 +18,12 @@ GeoCrafter is a clean, modular MCP server for geocoding and reverse geocoding -
|
|
|
18
18
|
|
|
19
19
|
**This project is independent and unofficial.**
|
|
20
20
|
|
|
21
|
-
- β **Not affiliated** with OpenStreetMap, Photon or Komoot
|
|
21
|
+
- β **Not affiliated** with Google, OpenStreetMap, Photon or Komoot
|
|
22
22
|
- β **Not sponsored** by these organizations
|
|
23
|
+
- β
Uses [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding) (10k free requests/month)
|
|
23
24
|
- β
Uses **public data** from the [Photon API](https://photon.komoot.io/) (OpenStreetMap)
|
|
24
25
|
- β
Educational and practical purpose project
|
|
25
26
|
|
|
26
|
-
Geocoding data comes from the Photon API (by Komoot), which uses OpenStreetMap data with Elasticsearch-powered fuzzy matching.
|
|
27
|
-
|
|
28
27
|
---
|
|
29
28
|
|
|
30
29
|
## π― What is it?
|
|
@@ -33,14 +32,24 @@ This application allows **ChatGPT** and other MCP clients to access geocoding se
|
|
|
33
32
|
|
|
34
33
|
### β¨ Features
|
|
35
34
|
|
|
36
|
-
- π **Address to GPS** - Convert addresses to coordinates
|
|
35
|
+
- π **Address to GPS** - Convert addresses to coordinates with multi-provider support
|
|
37
36
|
- π **GPS to Address** - Convert coordinates to addresses
|
|
37
|
+
- π **Multi-Provider** - Google Geocoding API + Photon API (OpenStreetMap), selectable per request
|
|
38
38
|
- π **Geohash Encoding/Decoding** - Convert coordinates to geohash strings for location deduplication
|
|
39
39
|
- π **Distance Calculation** - Haversine formula to compute exact distance between two GPS points
|
|
40
40
|
- ποΈ **Modular Architecture** - Clean separation of concerns, reusable for future MCP servers
|
|
41
41
|
- π **Dual Mode** - Works with ChatGPT (HTTP) and IDEs (stdio)
|
|
42
42
|
- πΊοΈ **GeoJSON Map Viewer** - Render interactive maps inside ChatGPT with fullscreen controls (Apps SDK)
|
|
43
43
|
|
|
44
|
+
### π Providers
|
|
45
|
+
|
|
46
|
+
| Provider | Best for | Limitations |
|
|
47
|
+
|----------|----------|-------------|
|
|
48
|
+
| **Google** (recommended) | POIs, businesses, intent-based queries ("gare ales france") | Requires API key, 10k free/month |
|
|
49
|
+
| **Photon** | Typo-tolerant search on place/street names, no API key needed | Less accurate on POI resolution |
|
|
50
|
+
|
|
51
|
+
The LLM automatically picks the best provider based on query type, or the user can force one (e.g. "use Google", "use Photon").
|
|
52
|
+
|
|
44
53
|
### π¬ Usage examples
|
|
45
54
|
|
|
46
55
|
In ChatGPT or your IDE, simply ask:
|
|
@@ -68,15 +77,19 @@ The LLM will use the MCP server to get the information.
|
|
|
68
77
|
### How does it work?
|
|
69
78
|
|
|
70
79
|
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
β
|
|
74
|
-
|
|
80
|
+
ββββββββββββββββ
|
|
81
|
+
ββββββΊ β Google β
|
|
82
|
+
βββββββββββββββ ββββββββββββββββ β β Geocoding β
|
|
83
|
+
β ChatGPT β βββββββΊ β MCP Server β βββ€ ββββββββββββββββ
|
|
84
|
+
β / IDE β MCP β (Node.js) β β ββββββββββββββββ
|
|
85
|
+
βββββββββββββββ ββββββββββββββββ ββββββΊ β Photon β
|
|
86
|
+
β API (OSM) β
|
|
87
|
+
ββββββββββββββββ
|
|
75
88
|
```
|
|
76
89
|
|
|
77
|
-
1. **ChatGPT** calls your MCP server via the [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
78
|
-
2. **The MCP server**
|
|
79
|
-
3. **The results** are returned
|
|
90
|
+
1. **ChatGPT/IDE** calls your MCP server via the [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
91
|
+
2. **The MCP server** routes the request to the selected geocoding provider (Google or Photon)
|
|
92
|
+
3. **The results** are returned in a unified format
|
|
80
93
|
|
|
81
94
|
### MCP Protocol
|
|
82
95
|
|
|
@@ -99,12 +112,18 @@ MCP (Model Context Protocol) is an open standard created by Anthropic that allow
|
|
|
99
112
|
"mcpServers": {
|
|
100
113
|
"mcp-geocrafter": {
|
|
101
114
|
"command": "npx",
|
|
102
|
-
"args": ["-y", "@shyzus/mcp-geocrafter"]
|
|
115
|
+
"args": ["-y", "@shyzus/mcp-geocrafter"],
|
|
116
|
+
"env": {
|
|
117
|
+
"GOOGLE_API_KEY": "your-google-api-key",
|
|
118
|
+
"GEOCODING_PROVIDER": "google"
|
|
119
|
+
}
|
|
103
120
|
}
|
|
104
121
|
}
|
|
105
122
|
}
|
|
106
123
|
```
|
|
107
124
|
|
|
125
|
+
> `GOOGLE_API_KEY` enables the Google provider. `GEOCODING_PROVIDER` sets the default (optional, defaults to `photon` if omitted). The LLM can override the provider per request.
|
|
126
|
+
|
|
108
127
|
**Config file locations:**
|
|
109
128
|
- **Cursor**: `~/.cursor/mcp.json` (macOS/Linux) or `%APPDATA%\Cursor\mcp.json` (Windows)
|
|
110
129
|
- **Claude Desktop**: `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
@@ -176,7 +195,8 @@ npm test
|
|
|
176
195
|
npm run test:watch
|
|
177
196
|
```
|
|
178
197
|
|
|
179
|
-
|
|
198
|
+
113 tests across 7 suites:
|
|
199
|
+
- `googleClient.test.ts` β Google Geocoding API client, mapping, error handling (23 tests)
|
|
180
200
|
- `errors.test.ts` β Error classes, formatting, network detection (17 tests)
|
|
181
201
|
- `config.test.ts` β Environment variables, validation, singleton (20 tests)
|
|
182
202
|
- `displayGeoJsonMap.test.ts` β GeoJSON parsing, viewport, colors, output (26 tests)
|
|
@@ -361,7 +381,12 @@ mcp-location/
|
|
|
361
381
|
β βββ __tests__/
|
|
362
382
|
β β βββ config.test.ts # Tests config
|
|
363
383
|
β βββ client/
|
|
364
|
-
β β
|
|
384
|
+
β β βββ types.ts # GeocodingProvider interface
|
|
385
|
+
β β βββ index.ts # Provider factory/registry
|
|
386
|
+
β β βββ googleClient.ts # Google Geocoding API client
|
|
387
|
+
β β βββ photonClient.ts # Photon API client (OSM fuzzy matching)
|
|
388
|
+
β β βββ __tests__/
|
|
389
|
+
β β βββ googleClient.test.ts
|
|
365
390
|
β βββ tools/
|
|
366
391
|
β β βββ searchAddress.ts # Tool: adresse β GPS
|
|
367
392
|
β β βββ reverseGeocode.ts # Tool: GPS β adresse
|
|
@@ -451,16 +476,18 @@ Create a `.env` file:
|
|
|
451
476
|
```bash
|
|
452
477
|
PORT=3000 # HTTP server port
|
|
453
478
|
NODE_ENV=production # Environment
|
|
479
|
+
GEOCODING_PROVIDER=google # Default provider: "photon" (default) or "google"
|
|
480
|
+
GOOGLE_API_KEY=AIzaSy... # Required for Google provider (10k free requests/month)
|
|
454
481
|
PHOTON_BASE_URL=https://photon.komoot.io # Optional (default: Komoot's public instance)
|
|
455
482
|
USER_AGENT=MyApp/1.0 # Optional
|
|
456
483
|
CORS_ORIGIN=* # CORS origin (default: * in dev, https://chatgpt.com in prod)
|
|
457
484
|
```
|
|
458
485
|
|
|
459
|
-
###
|
|
486
|
+
### Providers configuration
|
|
460
487
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
488
|
+
- **Google**: Set `GOOGLE_API_KEY` to enable. Get a key from [Google Cloud Console](https://console.cloud.google.com) β APIs & Services β Credentials. Enable "Geocoding API" first.
|
|
489
|
+
- **Photon**: Always available, no configuration needed. You can optionally self-host (set `PHOTON_BASE_URL`).
|
|
490
|
+
- The `provider` parameter on `search_address` and `reverse_geocode` tools lets the LLM override the default per request.
|
|
464
491
|
|
|
465
492
|
---
|
|
466
493
|
|
|
@@ -472,7 +499,7 @@ This project serves as a **template/base** for future MCP servers with a clean,
|
|
|
472
499
|
|
|
473
500
|
- **`config.ts`**: Environment variables, constants, validation
|
|
474
501
|
- **`types.ts`**: Shared TypeScript interfaces
|
|
475
|
-
- **`client/`**: External API abstraction (Photon)
|
|
502
|
+
- **`client/`**: External API abstraction (Google, Photon) with provider interface + factory
|
|
476
503
|
- **`tools/`**: Business logic (validation, transformation, formatting)
|
|
477
504
|
- **`servers/`**: MCP implementation (stdio/Streamable HTTP), reuses tools
|
|
478
505
|
- **`utils/`**: Custom error classes, geohash encode/decode, Haversine distance (zero dependencies)
|
|
@@ -578,13 +605,14 @@ MIT - Use freely for your personal or commercial projects.
|
|
|
578
605
|
|
|
579
606
|
## π Credits & Attributions
|
|
580
607
|
|
|
581
|
-
- **Geocoding Data** - [Photon API](https://photon.komoot.io/) by [Komoot](https://www.komoot.com/)
|
|
608
|
+
- **Geocoding Data** - [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding) and [Photon API](https://photon.komoot.io/) by [Komoot](https://www.komoot.com/) (OpenStreetMap data)
|
|
582
609
|
- **MCP Protocol** - [Anthropic](https://www.anthropic.com/)
|
|
583
610
|
- **Apps SDK** - [OpenAI](https://openai.com/)
|
|
584
611
|
|
|
585
612
|
### Data & Licenses
|
|
586
613
|
|
|
587
|
-
|
|
614
|
+
- Google Geocoding data is provided under [Google Maps Platform Terms of Service](https://cloud.google.com/maps-platform/terms)
|
|
615
|
+
- Photon/OpenStreetMap data is provided under the Open Database License (ODbL)
|
|
588
616
|
|
|
589
617
|
---
|
|
590
618
|
|
package/package.json
CHANGED