Use the Cloud Run remote MCP server

The Cloud Run remote MCP server is enabled when you enable the Cloud Run Admin API.

Model Context Protocol (MCP) standardizes how large language models (LLMs) and AI applications or agents connect to external data sources. MCP servers let you use their tools, resources, and prompts to take actions and get updated data from their backend service.

What's the difference between local and remote MCP servers?

Local MCP servers
Typically run on your local machine and use the standard input and output streams (stdio) for communication between services on the same device.
Remote MCP servers
Run on the service's infrastructure and offer an HTTP endpoint to AI applications for communication between the AI MCP client and the MCP server. For more information about MCP architecture, see MCP architecture.

For information on the Cloud Run local MCP server, see Cloud Run MCP server on GitHub.

Google and Google Cloud remote MCP servers

Google and Google Cloud remote MCP servers have the following features and benefits:

  • Simplified, centralized discovery.
  • Managed global or regional HTTP endpoints.
  • Fine-grained authorization.
  • Optional prompt and response security with Model Armor protection.
  • Centralized audit logging.

For information about other MCP servers and information about security and governance controls available for Google Cloud MCP servers, see Google Cloud MCP servers overview.

You might want to use the Cloud Run local MCP server for the following reasons:

  • Local development and testing
  • Offline MCP use

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  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. Enable the Cloud Run 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

  7. Install and initialize the gcloud CLI.
  8. Update components:
    gcloud components update

Required roles

To get the permissions that you need to use the Cloud Run MCP server, ask your administrator to grant you the following IAM roles on the project where you want to use the Cloud Run MCP server:

For more information about granting roles, see Manage access to projects, folders, and organizations.

These predefined roles contain the permissions required to use the Cloud Run MCP server. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to use the Cloud Run MCP server:

  • Make MCP tool calls: mcp.tools.call
  • Get Cloud Run prompts: run.prompts.get
  • List Cloud Run services: run.services.list
  • Create new Cloud Run services: run.services.create
  • Download the container image of the Cloud Run service : artifactregistry.repositories.downloadArtifacts

You might also be able to get these permissions with custom roles or other predefined roles.

For a list of IAM roles and permissions that are associated with Cloud Run, see Cloud Run IAM roles and Cloud Run IAM permissions. If your Cloud Run service interfaces with Google Cloud APIs, such as Cloud Client Libraries, see the service identity configuration guide. For more information about granting roles, see deployment permissions and manage access.

Authentication and authorization

The Cloud Run remote MCP server uses the OAuth 2.0 protocol with Identity and Access Management (IAM) for authentication and authorization. All Google Cloud identities are supported for authentication to MCP servers.

The Cloud Run remote MCP server doesn't accept API keys.

We recommend that you create a separate identity for agents that are using MCP tools so that access to resources can be controlled and monitored. For more information about authentication, see Authenticate to MCP servers.

Cloud Run MCP OAuth scopes

OAuth 2.0 uses scopes and credentials to determine if an authenticated principal is authorized to take a specific action on a resource. For more information about OAuth 2.0 scopes at Google, read Using OAuth 2.0 to access Google APIs.

Cloud Run has the following MCP tool OAuth scopes:

Scope URI for gcloud CLI Description
https://www.googleapis.com/auth/run.readonly Only allows access to read data.
https://www.googleapis.com/auth/run Allows access to read and modify data.

Additional scopes might be required on the resources accessed during a tool call. To view a list of scopes required for Cloud Run, see Cloud Run Admin API.

Configure an MCP client to use the Cloud Run MCP server

AI applications and agents, such as Claude or Gemini CLI, can instantiate an MCP client that connects to a single MCP server. An AI application can have multiple clients that connect to different MCP servers. To connect to a remote MCP server, the MCP client must know the remote MCP server's URL.

In your AI application, look for a way to connect to a remote MCP server. You are prompted to enter details about the server, such as its name and URL.

For the Cloud Run MCP server, enter the following as required:

  • Server name: Cloud Run MCP server
  • Server URL or Endpoint: https://run.googleapis.com/mcp or https://run.REGION.rep.googleapis.com/mcp (Preview)
  • Transport: HTTP
  • Authentication details: Depending on how you want to authenticate, you can enter your Google Cloud credentials, your OAuth Client ID and secret, or an agent identity and credentials. For more information on authentication, see Authenticate to MCP servers.

For host-specific guidance about setting up and connecting to MCP server, see the following:

For more general guidance, see the following resources:

Available tools

To view details of available MCP tools and their descriptions for the Cloud Run MCP server, see the Cloud Run MCP reference.

Example use cases

The following are example use cases for the Cloud Run MCP server:

  • Let an agent deploy a Cloud Run service to a project.

  • Let an agent deploy vibe-coded apps on Cloud Run from source code or a zip file.

  • Get a list of Cloud Run services and service details by name, project, and region.

  • Deploy a public or private Cloud Run web service from a prebuilt Docker image from Artifact Registry or Docker Hub with a set of specific environment variables to a project and region.

