@shyzus/mcp-geocrafter 1.4.1 β†’ 1.5.1

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,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)
@@ -11,6 +11,8 @@ GeoCrafter is a clean, modular MCP server for geocoding and reverse geocoding -
11
11
  ![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue)
12
12
  ![MCP](https://img.shields.io/badge/MCP-2025--11--25-orange)
13
13
  ![ChatGPT](https://img.shields.io/badge/ChatGPT-MCP-purple)
14
+ ![Google](https://img.shields.io/badge/Google%20Geocoding-supported-4285F4)
15
+ ![Photon](https://img.shields.io/badge/Photon%20OSM-supported-7EB900)
14
16
 
15
17
  ---
16
18
 
@@ -18,13 +20,12 @@ GeoCrafter is a clean, modular MCP server for geocoding and reverse geocoding -
18
20
 
19
21
  **This project is independent and unofficial.**
20
22
 
21
- - ❌ **Not affiliated** with OpenStreetMap, Photon or Komoot
23
+ - ❌ **Not affiliated** with Google, OpenStreetMap, Photon or Komoot
22
24
  - ❌ **Not sponsored** by these organizations
25
+ - βœ… Uses [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding) (10k free requests/month)
23
26
  - βœ… Uses **public data** from the [Photon API](https://photon.komoot.io/) (OpenStreetMap)
24
27
  - βœ… Educational and practical purpose project
25
28
 
26
- Geocoding data comes from the Photon API (by Komoot), which uses OpenStreetMap data with Elasticsearch-powered fuzzy matching.
27
-
28
29
  ---
29
30
 
30
31
  ## 🎯 What is it?
@@ -33,14 +34,24 @@ This application allows **ChatGPT** and other MCP clients to access geocoding se
33
34
 
34
35
  ### ✨ Features
35
36
 
36
- - πŸ” **Address to GPS** - Convert addresses to coordinates (fuzzy matching)
37
+ - πŸ” **Address to GPS** - Convert addresses to coordinates with multi-provider support
37
38
  - πŸ“ **GPS to Address** - Convert coordinates to addresses
39
+ - πŸ”„ **Multi-Provider** - Google Geocoding API + Photon API (OpenStreetMap), selectable per request
38
40
  - πŸ”— **Geohash Encoding/Decoding** - Convert coordinates to geohash strings for location deduplication
39
41
  - πŸ“ **Distance Calculation** - Haversine formula to compute exact distance between two GPS points
40
42
  - πŸ—οΈ **Modular Architecture** - Clean separation of concerns, reusable for future MCP servers
41
43
  - πŸ”Œ **Dual Mode** - Works with ChatGPT (HTTP) and IDEs (stdio)
42
44
  - πŸ—ΊοΈ **GeoJSON Map Viewer** - Render interactive maps inside ChatGPT with fullscreen controls (Apps SDK)
43
45
 
46
+ ### πŸ”„ Providers
47
+
48
+ | Provider | Best for | Limitations |
49
+ |----------|----------|-------------|
50
+ | **Google** (recommended) | POIs, businesses, intent-based queries ("gare ales france") | Requires API key, 10k free/month |
51
+ | **Photon** | Typo-tolerant search on place/street names, no API key needed | Less accurate on POI resolution |
52
+
53
+ The LLM automatically picks the best provider based on query type, or the user can force one (e.g. "use Google", "use Photon").
54
+
44
55
  ### πŸ’¬ Usage examples
45
56
 
46
57
  In ChatGPT or your IDE, simply ask:
@@ -68,15 +79,19 @@ The LLM will use the MCP server to get the information.
68
79
  ### How does it work?
69
80
 
70
81
  ```
71
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
72
- β”‚ ChatGPT β”‚ ◄─────► β”‚ MCP Server β”‚ ◄─────► β”‚ Photon β”‚
73
- β”‚ β”‚ HTTP β”‚ (Node.js) β”‚ HTTP β”‚ API β”‚
74
- β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
82
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
83
+ β”Œβ”€β”€β”€β”€β–Ί β”‚ Google β”‚
84
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ Geocoding β”‚
85
+ β”‚ ChatGPT β”‚ ◄─────► β”‚ MCP Server β”‚ ◄── β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
86
+ β”‚ / IDE β”‚ MCP β”‚ (Node.js) β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
87
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ └────► β”‚ Photon β”‚
88
+ β”‚ API (OSM) β”‚
89
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
75
90
  ```
76
91
 
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
92
+ 1. **ChatGPT/IDE** calls your MCP server via the [Model Context Protocol](https://modelcontextprotocol.io/)
93
+ 2. **The MCP server** routes the request to the selected geocoding provider (Google or Photon)
94
+ 3. **The results** are returned in a unified format
80
95
 
81
96
  ### MCP Protocol
82
97
 
@@ -92,7 +107,7 @@ MCP (Model Context Protocol) is an open standard created by Anthropic that allow
92
107
 
93
108
  ### Use with Cursor / Claude Desktop / Warp
94
109
 
95
- **The easiest way** - Install the npm client that connects to the remote server:
110
+ **The easiest way** - Install the npm client that connects to the remote server (Google + Photon providers are both available server-side):
96
111
 
97
112
  ```json
98
113
  {
@@ -105,6 +120,8 @@ MCP (Model Context Protocol) is an open standard created by Anthropic that allow
105
120
  }
106
121
  ```
107
122
 
123
+ > This connects to the hosted server at `https://geocrafter.rankorr.red/mcp` which has both Google and Photon providers configured. The LLM picks the best provider per query, or the user can force one.
124
+
108
125
  **Config file locations:**
109
126
  - **Cursor**: `~/.cursor/mcp.json` (macOS/Linux) or `%APPDATA%\Cursor\mcp.json` (Windows)
110
127
  - **Claude Desktop**: `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
@@ -112,6 +129,26 @@ MCP (Model Context Protocol) is an open standard created by Anthropic that allow
112
129
 
113
130
  ---
114
131
 
132
+ ### Google API Key Setup
133
+
134
+ To use the Google provider, you need a Google API key. There are **two ways** to provide it:
135
+
136
+ **Option A β€” Server-side (env var):** Set `GOOGLE_API_KEY` on the server. All clients benefit automatically.
137
+
138
+ **Option B β€” Per-request (tool parameter):** Pass `apiKey` in the tool call. Useful for N8N, automation workflows, or when you don't control the server. The key is never logged or returned in responses.
139
+
140
+ **To get a key:**
141
+
142
+ 1. Go to [Google Cloud Console](https://console.cloud.google.com)
143
+ 2. Create or select a project
144
+ 3. **APIs & Services** β†’ **Library** β†’ search **"Geocoding API"** β†’ **Enable**
145
+ 4. **APIs & Services** β†’ **Credentials** β†’ **Create Credentials** β†’ **API Key**
146
+ 5. Copy the key
147
+
148
+ > **Pricing**: First 10,000 requests/month are **free**. Beyond that, ~4.34€/1k requests. [Details](https://developers.google.com/maps/documentation/geocoding/usage-and-billing)
149
+
150
+ ---
151
+
115
152
  ### Use with ChatGPT
116
153
 
117
154
  A production server is available and ready to use!
@@ -176,7 +213,8 @@ npm test
176
213
  npm run test:watch
177
214
  ```
178
215
 
179
- 90 tests across 6 suites:
216
+ 113 tests across 7 suites:
217
+ - `googleClient.test.ts` β€” Google Geocoding API client, mapping, error handling (23 tests)
180
218
  - `errors.test.ts` β€” Error classes, formatting, network detection (17 tests)
181
219
  - `config.test.ts` β€” Environment variables, validation, singleton (20 tests)
182
220
  - `displayGeoJsonMap.test.ts` β€” GeoJSON parsing, viewport, colors, output (26 tests)
@@ -276,6 +314,19 @@ The MCP server already works in Cursor! Ask me a question about locations and I'
276
314
 
277
315
  2. Configure in `~/Library/Application Support/Claude/claude_desktop_config.json`:
278
316
 
317
+ **Option A β€” Use the remote server (recommended, no API key needed):**
318
+ ```json
319
+ {
320
+ "mcpServers": {
321
+ "mcp-geocrafter": {
322
+ "command": "npx",
323
+ "args": ["-y", "@shyzus/mcp-geocrafter"]
324
+ }
325
+ }
326
+ }
327
+ ```
328
+
329
+ **Option B β€” Run locally with your own Google API key:**
279
330
  ```json
280
331
  {
281
332
  "mcpServers": {
@@ -283,7 +334,11 @@ The MCP server already works in Cursor! Ask me a question about locations and I'
283
334
  "command": "node",
284
335
  "args": [
285
336
  "/absolute/path/to/mcp-location/dist/index.js"
286
- ]
337
+ ],
338
+ "env": {
339
+ "GOOGLE_API_KEY": "your-google-api-key",
340
+ "GEOCODING_PROVIDER": "google"
341
+ }
287
342
  }
288
343
  }
289
344
  }
@@ -361,7 +416,12 @@ mcp-location/
361
416
  β”‚ β”œβ”€β”€ __tests__/
362
417
  β”‚ β”‚ └── config.test.ts # Tests config
363
418
  β”‚ β”œβ”€β”€ client/
364
- β”‚ β”‚ └── photonClient.ts # Client API Photon (fuzzy matching)
419
+ β”‚ β”‚ β”œβ”€β”€ types.ts # GeocodingProvider interface
420
+ β”‚ β”‚ β”œβ”€β”€ index.ts # Provider factory/registry
421
+ β”‚ β”‚ β”œβ”€β”€ googleClient.ts # Google Geocoding API client
422
+ β”‚ β”‚ β”œβ”€β”€ photonClient.ts # Photon API client (OSM fuzzy matching)
423
+ β”‚ β”‚ └── __tests__/
424
+ β”‚ β”‚ └── googleClient.test.ts
365
425
  β”‚ β”œβ”€β”€ tools/
366
426
  β”‚ β”‚ β”œβ”€β”€ searchAddress.ts # Tool: adresse β†’ GPS
367
427
  β”‚ β”‚ β”œβ”€β”€ reverseGeocode.ts # Tool: GPS β†’ adresse
@@ -451,16 +511,21 @@ Create a `.env` file:
451
511
  ```bash
452
512
  PORT=3000 # HTTP server port
453
513
  NODE_ENV=production # Environment
514
+ GEOCODING_PROVIDER=google # Default provider: "photon" (default) or "google"
515
+ GOOGLE_API_KEY=AIzaSy... # Required for Google provider (10k free requests/month)
454
516
  PHOTON_BASE_URL=https://photon.komoot.io # Optional (default: Komoot's public instance)
455
517
  USER_AGENT=MyApp/1.0 # Optional
456
518
  CORS_ORIGIN=* # CORS origin (default: * in dev, https://chatgpt.com in prod)
457
519
  ```
458
520
 
459
- ### Customize the Photon API
521
+ ### Providers configuration
460
522
 
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`)
523
+ - **Google**: Two options to provide the API key:
524
+ - **Server-side**: Set `GOOGLE_API_KEY` environment variable β€” all clients benefit automatically
525
+ - **Per-request**: Pass `apiKey` parameter in the tool call β€” for N8N, automations, or when you don't control the server
526
+ - **Photon**: Always available, no configuration needed. You can optionally self-host (set `PHOTON_BASE_URL`).
527
+ - The `provider` parameter on `search_address` and `reverse_geocode` tools lets the LLM override the default per request.
528
+ - The `apiKey` parameter is never logged, never stored, never returned in responses.
464
529
 
465
530
  ---
466
531
 
@@ -472,7 +537,7 @@ This project serves as a **template/base** for future MCP servers with a clean,
472
537
 
473
538
  - **`config.ts`**: Environment variables, constants, validation
474
539
  - **`types.ts`**: Shared TypeScript interfaces
475
- - **`client/`**: External API abstraction (Photon)
540
+ - **`client/`**: External API abstraction (Google, Photon) with provider interface + factory
476
541
  - **`tools/`**: Business logic (validation, transformation, formatting)
477
542
  - **`servers/`**: MCP implementation (stdio/Streamable HTTP), reuses tools
478
543
  - **`utils/`**: Custom error classes, geohash encode/decode, Haversine distance (zero dependencies)
@@ -578,13 +643,14 @@ MIT - Use freely for your personal or commercial projects.
578
643
 
579
644
  ## πŸ™ Credits & Attributions
580
645
 
581
- - **Geocoding Data** - [Photon API](https://photon.komoot.io/) by [Komoot](https://www.komoot.com/) - OpenStreetMap data
646
+ - **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
647
  - **MCP Protocol** - [Anthropic](https://www.anthropic.com/)
583
648
  - **Apps SDK** - [OpenAI](https://openai.com/)
584
649
 
585
650
  ### Data & Licenses
586
651
 
587
- Geocoding data comes from the Photon API (by Komoot) which uses OpenStreetMap data. This data is provided under the Open Database License (ODbL).
652
+ - Google Geocoding data is provided under [Google Maps Platform Terms of Service](https://cloud.google.com/maps-platform/terms)
653
+ - Photon/OpenStreetMap data is provided under the Open Database License (ODbL)
588
654
 
589
655
  ---
590
656
 
@@ -6,7 +6,7 @@ const SERVER_URL = process.argv[2] || 'https://geocrafter.rankorr.red/mcp';
6
6
  // Proxy HTTP MCP server to stdio for Cursor
7
7
  const server = new McpServer({
8
8
  name: 'geocrafter-http-proxy',
9
- version: '1.0.5',
9
+ version: '1.5.0',
10
10
  });
11
11
  // Forward all requests to HTTP server
12
12
  async function forwardRequest(method, params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shyzus/mcp-geocrafter",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
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",