google-maps-harness
google-maps-harness
エージェント向けの13の読み取り専用 Google Maps Platform ツール:場所の位置、周辺情報、移動時間、到着時の状況。
このリポジトリからインストールする方法は2つあります。
対象 | セットアップ | |
スキル | claude.ai および Claude Code | zip をアップロード。claude.ai ではドメイン許可リストへの登録が必要。 |
(MCP) Model Context Protocol サーバー | Claude Code, Claude Desktop | venv と1つの登録コマンド。 |
どちらも同じ機能を同じ制御で提供します。スキルは claude.ai がローカルサーバーを起動できないために存在します。MCP サーバーは、ローカルプロセスで問題ない場合に適しているため存在します。
このツールは書き込みを一切行わないため、管理するリスクは損害ではなく、コスト、コンテキスト、そして Google が返す情報への信頼です。
エージェントが得られるもの
ツール | 回答 |
| この住所、ランドマーク、プラスコードの位置は? |
| この座標には何がある? |
| このプレイス ID の正確な位置は? |
| この住所は実在し、配送可能か? |
| 「ユニオンスクエア近くのラーメン」に合致する場所は? |
| この円の内側には、カテゴリ別に何がある? |
| 1つの場所の営業時間、評価、価格帯、電話番号、ウェブサイト。 |
| ユーザーはおそらく何を意味していたか? |
| A から B まで、交通状況込みでどのくらい時間がかかる? |
| これら10個のうち、あれら10個のうちどれが最も近いか? |
| そこでの現在時刻、または指定日の時刻は? |
| この地点、またはこの地点列の標高は? |
| そこでの空気の質は?誰が注意すべきか? |
compute_route_matrix は、検索ではなく判断のために作られたツールです。1回の呼び出しで、すべての候補をすべてのオプションに対してランク付けし、1回の請求になります。
スキルは同じ13個をサブコマンドとして公開します(geocode、search-nearby、matrix)。さらに、自身のセットアップを診断する check コマンドも含まれます。
Related MCP server: Google Maps MCP Server Enhanced
ステップ1 — Google Cloud(両方のパスで必要)
API を有効にする
Map API → API 一覧 で、請求先が設定されているプロジェクトに対してこれらを有効にします。Maps Platform は、無料の月間クレジットの範囲内でも、請求先アカウントが紐付いていないとすべてのリクエストを拒否します。
API | 有効になるツール |
Geocoding API |
|
Places API (New) | 4つの |
Routes API |
|
Time Zone API |
|
Elevation API |
|
Address Validation API |
|
Air Quality API |
|
特に Places API (New) に注意してください。コンソールには従来の「Places API」も表示されますが、そちらだけを有効にすると、4つの場所ツールすべてで403エラーが発生します。
公開したいものだけを有効にしてください。API がオフのツールを使用すると、その名前を明示したエラーメッセージが返されるため、意図的に機能範囲を絞って運用するのに適しています。
キーを作成して制限を設定する
Maps Platform 認証情報 で、API キーを作成し、ページを離れる前に両方の制限を設定します。
アプリケーションの制限 → なし。 このキーはブラウザやスマートフォンではなく、サーバーサイドのプロセスで使用されます。HTTP リファラー制限や Android/iOS 制限はすべて失敗します。
API の制限 → キーを制限 し、上記の API のみにチェックを入れます。制限のないキーは、プロジェクト上のすべての Google API に対して課金されるため、漏洩すると上限のないアカウントになります。
各 API の [割り当て] ページで、1日の割り当て上限も設定してください。Google は自身のエッジでこれを強制します。これが、クライアント側で何が実行されていても支出上限を確実に守る唯一の方法です。
ステップ 2a — スキルとしてインストールする
パッケージをビルドする
python3 skill/build.py # dist/google-maps.zip — no credential
python3 skill/build.py --with-key .env # also dist/google-maps-personal.zip2つのビルドがあります。claude.ai にはキーを保存する場所がないためです。環境変数を設定する場所も、永続的なホームディレクトリもないため、アップロードされたキーファイルは1回の会話でしか持続しません。パーソナルビルドはキーをスキル内にバンドルします。これは一度アップロードすれば永続的に使用できます。
ビルド | 内容 | アップロード先 |
| 認証情報なし | 共有する相手全員 |
| あなたのキー | 自分のアカウントのみ |
この利便性には実際のリスクが伴います。キーは Anthropic の標準的な保持ポリシーに従ってスキルアーティファクトに保存されます。そのため、2つは注意ではなく仕組みによって分離されています。異なるファイル名、パーソナルビルドの SKILL.md 内の共有禁止のバナー、*-personal.zip は書き込まれた場所で gitignore され、tests/test_skill_build.py は、ワーキングツリーにキーが存在する場合でも共有可能なビルドにキーが含まれていないことをアサートします。
claude.ai にインストールする
設定 → 機能 → スキル で、zip をアップロードします。
設定 → 機能 → コード実行 → ドメイン許可リスト で、次の6つを追加します。
geocode.googleapis.com places.googleapis.com routes.googleapis.com addressvalidation.googleapis.com airquality.googleapis.com maps.googleapis.com
ステップ2は必須であり、見落とされがちです。サンドボックスは管理されたプロキシを通じてインターネットにアクセスし、許可されたドメインのみが通れます。デフォルト設定(パッケージマネージャーのみ)では、キーがどんなに正しくても、すべての Maps 呼び出しが CONNECT トンネルで403エラーになって失敗します。
6つの名前付きホストは すべてのドメイン よりも優れています。その許可リストは、モデルが記述したコードを実行するサンドボックスとオープンインターネットの間の唯一の防御であり、1つのスキルを修正するためにこれをすべてに拡大すると、簡単には戻せない制御を消費することになります。ドメインごとのリストは組織レベルの機能です。あなたのプランが「すべてか無か」しか提供しない場合、それがあなたの目の前にあるトレードオフです。
サンドボックスが、スクリプトが通常は無視するプロキシを経由する場合、--use-proxy を追加するか、GOOGLE_MAPS_USE_PROXY=1 を設定してください。--use-proxy が存在する理由 を参照。
Claude Code にインストールする
cp -R skill/google-maps ~/.claude/skills/フルネットワークアクセス。許可リストは不要。
確認する
Claude にスキルのチェックを実行するよう依頼するか、自分で実行します。
python3 skill/google-maps/scripts/maps.py check --allKEY bundled with the skill (39 characters, fingerprint 28988599)
PROXY none in the environment; requests go direct
NETWORK reachable
OK Geocoding enabled
OK Places (New) enabled
...外部からは同じに見える3つの障害(キーなし、ルートなし、API がオフ)を区別し、キーの一部は出力しません。
ステップ 2b — MCP サーバーとしてインストールする
python3 -m venv .venv
.venv/bin/pip install --require-hashes -r requirements.lock
.venv/bin/pip install -e . --no-deps
cp .env.example .env && chmod 600 .env # then fill in GOOGLE_MAPS_API_KEYclaude mcp add google-maps -- /absolute/path/to/.venv/bin/google-maps-harness --env-file /absolute/path/to/.envキーはそのコマンドラインではなく、ファイルに記述します。-e で渡された値は ~/.claude.json とシェル履歴に保存され、どちらも所有者のみがアクセスできるわけではありません。サーバーは指定された .env 以外は読み取らないため、誤って読み込まれることはありません。
コードを変更した後はクライアントを再起動してください。登録されたプロセスは起動時にモジュールを読み込むため、再起動しないと古いコードが実行され続けます。
設定
キー以外のすべての設定はオプションです。スキルはコマンドラインフラグとして同じ選択肢を受け取ります。python3 scripts/maps.py --help で一覧表示されます。
変数 | デフォルト | 機能 |
| — | 必須。Maps Platform キー。 |
|
| リクエストごとの接続および読み取りタイムアウト。 |
|
| 1回のツール呼び出しが行う上流リクエスト数。 |
|
| 1回のツール呼び出しが上流で費やす実時間。 |
| 未設定 | あいまいな名前の優先順位を決定する2文字の地域コード。 |
|
| 場所の名前やルート案内の言語。 |
|
| 場所の検索でレビューや編集者による概要をリクエストできるようにする。 |
|
| スキルのみ。環境変数で指定されたプロキシを経由する。 |
コストを管理する
Google はリクエストごとに課金し、Places は要求する最も高価なフィールドに基づいて課金します。エージェントと請求書の間には3つの制御があります。
詳細度の階層で価格が決まる。 すべての Places ツールは
detailパラメータを受け取ります。essentials(住所と座標)、pro(名前と営業状況を追加)、enterprise(営業時間、評価、電話番号、ウェブサイトを追加)、atmosphere(レビューを追加)。エージェントは階層を指定し、フィールドマスクを自分で構成することはないため、こっそりとすべてを要求することはできません。atmosphere階層はデフォルトでオフ。 最も高価な階層であると同時に、見知らぬ人が書いた散文をモデルのコンテキストに引き込む階層です。意図的に有効にするか、まったく使用しないでください。すべての呼び出しにハードリミットあり。 上流リクエスト25回、30秒。各結果は
upstream_requestsを報告するため、呼び出しに費やされた金額は請求コンソールだけでなく、回答にも表示されます。
compute_route_matrix は、Google 自身の625ペアを大幅に下回る100の起点-終点ペアに制限されています。Google はペアごとにマトリックスを課金するためです。
セキュリティ体制
キーは1か所で保持。 トランスポートのみがキーを付加します。ツールやその他のモジュールがキーを扱うことはありません。スキルはさらに、キーをコマンドライン引数として受け取ることを拒否します。argv は
psで見え、シェル履歴に残るためです。送信されたものをリダイレクトできない。 リダイレクトは完全に拒否され、ソケットを開く前にホスト許可リストがチェックされます。これらの API のうち3つはクエリ文字列にキーを含むため、リダイレクトに従うと、課金可能な認証情報が見知らぬ人に渡ってしまいます。
すべてのエラーはスクラブされる。 キーはクライアントが構築される前に登録され、ツールから送出されるすべての例外は最初にスクラバーを通過します。
Google が返すすべての情報は信頼できないとラベル付けされる。 場所の名前、編集者による概要、レビュー、ルート案内は、事業主や一般の人々によって書かれています。すべての応答には、モデルに対してそのテキストをデータとして扱うよう警告するメッセージが含まれ、すべての文字列から制御文字が削除されます。
すべての引数はリクエストになる前に検証される。 座標は有限でなければなりません。JSON パーサーは、許可すると
NaNを渡します。プレイス ID は文字クラスに対して照合され、URL パスにパーセントエンコードされます。自由テキストは長さ制限があり、制御文字を拒否します。応答は二重に制限される: ソケットから最大4 MiB、モデルのコンテキストに最大96 KiB。
--use-proxy が存在する理由
プロキシ環境変数はデフォルトで無視されます。通常のマシンでは、このデフォルトがキーを保護します。そのような変数が1つあると、すべてのリクエストが他人の選択したホストを経由してしまうからです。
サンドボックスではそれが逆転します。管理された egress プロキシが唯一の出口である場合、それを無視しても何も保護されません。リクエストが決して外部に出ないことが保証されるだけです。そのため、選択は明示的に行われ、想定されるものではありません。そして、デフォルトでオフのままであるのは、それを必要とする環境が自身のことを認識しているからです。
それを有効にしても、2つのことは変わりません。ホスト許可リストはURLが構築される前に実行されるため、コードを新しい宛先に誘導することはできません。また、CONNECTトンネルによりプロキシはリクエストに関与しません。独自の認証局でTLSを終端するプロキシはキーを確認できますが、それは管理されたサンドボックス内であり、すでにコードを実行している同じ当事者です。しかし、想定するよりも知っておく価値があります。
これが意図的に行わないこと
書き込みはありません。 Google Maps Platformにはここで意味のある書き込み面はなく、これによって公開されるものもありません。
呼び出し元が指定するフィールドマスクはありません。 フィールドマスクはHTTPヘッダー値です。モデル出力から組み立てると、最初の改行を待つヘッダーインジェクションとなり、毎回の呼び出しで最も高価なフィールドを要求する方法になります。
ローカルの支出台帳はありません。 Google自身のAPIごとの日次上限がエッジで予算を強制し、クライアントで何が実行されていても有効です。それをローカルで複製すると、状態、ロック、そして真実を保つための2番目の数値が追加されます。
地図画像や静的タイルはありません。 それらはモデルが読み取れないバイトであり、そのURLにはキーが含まれています。
実行環境
Surface | Skill | MCP server |
Claude Code | はい、フルネットワーク | はい |
Claude Desktop | — | はい |
claude.ai | はい、ドメインが許可リストに追加されれば | いいえ — ローカルプロセスを起動できません |
Claude API container | いいえ — ネットワークアクセスなし、設定不可 | いいえ |
開発
.venv/bin/python -m unittest discover -s . -p "test_*.py"
.venv/bin/ruff check . && .venv/bin/ruff format --check . && .venv/bin/mypy --strict --exclude tests .テストはオフラインで実行されます。スイート内の何もソケットを開いたり、実際のキーを必要としません。フェイクトランスポートはリクエストがどうなっていたかを記録し、それによりテストはモックの呼び出し回数ではなく、実際のワイヤー上でアサートできます。
SkillはPython 3.9をターゲットとし、サーバーは3.11をターゲットとしています。なぜなら、Skillはこのプロジェクトが選択しないサンドボックスに出荷されるからです。CIはまさにその理由でSkillを3.9で実行します。かつてリンターがtimezone.utcを3.11専用のdatetime.UTCに書き換え、スイート(3.11と3.14で実行される)はそれを見つけられませんでした。
ライセンス
MIT.
Available Tools
13 toolsautocomplete_placesARead-only
Complete a partial place name or address into up to five candidates, each with a place id. Use this to pin down what the user meant before spending a search or a details lookup, and to turn a vague name into an id the other tools can use. The cheapest way to resolve a place.
Inputs: partial_text (required), latitude, longitude, radius_metres. Returns: object
compute_routeARead-only
Get the driving, walking, cycling, or transit route between two places, with total time, distance, and any warnings. Each endpoint is written one of three ways: 'place_id:ChIJ...' from a place search (most precise), '40.7580,-73.9855' as a coordinate pair, or plain text for Google to resolve as an address. Traffic is included on DRIVE and TWO_WHEELER. Set include_steps only when you need turn-by-turn text; it makes the response much larger.
Inputs: origin (required), destination (required), units, avoid_tolls, +7 more. Returns: object
compute_route_matrixARead-only
Get travel time and distance for every origin against every destination in one call — the comparison tool. Use it to pick the nearest branch, rank candidate sites by drive time, or check which of several suppliers is reachable inside a window. Each endpoint uses the same three forms as compute_route. Google bills this per pair, so origins times destinations is capped at 100.
Inputs: origins (required), destinations (required), avoid_tolls, travel_mode, +3 more. Returns: object
geocode_addressARead-only
Turn an address, a landmark name, or a plus code into coordinates, a normalized address, and its component parts (street, city, postal code, country). Use this before any tool that needs a latitude and longitude. Returns several candidates when the text is ambiguous.
Inputs: address (required), region_code. Returns: object
geocode_place_idARead-only
Look up the coordinates, normalized address, and address components of a place id returned by a place search. More precise than geocoding the place's name, and cheaper than a full details lookup when location is all you need.
Inputs: place_id (required). Returns: object
get_air_qualityARead-only
Get current air quality at a coordinate: the local and universal air quality index, the dominant pollutant and its concentration, and health guidance for the general population and for sensitive groups. Needs the Air Quality API enabled on the project, which is separate from the other Maps APIs.
Inputs: latitude (required), longitude (required). Returns: object
get_elevationARead-only
Get the elevation in metres above sea level at one point or at several. Pass coordinates as a list of 'lat,lng' strings, at most 50. Use it to judge terrain — how much a route climbs, whether a site is on a floodplain, how exposed a location is.
Inputs: coordinates (required). Returns: object
get_place_detailsARead-only
Read everything Google holds about one place: address, coordinates, opening hours, rating, price level, phone, and website. Takes a place id from a search or autocomplete. Set detail to control cost — enterprise is the tier that carries hours, ratings, and contact details; atmosphere adds reviews and may be disabled.
Inputs: place_id (required), detail. Returns: object
get_time_zoneARead-only
Get the time zone in force at a coordinate: its IANA id, its name, and its offset from UTC including daylight saving. Pass the moment you care about, because the offset changes across the year. Use this before reasoning about whether somewhere is open, or what local time a meeting lands at.
Inputs: latitude (required), longitude (required), timestamp (required). Returns: object
reverse_geocodeARead-only
Turn a latitude and longitude into the addresses at that point, from the exact street address outward to the neighbourhood, city, and country. Use this to describe where a coordinate is.
Inputs: latitude (required), longitude (required). Returns: object
search_places_by_textARead-only
Search for places by describing them in words — 'ramen near Union Square', 'hardware stores in Asheville NC', 'EV charging on I-81'. Returns up to 20 places per page and a token for the next page, to a maximum of 60 places. Set detail to control how much you get back and what it costs: essentials (address and coordinates), pro (adds names and business status), enterprise (adds ratings, hours, phone, and website), atmosphere (adds reviews and summaries; may be disabled).
Inputs: query (required), detail, rank_by, latitude, +6 more. Returns: object
search_places_nearbyARead-only
List places inside a circle, ranked by popularity or by distance from its centre. Use this when you have a point and want what is around it; use search_places_by_text when you can describe what you want. Up to 20 places, no paging. Filter by type with values such as restaurant, pharmacy, gas_station, hospital, or park.
Inputs: latitude (required), longitude (required), detail, rank_by, +3 more. Returns: object
validate_addressARead-only
Check whether a postal address is real and deliverable, and get back the corrected, standardized version plus a note of anything that was missing, unconfirmed, or inferred. Use this before relying on an address a user typed; use geocode_address instead when you only need coordinates.
Inputs: region_code (required), address_lines (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Most tools have clearly distinct purposes: geocoding tools separate address, coordinate, and place ID lookups; search tools differ by text query vs. nearby; compute_route vs. compute_route_matrix are well-differentiated. However, search_places_by_text and search_places_nearby could overlap in some use cases (e.g., 'restaurants near me' vs. a point), and the descriptions partially compensate.
Tool names follow a consistent verb_noun pattern throughout (e.g., geocode_address, search_places_by_text, compute_route, get_place_details). All names are descriptive and predictable, making it easy to infer what each tool does from its name alone.
With 13 tools, the set is well-scoped for a Google Maps MCP server. Each tool covers a distinct geographic or mapping function—geocoding, search, routing, elevation, time zone, air quality, validation—without unnecessary bulk. The count feels complete and not overwhelming.
The server covers a comprehensive set of mapping operations: geocoding (forward, reverse, place ID, validation), place search (text, nearby, autocomplete, details), routing (single and matrix), and supplemental data (elevation, time zone, air quality). A minor gap is the lack of a tool for displaying maps or static map images, but this is not core to the MCP paradigm.
Maintenance
Related MCP Connectors
Geocoding, routing, isochrones, traffic, weather, and place search for AI agents. 19 MCP tools.
Routing, geocoding, places, matrix and map tools for location-aware AI workflows.
The Google Maps MCP server is a fully-managed server provided by the Maps Grounding Lite API that connects AI applications to Google Maps Platform services. It provides three main tools for building LLM applications: searching for places, looking up weather information, and computing routes with details like distance and travel time. The server acts as a proxy that translates Google Maps data into a format that AI applications can understand, enabling agents to accurately answer real-world location and travel queries.
Place search, routes and spatial reasoning for AI agents, with real-world addresses.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables location-aware AI agents to search for nearby places, get detailed place information including hours and ratings, and calculate routes with turn-by-turn directions using Google Maps APIs.22MIT
- AlicenseBqualityBmaintenanceProvides 14 comprehensive tools for geocoding, navigation, and visual mapping using Google Maps APIs. It also offers detailed environmental data including weather forecasts, air quality indices, and solar irradiance for location-based analysis and trip planning.1410MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to access Google Maps services including places search, details, directions, geocoding, and nearby search through natural language.63MIT
- 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.113Apache 2.0