Example prompts

You can use the following example prompts to get information about Cloud Run services and analyze the Cloud Run service logs:

  • "Deploy a private Cloud Run service named SERVICE_NAME from the Docker image us-docker.pkg.dev/cloudrun/container/hello to project PROJECT_ID."
  • "List the services in project PROJECT_ID."
  • "Find the details of a service that I deployed on project PROJECT_ID using the MCP server in the REGION region."

In the prompts, replace the following:

  • SERVICE_NAME: the name of the Cloud Run service
  • PROJECT_ID: the Google Cloud project ID
  • REGION: the name of the region

Use the /deploy prompt

You can use the /deploy prompt to quickly deploy a Cloud Run service using the Cloud Run MCP server. You might need to navigate your chatbot menu to find the necessary tool or prompt.

  • To deploy the current working directory to Cloud Run, run the following /deploy prompt:

    /deploy SERVICE_NAME \
      --project PROJECT_ID \
      --region REGION \
    

    Replace the following:

    • SERVICE_NAME: the name of the Cloud Run service
    • PROJECT_ID: the Google Cloud project ID
    • REGION: the name of the region

Optional security and safety configurations

MCP introduces new security risks and considerations due to the wide variety of actions that you can do with the MCP tools. To minimize and manage these risks, Google Cloud offers default settings and customizable policies to control the use of MCP tools in your Google Cloud organization or project.

For more information about MCP security and governance, see AI security and safety

Use Model Armor

Model Armor is a Google Cloud service designed to enhance the security and safety of your AI applications. It works by proactively screening LLM prompts and responses, protecting against various risks and supporting responsible AI practices. Whether you are deploying AI in your cloud environment, or on external cloud providers, Model Armor can help you prevent malicious input, verify content safety, protect sensitive data, maintain compliance, and enforce your AI safety and security policies consistently across your diverse AI landscape.

Model Armor is only available in specific regional locations. If Model Armor is enabled for a project, and a call to that project comes from an unsupported region, then Model Armor makes a cross-regional call. For more information, see Model Armor locations.

Enable Model Armor

You must enable Model Armor APIs before you can use Model Armor.

Console

  1. Enable the Model Armor 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

  2. Select the project where you want to activate Model Armor.

gcloud

Before you begin, follow these steps using the Google Cloud CLI with the Model Armor API:

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. Run the following command to set the API endpoint for the Model Armor service.

    gcloud config set api_endpoint_overrides/modelarmor "https://modelarmor.LOCATION.rep.googleapis.com/"

    Replace LOCATION with the region where you want to use Model Armor.

Configure protection for Google and Google Cloud remote MCP servers

To help protect your MCP tool calls and responses you can use Model Armor floor settings. A floor setting defines the minimum security filters that apply across the project. This configuration applies a consistent set of filters to all MCP tool calls and responses within the project.

Set up a Model Armor floor setting with MCP sanitization enabled. For more information, see Configure Model Armor floor settings.

See the following example command:

gcloud model-armor floorsettings update \
--full-uri='projects/PROJECT_ID/locations/global/floorSetting' \
--enable-floor-setting-enforcement=TRUE \
--add-integrated-services=GOOGLE_MCP_SERVER \
--google-mcp-server-enforcement-type=INSPECT_AND_BLOCK \
--enable-google-mcp-server-cloud-logging \
--malicious-uri-filter-settings-enforcement=ENABLED \
--add-rai-settings-filters='[{"confidenceLevel": "MEDIUM_AND_ABOVE", "filterType": "DANGEROUS"}]'

Replace PROJECT_ID with your Google Cloud project ID.

Note the following settings:

  • INSPECT_AND_BLOCK: The enforcement type that inspects content for the Google MCP server and blocks prompts and responses that match the filters.
  • ENABLED: The setting that enables a filter or enforcement.
  • MEDIUM_AND_ABOVE: The confidence level for the Responsible AI - Dangerous filter settings. You can modify this setting, though lower values might result in more false positives. For more information, see Model Armor confidence levels.

Disable scanning MCP traffic with Model Armor

If you want to stop scanning Google MCP traffic with Model Armor, run the following command:

gcloud model-armor floorsettings update \
  --full-uri='projects/PROJECT_ID/locations/global/floorSetting' \
  --remove-integrated-services=GOOGLE_MCP_SERVER

Replace PROJECT_ID with the Google Cloud project ID.

Model Armor won't scan MCP traffic in the project.

Control MCP use with IAM deny policies

Identity and Access Management (IAM) deny policies help you secure Google Cloud remote MCP servers. Configure these policies to block unwanted MCP tool access.

For example, you can deny or allow access based on:

  • The principal
  • Tool properties like read-only
  • The application's OAuth client ID

For more information, see Control MCP use with Identity and Access Management.

What's next