Enable and disable MCP servers

Cloud API Registry lets you discover, govern, use, and monitor Model Context Protocol (MCP) servers and tools for your AI applications and agents.

An MCP server is an endpoint that exposes functionalities known as MCP tools. An MCP tool is a specific function or capability provided by an MCP server that an AI agent or application can invoke. You must first enable an MCP server before an MCP client can access its tools. For more information, see the Cloud API Registry overview.

This document shows you how to enable and disable MCP servers using the Google Cloud CLI.

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. Install the Google Cloud CLI.

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

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

    gcloud init
  5. Create or select 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.
    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  6. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

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

  8. Enable the Cloud API Registry and Service Usage APIs:

    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.

    gcloud services enable cloudapiregistry.googleapis.com serviceusage.googleapis.com
  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
  12. Create or select 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.
    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

  13. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

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

  15. Enable the Cloud API Registry and Service Usage APIs:

    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.

    gcloud services enable cloudapiregistry.googleapis.com serviceusage.googleapis.com
  16. The commands in this document default to the current project. For example, gcloud beta api-registry mcp enable SERVICE enables an MCP server for the current project.

    You can retrieve the current project ID:

    gcloud config list --format='text(core.project)'

    You can set the current project ID:

    gcloud config set project PROJECT_ID

Required roles

To get the permissions that you need to enable and disable MCP servers, ask your administrator to grant you the following IAM roles on your project:

  • Cloud API Registry Admin (roles/cloudapiregistry.admin)
  • Service Usage Admin (roles/serviceusage.serviceUsageAdmin)

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

You might also be able to get the required permissions through custom roles or other predefined roles.

Enable an MCP server

You can enable an MCP server for a Google service using the gcloud beta api-registry mcp enable command.

To enable an MCP server, run the following command:

gcloud beta api-registry mcp enable SERVICE

Replace SERVICE with the service whose MCP endpoint you want to enable—for example bigquery.googleapis.com.

You should receive a message indicating that the operation has completed successfully.

Disable an MCP server

You can disable an MCP server for a Google service using the gcloud beta api-registry mcp disable command.

To disable an MCP server, run the following command:

gcloud beta api-registry mcp disable SERVICE

Replace SERVICE with the service whose MCP endpoint you want to disable—for example bigquery.googleapis.com.

You should receive a message indicating that the operation has completed successfully.

What's next