@cablate/mcp-google-map 0.0.67 → 0.0.68

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-google-map",
3
- "version": "0.0.67",
3
+ "version": "0.0.68",
4
4
  "description": "Use Google Maps for place research, travel planning, and local SEO through focused Skills and a standalone CLI—no MCP setup required.",
5
5
  "author": {
6
6
  "name": "CabLate",
package/README.md CHANGED
@@ -1,132 +1,101 @@
1
- # MCP Google Maps
1
+ # Google Maps for AI agents
2
2
 
3
- Give AI agents reliable Google Maps search, geocoding, routing, weather, air quality, and local SEO data. Use it as a Codex Plugin with standalone CLI calls, or connect the same 18 tools through MCP.
3
+ **Stop rebuilding place search, routing, and location workflows for every AI app.**
4
4
 
5
- <p align="center"><b>English</b> | <a href="./README.zh-TW.md">繁體中文</a></p>
5
+ `@cablate/mcp-google-map` turns Google Maps Platform into 18 read-only agent tools and three focused Skills. An agent can find real places, verify routes, compare options, build practical itineraries, or audit local search visibility—through MCP or a standalone CLI.
6
6
 
7
- <p align="center">
8
- <img src="./assets/banner.webp" alt="MCP Google Maps — AI-Powered Geospatial Tools" width="800">
9
- </p>
7
+ You choose the integration model: Codex Plugin when you want Skills without MCP setup, stdio for desktop MCP clients, or Streamable HTTP for shared and remote deployments.
8
+
9
+ <p align="center"><b>English</b> · <a href="./README.zh-TW.md">繁體中文</a></p>
10
+
11
+ <p align="center"><img src="./assets/banner.webp" alt="Google Maps tools and workflows for AI agents" width="800"></p>
10
12
 
11
13
  <p align="center">
12
14
  <a href="https://www.npmjs.com/package/@cablate/mcp-google-map"><img src="https://img.shields.io/npm/v/@cablate/mcp-google-map" alt="npm version"></a>
13
15
  <a href="https://www.npmjs.com/package/@cablate/mcp-google-map"><img src="https://img.shields.io/npm/dm/@cablate/mcp-google-map" alt="npm downloads"></a>
14
- <a href="https://github.com/cablate/mcp-google-map/stargazers"><img src="https://img.shields.io/github/stars/cablate/mcp-google-map?style=social" alt="GitHub stars"></a>
15
- <a href="./LICENSE"><img src="https://img.shields.io/github/license/cablate/mcp-google-map" alt="license"></a>
16
+ <a href="https://github.com/cablate/mcp-google-map/actions/workflows/ci.yml"><img src="https://github.com/cablate/mcp-google-map/actions/workflows/ci.yml/badge.svg" alt="CI status"></a>
17
+ <a href="./LICENSE"><img src="https://img.shields.io/github/license/cablate/mcp-google-map" alt="MIT license"></a>
16
18
  </p>
17
19
 
18
- <p align="center">
19
- <img src="./assets/demo-grid-en.png" alt="Travel planning demo — Kyoto 2-day, Tokyo outdoor, Japan 5-day, Bangkok budget" width="800">
20
- </p>
20
+ ## Why use it?
21
+
22
+ Giving an agent a raw Maps API is only the beginning. Useful answers often require several dependent calls: resolve a place, preserve its identity, search around it, check opening details, calculate travel time, and explain what was actually verified. This project packages that work into one consistent interface.
23
+
24
+ - **Move from lookup to outcome.** Atomic tools handle geocoding, place details, directions, weather, air quality, and maps. Composite tools explore areas, compare candidates, optimize stops, and measure local rankings.
25
+ - **Use the same capabilities with or without MCP.** The standalone `exec` CLI works with Agent Skills and automation; the MCP server exposes the same 18 tools over stdio or HTTP.
26
+ - **Give agents workflow guidance, not just function names.** Three Skills cover general map research, evidence-backed travel planning, and local SEO. Codex loads their full instructions only when a request matches.
27
+ - **Keep deployment and credentials under your control.** Run locally or self-host. API keys remain in your environment or request headers, with per-session isolation for HTTP deployments.
28
+ - **Start narrow and grow later.** Register only the tools you need with `GOOGLE_MAPS_ENABLED_TOOLS`, or use the full catalog.
29
+
30
+ <p align="center"><img src="./assets/demo-grid-en.png" alt="Examples of travel planning with checked places and routes" width="800"></p>
31
+
32
+ ## What can an agent do?
33
+
34
+ | Outcome | How the project helps |
35
+ |---|---|
36
+ | Find and evaluate real places | Natural-language and nearby search, place details, ratings, hours, reviews, and distance comparison |
37
+ | Build a trip that works geographically | Candidate discovery, along-route stops, travel-time checks, multi-stop optimization, weather, and static maps |
38
+ | Research a neighborhood | Multi-category exploration plus targeted distance, elevation, timezone, weather, and air-quality checks |
39
+ | Plan field work or deliveries | Route matrices and optimized stop ordering for up to 25 stops |
40
+ | Audit local search visibility | Geographic grid ranking, competitor discovery, ARP, ATRP, and SoLV metrics |
41
+ | Enrich location data | Single or batch geocoding, reverse geocoding, and structured JSON output |
21
42
 
22
- - **18 tools** — 14 atomic tools and 4 higher-level workflows
23
- - **Three ways to connect** — Codex Plugin, MCP over stdio, or Streamable HTTP
24
- - **Three focused Skills** — general maps, travel planning, and local SEO
43
+ These are data and planning tools, not guarantees of safety, accessibility, opening status, or ranking outcomes. Applications displaying Places reviews, photos, or AI summaries must follow the [content attribution and storage guidance](./skills/_shared/content-attribution.md).
25
44
 
26
- ## Choose how to use it
45
+ ## Choose your integration
27
46
 
28
- | If you want to… | Use | What runs |
47
+ | Use | Best for | What runs |
29
48
  |---|---|---|
30
- | Let Codex answer map, travel, or local SEO questions without configuring MCP | **Codex Plugin** | The matching Skill loads on demand and calls the standalone CLI |
31
- | Add Google Maps tools to Claude Desktop, Cursor, VS Code, or another local MCP client | **MCP stdio** | The client starts one local MCP process |
32
- | Serve multiple or remote MCP sessions | **Streamable HTTP** | A self-hosted HTTP server at `/mcp` |
49
+ | **Codex Plugin** | Asking Codex map, travel, or local SEO questions without MCP configuration | A matching Skill loads on demand and calls the standalone CLI |
50
+ | **Standalone CLI** | Scripts, automation, and other Skill-compatible agents | One stateless command returns JSON |
51
+ | **MCP stdio** | Claude Desktop, Cursor, VS Code, and other local MCP clients | The client starts a local MCP process |
52
+ | **Streamable HTTP** | Multi-session, containerized, LAN, or remote access | A self-hosted server exposes `/mcp` |
33
53
 
34
- All options require Node.js 18+ and a Google Maps Platform API key. Enable **Places API (New)** and **Routes API** in [Google Cloud Console](https://console.cloud.google.com) for place and route workflows. Google may charge for live API requests.
54
+ All options require Node.js 18+ and a Google Maps Platform API key. Live calls may be billable. Enable the APIs needed by your selected tools; common place and route workflows require **Places API (New)**, **Routes API**, and often **Geocoding API**.
35
55
 
36
- ## Fastest start: Codex Plugin
56
+ ## Start with Codex—no MCP required
37
57
 
38
58
  ```bash
39
59
  codex plugin marketplace add cablate/mcp-google-map --ref main
40
60
  codex plugin add mcp-google-map@cablate
41
61
  ```
42
62
 
43
- Set `GOOGLE_MAPS_API_KEY` in the environment where Codex runs, then start a new conversation and ask a location question. Confirm local readiness without calling Google APIs:
63
+ Set `GOOGLE_MAPS_API_KEY` in the environment where Codex runs, then start a new conversation. Verify the local setup without making a Google API request:
44
64
 
45
65
  ```bash
46
66
  npx -y @cablate/mcp-google-map doctor
47
67
  ```
48
68
 
49
- A ready installation reports successful Node.js, package, and API-key checks; `live-api` is skipped. Use `doctor --live` only when you intend to make potentially billable test requests.
69
+ Success means the `node`, `package`, and `api-key` checks pass and `live-api` is skipped. Use `doctor --live` only when you intend to send potentially billable checks to Geocoding, Places, and Routes.
50
70
 
51
- The plugin does **not** start or register an MCP server. At runtime, Codex first sees the names and descriptions of three Skills and loads full instructions only when the request matches:
71
+ Try asking:
52
72
 
53
- - `google-maps` — place search, geocoding, routes, neighborhood, and environmental facts
54
- - `google-maps-travel-planning` — day trips and multi-day itineraries
55
- - `google-maps-local-seo` — business visibility and geographic rank analysis
73
+ > Plan a practical two-day Kyoto itinerary. Group nearby places, check travel times, and explain any opening-hour assumptions.
56
74
 
57
- For a complete no-MCP walkthrough, see the [Agent Skill demo](./examples/agent-skill-demo.md).
75
+ Codex selects `google-maps` for general location research, `google-maps-travel-planning` for itineraries, or `google-maps-local-seo` for business visibility analysis. The plugin does not register or start an MCP server. See the [no-MCP walkthrough](./examples/agent-skill-demo.md) for a reproducible example.
58
76
 
59
- ### vs Google Grounding Lite
77
+ ## Use the standalone CLI
60
78
 
61
- | | This project | [Grounding Lite](https://cloud.google.com/blog/products/ai-machine-learning/announcing-official-mcp-support-for-google-services) |
62
- |---|---|---|
63
- | Tools | **18** | 3 |
64
- | Geocoding | Yes | No |
65
- | Step-by-step directions | Yes | No |
66
- | Elevation | Yes | No |
67
- | Distance matrix | Yes | No |
68
- | Place details | Yes | No |
69
- | Timezone | Yes | No |
70
- | Weather | Yes | Yes |
71
- | Air quality | Yes | No |
72
- | Map images | Yes | No |
73
- | Composite tools (explore, plan, compare) | Yes | No |
74
- | Open source | MIT | No |
75
- | Self-hosted | Yes | Google-managed only |
76
- | Agent Skill | Yes | No |
77
-
78
- ### CLI and server quick checks
79
+ Every MCP tool also has a short CLI name:
79
80
 
80
81
  ```bash
81
- # stdio (Claude Desktop, Cursor, etc.)
82
- npx @cablate/mcp-google-map --stdio
83
-
84
- # exec CLI — no server needed
85
- npx @cablate/mcp-google-map exec geocode '{"address":"Tokyo Tower"}'
86
-
87
- # HTTP server
88
- npx @cablate/mcp-google-map --port 3000 --apikey "YOUR_API_KEY"
82
+ npx -y @cablate/mcp-google-map exec geocode '{"address":"Tokyo Tower"}'
83
+ npx -y @cablate/mcp-google-map exec search-places '{"query":"quiet cafes in Kyoto"}'
84
+ npx -y @cablate/mcp-google-map exec directions '{"origin":"Tokyo Station","destination":"Tokyo Skytree","mode":"transit"}'
89
85
  ```
90
86
 
91
- ## Special Thanks
92
-
93
- Special thanks to [@junyinnnn](https://github.com/junyinnnn) for helping add support for `streamablehttp`.
94
-
95
- ## Available Tools
96
-
97
- | Tool | Description |
98
- |------|-------------|
99
- | `maps_search_nearby` | Find places near a location by type (restaurant, cafe, hotel, etc.). Supports filtering by radius, rating, and open status. |
100
- | `maps_search_places` | Free-text place search (e.g., "sushi restaurants in Tokyo"). Supports location bias, rating, open-now filters. |
101
- | `maps_place_details` | Get full details for a place by its place_id — reviews, phone, website, hours. Optional `maxPhotos` param returns photo URLs. |
102
- | `maps_geocode` | Convert an address or landmark name into GPS coordinates. |
103
- | `maps_reverse_geocode` | Convert GPS coordinates into a street address. |
104
- | `maps_distance_matrix` | Calculate travel distances and times between multiple origins and destinations. Driving mode supports `avoid_tolls` and `avoid_highways`. |
105
- | `maps_directions` | Get step-by-step navigation between two points with route details. Driving mode supports `avoid_tolls` and `avoid_highways`. |
106
- | `maps_elevation` | Get elevation (meters above sea level) for geographic coordinates. |
107
- | `maps_timezone` | Get timezone ID, name, UTC/DST offsets, and local time for coordinates. |
108
- | `maps_weather` | Get current weather conditions or forecast — temperature, humidity, wind, UV, precipitation. |
109
- | `maps_air_quality` | Get air quality index, pollutant concentrations, and health recommendations by demographic group. |
110
- | `maps_static_map` | Generate a map image with markers, paths, or routes — returned inline for the user to see directly. |
111
- | `maps_batch_geocode` | Geocode up to 50 addresses in one call — returns coordinates for each. |
112
- | `maps_search_along_route` | Search for places along a route between two points — ranked by minimal detour time. |
113
- | **Composite Tools** | |
114
- | `maps_explore_area` | Explore what's around a location — searches multiple place types and gets details in one call. |
115
- | `maps_plan_route` | Plan an optimized multi-stop route — uses Routes API waypoint optimization (up to 25 stops) for efficient ordering. Driving mode supports `avoid_tolls` and `avoid_highways`. |
116
- | `maps_compare_places` | Compare places side-by-side — searches, gets details, and optionally calculates distances. |
117
- | `maps_local_rank_tracker` | Track a business's local search ranking across a geographic grid — like LocalFalcon. Supports up to 3 keywords for batch scanning. Returns rank at each point, top-3 competitors, and metrics (ARP, ATRP, SoLV). |
87
+ Each call is stateless. Successful calls return `{ "success": true, "data": ... }` on stdout; failures exit nonzero and write structured JSON to stderr.
118
88
 
119
- All tools are annotated with `readOnlyHint: true` and `destructiveHint: false` — MCP clients can auto-approve these without user confirmation.
89
+ For bulk address enrichment:
120
90
 
121
- > **Prerequisite**: Enable **Places API (New)** and **Routes API** in [Google Cloud Console](https://console.cloud.google.com) before using place-related and routing tools.
122
-
123
- ## Installation
124
-
125
- The [fastest-start section](#fastest-start-codex-plugin) covers the Codex Plugin. Use one of the following configurations when you specifically need MCP.
91
+ ```bash
92
+ npx @cablate/mcp-google-map batch-geocode -i addresses.txt -o results.json
93
+ cat addresses.txt | npx @cablate/mcp-google-map batch-geocode -i -
94
+ ```
126
95
 
127
- ### MCP stdio (recommended for local clients)
96
+ ## Connect an MCP client
128
97
 
129
- Works with Claude Desktop, Cursor, VS Code, and any MCP client that supports stdio:
98
+ ### stdio
130
99
 
131
100
  ```json
132
101
  {
@@ -134,301 +103,83 @@ Works with Claude Desktop, Cursor, VS Code, and any MCP client that supports std
134
103
  "google-maps": {
135
104
  "command": "npx",
136
105
  "args": ["-y", "@cablate/mcp-google-map", "--stdio"],
137
- "env": {
138
- "GOOGLE_MAPS_API_KEY": "YOUR_API_KEY"
139
- }
106
+ "env": { "GOOGLE_MAPS_API_KEY": "YOUR_API_KEY" }
140
107
  }
141
108
  }
142
109
  }
143
110
  ```
144
111
 
145
- **Reduce context usage** — If you only need a subset of tools, set `GOOGLE_MAPS_ENABLED_TOOLS` to limit which tools are registered:
146
-
147
- ```json
148
- {
149
- "env": {
150
- "GOOGLE_MAPS_API_KEY": "YOUR_API_KEY",
151
- "GOOGLE_MAPS_ENABLED_TOOLS": "maps_geocode,maps_directions,maps_search_places"
152
- }
153
- }
154
- ```
155
-
156
- Omit or set to `*` for all 18 tools (default).
112
+ To reduce tool-list context, add a comma-separated allowlist such as `"GOOGLE_MAPS_ENABLED_TOOLS": "maps_geocode,maps_directions,maps_search_places"`. Omit it or use `*` to expose all tools.
157
113
 
158
114
  ### Streamable HTTP
159
115
 
160
- For multi-session deployments, per-request API key isolation, or remote access:
161
-
162
116
  ```bash
163
- npx @cablate/mcp-google-map --port 3000 --apikey "YOUR_API_KEY"
164
-
165
- # Bind to all interfaces for remote access (e.g. Docker, LAN)
166
- npx @cablate/mcp-google-map --host 0.0.0.0 --port 3000 --apikey "YOUR_API_KEY"
117
+ npx @cablate/mcp-google-map --host 127.0.0.1 --port 3000 --apikey "YOUR_API_KEY"
167
118
  ```
168
119
 
169
- Then configure your MCP client:
170
-
171
120
  ```json
172
121
  {
173
122
  "mcpServers": {
174
123
  "google-maps": {
175
124
  "type": "http",
176
- "url": "http://localhost:3000/mcp"
125
+ "url": "http://127.0.0.1:3000/mcp"
177
126
  }
178
127
  }
179
128
  }
180
129
  ```
181
130
 
182
- ### Server Information
183
-
184
- - **Transport**: stdio (`--stdio`) or Streamable HTTP (default)
185
- - **Tools**: 18 Google Maps tools (14 atomic + 4 composite) — filterable via `GOOGLE_MAPS_ENABLED_TOOLS`
186
-
187
- ### CLI Exec Mode (Agent Skill)
188
-
189
- Use tools directly without running the MCP server:
190
-
191
- ```bash
192
- npx @cablate/mcp-google-map exec geocode '{"address":"Tokyo Tower"}'
193
- npx @cablate/mcp-google-map exec search-places '{"query":"ramen in Tokyo"}'
194
- ```
195
-
196
- All 18 tools available: `geocode`, `reverse-geocode`, `search-nearby`, `search-places`, `place-details`, `directions`, `distance-matrix`, `elevation`, `timezone`, `weather`, `air-quality`, `static-map`, `batch-geocode-tool`, `search-along-route`, `explore-area`, `plan-route`, `compare-places`, `local-rank-tracker`. See [`skills/`](./skills/) for the Skill definitions and full parameter docs.
197
-
198
- To use the **Agent Skill without MCP**:
199
-
200
- 1. Install the entire [`skills/`](./skills/) tree in your agent's Skills directory, following that client's instructions. Keep all three Skill folders and `_shared/` together so cross-Skill references continue to resolve. Installing the npm package alone does not register a Skill unless the package is installed through its plugin marketplace.
201
- 2. Make Node.js 18+ and `npx` available to the agent, and set `GOOGLE_MAPS_API_KEY` in its environment. Prefer the environment variable to `--apikey`, which can expose a key in shell history or process listings.
202
- 3. Ask the agent a location question. The Skill guides it to call the standalone CLI, for example `npx -y @cablate/mcp-google-map exec geocode '{"address":"Tokyo Tower"}'`. No MCP server or MCP client configuration is needed.
203
-
204
- Run `npx -y @cablate/mcp-google-map doctor` for a non-billable local readiness check. After informing the user that test requests may incur Google Maps Platform charges, `doctor --live` can verify Geocoding, Places API (New), and Routes API independently.
131
+ Bind to `0.0.0.0` only when the server must accept external connections. For multi-tenant deployments, prefer the `X-Google-Maps-API-Key` request header so keys remain isolated by session.
205
132
 
206
- For a reproducible no-MCP walkthrough, see the [Agent Skill demo](./examples/agent-skill-demo.md). If your agent or app displays Places reviews, photos, or AI summaries, follow the [content attribution and storage guidance](./skills/_shared/content-attribution.md); the tool preserves source/disclosure metadata but does not render a compliant UI for you.
133
+ ## Tool catalog
207
134
 
208
- ### Batch Geocode
135
+ | Group | Tools |
136
+ |---|---|
137
+ | Places and discovery | `maps_search_places`, `maps_search_nearby`, `maps_place_details`, `maps_explore_area`, `maps_compare_places`, `maps_search_along_route` |
138
+ | Location and routing | `maps_geocode`, `maps_reverse_geocode`, `maps_directions`, `maps_distance_matrix`, `maps_plan_route`, `maps_batch_geocode` |
139
+ | Context and visualization | `maps_elevation`, `maps_timezone`, `maps_weather`, `maps_air_quality`, `maps_static_map` |
140
+ | Local SEO | `maps_local_rank_tracker` |
209
141
 
210
- Geocode hundreds of addresses from a file:
211
-
212
- ```bash
213
- npx @cablate/mcp-google-map batch-geocode -i addresses.txt -o results.json
214
- cat addresses.txt | npx @cablate/mcp-google-map batch-geocode -i -
215
- ```
216
-
217
- Input: one address per line. Output: JSON with `{ total, succeeded, failed, results[] }`. Default concurrency: 20 parallel requests.
142
+ All 18 tools declare `readOnlyHint: true` and `destructiveHint: false`. Exact parameters, response shapes, and workflow recipes live in the [tool reference](./skills/google-maps/references/tools-api.md).
218
143
 
144
+ ## API key and Google Cloud setup
219
145
 
146
+ The key must belong to a Google Cloud project with billing enabled and restrictions compatible with the runtime. The [setup and diagnostics guide](./skills/_shared/setup-and-diagnostics.md) maps each capability to its required API and explains common failures.
220
147
 
221
- ### API Key Configuration
148
+ Credential priority is:
222
149
 
223
- API keys can be provided in three ways (priority order):
150
+ 1. `X-Google-Maps-API-Key` HTTP request header
151
+ 2. `--apikey` command-line option
152
+ 3. `GOOGLE_MAPS_API_KEY` environment variable
224
153
 
225
- 1. **HTTP Headers** (Highest priority)
154
+ Prefer environment variables or request headers. Command-line secrets can appear in shell history and process listings.
226
155
 
227
- ```json
228
- {
229
- "mcp-google-map": {
230
- "transport": "streamableHttp",
231
- "url": "http://localhost:3000/mcp",
232
- "headers": {
233
- "X-Google-Maps-API-Key": "YOUR_API_KEY"
234
- }
235
- }
236
- }
237
- ```
156
+ ## Trust and limits
238
157
 
239
- 2. **Command Line**
240
-
241
- ```bash
242
- mcp-google-map --apikey YOUR_API_KEY
243
- ```
244
-
245
- 3. **Environment Variable** (.env file or command line)
246
- ```env
247
- GOOGLE_MAPS_API_KEY=your_api_key_here
248
- MCP_SERVER_PORT=3000
249
- MCP_SERVER_HOST=0.0.0.0
250
- ```
158
+ - Place and route facts come from the Google Maps Platform APIs enabled for your project; weather availability has regional limitations.
159
+ - A successful API response does not prove accessibility, safety, legal suitability, or real-time availability.
160
+ - The package preserves source and disclosure metadata where returned, but your interface remains responsible for compliant attribution and storage.
161
+ - HTTP mode supports per-session API-key isolation and DNS rebinding protection.
162
+ - This project is MIT licensed and self-hostable. See [SECURITY.md](./SECURITY.md) for vulnerability reporting and [Security Assessment Clarifications](./SECURITY_ASSESSMENT.md) for the review checklist.
251
163
 
252
164
  ## Development
253
165
 
254
- ### Local Development
255
-
256
166
  ```bash
257
- # Clone the repository
258
167
  git clone https://github.com/cablate/mcp-google-map.git
259
168
  cd mcp-google-map
260
-
261
- # Install dependencies
262
- npm install
263
-
264
- # Set up environment variables
265
- cp .env.example .env
266
- # Edit .env with your API key
267
-
268
- # Build the project
169
+ npm ci
269
170
  npm run build
270
-
271
- # Start the server
272
- npm start
273
-
274
- # Or run in development mode
275
- npm run dev
276
- ```
277
-
278
- ### Testing
279
-
280
- ```bash
281
- # Run smoke tests (no API key required for basic tests)
171
+ npm run test:unit
282
172
  npm test
283
-
284
- # Run full E2E tests (requires GOOGLE_MAPS_API_KEY)
285
- npm run test:e2e
286
173
  ```
287
174
 
288
- ### Project Structure
289
-
290
- ```
291
- src/
292
- ├── cli.ts # CLI entry point
293
- ├── config.ts # Tool registration and server config
294
- ├── index.ts # Package exports
295
- ├── core/
296
- │ └── BaseMcpServer.ts # MCP server with streamable HTTP transport
297
- ├── services/
298
- │ ├── NewPlacesService.ts # Google Places API (New) client
299
- │ ├── PlacesSearcher.ts # Service facade layer
300
- │ ├── RoutesService.ts # Google Routes API client (directions, distance matrix, waypoint optimization)
301
- │ └── toolclass.ts # Google Maps API client (geocoding, timezone, elevation, static map)
302
- ├── tools/
303
- │ └── maps/
304
- │ ├── searchNearby.ts # maps_search_nearby tool
305
- │ ├── searchPlaces.ts # maps_search_places tool
306
- │ ├── placeDetails.ts # maps_place_details tool
307
- │ ├── geocode.ts # maps_geocode tool
308
- │ ├── reverseGeocode.ts # maps_reverse_geocode tool
309
- │ ├── distanceMatrix.ts # maps_distance_matrix tool
310
- │ ├── directions.ts # maps_directions tool
311
- │ ├── elevation.ts # maps_elevation tool
312
- │ ├── timezone.ts # maps_timezone tool
313
- │ ├── weather.ts # maps_weather tool
314
- │ ├── airQuality.ts # maps_air_quality tool
315
- │ ├── staticMap.ts # maps_static_map tool
316
- │ ├── batchGeocode.ts # maps_batch_geocode tool
317
- │ ├── searchAlongRoute.ts # maps_search_along_route tool
318
- │ ├── exploreArea.ts # maps_explore_area (composite)
319
- │ ├── planRoute.ts # maps_plan_route (composite)
320
- │ ├── comparePlaces.ts # maps_compare_places (composite)
321
- │ └── localRankTracker.ts # maps_local_rank_tracker (composite)
322
- └── utils/
323
- ├── apiKeyManager.ts # API key management
324
- └── requestContext.ts # Per-request context (API key isolation)
325
- tests/
326
- └── smoke.test.ts # Smoke + E2E test suite
327
- skills/
328
- ├── google-maps/ # General place, route, and environment workflow
329
- │ ├── SKILL.md
330
- │ └── references/tools-api.md # Tool parameters + generic recipes
331
- ├── google-maps-travel-planning/ # Day-trip and itinerary workflow
332
- │ ├── SKILL.md
333
- │ └── references/travel-planning.md
334
- ├── google-maps-local-seo/ # Business visibility and grid-rank workflow
335
- │ ├── SKILL.md
336
- │ └── references/local-seo.md
337
- └── _shared/ # On-demand resources used by all three Skills
338
- ├── setup-and-diagnostics.md
339
- └── content-attribution.md
340
- .agents/
341
- ├── plugins/marketplace.json # CabLate marketplace catalog
342
- └── skills/project-docs/ # Maintainer-only development Skill
343
- .codex-plugin/plugin.json # Codex compatibility manifest
344
- plugin.json # Portable Agent Plugin manifest
345
- ```
175
+ Live E2E calls require `GOOGLE_MAPS_API_KEY` and may be billable: `npm run test:e2e`.
346
176
 
347
- ## Tech Stack
177
+ Contributions are welcome. Read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening a pull request. Release history is in [CHANGELOG.md](./CHANGELOG.md).
348
178
 
349
- - **TypeScript** - Type-safe development
350
- - **Node.js** - Runtime environment
351
- - **@googlemaps/places** - Google Places API (New) for place search and details
352
- - **Google Routes API** - Directions, distance matrix, and waypoint optimization via REST
353
- - **@googlemaps/google-maps-services-js** - Geocoding, timezone, elevation
354
- - **@modelcontextprotocol/sdk** - MCP protocol implementation (v1.27+)
355
- - **Express.js** - HTTP server framework
356
- - **Zod** - Schema validation
179
+ ## Acknowledgements
357
180
 
358
- ## Security
359
-
360
- - API keys are handled server-side
361
- - Per-session API key isolation for multi-tenant deployments
362
- - DNS rebinding protection available for production
363
- - Input validation using Zod schemas
364
-
365
- For enterprise security reviews, see [Security Assessment Clarifications](./SECURITY_ASSESSMENT.md) — a 23-item checklist covering licensing, data protection, credential management, tool contamination, and AI agent execution environment verification.
366
-
367
- To report a vulnerability, see [SECURITY.md](SECURITY.md).
368
-
369
- ## Roadmap
370
-
371
- ### Recent Additions
372
-
373
- | Tool / Feature | What it unlocks | Status |
374
- |------|----------------|--------|
375
- | `maps_static_map` | Map images with pins/routes — multimodal AI can "see" the map | **Done** |
376
- | `maps_air_quality` | AQI, pollutants — health-aware travel, outdoor planning | **Done** |
377
- | `maps_batch_geocode` | Geocode up to 50 addresses in one call — data enrichment | **Done** |
378
- | `maps_search_along_route` | Find places along a route ranked by detour time — trip planning | **Done** |
379
- | `maps_explore_area` | One-call neighborhood overview (composite) | **Done** |
380
- | `maps_plan_route` | Optimized multi-stop itinerary (composite) | **Done** |
381
- | `maps_compare_places` | Side-by-side place comparison (composite) | **Done** |
382
- | `maps_local_rank_tracker` | Geographic grid rank tracking — local SEO analysis (composite) | **Done** |
383
- | `GOOGLE_MAPS_ENABLED_TOOLS` | Filter tools to reduce context usage | **Done** |
384
-
385
- ### Planned
386
-
387
- | Feature | What it unlocks | Status |
388
- |---------|----------------|--------|
389
- | `maps_place_photo` | Place photos for multimodal AI — "see" the restaurant ambiance | Planned |
390
- | Language parameter | Multi-language responses (ISO 639-1) across all tools | Planned |
391
- | MCP Prompt Templates | `/travel-planner`, `/neighborhood-scout` slash commands in Claude Desktop | Planned |
392
- | Geo-Reasoning Benchmark | 10-scenario test suite measuring LLM geospatial reasoning accuracy | Research |
393
-
394
- ### Use Cases We're Building Toward
395
-
396
- These are the real-world scenarios driving our tool decisions:
397
-
398
- - **Travel planning** — "Plan a day trip in Tokyo" (geocode → search → directions → weather)
399
- - **Real estate analysis** — "Analyze this neighborhood: schools, commute, flood risk" (search-nearby × N + elevation + distance-matrix)
400
- - **Logistics optimization** — "Route these 12 deliveries efficiently from the warehouse" (plan-route)
401
- - **Field sales** — "Visit 6 clients in Chicago, minimize drive time, find lunch spots" (plan-route + search-nearby)
402
- - **Disaster response** — "Nearest open hospitals? Am I in a flood zone?" (search-nearby + elevation)
403
- - **Content creation** — "Top 5 neighborhoods in Austin with restaurant density and airport distance" (explore-area + distance-matrix)
404
- - **Accessibility** — "Wheelchair-accessible restaurants, avoid steep routes" (search-nearby + place-details + elevation)
405
- - **Local SEO** — "Audit my restaurant's ranking vs competitors within 1km" (search-places + compare-places + explore-area)
406
-
407
- ## Changelog
408
-
409
- See [CHANGELOG.md](./CHANGELOG.md) for version history.
181
+ Thanks to [@junyinnnn](https://github.com/junyinnnn) for helping add Streamable HTTP support.
410
182
 
411
183
  ## License
412
184
 
413
- MIT
414
-
415
- ## Contributing
416
-
417
- Community participation and contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding guidelines, and the pull request process.
418
-
419
- - Submit Issues: Report bugs or provide suggestions
420
- - Create Pull Requests: Submit code improvements
421
- - Documentation: Help improve documentation
422
-
423
- ## Contact
424
-
425
- - Email: [reahtuoo310109@gmail.com](mailto:reahtuoo310109@gmail.com)
426
- - GitHub: [CabLate](https://github.com/cablate/)
427
-
428
- ## Star History
429
-
430
- <a href="https://glama.ai/mcp/servers/@cablate/mcp-google-map">
431
- <img width="380" height="200" src="https://glama.ai/mcp/servers/@cablate/mcp-google-map/badge" alt="Google Map Server MCP server" />
432
- </a>
433
-
434
- [![Star History Chart](https://star-history.dera.page/svg?repos=cablate/mcp-google-map&type=Date)](https://star-history.dera.page/#cablate/mcp-google-map&Date)
185
+ [MIT](./LICENSE)
package/README.zh-TW.md CHANGED
@@ -1,132 +1,101 @@
1
- # MCP Google Maps
1
+ # 給 AI 代理使用的 Google Maps
2
2
 
3
- 讓 AI 代理可靠地取得 Google Maps 地點搜尋、地址解析、路線、天氣、空氣品質與 Local SEO 資料。你可以安裝 Codex Plugin,讓代理直接呼叫 CLI;也可以透過 MCP 使用同一組 18 個工具。
3
+ **不用再為每一個 AI 應用重做地點搜尋、路線與位置工作流程。**
4
4
 
5
- <p align="center"><a href="./README.md">English</a> | <b>繁體中文</b></p>
5
+ `@cablate/mcp-google-map` 將 Google Maps Platform 整理成 18 個唯讀代理工具與三個用途明確的 Skills。代理可以搜尋真實地點、驗證路線、比較選項、建立可執行的旅行計畫,或分析在地搜尋能見度;既可透過 MCP,也可直接使用獨立 CLI。
6
6
 
7
- <p align="center">
8
- <img src="./assets/banner.webp" alt="MCP Google Maps — AI 驅動的地理空間工具" width="800">
9
- </p>
7
+ 整合方式由你決定:不想設定 MCP 時安裝 Codex Plugin;桌面 MCP client 使用 stdio;共享或遠端部署則使用 Streamable HTTP。
10
8
 
11
- <p align="center">
12
- <a href="https://www.npmjs.com/package/@cablate/mcp-google-map"><img src="https://img.shields.io/npm/v/@cablate/mcp-google-map" alt="npm version"></a>
13
- <a href="https://www.npmjs.com/package/@cablate/mcp-google-map"><img src="https://img.shields.io/npm/dm/@cablate/mcp-google-map" alt="npm downloads"></a>
14
- <a href="https://github.com/cablate/mcp-google-map/stargazers"><img src="https://img.shields.io/github/stars/cablate/mcp-google-map?style=social" alt="GitHub stars"></a>
15
- <a href="./LICENSE"><img src="https://img.shields.io/github/license/cablate/mcp-google-map" alt="license"></a>
16
- </p>
9
+ <p align="center"><a href="./README.md">English</a> · <b>繁體中文</b></p>
10
+
11
+ <p align="center"><img src="./assets/banner.webp" alt="提供給 AI 代理的 Google Maps 工具與工作流程" width="800"></p>
17
12
 
18
13
  <p align="center">
19
- <img src="./assets/demo-grid-zh.png" alt="旅行規劃展示 — 京都二日遊、東京戶外一日、日本五日、曼谷背包客" width="800">
14
+ <a href="https://www.npmjs.com/package/@cablate/mcp-google-map"><img src="https://img.shields.io/npm/v/@cablate/mcp-google-map" alt="npm 版本"></a>
15
+ <a href="https://www.npmjs.com/package/@cablate/mcp-google-map"><img src="https://img.shields.io/npm/dm/@cablate/mcp-google-map" alt="npm 下載數"></a>
16
+ <a href="https://github.com/cablate/mcp-google-map/actions/workflows/ci.yml"><img src="https://github.com/cablate/mcp-google-map/actions/workflows/ci.yml/badge.svg" alt="CI 狀態"></a>
17
+ <a href="./LICENSE"><img src="https://img.shields.io/github/license/cablate/mcp-google-map" alt="MIT 授權"></a>
20
18
  </p>
21
19
 
22
- - **18 個工具** — 14 個原子工具與 4 個高階工作流程
23
- - **三種連接方式** — Codex Plugin、MCP stdio、Streamable HTTP
24
- - **三個用途明確的 Skills** — 一般地圖、旅行規劃、Local SEO
20
+ ## 為什麼要用?
21
+
22
+ 把原始 Maps API 交給代理只是第一步。真正有用的答案通常依賴一連串呼叫:確認地點、保留同一個地點的識別資訊、搜尋周邊、檢查營業資料、計算旅行時間,再清楚說明哪些內容真的驗證過。本專案把這些工作整理成一致的介面。
23
+
24
+ - **從單次查詢走到可用成果。** 原子工具處理地址解析、地點詳情、導航、天氣、空氣品質與地圖;組合工具可探索區域、比較候選地點、最佳化停靠順序與分析在地排名。
25
+ - **同一套能力可用或不用 MCP。** 獨立 `exec` CLI 適合 Agent Skills 與自動化;MCP server 則透過 stdio 或 HTTP 暴露相同的 18 個工具。
26
+ - **不只提供函式名稱,也提供代理工作方法。** 三個 Skills 分別處理一般地圖研究、具證據的旅行規劃與 Local SEO。Codex 只有在請求符合時才載入完整指令。
27
+ - **部署方式與憑證仍由你控制。** 可在本機執行或自行架設;API key 保留在環境變數或 request header,HTTP 部署亦支援每個 session 隔離。
28
+ - **可以先小規模導入。** 透過 `GOOGLE_MAPS_ENABLED_TOOLS` 只註冊需要的工具,也可直接使用完整工具集。
29
+
30
+ <p align="center"><img src="./assets/demo-grid-zh.png" alt="使用已檢查地點與路線進行旅行規劃的範例" width="800"></p>
31
+
32
+ ## 代理能完成什麼?
33
+
34
+ | 成果 | 本專案提供的能力 |
35
+ |---|---|
36
+ | 搜尋並評估真實地點 | 自然語言與附近搜尋、地點詳情、評分、營業時間、評論與距離比較 |
37
+ | 建立地理上可執行的行程 | 候選地點探索、沿途停靠點、旅行時間檢查、多站最佳化、天氣與靜態地圖 |
38
+ | 研究一個區域 | 多類別區域探索,加上距離、海拔、時區、天氣與空氣品質查詢 |
39
+ | 規劃外勤或配送 | 路線矩陣,以及最多 25 個停靠點的順序最佳化 |
40
+ | 分析在地搜尋能見度 | 地理網格排名、競爭者探索、ARP、ATRP 與 SoLV 指標 |
41
+ | 補全位置資料 | 單筆或批次地址解析、反向地址解析與結構化 JSON 輸出 |
42
+
43
+ 這些是資料與規劃工具,不保證安全、無障礙、即時營業狀態或排名成果。應用程式若顯示 Places 評論、照片或 AI 摘要,必須遵守[內容署名與保存指引](./skills/_shared/content-attribution.md)。
25
44
 
26
- ## 選擇使用方式
45
+ ## 選擇整合方式
27
46
 
28
- | 你的需求 | 建議方式 | 實際執行方式 |
47
+ | 使用方式 | 適合情境 | 實際執行內容 |
29
48
  |---|---|---|
30
- | 讓 Codex 回答地圖、旅行或 Local SEO 問題,不想設定 MCP | **Codex Plugin** | 符合需求的 Skill 按需載入,並直接呼叫 CLI |
31
- | 在 Claude Desktop、Cursor、VS Code 或其他本機 MCP client 加入 Google Maps 工具 | **MCP stdio** | Client 啟動一個本機 MCP 程序 |
32
- | 提供多 session 或遠端 MCP 存取 | **Streamable HTTP** | 自架 HTTP server,端點為 `/mcp` |
49
+ | **Codex Plugin** | 不設定 MCP,直接讓 Codex 回答地圖、旅行或 Local SEO 問題 | 符合請求的 Skill 按需載入並呼叫獨立 CLI |
50
+ | **獨立 CLI** | 腳本、自動化與其他支援 Skill 的代理 | 單次無狀態命令回傳 JSON |
51
+ | **MCP stdio** | Claude Desktop、Cursor、VS Code 與其他本機 MCP clients | Client 啟動本機 MCP 程序 |
52
+ | **Streamable HTTP** | 多 session、容器、區域網路或遠端存取 | 自架 server 暴露 `/mcp` |
33
53
 
34
- 三種方式都需要 Node.js 18+ 與 Google Maps Platform API key。地點與路線工作流程還要先在 [Google Cloud Console](https://console.cloud.google.com) 啟用 **Places API (New)** 與 **Routes API**。實際 API 請求可能產生 Google 費用。
54
+ 所有方式都需要 Node.js 18+ 與 Google Maps Platform API key,實際 API 呼叫可能產生費用。請啟用所選工具需要的 API;常見地點與路線流程會使用 **Places API (New)**、**Routes API**,通常也需要 **Geocoding API**。
35
55
 
36
- ## 最快開始:Codex Plugin
56
+ ## 從 Codex 開始,不需要 MCP
37
57
 
38
58
  ```bash
39
59
  codex plugin marketplace add cablate/mcp-google-map --ref main
40
60
  codex plugin add mcp-google-map@cablate
41
61
  ```
42
62
 
43
- 在 Codex 的執行環境設定 `GOOGLE_MAPS_API_KEY`,重新開啟對話後直接提出地點問題。先用下列命令檢查本機環境,不會呼叫 Google API:
63
+ 在 Codex 的執行環境設定 `GOOGLE_MAPS_API_KEY`,再開啟新對話。先檢查本機環境,不會送出 Google API 請求:
44
64
 
45
65
  ```bash
46
66
  npx -y @cablate/mcp-google-map doctor
47
67
  ```
48
68
 
49
- 環境正確時,Node.js、套件與 API key 檢查會通過,`live-api` 會顯示略過。只有在你確定要送出可能計費的測試請求時,才使用 `doctor --live`。
69
+ 成功時,`node`、`package` 與 `api-key` 檢查會通過,`live-api` 會略過。只有在你確定要送出可能計費的 Geocoding、Places 與 Routes 測試時,才使用 `doctor --live`。
50
70
 
51
- Plugin **不會**啟動或註冊 MCP server。Codex 執行時先看到三個 Skill 的名稱與描述,只有請求符合時才載入完整指令:
71
+ 可以直接問:
52
72
 
53
- - `google-maps` — 地點搜尋、地址解析、路線、區域與環境資訊
54
- - `google-maps-travel-planning` — 單日與多日旅行行程
55
- - `google-maps-local-seo` — 商家能見度與地理排名分析
73
+ > 規劃一個實際可行的京都兩日行程。把鄰近地點排在一起、檢查交通時間,並說明營業時間有哪些假設。
56
74
 
57
- 完整的非 MCP 操作步驟見 [Agent Skill 示範](./examples/agent-skill-demo.md)。
75
+ Codex 會依請求選擇一般地圖研究、旅行規劃或 Local SEO Skill。Plugin 不會註冊或啟動 MCP server。可參考[非 MCP 完整示範](./examples/agent-skill-demo.md)重現整個流程。
58
76
 
59
- ### vs Google Grounding Lite
77
+ ## 使用獨立 CLI
60
78
 
61
- | | 本專案 | [Grounding Lite](https://cloud.google.com/blog/products/ai-machine-learning/announcing-official-mcp-support-for-google-services) |
62
- |---|---|---|
63
- | 工具數 | **18** | 3 |
64
- | 地理編碼 | 有 | 無 |
65
- | 逐步導航 | 有 | 無 |
66
- | 海拔查詢 | 有 | 無 |
67
- | 距離矩陣 | 有 | 無 |
68
- | 地點詳情 | 有 | 無 |
69
- | 時區查詢 | 有 | 無 |
70
- | 天氣查詢 | 有 | 有 |
71
- | 空氣品質 | 有 | 無 |
72
- | 地圖圖片 | 有 | 無 |
73
- | 組合工具(探索、規劃、比較) | 有 | 無 |
74
- | 開源 | MIT | 否 |
75
- | 自架部署 | 有 | 僅 Google 託管 |
76
- | Agent Skill | 有 | 無 |
77
-
78
- ### CLI 與 server 快速檢查
79
+ 每一個 MCP 工具都有簡短的 CLI 名稱:
79
80
 
80
81
  ```bash
81
- # stdio(Claude Desktop、Cursor 等)
82
- npx @cablate/mcp-google-map --stdio
83
-
84
- # exec CLI — 不需啟動 server
85
- npx @cablate/mcp-google-map exec geocode '{"address":"台北101"}'
86
-
87
- # HTTP server
88
- npx @cablate/mcp-google-map --port 3000 --apikey "YOUR_API_KEY"
82
+ npx -y @cablate/mcp-google-map exec geocode '{"address":"台北101"}'
83
+ npx -y @cablate/mcp-google-map exec search-places '{"query":"京都安靜的咖啡廳"}'
84
+ npx -y @cablate/mcp-google-map exec directions '{"origin":"台北車站","destination":"台北101","mode":"transit"}'
89
85
  ```
90
86
 
91
- ## 特別感謝
92
-
93
- 感謝 [@junyinnnn](https://github.com/junyinnnn) 協助實作 `streamablehttp` 支援。
94
-
95
- ## 可用工具
87
+ 每次呼叫皆為無狀態。成功時在 stdout 回傳 `{ "success": true, "data": ... }`;失敗時以非零狀態結束,並在 stderr 輸出結構化 JSON。
96
88
 
97
- | 工具 | 說明 |
98
- |------|------|
99
- | `maps_search_nearby` | 依類型搜尋附近地點(餐廳、咖啡廳、飯店等),支援半徑、評分、營業中篩選 |
100
- | `maps_search_places` | 自然語言地點搜尋(如「東京拉麵」),支援位置偏好、評分、營業中篩選 |
101
- | `maps_place_details` | 以 place_id 取得地點完整資訊 — 評論、電話、網站、營業時間。可選 `maxPhotos` 參數取得照片 URL。 |
102
- | `maps_geocode` | 將地址或地標名稱轉換為 GPS 座標 |
103
- | `maps_reverse_geocode` | 將 GPS 座標轉換為街道地址 |
104
- | `maps_distance_matrix` | 計算多個起點與終點間的旅行距離和時間 |
105
- | `maps_directions` | 取得兩點間的逐步導航路線 |
106
- | `maps_elevation` | 查詢地理座標的海拔高度(公尺) |
107
- | `maps_timezone` | 查詢座標的時區 ID、名稱、UTC/DST 偏移量和當地時間 |
108
- | `maps_weather` | 查詢當前天氣或預報 — 溫度、濕度、風速、紫外線、降水 |
109
- | `maps_air_quality` | 查詢空氣品質指數、污染物濃度,以及各族群健康建議 |
110
- | `maps_static_map` | 產生帶標記、路徑或路線的地圖圖片 — 直接內嵌在對話中 |
111
- | `maps_batch_geocode` | 一次地理編碼最多 50 個地址 |
112
- | `maps_search_along_route` | 搜尋兩點間路線沿途的地點 — 依最小繞路時間排序 |
113
- | **組合工具** | |
114
- | `maps_explore_area` | 一次呼叫探索某地周邊 — 搜尋多種地點類型並取得詳情 |
115
- | `maps_plan_route` | 規劃最佳化多站路線 — 地理編碼、最佳順序、回傳導航 |
116
- | `maps_compare_places` | 並排比較地點 — 搜尋、取得詳情,可選計算距離 |
117
- | `maps_local_rank_tracker` | 地理網格排名追蹤(類似 LocalFalcon)— 支援最多 3 個關鍵字批量掃描,回傳 ARP、ATRP、SoLV 指標 |
89
+ 批次補全地址可使用:
118
90
 
119
- 所有工具標註 `readOnlyHint: true` 和 `destructiveHint: false` — MCP 客戶端可自動核准,無需使用者確認。
120
-
121
- > **前置條件**:使用地點與路線相關工具前,請在 [Google Cloud Console](https://console.cloud.google.com) 啟用 **Places API (New)** 與 **Routes API**。
122
-
123
- ## 安裝
124
-
125
- [最快開始](#最快開始codex-plugin)已說明 Codex Plugin。只有在你確定需要 MCP 時,才選擇下列其中一種設定。
91
+ ```bash
92
+ npx @cablate/mcp-google-map batch-geocode -i addresses.txt -o results.json
93
+ cat addresses.txt | npx @cablate/mcp-google-map batch-geocode -i -
94
+ ```
126
95
 
127
- ### MCP stdio(本機 client 推薦)
96
+ ## 連接 MCP client
128
97
 
129
- 適用於 Claude Desktop、Cursor、VS Code 及任何支援 stdio 的 MCP 客戶端:
98
+ ### stdio
130
99
 
131
100
  ```json
132
101
  {
@@ -134,295 +103,83 @@ npx @cablate/mcp-google-map --port 3000 --apikey "YOUR_API_KEY"
134
103
  "google-maps": {
135
104
  "command": "npx",
136
105
  "args": ["-y", "@cablate/mcp-google-map", "--stdio"],
137
- "env": {
138
- "GOOGLE_MAPS_API_KEY": "YOUR_API_KEY"
139
- }
106
+ "env": { "GOOGLE_MAPS_API_KEY": "YOUR_API_KEY" }
140
107
  }
141
108
  }
142
109
  }
143
110
  ```
144
111
 
145
- **減少上下文用量** — 如果只需要部分工具,設定 `GOOGLE_MAPS_ENABLED_TOOLS` 限制註冊的工具:
146
-
147
- ```json
148
- {
149
- "env": {
150
- "GOOGLE_MAPS_API_KEY": "YOUR_API_KEY",
151
- "GOOGLE_MAPS_ENABLED_TOOLS": "maps_geocode,maps_directions,maps_search_places"
152
- }
153
- }
154
- ```
155
-
156
- 不設定或設為 `*` 即啟用全部 18 個工具(預設)。
112
+ 若要減少工具清單占用的上下文,可加入 `"GOOGLE_MAPS_ENABLED_TOOLS": "maps_geocode,maps_directions,maps_search_places"`。不設定或使用 `*` 即暴露全部工具。
157
113
 
158
114
  ### Streamable HTTP
159
115
 
160
- 適用於多 session 部署、per-request API key 隔離或遠端存取:
161
-
162
116
  ```bash
163
- npx @cablate/mcp-google-map --port 3000 --apikey "YOUR_API_KEY"
164
-
165
- # 綁定所有網路介面以支援遠端存取(例如 Docker、區域網路)
166
- npx @cablate/mcp-google-map --host 0.0.0.0 --port 3000 --apikey "YOUR_API_KEY"
117
+ npx @cablate/mcp-google-map --host 127.0.0.1 --port 3000 --apikey "YOUR_API_KEY"
167
118
  ```
168
119
 
169
- 然後設定你的 MCP 客戶端:
170
-
171
120
  ```json
172
121
  {
173
122
  "mcpServers": {
174
123
  "google-maps": {
175
124
  "type": "http",
176
- "url": "http://localhost:3000/mcp"
125
+ "url": "http://127.0.0.1:3000/mcp"
177
126
  }
178
127
  }
179
128
  }
180
129
  ```
181
130
 
182
- ### Server 資訊
183
-
184
- - **傳輸方式**:stdio(`--stdio`)或 Streamable HTTP(預設)
185
- - **工具數**:18 個 Google Maps 工具(14 原子 + 4 組合)— 可透過 `GOOGLE_MAPS_ENABLED_TOOLS` 篩選
186
-
187
- ### CLI Exec 模式(Agent Skill)
131
+ 只有 server 確實需要接受外部連線時才綁定 `0.0.0.0`。多租戶部署建議使用 `X-Google-Maps-API-Key` request header,讓不同 session 的 key 保持隔離。
188
132
 
189
- 不啟動 MCP server,直接使用工具:
190
-
191
- ```bash
192
- npx @cablate/mcp-google-map exec geocode '{"address":"台北101"}'
193
- npx @cablate/mcp-google-map exec search-places '{"query":"東京拉麵"}'
194
- ```
133
+ ## 工具目錄
195
134
 
196
- 全部 18 個工具可用:`geocode`、`reverse-geocode`、`search-nearby`、`search-places`、`place-details`、`directions`、`distance-matrix`、`elevation`、`timezone`、`weather`、`air-quality`、`static-map`、`batch-geocode-tool`、`search-along-route`、`explore-area`、`plan-route`、`compare-places`、`local-rank-tracker`。Skill 定義與完整參數文件見 [`skills/`](./skills/)。
135
+ | 分類 | 工具 |
136
+ |---|---|
137
+ | 地點與探索 | `maps_search_places`、`maps_search_nearby`、`maps_place_details`、`maps_explore_area`、`maps_compare_places`、`maps_search_along_route` |
138
+ | 位置與路線 | `maps_geocode`、`maps_reverse_geocode`、`maps_directions`、`maps_distance_matrix`、`maps_plan_route`、`maps_batch_geocode` |
139
+ | 環境資訊與視覺化 | `maps_elevation`、`maps_timezone`、`maps_weather`、`maps_air_quality`、`maps_static_map` |
140
+ | Local SEO | `maps_local_rank_tracker` |
197
141
 
198
- 若要**不透過 MCP、只用 Agent Skill**:
142
+ 全部 18 個工具都宣告 `readOnlyHint: true` 與 `destructiveHint: false`。完整參數、回應格式與工作流程範例見[工具參考](./skills/google-maps/references/tools-api.md)。
199
143
 
200
- 1. 依你的代理工具說明,將整個 [`skills/`](./skills/) 目錄樹安裝到它的 Skills 目錄;三個 Skill 資料夾與 `_shared/` 必須放在一起,跨 Skill 參考才會正常解析。除非透過 Plugin Marketplace 安裝,否則只安裝 npm 套件不會自動把 Skill 註冊到代理工具。
201
- 2. 讓代理工具可使用 Node.js 18+、`npx`,並在其環境設定 `GOOGLE_MAPS_API_KEY`。建議使用環境變數;`--apikey` 可能讓金鑰出現在 shell 歷史或程序清單。
202
- 3. 直接向代理工具提問地點問題。Skill 會引導它呼叫獨立 CLI,例如 `npx -y @cablate/mcp-google-map exec geocode '{"address":"台北101"}'`;不必啟動 MCP server 或設定 MCP client。
144
+ ## API key 與 Google Cloud 設定
203
145
 
204
- 先執行 `npx -y @cablate/mcp-google-map doctor`,即可在不呼叫 Google API、不產生 API 費用的情況下檢查本機準備狀態。告知使用者測試請求可能產生 Google Maps Platform 費用後,可用 `doctor --live` 分別驗證 Geocoding、Places API (New) 與 Routes API。
146
+ API key 所屬的 Google Cloud project 必須已啟用 billing,且 key restrictions 要與執行環境相容。[設定與診斷指南](./skills/_shared/setup-and-diagnostics.md)列出每項能力需要的 API,以及常見錯誤的處理方式。
205
147
 
206
- 完整的非 MCP 操作步驟見 [Agent Skill 示範](./examples/agent-skill-demo.md)。若代理工具或應用程式會呈現 Places 評論、照片或 AI 摘要,請遵照[內容署名與保存指引](./skills/_shared/content-attribution.md);工具會保留來源及揭露欄位,但不會替你的介面完成署名呈現。
148
+ 憑證優先順序如下:
207
149
 
208
- ### 批次地理編碼
150
+ 1. `X-Google-Maps-API-Key` HTTP request header
151
+ 2. `--apikey` 命令列參數
152
+ 3. `GOOGLE_MAPS_API_KEY` 環境變數
209
153
 
210
- 從檔案批次地理編碼:
154
+ 建議使用環境變數或 request header。命令列中的秘密可能出現在 shell 歷史或程序清單。
211
155
 
212
- ```bash
213
- npx @cablate/mcp-google-map batch-geocode -i addresses.txt -o results.json
214
- cat addresses.txt | npx @cablate/mcp-google-map batch-geocode -i -
215
- ```
156
+ ## 信任與限制
216
157
 
217
- 輸入:每行一個地址。輸出:JSON `{ total, succeeded, failed, results[] }`。預設並行度:20。
218
-
219
- ### API Key 設定
220
-
221
- API key 可透過三種方式提供(優先順序):
222
-
223
- 1. **HTTP Headers**(最高優先)
224
-
225
- ```json
226
- {
227
- "mcp-google-map": {
228
- "transport": "streamableHttp",
229
- "url": "http://localhost:3000/mcp",
230
- "headers": {
231
- "X-Google-Maps-API-Key": "YOUR_API_KEY"
232
- }
233
- }
234
- }
235
- ```
236
-
237
- 2. **命令列參數**
238
-
239
- ```bash
240
- mcp-google-map --apikey YOUR_API_KEY
241
- ```
242
-
243
- 3. **環境變數**(.env 檔案或命令列)
244
- ```env
245
- GOOGLE_MAPS_API_KEY=your_api_key_here
246
- MCP_SERVER_PORT=3000
247
- MCP_SERVER_HOST=0.0.0.0
248
- ```
158
+ - 地點與路線事實來自你為專案啟用的 Google Maps Platform APIs;天氣服務有區域限制。
159
+ - API 成功回應不等於已證明無障礙、安全、法律適用性或即時可用性。
160
+ - 套件會保留 API 回傳的來源與揭露 metadata,但你的介面仍有責任符合署名與保存規範。
161
+ - HTTP 模式支援每個 session 的 API key 隔離與 DNS rebinding 防護。
162
+ - 本專案採 MIT 授權且可自行架設。漏洞回報請見 [SECURITY.md](./SECURITY.md);企業審查可參考 [Security Assessment Clarifications](./SECURITY_ASSESSMENT.md)。
249
163
 
250
164
  ## 開發
251
165
 
252
- ### 本地開發
253
-
254
166
  ```bash
255
- # 複製專案
256
167
  git clone https://github.com/cablate/mcp-google-map.git
257
168
  cd mcp-google-map
258
-
259
- # 安裝依賴
260
- npm install
261
-
262
- # 設定環境變數
263
- cp .env.example .env
264
- # 編輯 .env 填入你的 API key
265
-
266
- # 建置專案
169
+ npm ci
267
170
  npm run build
268
-
269
- # 啟動 server
270
- npm start
271
-
272
- # 或以開發模式執行
273
- npm run dev
274
- ```
275
-
276
- ### 測試
277
-
278
- ```bash
279
- # 執行 smoke tests(基本測試不需要 API key)
171
+ npm run test:unit
280
172
  npm test
281
-
282
- # 執行完整 E2E 測試(需要 GOOGLE_MAPS_API_KEY)
283
- npm run test:e2e
284
- ```
285
-
286
- ### 專案結構
287
-
288
173
  ```
289
- src/
290
- ├── cli.ts # CLI 進入點
291
- ├── config.ts # 工具註冊與 server 設定
292
- ├── index.ts # 套件匯出
293
- ├── core/
294
- │ └── BaseMcpServer.ts # MCP server(streamable HTTP 傳輸)
295
- ├── services/
296
- │ ├── NewPlacesService.ts # Google Places API (New) 客戶端
297
- │ ├── PlacesSearcher.ts # Service facade 層
298
- │ └── toolclass.ts # Legacy Google Maps API 客戶端
299
- ├── tools/
300
- │ └── maps/
301
- │ ├── searchNearby.ts # maps_search_nearby 工具
302
- │ ├── searchPlaces.ts # maps_search_places 工具
303
- │ ├── placeDetails.ts # maps_place_details 工具
304
- │ ├── geocode.ts # maps_geocode 工具
305
- │ ├── reverseGeocode.ts # maps_reverse_geocode 工具
306
- │ ├── distanceMatrix.ts # maps_distance_matrix 工具
307
- │ ├── directions.ts # maps_directions 工具
308
- │ ├── elevation.ts # maps_elevation 工具
309
- │ ├── timezone.ts # maps_timezone 工具
310
- │ ├── weather.ts # maps_weather 工具
311
- │ ├── airQuality.ts # maps_air_quality 工具
312
- │ ├── staticMap.ts # maps_static_map 工具
313
- │ ├── batchGeocode.ts # maps_batch_geocode 工具
314
- │ ├── searchAlongRoute.ts # maps_search_along_route 工具
315
- │ ├── exploreArea.ts # maps_explore_area(組合)
316
- │ ├── planRoute.ts # maps_plan_route(組合)
317
- │ ├── comparePlaces.ts # maps_compare_places(組合)
318
- │ └── localRankTracker.ts # maps_local_rank_tracker(組合)
319
- └── utils/
320
- ├── apiKeyManager.ts # API key 管理
321
- └── requestContext.ts # Per-request context(API key 隔離)
322
- tests/
323
- └── smoke.test.ts # Smoke + E2E 測試套件
324
- skills/
325
- ├── google-maps/ # 一般地點、路線與環境資訊工作流程
326
- │ ├── SKILL.md
327
- │ └── references/tools-api.md # 工具參數 + 一般場景食譜
328
- ├── google-maps-travel-planning/ # 單日與多日行程工作流程
329
- │ ├── SKILL.md
330
- │ └── references/travel-planning.md
331
- ├── google-maps-local-seo/ # 商家能見度與地理排名工作流程
332
- │ ├── SKILL.md
333
- │ └── references/local-seo.md
334
- └── _shared/ # 三個 Skills 按需載入的共用資源
335
- ├── setup-and-diagnostics.md
336
- └── content-attribution.md
337
- .agents/
338
- ├── plugins/marketplace.json # CabLate marketplace 目錄
339
- └── skills/project-docs/ # 僅供維護者使用的開發 Skill
340
- .codex-plugin/plugin.json # Codex 相容 manifest
341
- plugin.json # 可攜式 Agent Plugin manifest
342
- ```
343
-
344
- ## 技術棧
345
-
346
- - **TypeScript** - 型別安全開發
347
- - **Node.js** - 執行環境
348
- - **@googlemaps/places** - Google Places API (New) 地點搜尋與詳情
349
- - **@googlemaps/google-maps-services-js** - Legacy API 地理編碼、導航、距離矩陣、海拔
350
- - **@modelcontextprotocol/sdk** - MCP 協議實作(v1.27+)
351
- - **Express.js** - HTTP server 框架
352
- - **Zod** - Schema 驗證
353
-
354
- ## 安全性
355
-
356
- - API key 在 server 端處理
357
- - 多租戶部署的 per-session API key 隔離
358
- - 正式環境可啟用 DNS rebinding 防護
359
- - 使用 Zod schemas 進行輸入驗證
360
-
361
- 企業安全審查請參考 [Security Assessment Clarifications](./SECURITY_ASSESSMENT.md) — 涵蓋授權、資料保護、憑證管理、工具污染、AI 代理執行環境驗證的 23 項檢查清單。
362
-
363
- ## 路線圖
364
-
365
- ### 近期新增
366
-
367
- | 工具 / 功能 | 解鎖場景 | 狀態 |
368
- |------|----------------|--------|
369
- | `maps_static_map` | 帶標記/路線的地圖圖片 — 多模態 AI 可「看見」地圖 | **完成** |
370
- | `maps_air_quality` | AQI、污染物 — 健康出行、戶外規劃 | **完成** |
371
- | `maps_batch_geocode` | 一次地理編碼最多 50 個地址 — 資料增強 | **完成** |
372
- | `maps_search_along_route` | 沿路線搜尋地點,依繞路時間排序 — 旅行規劃 | **完成** |
373
- | `maps_explore_area` | 一次呼叫的社區概覽(組合工具) | **完成** |
374
- | `maps_plan_route` | 最佳化多站行程(組合工具) | **完成** |
375
- | `maps_compare_places` | 並排地點比較(組合工具) | **完成** |
376
- | `maps_local_rank_tracker` | 地理網格排名追蹤 — Local SEO 分析(組合工具) | **完成** |
377
- | `GOOGLE_MAPS_ENABLED_TOOLS` | 篩選工具以減少上下文用量 | **完成** |
378
-
379
- ### 計畫中
380
-
381
- | 功能 | 解鎖場景 | 狀態 |
382
- |---------|----------------|--------|
383
- | `maps_place_photo` | 地點照片供多模態 AI 使用 — 「看見」餐廳氛圍 | 計畫中 |
384
- | 語言參數 | 所有工具支援多語言回應(ISO 639-1) | 計畫中 |
385
- | MCP Prompt Templates | Claude Desktop 中的 `/travel-planner`、`/neighborhood-scout` 斜線指令 | 計畫中 |
386
- | Geo-Reasoning Benchmark | 10 場景測試套件,衡量 LLM 地理空間推理準確度 | 研究中 |
387
174
 
388
- ### 我們在建構的應用場景
175
+ 即時 E2E 呼叫需要 `GOOGLE_MAPS_API_KEY`,且可能計費:`npm run test:e2e`。
389
176
 
390
- 以下是驅動工具開發方向的真實場景:
177
+ 歡迎參與貢獻。送出 pull request 前請先閱讀 [CONTRIBUTING.md](./CONTRIBUTING.md);版本紀錄見 [CHANGELOG.md](./CHANGELOG.md)。
391
178
 
392
- - **旅行規劃** — 「規劃東京一日遊」(geocode → search → directions → weather)
393
- - **房地產分析** — 「分析這個社區:學校、通勤、洪水風險」(search-nearby × N + elevation + distance-matrix)
394
- - **物流優化** — 「從倉庫出發,最佳化這 12 個配送地址的路線」(plan-route)
395
- - **外勤銷售** — 「拜訪芝加哥 6 個客戶,最小化車程,找午餐地點」(plan-route + search-nearby)
396
- - **災害應變** — 「最近有開的醫院?我在洪水區嗎?」(search-nearby + elevation)
397
- - **內容創作** — 「Austin 前 5 社區的餐廳密度和機場距離」(explore-area + distance-matrix)
398
- - **無障礙** — 「輪椅可達的餐廳,避開陡坡路線」(search-nearby + place-details + elevation)
399
- - **Local SEO** — 「分析我的餐廳在 1 公里內跟競爭對手的排名差距」(search-places + compare-places + explore-area)
400
-
401
- ## 更新日誌
179
+ ## 特別感謝
402
180
 
403
- 見 [CHANGELOG.md](./CHANGELOG.md)。
181
+ 感謝 [@junyinnnn](https://github.com/junyinnnn) 協助加入 Streamable HTTP 支援。
404
182
 
405
183
  ## 授權
406
184
 
407
- MIT
408
-
409
- ## 貢獻
410
-
411
- 歡迎社群參與和貢獻!
412
-
413
- - 提交 Issue:回報 bug 或提供建議
414
- - 建立 Pull Request:提交程式碼改進
415
- - 文件:協助改善文件
416
-
417
- ## 聯絡
418
-
419
- - Email: [reahtuoo310109@gmail.com](mailto:reahtuoo310109@gmail.com)
420
- - GitHub: [CabLate](https://github.com/cablate/)
421
-
422
- ## Star History
423
-
424
- <a href="https://glama.ai/mcp/servers/@cablate/mcp-google-map">
425
- <img width="380" height="200" src="https://glama.ai/mcp/servers/@cablate/mcp-google-map/badge" alt="Google Map Server MCP server" />
426
- </a>
427
-
428
- [![Star History Chart](https://star-history.dera.page/svg?repos=cablate/mcp-google-map&type=Date)](https://star-history.dera.page/#cablate/mcp-google-map&Date)
185
+ [MIT](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cablate/mcp-google-map",
3
- "version": "0.0.67",
3
+ "version": "0.0.68",
4
4
  "mcpName": "io.github.cablate/google-map",
5
5
  "description": "18 Google Maps tools for AI agents — geocode, search, directions, weather, air quality, local rank tracking, map images via MCP server or standalone CLI",
6
6
  "type": "module",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "mcp-google-map",
4
- "version": "0.0.67",
4
+ "version": "0.0.68",
5
5
  "description": "Use Google Maps for place research, travel planning, and local SEO through focused Skills and a standalone CLI—no MCP setup required.",
6
6
  "author": {
7
7
  "name": "CabLate",