google-maps-mcp
Provides tools for interacting with Google Maps Platform APIs, including maps (static maps, street view, elevation), routes (directions, distance matrix, route optimization), and places (geocoding, place details, search, autocomplete, photos, address validation, timezone).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@google-maps-mcpShow me the fastest route from San Francisco to Los Angeles"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
google-maps-mcp
A TypeScript Model Context Protocol (MCP) server that exposes Google Maps Platform APIs as tools for LLMs. Gives AI assistants real, structured map data — directions, transit routes, place search, address validation, photos, elevation, and more — instead of guessing from training data.
Works with Claude Desktop and any other MCP-compatible client.
Features
15 tools across three categories:
Category | Tools |
Maps | Static map image URL, embed URL (iframe), elevation data, Street View image URL |
Routes | Turn-by-turn directions (drive/walk/cycle/transit), distance matrix, multi-stop route optimization |
Places | Geocoding / reverse geocoding, place details, text search, nearby search, autocomplete, photos, address validation, timezone |
Transport: HTTP Streamable (stateful sessions, SSE keep-alive) — the modern MCP transport, compatible with mcp-remote and all HTTP-capable clients.
Minimal footprint: only two runtime dependencies (@modelcontextprotocol/sdk, zod). All Google Maps calls use Node.js built-in fetch against REST APIs — no Google SDK required.
Prerequisites
Node.js 22+ (or Docker)
mcp-remote — install once globally:
npm install -g mcp-remoteA Google Maps Platform API key with the relevant APIs enabled (see below)
A Google Cloud project with billing enabled
APIs to enable in Google Cloud Console
Go to APIs & Services → Library and enable:
API | Used by |
Maps Static API |
|
Street View Static API |
|
Maps Embed API |
|
Elevation API |
|
Geocoding API |
|
Time Zone API |
|
Places API (New) |
|
Address Validation API |
|
Routes API |
|
Route Optimization API |
|
You can restrict the key to these APIs and to your server's IP for production use.
Quick Start
Option A — Run with Docker (recommended)
docker run -d \
--name google-maps-mcp \
-p 127.0.0.1:3003:3003 \
-e GOOGLE_MAPS_API_KEY=your_key_here \
-e MCP_AUTH_TOKEN=your_secret_token \
ghcr.io/apurvaumredkar/google-maps-mcp:latestVerify:
curl http://localhost:3003/health
# {"status":"ok","service":"google-maps-mcp"}Option B — npm / npx
No install required — run directly with npx:
GOOGLE_MAPS_API_KEY=your_key_here \
MCP_AUTH_TOKEN=your_secret_token \
npx mcp-server-google-maps
# google-maps-mcp listening on port 3003Or install globally:
npm install -g mcp-server-google-maps
GOOGLE_MAPS_API_KEY=your_key_here MCP_AUTH_TOKEN=your_secret_token mcp-server-google-mapsSet PORT= to change the default port (3003).
Option C — Build from source
git clone https://github.com/apurvaumredkar/google-maps-mcp.git
cd google-maps-mcp
npm install
npm run buildCreate a .env file (or export the vars):
GOOGLE_MAPS_API_KEY=your_key_here
MCP_AUTH_TOKEN=your_secret_token
# Optional — only needed for routes_optimize:
GOOGLE_CLOUD_PROJECT_ID=your_project_idStart the server:
GOOGLE_MAPS_API_KEY=... MCP_AUTH_TOKEN=... npm start
# google-maps-mcp listening on port 3003Option D — Docker Compose (self-hosted stack)
Add to your docker-compose.yml:
services:
google-maps-mcp:
build: .
container_name: google-maps-mcp
restart: unless-stopped
ports:
- "127.0.0.1:3003:3003"
environment:
- GOOGLE_MAPS_API_KEY=${GOOGLE_MAPS_API_KEY}
- MCP_AUTH_TOKEN=${MCP_AUTH_TOKEN}
- GOOGLE_CLOUD_PROJECT_ID=${GOOGLE_CLOUD_PROJECT_ID:-}Environment Variables
Variable | Required | Description |
| Yes | Your Google Maps Platform API key |
| No | Secret token clients must send in the |
| No | HTTP port (default: |
| No | Required only for |
Connecting a Client
This server works with any MCP-compatible client — Claude Desktop, LM Studio, Cursor, or any other tool that supports the Model Context Protocol. The config format may differ per client, but the endpoint and auth are the same.
The server exposes a single endpoint: POST/GET http://localhost:3003/mcp
If MCP_AUTH_TOKEN is set, all requests must include the header:
X-Api-Key: <MCP_AUTH_TOKEN>If MCP_AUTH_TOKEN is not set, no header is required (suitable for local-only use).
Claude Desktop (example)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"google-maps": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:3003/mcp",
"--header",
"X-Api-Key: your_secret_token"
]
}
}
}Tool Reference
Maps
maps_static_map — Static Map Image
Returns a direct image URL for a static map.
Parameter | Type | Default | Description |
| string | required | Address or |
| integer |
| Zoom level 0–21 |
| string |
| Image dimensions WxH in pixels |
| enum |
|
|
| string | — | Marker spec e.g. |
| string | — | Path spec for drawing routes |
| enum |
|
|
| enum |
|
|
| string | — | BCP 47 language code for labels |
| string | — | ISO 3166-1 alpha-2 region code |
maps_embed_url — Maps Embed URL
Returns an iframe-ready embed URL.
Parameter | Type | Description |
| enum |
|
| string | Place/search query (place, search modes) |
| string |
|
| integer | Zoom level |
| string | For directions mode |
| string | Pipe-separated waypoints |
| enum |
|
maps_elevation — Elevation Data
Returns elevation in metres above sea level.
Parameter | Type | Description |
| string | Pipe-separated |
| string | Pipe-separated |
| integer | Number of samples along path (2–512) |
maps_street_view — Street View Image
Returns a direct Street View panorama image URL.
Parameter | Type | Default | Description |
| string | — | Address or |
| string | — | Specific panorama ID (overrides location) |
| string |
| Image size WxH |
| number | — | Camera heading 0–360° |
| number | — | Camera pitch -90° to 90° |
| number |
| Field of view 10–120° |
| enum | — |
|
Routes
routes_compute — Compute Route
Turn-by-turn directions with real-time traffic.
TRANSIT restrictions:
TRANSITmode does not supportintermediates(waypoints) or route modifiers (avoid_tolls,avoid_highways,avoid_ferries). Passing these withtravel_mode: TRANSITreturns a clear error — compute separate legs instead (A→B, then B→C).
Parameter | Type | Default | Description |
| string | required | Address or |
| string | required | Address or |
| enum |
|
|
| enum[] | — | Filter transit to specific vehicle types: |
| string[] | — | Waypoints between origin and destination (not supported with |
| string | — | ISO 8601 datetime for traffic-aware routing |
| boolean |
| Avoid toll roads (not supported with |
| boolean |
| Avoid highways (not supported with |
| boolean |
| Avoid ferries (not supported with |
| enum |
|
|
| boolean |
| Return up to 3 alternatives |
routes_matrix — Route Distance Matrix
Compute travel time/distance between multiple origins and destinations simultaneously.
Parameter | Type | Default | Description |
| string[] | required | Up to 25 addresses or |
| string[] | required | Up to 25 addresses or |
| enum |
|
|
| string | — | ISO 8601 datetime |
| enum |
|
|
routes_optimize — Optimize Multi-Stop Route
Optimizes stop order to minimize total travel. Requires GOOGLE_CLOUD_PROJECT_ID.
Parameter | Type | Description |
| string | Start location — must be |
| string | End location (defaults to start) |
| object[] | Array of |
| enum |
|
Places
places_geocode — Geocode / Reverse Geocode
Convert addresses ↔ coordinates.
Parameter | Type | Description |
| string | Address to geocode |
| string |
|
| string | ISO 3166-1 alpha-2 region bias |
| string | Component filter e.g. |
places_details — Place Details
Full details for a place by its Google Place ID.
Parameter | Type | Description |
| string | Google Place ID |
| string | Comma-separated field mask (has sensible default) |
| string | Response language |
places_text_search — Search Places by Text
Find places matching a natural language query.
Parameter | Type | Description |
| string | e.g. |
| number | Bias results toward this location |
| number | Bias circle radius |
| integer | 1–20, default 10 |
| number | Minimum average star rating (0–5) |
| boolean | Only currently open places |
| string | Filter by place type e.g. |
| enum[] |
|
places_nearby_search — Search Nearby Places
Find places near a coordinate within a radius.
Parameter | Type | Description |
| number | Center of search |
| number | Search radius in metres (max 50,000) |
| string[] | Place type filters |
| string[] | Place types to exclude |
| integer | 1–20, default 10 |
| enum |
|
places_autocomplete — Place Autocomplete
Predict place names from partial input.
Parameter | Type | Description |
| string | Partial text to complete |
| number | Bias toward this location |
| string[] | Type filter |
| string[] | ISO 3166-1 alpha-2 country filter |
| boolean | Also return query predictions |
places_photos — Place Photos
Get photo URLs for a place.
Parameter | Type | Default | Description |
| string | required | Google Place ID |
| integer |
| Max photos to return (1–10) |
| integer |
| Max photo width in pixels |
| integer |
| Max photo height in pixels |
places_address_validation — Validate Address
Validate and standardize a postal address.
Parameter | Type | Description |
| string[] | Address lines |
| string | ISO 3166-1 alpha-2 country code |
| string | City/town |
| string | State/province |
| string | Postal code |
| boolean | USPS CASS validation (US only) |
places_timezone — Get Timezone
Get IANA timezone and UTC/DST offset for any coordinates.
Parameter | Type | Description |
| number | Location |
| integer | Unix timestamp for DST calculation (defaults to now) |
| string | Response language |
Architecture
src/
├── index.ts # Raw Node.js HTTP server, auth, stateful session management
├── server.ts # McpServer instantiation + tool registration
├── maps-client.ts # Typed fetch wrappers for all Google Maps REST APIs
└── tools/
├── maps.ts # 4 tools: static map, embed, elevation, street view
├── routes.ts # 3 tools: compute route, matrix, optimize
└── places.ts # 8 tools: geocode, details, text search, nearby, autocomplete,
# photos, address validation, timezoneKey design decisions:
Raw
node:httpinstead of Express — required for correct interop with the MCP SDK's internal Hono-based request handling. Express pre-consumes the request body stream in a way that breaksStreamableHTTPServerTransport.Stateful session map —
mcp-remoteand SSE keep-alive require sessions to persist across requests. Sessions are keyed byMcp-Session-Idheader and cleaned up on transport close.Auth before body read — the
X-Api-Keycheck happens on the header before any body stream is touched, so rejected requests drain cleanly.Auth split for Google APIs — legacy REST APIs (Static Maps, Geocoding, Elevation, Timezone, Street View) use
?key=query param; new APIs (Places v1, Routes v2, Address Validation) useX-Goog-Api-Keyheader.
Development
npm run dev # TypeScript watch mode (tsc --watch)
npm run build # Compile to dist/
npm start # Run compiled serverRebuild Docker image after changes
docker compose build google-maps-mcp
docker compose up -d google-maps-mcpTesting the MCP endpoint
# Health check (no auth required)
curl http://localhost:3003/health
# MCP initialize (auth required)
TOKEN=your_secret_token
curl -s -X POST http://localhost:3003/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "X-Api-Key: $TOKEN" \
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1"}},"id":1}'
# List tools (use session ID from Mcp-Session-Id response header)
SESSION=<Mcp-Session-Id from above>
curl -s -X POST http://localhost:3003/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "X-Api-Key: $TOKEN" \
-H "Mcp-Session-Id: $SESSION" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":2}'Windows/WSL gotcha: if your
.envfile has Windows CRLF line endings, extract values withtr -d '\r':TOKEN=$(grep MCP_AUTH_TOKEN .env | cut -d= -f2 | tr -d '\r')
Changelog
v1.0.4
routes_compute: Added early validation for TRANSIT mode — passingintermediatesor route modifiers (avoid_tolls,avoid_highways,avoid_ferries) now returns a clear, actionable error instead of a cryptic 400 from the Google API.
v1.0.3
routes_compute: Addedtransit_allowed_modesparameter to filter transit routes by vehicle type (BUS,SUBWAY,TRAIN,LIGHT_RAIL,RAIL).
v1.0.2
Initial public release with 15 tools across Maps, Routes, and Places categories.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/apurvaumredkar/google-maps-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server