說明
Google 地圖平台 Code Assist 工具包是 Model Context Protocol (MCP) 伺服器,可根據官方最新文件和程式碼範例,提升用於開發 Google 地圖平台應用程式的大型語言模型 (LLM) 回覆品質。
由於 MCP 伺服器會在系統提示模型時存取內容,因此 LLM 的 Google 地圖平台相關脈絡不必受限於模型訓練日期可用的資料。
MCP 伺服器可存取的 Google 地圖平台資源包括:
- Google 地圖平台說明文件
- Google 地圖平台服務條款
- Google 地圖平台安全防護中心
- Google 地圖平台官方 GitHub 機構中的程式碼存放區
提供的工具
MCP 伺服器會為 AI 用戶端公開下列工具:
retrieve-instructions:用戶端使用的輔助工具,可取得重要系統指令,瞭解如何以最佳方式推斷使用者意圖,並有效呼叫retrieve-google-maps-platform-docs工具。retrieve-google-maps-platform-docs:主要工具。這項服務會接收自然語言查詢,並提交至代管的檢索增強生成 (RAG) 引擎。RAG 引擎會搜尋最新版本的 Google 地圖平台官方文件、教學課程和程式碼範例,將相關脈絡傳回 AI,生成準確的回覆。
支援的 MCP 傳輸方式
這個伺服器支援兩種標準 MCP 通訊協定:
stdio:這是用戶端透過command叫用伺服器時使用的預設傳輸方式。它會透過標準輸入/輸出串流進行通訊,因此非常適合在本機執行指令列。Streamable HTTP:伺服器會公開接受 POST 要求的/mcp端點。這是透過url連線的用戶端所使用的標準,適用於遠端伺服器連線。我們的實作方式支援串流,可提供即時互動式回覆。
用量
您可以在本機開發電腦上執行 Code Assist MCP 伺服器,也可以在 Google Cloud Run 上遠端執行。
需求條件
如要使用 Google 地圖平台程式碼輔助工具包,您需要安裝 Node.js (建議使用 LTS 版本) 和 npm 的環境,才能複製及執行伺服器,並使用 MCP 用戶端存取伺服器。
使用 Code Assist 做為本機 MCP 伺服器,並透過 stdio 傳輸 (建議)
在本機執行伺服器,並使用 stdio 通訊協定連線至用戶端,以便搭配 AI 輔助 IDE (例如 VS Code、Android Studio、Cursor) 或桌面 AI 應用程式 (例如 Gemini CLI) 使用。這是最簡單且最常見的設定。
設定用戶端
將伺服器新增至偏好 AI 用戶端的 MCP 設定檔。請在下方找到您的用戶端,查看經過驗證的具體操作說明。
-
Gemini Code Assist 和 Gemini CLI
- 方法 1 - 直接從指令列新增伺服器 (假設您已安裝 Gemini CLI):
gemini mcp add google-maps-platform-code-assist npx -y @googlemaps/code-assist-mcp@latest- 執行
gemini mcp list驗證安裝。
- 執行
- 方法 2 - 安裝 Code Assist 做為 Gemini CLI 擴充功能,並使用靜態前置字元、MCP 工具和基本 Google 地圖主題:
gemini extensions install https://github.com/googlemaps/platform-ai.git - 方法 3 - 手動將 MCP 伺服器設定新增至
~/.gemini/settings.json檔案。
{ "mcpServers": { "google-maps-platform-code-assist": { "command": "npx", "args": ["-y", "@googlemaps/code-assist-mcp@latest"] } } } - 方法 1 - 直接從指令列新增伺服器 (假設您已安裝 Gemini CLI):
-
- 方法 1 - 直接從指令列新增伺服器 (假設您已安裝 Claude Code):
claude mcp add google-maps-platform-code-assist -- npx -y @googlemaps/code-assist-mcp@latest- 執行
claude mcp list驗證安裝。 - Windows 使用者:在原生 Windows (非 WSL) 上,您必須使用
cmd /c包裝函式,npx指令才能正常運作。
claude mcp add google-maps-platform-code-assist -- cmd /c "npx -y @googlemaps/code-assist-mcp@latest" - 執行
- 方法 2 - 手動將伺服器新增至 Claude 設定檔
~/.claude.json
"mcpServers": { "google-maps-platform-code-assist": { "command": "npx", "args": [ "-y", "@googlemaps/code-assist-mcp@latest" ] } } - 方法 1 - 直接從指令列新增伺服器 (假設您已安裝 Claude Code):
-
<-- If you already have Cursor installed, click here to install Google Maps Platform Code Assist MCP directly.
- 如果沒有,請將該段落新增至工作區的
.cursor-settings/mcp.json檔案。
{ "mcpServers": { "google-maps-platform-code-assist": { "command": "npx", "args": ["-y", "@googlemaps/code-assist-mcp@latest"] } } } -
{ "mcpServers": { "google-maps-platform-code-assist": { "command": "npx", "args": ["-y", "@googlemaps/code-assist-mcp@latest"] } } } -
- 建立
mcp.json檔案,並放在 Android Studio 的設定目錄中。將 Code Assist 伺服器新增至清單:
{ "mcpServers": { "google-maps-platform-code-assist": { "command": "npx", "args": ["-y", "@googlemaps/code-assist-mcp@latest"] } } } - 建立
-
- 方法 1:使用 Cline MCP GUI 安裝
- 方法 2:使用 Cline MCP 設定檔手動 / 以程式輔助方式安裝。設定檔位於:
- macOS:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Windows:
%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Linux:
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - 在
cline_mcp_settings.json中將下列項目新增至 MCP 設定:{ "mcpServers": { "google-maps-platform-code-assist": { "command": "npx", "args": ["-y", "@googlemaps/code-assist-mcp@latest"], "alwaysAllow": [ "retrieve-instructions", "retrieve-google-maps-platform-docs" ] } } }
- macOS:
-
- 方法 1:使用 Roo MCP GUI 安裝
- 方法 2:使用 Roo Code 設定檔手動 / 以程式輔助方式安裝。設定檔位於:
- macOS:
~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json - Windows:
%APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\mcp_settings.json - Linux:
~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json - 在
mcp_settings.json中將下列項目新增至 MCP 設定:{ "mcpServers": { "google-maps-platform-code-assist": { "command": "npx", "args": ["-y", "@googlemaps/code-assist-mcp@latest"], "alwaysAllow": [ "retrieve-instructions", "retrieve-google-maps-platform-docs" ] } } }
- macOS:
-
-
在「代理程式」模式中,依序點選「工具」、「設定工具」頂端標題和「從 NPM 套件名稱安裝」(請參閱下方的螢幕截圖)
-
-
-
-
輸入套件名稱
@googlemaps/code-assist-mcp並按下 Enter 鍵,接受安裝並使用預設的 3000 埠,然後最後一次按下 Enter 鍵確認變更 -
-
-
- 與上述 Cursor 指令類似。
-
- 與上述 Cline 和 Roo 程式碼的操作說明類似
瞭解詳情
如要進一步瞭解如何安裝及使用工具包,以及使用條款,請參閱 GitHub 存放區的 README。