Cloud Run リモート MCP サーバーを使用する

Cloud Run Admin API を有効にすると、Cloud Run リモート MCP サーバーが有効になります。

Model Context Protocol(MCP)により、大規模言語モデル(LLM)と AI アプリケーション(エージェント)が外部のデータソースに接続する方法が標準化されます。MCP サーバーを使用すると、そのツール、リソース、プロンプトを使用してアクションを実行し、バックエンド サービスから更新されたデータを取得できます。

ローカル MCP サーバーとリモート MCP サーバーの違いは何ですか?

ローカル MCP サーバー
通常はローカルマシンで実行され、同じデバイス上のサービス間の通信に標準の入力ストリームと出力ストリーム(stdio)を使用します。
リモート MCP サーバー
サービスのインフラストラクチャで実行され、AI MCP クライアントと MCP サーバー間の通信用に AI アプリケーションに HTTP エンドポイントを提供します。MCP アーキテクチャの詳細については、MCP アーキテクチャをご覧ください。

Cloud Run ローカル MCP サーバーについては、GitHub の Cloud Run MCP サーバーをご覧ください。

Google と Google Cloud リモート MCP サーバー

Google と Google Cloud リモート MCP サーバーには、次の機能とメリットがあります。

  • 簡素化された一元的な検出
  • マネージド グローバルまたはリージョン HTTP エンドポイント
  • きめ細かい認可
  • Model Armor 保護によるプロンプトとレスポンスのセキュリティ(オプション)
  • 一元的な監査ロギング

他の MCP サーバーと、Google Cloud MCP サーバーで使用可能なセキュリティとガバナンスの制御については、Google Cloud MCP サーバーの概要をご覧ください。

Cloud Run ローカル MCP サーバーを使用する理由は次のとおりです。

  • ローカルで開発とテストを行う
  • オフラインでの MCP の使用

始める前に

  1. Google Cloud アカウントにログインします。 Google Cloudを初めて使用する場合は、 アカウントを作成して、実際のシナリオでの Google プロダクトのパフォーマンスを評価してください。新規のお客様には、ワークロードの実行、テスト、デプロイができる無料クレジット $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. Verify that billing is enabled for your Google Cloud project.

  4. 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

  5. Verify that billing is enabled for your Google Cloud project.

  6. Cloud Run API を有効にします。

    API を有効にするために必要なロール

    API を有効にするには、serviceusage.services.enable 権限が必要です。プロジェクトを作成した場合は、オーナーロール(roles/owner)を介してこの権限がすでに付与されている可能性があります。それ以外の場合は、Service Usage 管理者ロール(roles/serviceusage.serviceUsageAdmin)を介してこの権限を取得できます。ロールを付与する方法をご覧ください。

    API の有効化

  7. gcloud CLI をインストールして初期化します
  8. コンポーネントを更新します。
    gcloud components update