使用 App Lifecycle Manager 遠端 MCP 伺服器

本文說明如何使用 App Lifecycle Manager 遠端 Model Context Protocol (MCP) 伺服器,連線至 Gemini CLI、ChatGPT、Claude 等 AI 應用程式,以及您正在開發的自訂應用程式。您可以透過 App Lifecycle Manager 遠端 MCP 伺服器,從 AI 應用程式管理 App Lifecycle Manager 資源,例如 SaaS、租戶和單元。啟用 App Lifecycle Manager API 時,系統會啟用 App Lifecycle Manager 遠端 MCP 伺服器。

Model Context Protocol (MCP) 可將大型語言模型 (LLM) 和 AI 應用程式/代理程式連結至外部資料來源的方式標準化。MCP 伺服器可讓您使用工具、資源和提示,從後端服務採取行動及取得更新資料。

本機和遠端 MCP 伺服器有何不同?

本機 MCP 伺服器
通常在本機執行,並使用標準輸入和輸出串流 (stdio) 在同一部裝置上的服務之間通訊。
遠端 MCP 伺服器
在服務的基礎架構上執行,並為 AI 應用程式提供 HTTP 端點,供 AI MCP 用戶端與 MCP 伺服器通訊。如要進一步瞭解 MCP 架構,請參閱 MCP 架構

如要瞭解 App Lifecycle Manager 本機 MCP 伺服器,請參閱「使用 App Lifecycle Manager 本機 MCP 伺服器」。

Google 和 Google Cloud 遠端 MCP 伺服器

Google 和 Google Cloud 遠端 MCP 伺服器具備下列功能和優勢:

  • 簡化集中式探索作業
  • 代管全域或區域 HTTP 端點
  • 精細授權
  • 使用 Model Armor 保護機制,選擇性確保提示詞和回覆安全無虞
  • 集中式稽核記錄

如要瞭解其他 MCP 伺服器,以及 Google Cloud MCP 伺服器適用的安全性與控管措施,請參閱 Google Cloud MCP 伺服器總覽

事前準備

  1. 登入 Google Cloud 帳戶。如果您是 Google Cloud新手,歡迎 建立帳戶,親自評估產品在實際工作環境中的成效。新客戶還能獲得價值 $300 美元的免費抵免額,可用於執行、測試及部署工作負載。
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Enable the App Lifecycle Manager API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  4. 安裝 Google Cloud CLI。

  5. 若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI

  6. 執行下列指令,初始化 gcloud CLI:

    gcloud init
  7. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  8. Enable the App Lifecycle Manager API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  9. 安裝 Google Cloud CLI。

  10. 若您採用的是外部識別資訊提供者 (IdP),請先使用聯合身分登入 gcloud CLI

  11. 執行下列指令,初始化 gcloud CLI:

    gcloud init

必要的角色

如要取得使用 App Lifecycle Manager MCP 伺服器所需的權限,請要求管理員在您要使用 App Lifecycle Manager MCP 伺服器的專案中,授予下列 IAM 角色:

如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和組織的存取權」。

這些預先定義的角色具備使用 App Lifecycle Manager MCP 伺服器所需的權限。如要查看確切的必要權限,請展開「Required permissions」(必要權限) 部分:

所需權限

如要使用 App Lifecycle Manager MCP 伺服器,必須具備下列權限:

  • 呼叫 MCP 工具: mcp.tools.call

您或許還可透過自訂角色或其他預先定義的角色取得這些權限。

驗證及授權

App Lifecycle Manager 遠端 MCP 伺服器會使用 OAuth 2.0 通訊協定搭配 Identity and Access Management (IAM) 進行驗證及授權。驗證 MCP 伺服器時,系統支援所有Google Cloud 身分

App Lifecycle Manager 遠端 MCP 伺服器不接受 API 金鑰。

建議您為使用 MCP 工具的代理商建立個別身分,以便控管及監控資源存取權。如要進一步瞭解驗證,請參閱「向 MCP 伺服器進行驗證」。

App Lifecycle Manager MCP OAuth 範圍

OAuth 2.0 會使用範圍和憑證,判斷經過驗證的主體是否獲得授權,可對資源執行特定動作。如要進一步瞭解 Google 的 OAuth 2.0 範圍,請參閱「使用 OAuth 2.0 存取 Google API」。

App Lifecycle Manager 具有下列 MCP 工具 OAuth 範圍:

gcloud CLI 的範圍 URI 說明
https://www.googleapis.com/auth/cloud-platform 可存取所有 Google Cloud 資源,包括 App Lifecycle Manager。

設定 MCP 用戶端,使用 App Lifecycle Manager MCP 伺服器

AI 應用程式和代理 (例如 Claude 或 Gemini CLI) 可以例項化 MCP 用戶端,連線至單一 MCP 伺服器。AI 應用程式可有多個連線至不同 MCP 伺服器的用戶端。如要連線至遠端 MCP 伺服器,MCP 用戶端必須知道遠端 MCP 伺服器的網址。

在 AI 應用程式中,尋找連線至遠端 MCP 伺服器的方法。系統會提示你輸入伺服器的詳細資料,例如名稱和網址。

如果是 App Lifecycle Manager MCP 伺服器,請輸入下列必要資訊:

  • 伺服器名稱:App Lifecycle Manager MCP 伺服器
  • 伺服器網址端點https://saasservicemgmt.googleapis.com/mcp
  • 傳輸:HTTP
  • 驗證詳細資料:視驗證方式而定,您可以輸入 Google Cloud 憑證、OAuth 用戶端 ID 和密鑰,或是代理程式身分和憑證。如要進一步瞭解驗證,請參閱「向 MCP 伺服器進行驗證」。
  • OAuth 範圍:連線至 App Lifecycle Manager MCP 伺服器時要使用的 OAuth 2.0 範圍

如需設定及連線至 MCP 伺服器的特定主機指南,請參閱下列內容:

如需更多一般指引,請參閱下列資源:

可用的工具

如要查看 App Lifecycle Manager MCP 伺服器的可用 MCP 工具詳細資料和說明,請參閱「App Lifecycle Manager MCP 參考資料」。

列出工具

使用 MCP 檢查器列出工具,或直接將 tools/list HTTP 要求傳送至 App Lifecycle Manager 遠端 MCP 伺服器。tools/list 方法不需要驗證。

POST /mcp HTTP/1.1
Host: saasservicemgmt.googleapis.com
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "method": "tools/list",
}

後續步驟