@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.
Files changed (2) hide show
  1. package/README.md +51 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # πŸ—ΊοΈ GeoCrafter - Geocoding Server for ChatGPT
1
+ # πŸ—ΊοΈ GeoCrafter - Multi-Provider Geocoding MCP Server
2
2
 
3
- GeoCrafter is a clean, modular MCP server for geocoding and reverse geocoding - Powered by Photon API (OpenStreetMap + Elasticsearch) with fuzzy matching support.
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
  [![CI](https://github.com/Shyzkanza/mcp-location/actions/workflows/ci.yml/badge.svg)](https://github.com/Shyzkanza/mcp-location/actions/workflows/ci.yml)
6
6
  [![Release](https://github.com/Shyzkanza/mcp-location/actions/workflows/release.yml/badge.svg)](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 (fuzzy matching)
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
- β”‚ ChatGPT β”‚ ◄─────► β”‚ MCP Server β”‚ ◄─────► β”‚ Photon β”‚
73
- β”‚ β”‚ HTTP β”‚ (Node.js) β”‚ HTTP β”‚ API β”‚
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** fetches data from the Photon API (OpenStreetMap + Elasticsearch)
79
- 3. **The results** are returned to ChatGPT
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
- 90 tests across 6 suites:
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
- β”‚ β”‚ └── photonClient.ts # Client API Photon (fuzzy matching)
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
- ### Customize the Photon API
486
+ ### Providers configuration
460
487
 
461
- The Photon API is public but you can:
462
- 1. Use a self-hosted Photon instance (set `PHOTON_BASE_URL`)
463
- 2. Set a custom User-Agent (set `USER_AGENT`)
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/) - OpenStreetMap data
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
- Geocoding data comes from the Photon API (by Komoot) which uses OpenStreetMap data. This data is provided under the Open Database License (ODbL).
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shyzus/mcp-geocrafter",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "GeoCrafter - MCP server for geocoding, reverse geocoding, geohash and distance calculation - Powered by Photon API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",