Skip to content

Commit 3e5ef49

Browse files
cablateclaude
andauthored
feat: Places API migration + search_places tool + tool descriptions (#32)
* feat: migrate search_nearby to Places API (New), add maps_search_places tool, improve tool descriptions - Migrate search_nearby from legacy placesNearby() to @googlemaps/places searchNearby() - Add maps_search_places tool using searchText() for free-text place search with location bias, rating, and open-now filters - Improve all 8 tool descriptions with scenario-based patterns for better AI agent tool selection - Remove dead code: searchNearbyPlaces() and getPlaceDetails() from legacy GoogleMapsTools - Update README: fix tool count, add tool table, update project structure, link to CHANGELOG.md - Fix duplicate CHANGELOG 0.0.21 entry - Add search_nearby and maps_search_places E2E tests (64 assertions total) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: pass GOOGLE_MAPS_API_KEY to CI smoke test for full E2E coverage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aad4d1b commit 3e5ef49

16 files changed

Lines changed: 399 additions & 222 deletions

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ jobs:
2121

2222
- name: Smoke Test
2323
run: npm test
24+
env:
25+
GOOGLE_MAPS_API_KEY: ${{ secrets.GOOGLE_MAPS_API_KEY }}

CHANGELOG.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# Changelog
22

3-
## 0.0.21
4-
5-
- feat: tool annotations + actionable error messages + CHANGELOG (#31)
6-
7-
83
## 0.0.21
94

105
- Migrated from deprecated `server.tool()` to `server.registerTool()` API for MCP SDK v1.27+ compatibility

README.md

Lines changed: 73 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,49 @@
88

99
---
1010

11-
> **📢 Important Notice**
11+
> **Important Notice**
1212
>
1313
> Google officially announced MCP support for Google Maps on December 10, 2025, introducing **[Maps Grounding Lite](https://cloud.google.com/blog/products/ai-machine-learning/announcing-official-mcp-support-for-google-services)** - a fully-managed MCP server for geospatial data and routing.
1414
>
1515
> This community project remains actively maintained as an alternative with different features and deployment options.
1616
1717
---
1818

19-
A powerful Model Context Protocol (MCP) server providing comprehensive Google Maps API integration with streamable HTTP transport support and LLM processing capabilities.
19+
A Model Context Protocol (MCP) server providing comprehensive Google Maps API integration with streamable HTTP transport support and multi-session capabilities.
2020

21-
## 🙌 Special Thanks
21+
## Special Thanks
2222

23-
This project has received contributions from the community.
23+
This project has received contributions from the community.
2424
Special thanks to [@junyinnnn](https://github.com/junyinnnn) for helping add support for `streamablehttp`.
2525

26-
## ✅ Testing Status
26+
## Verified Compatibility
2727

28-
**This MCP server has been tested and verified to work correctly with:**
28+
This MCP server has been tested and verified with:
2929

3030
- Claude Desktop
3131
- Dive Desktop
3232
- MCP protocol implementations
3333

34-
All tools and features are confirmed functional through real-world testing.
35-
36-
## Features
37-
38-
### 🆕 Latest Updates
39-
40-
- ℹ️ **Reminder: enable Places API (New) in https://console.cloud.google.com before using the new Place features.**
41-
42-
43-
### 🗺️ Google Maps Integration
44-
45-
- **Location Search**
46-
47-
- Search for places near a specific location with customizable radius and filters
48-
- Get detailed place information including ratings, opening hours, and contact details
49-
50-
- **Geocoding Services**
51-
52-
- Convert addresses to coordinates (geocoding)
53-
- Convert coordinates to addresses (reverse geocoding)
54-
55-
- **Distance & Directions**
56-
57-
- Calculate distances and travel times between multiple origins and destinations
58-
- Get detailed turn-by-turn directions between two points
59-
- Support for different travel modes (driving, walking, bicycling, transit)
34+
## Available Tools
6035

61-
- **Elevation Data**
62-
- Retrieve elevation data for specific locations
36+
| Tool | Description |
37+
|------|-------------|
38+
| `search_nearby` | Find places near a location by type (restaurant, cafe, hotel, etc.). Supports filtering by radius, rating, and open status. |
39+
| `maps_search_places` | Free-text place search (e.g., "sushi restaurants in Tokyo"). Supports location bias, rating, open-now filters. |
40+
| `get_place_details` | Get full details for a place by its place_id — reviews, phone, website, hours, photos. |
41+
| `maps_geocode` | Convert an address or landmark name into GPS coordinates. |
42+
| `maps_reverse_geocode` | Convert GPS coordinates into a street address. |
43+
| `maps_distance_matrix` | Calculate travel distances and times between multiple origins and destinations. |
44+
| `maps_directions` | Get step-by-step navigation between two points with route details. |
45+
| `maps_elevation` | Get elevation (meters above sea level) for geographic coordinates. |
6346

64-
### 🚀 Advanced Features
47+
All tools are annotated with `readOnlyHint: true` and `destructiveHint: false` — MCP clients can auto-approve these without user confirmation.
6548

66-
- **Streamable HTTP Transport**: Latest MCP protocol with real-time streaming capabilities
67-
- **Session Management**: Stateful sessions with UUID-based identification
68-
- **Multiple Connection Support**: Handle multiple concurrent client connections
69-
- **Echo Service**: Built-in testing tool for MCP server functionality
49+
> **Prerequisite**: Enable **Places API (New)** in [Google Cloud Console](https://console.cloud.google.com) before using place-related tools.
7050
7151
## Installation
7252

73-
> ⚠️ **Important Notice**: This server uses HTTP transport, not stdio. Direct npx usage in MCP Server Settings is **NOT supported**.
53+
> **Note**: This server uses HTTP transport, not stdio. Direct npx usage in MCP Server Settings is **NOT supported**.
7454
7555
### Method 1: Global Installation (Recommended)
7656

@@ -87,7 +67,7 @@ mcp-google-map -p 3000 -k "your_api_key_here"
8767

8868
### Method 2: Using npx (Quick Start)
8969

90-
> ⚠️ **Warning**: Cannot be used directly in MCP Server Settings with stdio mode
70+
> Cannot be used directly in MCP Server Settings with stdio mode
9171
9272
**Step 1: Launch HTTP Server in Terminal**
9373

@@ -110,7 +90,7 @@ GOOGLE_MAPS_API_KEY=YOUR_API_KEY npx @cablate/mcp-google-map
11090
}
11191
```
11292

113-
### Common Mistake to Avoid
93+
### Common Mistake to Avoid
11494

11595
```json
11696
// This WILL NOT WORK - stdio mode not supported with npx
@@ -125,8 +105,8 @@ GOOGLE_MAPS_API_KEY=YOUR_API_KEY npx @cablate/mcp-google-map
125105
### Server Information
126106

127107
- **Endpoint**: `http://localhost:3000/mcp`
128-
- **Transport**: HTTP (not stdio)
129-
- **Tools**: 8 Google Maps tools available
108+
- **Transport**: Streamable HTTP (not stdio)
109+
- **Tools**: 8 Google Maps tools
130110

131111
### API Key Configuration
132112

@@ -135,14 +115,12 @@ API keys can be provided in three ways (priority order):
135115
1. **HTTP Headers** (Highest priority)
136116

137117
```json
138-
// MCP Client config
139118
{
140119
"mcp-google-map": {
141120
"transport": "streamableHttp",
142121
"url": "http://localhost:3000/mcp",
143-
// if your MCP Client support 'headers'
144122
"headers": {
145-
"X-Google-Maps-API-Key": "YOUR_API_KEY"
123+
"X-Google-Maps-API-Key": "YOUR_API_KEY"
146124
}
147125
}
148126
}
@@ -160,20 +138,6 @@ API keys can be provided in three ways (priority order):
160138
MCP_SERVER_PORT=3000
161139
```
162140

163-
## Available Tools
164-
165-
The server provides the following tools:
166-
167-
### Google Maps Tools
168-
169-
1. **search_nearby** - Search for nearby places based on location, with optional filtering by keywords, distance, rating, and operating hours
170-
2. **get_place_details** - Get detailed information about a specific place including contact details, reviews, ratings, and operating hours
171-
3. **maps_geocode** - Convert addresses or place names to geographic coordinates (latitude and longitude)
172-
4. **maps_reverse_geocode** - Convert geographic coordinates to a human-readable address
173-
5. **maps_distance_matrix** - Calculate travel distances and durations between multiple origins and destinations
174-
6. **maps_directions** - Get detailed turn-by-turn navigation directions between two locations
175-
7. **maps_elevation** - Get elevation data (height above sea level) for specific geographic locations
176-
177141
## Development
178142

179143
### Local Development
@@ -200,96 +164,85 @@ npm start
200164
npm run dev
201165
```
202166

167+
### Testing
168+
169+
```bash
170+
# Run smoke tests (no API key required for basic tests)
171+
npm test
172+
173+
# Run full E2E tests (requires GOOGLE_MAPS_API_KEY)
174+
npm run test:e2e
175+
```
176+
203177
### Project Structure
204178

205179
```
206180
src/
207-
├── cli.ts # Main CLI entry point
208-
├── config.ts # Server configuration
209-
├── index.ts # Package exports
181+
├── cli.ts # CLI entry point
182+
├── config.ts # Tool registration and server config
183+
├── index.ts # Package exports
210184
├── core/
211-
│ └── BaseMcpServer.ts # Base MCP server with streamable HTTP
212-
└── tools/
213-
└── maps/ # Google Maps tools
214-
├── toolclass.ts # Google Maps API client
215-
├── searchPlaces.ts # Maps service layer
216-
├── searchNearby.ts # Search nearby places
217-
├── placeDetails.ts # Place details
218-
├── geocode.ts # Geocoding
219-
├── reverseGeocode.ts # Reverse geocoding
220-
├── distanceMatrix.ts # Distance matrix
221-
├── directions.ts # Directions
222-
└── elevation.ts # Elevation data
185+
│ └── BaseMcpServer.ts # MCP server with streamable HTTP transport
186+
├── services/
187+
│ ├── NewPlacesService.ts # Google Places API (New) client
188+
│ ├── PlacesSearcher.ts # Service facade layer
189+
│ └── toolclass.ts # Legacy Google Maps API client
190+
├── tools/
191+
│ └── maps/
192+
│ ├── searchNearby.ts # search_nearby tool
193+
│ ├── searchPlaces.ts # maps_search_places tool
194+
│ ├── placeDetails.ts # get_place_details tool
195+
│ ├── geocode.ts # maps_geocode tool
196+
│ ├── reverseGeocode.ts # maps_reverse_geocode tool
197+
│ ├── distanceMatrix.ts # maps_distance_matrix tool
198+
│ ├── directions.ts # maps_directions tool
199+
│ └── elevation.ts # maps_elevation tool
200+
└── utils/
201+
├── apiKeyManager.ts # API key management
202+
└── requestContext.ts # Per-request context (API key isolation)
203+
tests/
204+
└── smoke.test.ts # Smoke + E2E test suite
223205
```
224206

225207
## Tech Stack
226208

227209
- **TypeScript** - Type-safe development
228210
- **Node.js** - Runtime environment
229-
- **Google Maps Services JS** - Google Maps API integration
230-
- **Model Context Protocol SDK** - MCP protocol implementation
211+
- **@googlemaps/places** - Google Places API (New) for place search and details
212+
- **@googlemaps/google-maps-services-js** - Legacy API for geocoding, directions, distance matrix, elevation
213+
- **@modelcontextprotocol/sdk** - MCP protocol implementation (v1.27+)
231214
- **Express.js** - HTTP server framework
232215
- **Zod** - Schema validation
233216

234-
## Security Considerations
217+
## Security
235218

236-
- API keys are handled server-side for security
219+
- API keys are handled server-side
220+
- Per-session API key isolation for multi-tenant deployments
237221
- DNS rebinding protection available for production
238222
- Input validation using Zod schemas
239-
- Error handling and logging
240223

241-
### Security Assessment Clarifications (2026-03)
224+
For enterprise security reviews, see [Security Assessment Clarifications](./SECURITY_ASSESSMENT.md).
242225

243-
For enterprise security reviews, see the standalone document:
226+
## Changelog
244227

245-
- [Security Assessment Clarifications (23 items)](./SECURITY_ASSESSMENT.md)
228+
See [CHANGELOG.md](./CHANGELOG.md) for version history.
246229

247230
## License
248231

249232
MIT
250233

251234
## Contributing
252235

253-
Community participation and contributions are welcome! Here's how you can contribute:
236+
Community participation and contributions are welcome!
254237

255-
- ⭐️ Star the project if you find it helpful
256-
- 🐛 Submit Issues: Report bugs or provide suggestions
257-
- 🔧 Create Pull Requests: Submit code improvements
258-
- 📖 Documentation: Help improve documentation
238+
- Submit Issues: Report bugs or provide suggestions
239+
- Create Pull Requests: Submit code improvements
240+
- Documentation: Help improve documentation
259241

260242
## Contact
261243

262-
If you have any questions or suggestions, feel free to reach out:
263-
264-
- 📧 Email: [reahtuoo310109@gmail.com](mailto:reahtuoo310109@gmail.com)
265-
- 💻 GitHub: [CabLate](https://github.com/cablate/)
266-
- 🤝 Collaboration: Welcome to discuss project cooperation
267-
- 📚 Technical Guidance: Sincere welcome for suggestions and guidance
268-
269-
## Changelog
270-
271-
### v0.0.19 (Latest)
272-
273-
- **New Places API Integration**: Updated to use Google's new Places API (New) instead of the legacy API to resolve HTTP 403 errors and ensure continued functionality.
274-
275-
### v0.0.18
276-
277-
- **Error response improvements**: Now all error messages are in English with more detailed information (previously in Chinese)
278-
279-
### v0.0.17
280-
281-
- **Added HTTP Header Authentication**: Support for passing API keys via `X-Google-Maps-API-Key` header in MCP Client config
282-
- **Fixed Concurrent User Issues**: Each session now uses its own API key without conflicts
283-
- **Fixed npx Execution**: Resolved module bundling issues
284-
- **Improved Documentation**: Clearer setup instructions
285-
286-
### v0.0.14
287-
288-
- Added streamable HTTP transport support
289-
- Improved CLI interface with emoji indicators
290-
- Enhanced error handling and logging
291-
- Added comprehensive tool descriptions for LLM integration
292-
- Updated to latest MCP SDK version
244+
- Email: [reahtuoo310109@gmail.com](mailto:reahtuoo310109@gmail.com)
245+
- GitHub: [CabLate](https://github.com/cablate/)
293246

294247
## Star History
295248

src/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ReverseGeocode, ReverseGeocodeParams } from "./tools/maps/reverseGeocod
88
import { DistanceMatrix, DistanceMatrixParams } from "./tools/maps/distanceMatrix.js";
99
import { Directions, DirectionsParams } from "./tools/maps/directions.js";
1010
import { Elevation, ElevationParams } from "./tools/maps/elevation.js";
11+
import { SearchPlaces, SearchPlacesParams } from "./tools/maps/searchPlaces.js";
1112

1213
// All Google Maps tools are read-only API queries
1314
const MAPS_TOOL_ANNOTATIONS = {
@@ -77,6 +78,13 @@ const serverConfigs: ServerInstanceConfig[] = [
7778
annotations: MAPS_TOOL_ANNOTATIONS,
7879
action: (params: ElevationParams) => Elevation.ACTION(params),
7980
},
81+
{
82+
name: SearchPlaces.NAME,
83+
description: SearchPlaces.DESCRIPTION,
84+
schema: SearchPlaces.SCHEMA,
85+
annotations: MAPS_TOOL_ANNOTATIONS,
86+
action: (params: SearchPlacesParams) => SearchPlaces.ACTION(params),
87+
},
8088
],
8189
},
8290
];

0 commit comments

Comments
 (0)