使用 App Lifecycle Manager 遠端 MCP 伺服器

本文說明如何使用 App Lifecycle Manager 遠端 Model Context Protocol (MCP) 伺服器,連結 Antigravity、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 架構」。

無狀態核心

在 MCP 2026-07-28 版中,MCP 從雙向有狀態通訊協定變更為無狀態通訊協定。每項 MCP 要求都包含自我描述,並可使用標頭轉送。由於每個要求都包含 HTTP 標頭或 _meta 參數中所需的所有資訊,因此不需要 initialize/initialized 握手或 Mcp-Session-Id。MCP 伺服器可透過多來回要求 (MRTR),要求工具所需的額外資訊。

為協助轉送及處理要求,而不剖析要求主體,必須提供部分 MCP 標頭,包括:

  • MCP 規格要求的標頭,例如通訊協定版本標頭和標準要求標頭。
  • MCP 伺服器定義的自訂標頭。這些標頭會使用 x-mcp-header 屬性,從工具的輸入結構定義鏡像至 HTTP 標頭。舉例來說,MCP 伺服器可能會定義自訂標頭,指定 Google Cloud 區域或專案 ID。

如要進一步瞭解 MCP 架構,請參閱 MCP 2026-07-28 版規格和主要異動。

如要瞭解 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, if it is not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

  4. Install the Google Cloud CLI.

  5. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  6. To initialize the gcloud CLI, run the following command:

    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, if it is not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    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) 進行驗證和授權。所有Google Cloud 身分都支援 MCP 伺服器驗證。

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 或 Antigravity) 可例項化 MCP 用戶端,連至單一 MCP 伺服器。AI 應用程式可以有多個用戶端,連線至不同的 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 方法不需要驗證。

curl -X POST https://saasservicemgmt.googleapis.com/TOOLSET_ENDPOINT \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'MCP-Protocol-Version: MCP_PROTOCOL_VERSION' \
    -H 'Mcp-Method: tools/list' \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "tools/list",
      "params": {
        "_meta": {
          "io.modelcontextprotocol/protocolVersion": "MCP_PROTOCOL_VERSION",
          "io.modelcontextprotocol/clientCapabilities": {
            "extensions": {
              "io.modelcontextprotocol/ui": {
                "mimeTypes": ["text/html;profile=mcp-app"]
              }
            }
          }
        }
      }
    }'

更改下列內容:

  • TOOLSET_ENDPOINT:服務名稱後方的 MCP 端點其餘部分。舉例來說,App Lifecycle Manager 的網址可能是 mcp/toolset-name。
  • MCP_PROTOCOL_VERSION:MCP 通訊協定版本。例如:2026-07-28。

後續步驟