google-maps-mcp
google-maps-mcp
A TypeScript Model Context Protocol (MCP) サーバーで、Google Maps Platform API をLLM向けツールとして公開します。AIアシスタントに、トレーニングデータからの推測ではなく、実際の構造化された地図データ(経路案内、公共交通機関のルート、場所の検索、住所検証、写真、標高など)を提供します。
Claude Desktop およびその他の MCP 互換クライアントで動作します。
機能
3つのカテゴリにわたる15のツール:
カテゴリ | ツール |
地図 | 静的マップ画像URL、埋め込みURL(iframe)、標高データ、ストリートビュー画像URL |
ルート | ターンバイターンの経路案内(車・徒歩・自転車・公共交通)、距離行列、複数経由地のルート最適化 |
場所 | ジオコーディング / 逆ジオコーディング、プレイス詳細、テキスト検索、周辺検索、オートコンプリート、写真、住所検証、タイムゾーン |
トランスポート: HTTP Streamable(ステートフルセッション、SSEキープアライブ) — モダンなMCPトランスポートで、mcp-remote および HTTP対応のすべてのクライアントと互換性があります。
最小フットプリント: ランタイム依存関係は2つだけ(@modelcontextprotocol/sdk、zod)。すべてのGoogle Maps呼び出しはREST APIに対してNode.js組み込みのfetchを使用します — Google SDKは不要です。
Related MCP server: google-maps-mcp-server
前提条件
Node.js 22+(またはDocker)
mcp-remote — 一度だけグローバルにインストール:
npm install -g mcp-remote関連するAPIを有効にしたGoogle Maps Platform APIキー(下記参照)
請求が有効なGoogle Cloudプロジェクト
Google Cloud Consoleで有効にするAPI
APIとサービス → ライブラリ に移動して有効にします:
API | 使用箇所 |
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 |
|
本番環境では、キーをこれらのAPIとサーバーのIPに制限できます。
クイックスタート
オプションA — Dockerで実行(推奨)
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:latest確認:
curl http://localhost:3003/health
# {"status":"ok","service":"google-maps-mcp"}オプションB — npm / npx
インストール不要 — 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 3003またはグローバルにインストール:
npm install -g mcp-server-google-maps
GOOGLE_MAPS_API_KEY=your_key_here MCP_AUTH_TOKEN=your_secret_token mcp-server-google-mapsPORT= を設定すると、デフォルトのポート(3003)を変更できます。
オプションC — ソースからビルド
git clone https://github.com/apurvaumredkar/google-maps-mcp.git
cd google-maps-mcp
npm install
npm run build.env ファイルを作成する(または変数をエクスポート):
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_idサーバーを起動:
GOOGLE_MAPS_API_KEY=... MCP_AUTH_TOKEN=... npm start
# google-maps-mcp listening on port 3003オプションD — Docker Compose(セルフホストスタック)
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:-}環境変数
変数 | 必須 | 説明 |
| 必須 | Google Maps Platform APIキー |
| 任意 | クライアントが |
| 任意 | HTTPポート(デフォルト: |
| 任意 |
|
クライアントの接続
このサーバーはあらゆるMCP互換クライアントで動作します — Claude Desktop、LM Studio、Cursor、その他Model Context Protocolをサポートする任意のツール。設定形式はクライアントごとに異なる場合がありますが、エンドポイントと認証は同じです。
サーバーは単一のエンドポイントを公開します: POST/GET http://localhost:3003/mcp
MCP_AUTH_TOKEN が設定されている場合、すべてのリクエストに次のヘッダーを含める必要があります:
X-Api-Key: <MCP_AUTH_TOKEN>MCP_AUTH_TOKEN が設定されていない場合、ヘッダーは不要です(ローカルのみでの使用に適しています)。
Claude Desktop(例)
~/Library/Application Support/Claude/claude_desktop_config.json(macOS)または %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"
]
}
}
}ツールリファレンス
地図
maps_static_map — 静的マップ画像
静的マップの直接画像URLを返します。
パラメータ | 型 | デフォルト | 説明 |
| string | 必須 | 住所または |
| integer |
| ズームレベル 0〜21 |
| string |
| 画像サイズ(ピクセル単位のWxH) |
| enum |
|
|
| string | — | マーカー指定(例: |
| string | — | ルート描画用のパス指定 |
| enum |
|
|
| enum |
|
|
| string | — | ラベルのBCP 47言語コード |
| string | — | ISO 3166-1 alpha-2 地域コード |
maps_embed_url — Maps埋め込みURL
iframe対応の埋め込みURLを返します。
パラメータ | 型 | 説明 |
| enum |
|
| string | 場所/検索クエリ(place、searchモード) |
| string | view/streetviewモード用の |
| integer | ズームレベル |
| string | directionsモード用 |
| string | パイプ区切りの経由地 |
| enum |
|
maps_elevation — 標高データ
海抜(メートル単位)の標高を返します。
パラメータ | 型 | 説明 |
| string | パイプ区切りの |
| string | パイプ区切りの |
| integer | パスに沿ったサンプル数(2〜512) |
maps_street_view — ストリートビュー画像
ストリートビューのパノラマ画像の直接URLを返します。
パラメータ | 型 | デフォルト | 説明 |
| string | — | 住所または |
| string | — | 特定のパノラマID(locationを上書き) |
| string |
| 画像サイズ WxH |
| number | — | カメラの方位 0〜360° |
| number | — | カメラの傾き -90°〜90° |
| number |
| 視野 10〜120° |
| enum | — | 屋内パノラマを除外するには |
ルート
routes_compute — ルート計算
リアルタイムの交通情報を含むターンバイターンの経路案内。
TRANSIT制限:
TRANSITモードはintermediates(経由地)とルート修飾子(avoid_tolls、avoid_highways、avoid_ferries)をサポートしていません。これらをtravel_mode: TRANSITと一緒に渡すと明確なエラーが返ります — 代わりに区間を分けて計算してください(A→B、次にB→C)。
パラメータ | 型 | デフォルト | 説明 |
| string | 必須 | 住所または |
| string | 必須 | 住所または |
| enum |
|
|
| enum[] | — | 交通機関を特定の車両タイプに絞り込みます: |
| string[] | — | 出発地と目的地の間のウェイポイント( |
| string | — | 交通状況を考慮したルーティング用のISO 8601日時 |
| boolean |
| 有料道路を避ける( |
| boolean |
| 高速道路を避ける( |
| boolean |
| フェリーを避ける( |
| enum |
|
|
| boolean |
| 最大3件の代替ルートを返す |
routes_matrix — ルート距離行列
複数の出発地と目的地の間の移動時間・距離を同時に計算します。
パラメータ | 型 | デフォルト | 説明 |
| string[] | 必須 | 最大25件の住所または |
| string[] | 必須 | 最大25件の住所または |
| enum |
|
|
| string | — | ISO 8601日時 |
| enum |
|
|
routes_optimize — マルチストップルートの最適化
停車順序を最適化し、総移動時間を最小化します。GOOGLE_CLOUD_PROJECT_ID が必要です。
パラメータ | 型 | 説明 |
| string | 開始地点 — |
| string | 終了地点(デフォルトは開始地点) |
| object[] |
|
| enum |
|
Places
places_geocode — ジオコーディング / 逆ジオコーディング
住所と座標を相互変換します。
パラメータ | 型 | 説明 |
| string | ジオコーディングする住所 |
| string | 逆ジオコーディング用の |
| string | ISO 3166-1 alpha-2 リージョンバイアス |
| string | コンポーネントフィルター(例: |
places_details — プレイスの詳細
Google プレイス ID による場所の完全な詳細情報。
パラメータ | 型 | 説明 |
| string | Google プレイス ID |
| string | カンマ区切りのフィールドマスク(適切なデフォルト値あり) |
| string | レスポンスの言語 |
places_text_search — テキストでプレイスを検索
自然言語のクエリに一致する場所を検索します。
パラメータ | 型 | 説明 |
| string | 例: |
| number | この場所にバイアス |
| number | バイアス円の半径 |
| integer | 1〜20、デフォルトは10 |
| number | 最小平均星評価(0〜5) |
| boolean | 現在営業中の場所のみ |
| string | 場所のタイプでフィルタリング(例: |
| enum[] |
|
places_nearby_search — 周辺のプレイスを検索
半径内の座標近くにある場所を検索します。
パラメータ | 型 | 説明 |
| number | 検索の中心 |
| number | 検索半径(メートル、最大50,000) |
| string[] | プレイスタイプのフィルター |
| string[] | 除外するプレイスタイプ |
| integer | 1〜20、デフォルトは10 |
| enum |
|
places_autocomplete — プレイスのオートコンプリート
部分的な入力からプレイス名を予測します。
パラメータ | 型 | 説明 |
| string | 補完する部分テキスト |
| number | この場所にバイアス |
| string[] | タイプフィルター |
| string[] | ISO 3166-1 alpha-2 の国コードフィルター |
| boolean | クエリ予測も返す |
places_photos — プレイスの写真
場所の写真URLを取得します。
パラメータ | 型 | デフォルト | 説明 |
| string | 必須 | Google プレイス ID |
| integer |
| 返す最大写真数(1〜10) |
| integer |
| 写真の最大幅(ピクセル) |
| integer |
| 写真の最大高さ(ピクセル) |
places_address_validation — 住所の検証
郵便住所を検証して標準化します。
パラメータ | 型 | 説明 |
| string[] | 住所の行 |
| string | ISO 3166-1 alpha-2 国コード |
| string | 市区町村 |
| string | 都道府県/州 |
| string | 郵便番号 |
| boolean | USPS CASS 検証(米国のみ) |
places_timezone — タイムゾーンの取得
任意の座標に対する IANA タイムゾーンと UTC/DST オフセットを取得します。
パラメータ | 型 | 説明 |
| number | 場所 |
| integer | DST計算用のUnixタイムスタンプ(デフォルトは現在時刻) |
| string | レスポンスの言語 |
アーキテクチャ
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, timezone主要な設計判断:
生の
node:httpを Express ではなく使用 — MCP SDK 内部の Hono ベースのリクエスト処理との正しい相互運用に必要です。Express はリクエストボディのストリームを先読みするため、StreamableHTTPServerTransportが壊れます。ステートフルセッションマップ —
mcp-remoteと SSE キープアライブでは、リクエスト間でセッションを永続させる必要があります。セッションはMcp-Session-Idヘッダーでキー化され、トランスポートのクローズ時にクリーンアップされます。ボディ読み取り前の認証 —
X-Api-Keyのチェックはボディストリームに触れる前にヘッダーで行われるため、拒否されたリクエストはクリーンにドレインされます。Google API の認証分割 — 従来の REST API(Static Maps、Geocoding、Elevation、Timezone、Street View)は
?key=クエリパラメータを使用します。新しい API(Places v1、Routes v2、Address Validation)はX-Goog-Api-Keyヘッダーを使用します。
開発
npm run dev # TypeScript watch mode (tsc --watch)
npm run build # Compile to dist/
npm start # Run compiled server変更後の Docker イメージの再ビルド
docker compose build google-maps-mcp
docker compose up -d google-maps-mcpMCP エンドポイントのテスト
# 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 の注意点:
.envファイルが Windows の CRLF 行末になっている場合は、tr -d '\r'で値を抽出してください:TOKEN=$(grep MCP_AUTH_TOKEN .env | cut -d= -f2 | tr -d '\r')
変更履歴
v1.0.4
routes_compute: TRANSIT モードの早期検証を追加 —intermediatesやルート修飾子(avoid_tolls、avoid_highways、avoid_ferries)を渡すと、Google API からの不可解な 400 エラーではなく、明確で実用的なエラーが返るようになりました。
v1.0.3
routes_compute:transit_allowed_modesパラメータを追加し、交通手段のタイプ(BUS、SUBWAY、TRAIN、LIGHT_RAIL、RAIL)でトランジットルートをフィルタリングできるようにしました。
v1.0.2
Maps、Routes、Places のカテゴリにわたる15のツールを備えた最初のパブリックリリース。
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.
Related MCP Servers
- AlicenseBqualityAmaintenanceA Model Context Protocol server that provides Google Maps API integration, allowing users to search locations, get place details, geocode addresses, calculate distances, obtain directions, and retrieve elevation data through LLM processing capabilities.71,992428MIT
- AlicenseAqualityDmaintenanceProduction-ready MCP server for Google Maps Platform APIs, providing 11 tools for directions, places, geocoding, traffic, and road data to empower AI agents with location intelligence.114Apache 2.0
- AlicenseAqualityDmaintenanceA TypeScript-based MCP server that integrates with Swagger/OpenAPI specifications to expose API endpoints as tools for Large Language Models (LLMs), enabling natural language interaction with any OpenAPI-compliant API.49MIT
- FlicenseNot gradedqualityDmaintenanceComprehensive MCP server for Google Maps APIs, enabling geocoding, place search and details, distance matrix, elevation, and directions through natural language.6
Related MCP Connectors
Live Google Maps business search, review, and photo data for AI agents over MCP.
Google Maps MCP Pack — geocoding, places, directions, distance matrix, elevation.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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