Connect to the Developer Knowledge MCP server

The Google Developer Knowledge MCP server gives AI-powered development tools the ability to search Google's official developer documentation and retrieve information for Google's products such as Firebase, Google Cloud, Android, Maps, and more. By connecting your AI application straight to our official library of documentation, it ensures the code and guidance you receive are up-to-date and based on authoritative context.

After you set up the server, integrated tools can assist with requests such as:

  • Implementation guidance

    • For example: What's the best way to implement push notifications using Firebase Cloud Messaging in an Android app?
  • Code generation and explanation

    • For example: Search the Google documentation for a Python example to list all buckets in a Cloud Storage project.
  • Troubleshooting and debugging

    • For example: Why is my Google Maps API key showing a 'For development purposes only' watermark?
  • Comparative analysis and summarization

    • For example: Help me choose between Cloud Run and Cloud Functions for a new microservice. Create a Markdown table that compares key aspects like primary use case, concurrency, and pricing model.

MCP server capabilities

The Google Developer Knowledge MCP server provides the following tools to your AI application:

Tool name Description
search_documents Searches Google's developer documentation (Firebase, Google Cloud, Android, Maps, and more) to find relevant pages and snippets for your query. Use get_documents with the parent from search results to get full page content.
get_documents Gets the full content of multiple documents using parents from search_documents results.
answer_query (Preview) Answers queries using the Developer Knowledge corpus for grounded generation.

The search_documents tool divides documentation into smaller chunks of text that are optimized for AI-powered search and retrieval. When you search, the tool returns one or more document snippets that are relevant to your query. If you need to view the full page content that surrounds a snippet, use get_documents with the parent provided in search results to retrieve full page content.

Use the answer_query tool when you want a direct answer to a question synthesized from the Developer Knowledge corpus, rather than a list of relevant snippets or full documents.

Installation

The Google Developer Knowledge MCP server is a remote MCP server that uses the Developer Knowledge API to search and retrieve documentation. You can authenticate using either OAuth or an API key.

Authenticate using OAuth

This section guides you through the process of authenticating your AI application with the Developer Knowledge MCP server using OAuth.

Prerequisite: Set up the Google Cloud CLI

Before proceeding, make sure you have:

Step 1: Enable the Developer Knowledge API in a project

  1. Open the Developer Knowledge API page in the Google APIs library.
  2. Check that you have the correct project selected in which you intend to use the API.
  3. Click Enable. No specific IAM roles are required to enable or use the API.

Step 2: Choose your authentication method

The authentication method you choose depends on whether your AI assistant supports Application Default Credentials (ADC) using the gcloud CLI or requires a standalone OAuth Client ID. Assistants like Gemini CLI can use your existing Google Cloud login for a seamless setup, while others, such as Antigravity, require you to manually create and provide your own credentials to establish a secure connection.

Select the tab that corresponds to your specific AI assistant's setup requirements.

ADC

Connect your account

  1. To grant the MCP server the ability to act on your behalf, run the following command, replacing PROJECT_ID with your Google Cloud project ID:

    gcloud auth application-default login
    --project=PROJECT_ID
    
  2. When prompted, choose an account, then click Continue.

Configure your AI application

Once authenticated, the final step is to provide your AI application with the server configuration details. While the exact JSON structure varies by application, you can use the following example as a template.

  1. To configure Gemini CLI or Gemini Code Assist, edit or create one of the following configuration files:

    • In your project: .gemini/settings.json
    • In your home directory: ~/.gemini/settings.json
    {
      "mcpServers": {
        "google-developer-knowledge": {
          "httpUrl": "https://developerknowledge.googleapis.com/mcp",
          "authProviderType": "google_credentials",
          "oauth": {
            "scopes": [
              "https://www.googleapis.com/auth/cloud-platform"
            ]
         },
          "timeout": 30000,
          "headers": {
            "X-goog-user-project": "PROJECT_ID"
          }
        }
      }
    }
    

    To check whether the MCP server is working as expected, continue on to verify installation.

Manual Credentials

Configure the OAuth consent screen

Configure the project's OAuth consent screen and add yourself as a test user. If you've already completed this step for your Google Cloud project, skip to the next step.

  1. Open the Google Cloud console Auth overview page, and click Get started.
  2. Enter an App name, select your Support email, and click Next.
  3. Within Audience, select External, and click Next.
  4. Enter your email address within Contact information, and click Next.
  5. Review and agree to the Google API Services: User Data Policy, and then click Continue.
  6. Click Create.

Add test users

  1. In the Google Auth Platform, click Audience.
  2. Under Test users, click Add users.
  3. Enter your email address and any other authorized test users, then click Save.

Create an OAuth client

To authenticate as an end user and access user data in your app, you need to create an OAuth 2.0 Client IDs. A client ID is used to identify a single app to Google's OAuth servers.

  1. In the Google Auth Platform, click Clients.
  2. Click Create client.
  3. From the Application type selector, choose Desktop app.
  4. In the Name field, type a name for the credential. This name is only shown in the Google Cloud console.
  5. Click Create. The OAuth client created screen appears, showing your new Client ID and Client secret.
  6. Click OK. The newly created credential appears under OAuth 2.0 Client IDs.
  7. Click your newly created client ID. In the Client secrets section, click the download icon to save the JSON file. You'll use the client_id and client_secret values in this file in a subsequent step.

Configure your AI application

Next, you need to provide your AI application with the server configuration details. While the exact series of steps varies by application, you can use the following example as a template.

To configure Antigravity to use the MCP server:

  1. In Antigravity, click the Additional options menu in the Agent pane > MCP Servers > Manage MCP Servers.
  2. At the top of the Manage MCP Servers pane that opens, click View raw config to edit the mcp_config.json file:

    {
      "mcpServers": {
        "google-developer-knowledge": {
          "serverUrl": "https://developerknowledge.googleapis.com/mcp"
        }
      }
    }
    
  3. Return to Manage MCP servers and click Refresh.

Add OAuth credentials

The first time you attempt to use the Developer Knowledge MCP server, your AI assistant will prompt you to complete setup:

  1. Ask the agent to use the Developer Knowledge MCP server with a prompt such as:

    How do I list Cloud Storage buckets?
    
  2. If you see a message asking you to register one or more redirect URIs, click the option to proceed. Because you set up the client ID as a Desktop app, there's no need to add these specific URIs in the Google Auth Platform.

  3. When your AI assistant prompts you for the Client ID and Client Secret, paste each corresponding key from the client secret JSON file you saved earlier.

  4. When prompted, choose an account, then click Continue.

  5. Return to your AI assistant. The agent will now process your request using the newly authenticated server.

Authenticate using an API key

This section guides you through the process of authenticating your AI application with the Developer Knowledge MCP server using an API key.

Step 1: Create an API key

You can generate a Developer Knowledge API key in your Google Cloud project using either the Google Cloud console or the gcloud CLI:

Google Cloud Console

Enable the API

  1. Open the Developer Knowledge API page in the Google APIs library.
  2. Check that you have the correct project selected in which you intend to use the API.
  3. Click Enable. No specific IAM roles are required to enable or use the API.

Create and secure the API key

  1. In the Google Cloud console for the project in which you enabled the API, go to the Credentials page.
  2. Click Create credentials, and then select API key from the menu.
  3. In the Name field, provide a name for the key.
  4. Click the Select API restrictions drop-down, and then type Developer Knowledge API. Click the result, and then click OK.
    • Note: If you just enabled the Developer Knowledge API, there may be a delay before it appears in the list. Wait a few minutes and try again.
  5. Click Create.

After the key is created, click Show key to view it. Make a note of it for use when configuring your AI application.

gcloud CLI

  1. If you haven't already, download and install the gcloud CLI.
  2. Enable the Developer Knowledge API, replacing PROJECT_ID with your Google Cloud project ID:

    gcloud services enable developerknowledge.googleapis.com --project=PROJECT_ID
    
  3. Create an API key using the same Google Cloud project ID:

    gcloud services api-keys create --project=PROJECT_ID --display-name="DK API Key"
    

    This command returns two values to make a note of:

  4. Restrict the key to the Developer Knowledge API, replacing KEY_NAME with the name of the key (for example, projects/my-project/locations/global/keys/12345-67890):

    gcloud services api-keys update KEY_NAME --api-target=service=developerknowledge.googleapis.com
    

Step 2: Enable the Developer Knowledge MCP server in a project

To enable the Developer Knowledge MCP server in your Google Cloud project, download and install the gcloud CLI, and then run the following command, replacing PROJECT_ID with your Google Cloud project ID:

gcloud beta services mcp enable developerknowledge.googleapis.com --project=PROJECT_ID

If the Developer Knowledge service isn't enabled for your Google Cloud project, you'll be prompted to enable the service before enabling the remote MCP server.

As a security best practice, we recommend that you enable MCP servers only for the services required for your AI application to function.

Step 3: Configure your AI application

Configure popular AI applications using these instructions. Replace YOUR_API_KEY with the Developer Knowledge API key you generated in the previous step:

Gemini CLI

To configure Gemini CLI, run the following command:

gemini mcp add -t http -H "X-Goog-Api-Key: YOUR_API_KEY" google-developer-knowledge https://developerknowledge.googleapis.com/mcp --scope user

Alternatively, edit or create one of the following configuration files:

  • In your project: .gemini/settings.json
  • In your home directory: ~/.gemini/settings.json
{
  "mcpServers": {
    "google-developer-knowledge": {
      "httpUrl": "https://developerknowledge.googleapis.com/mcp",
      "headers": {
        "X-Goog-Api-Key": "YOUR_API_KEY"
      }
    }
  }
}

Gemini Code Assist

To configure Gemini Code Assist, edit or create one of the following configuration files:

  • In your project: .gemini/settings.json
  • In your home directory: ~/.gemini/settings.json
{
  "mcpServers": {
    "google-developer-knowledge": {
      "httpUrl": "https://developerknowledge.googleapis.com/mcp",
      "headers": {
        "X-Goog-Api-Key": "YOUR_API_KEY"
      }
    }
  }
}

Claude Code

To configure Claude Code, run the following command under your app folder.

claude mcp add google-dev-knowledge --transport http https://developerknowledge.googleapis.com/mcp --header "X-Goog-Api-Key: YOUR_API_KEY"

Cursor

To configure Cursor, edit either .cursor/mcp.json (for a specific project) or ~/.cursor/mcp.json (for all projects).

{
  "mcpServers": {
    "google-developer-knowledge": {
      "url": "https://developerknowledge.googleapis.com/mcp",
      "headers": {
        "X-Goog-Api-Key": "YOUR_API_KEY"
      }
    }
  }
}

GitHub Copilot

To configure GitHub Copilot in VS Code for a single project, edit the .vscode/mcp.json file in your workspace.

{
  "servers": {
    "google-developer-knowledge": {
      "url": "https://developerknowledge.googleapis.com/mcp",
      "headers": {
        "X-Goog-Api-Key": "YOUR_API_KEY"
      }
    }
  }
}

To make the server available in every project, edit your user settings. Click the Open Settings (JSON) button.

{
  "mcp": {
    "servers": {
      "google-developer-knowledge": {
        "url": "https://developerknowledge.googleapis.com/mcp",
        "headers": {
          "X-Goog-Api-Key": "YOUR_API_KEY"
        }
      }
    }
  }
}

Windsurf

To configure Windsurf Editor, edit the ~/.codeium/windsurf/mcp_config.json file.

{
  "mcpServers": {
    "google-developer-knowledge": {
      "url": "https://developerknowledge.googleapis.com/mcp",
      "headers": {
        "X-Goog-Api-Key": "YOUR_API_KEY"
      }
    }
  }
}

Verify installation

Once configured, open your AI application and enter a prompt such as:

How do I list Cloud Storage buckets?

If you see a tool call to search_documents or another Developer Knowledge MCP server tool, the server is working correctly.

Manage token usage

Retrieving document content–especially when using batch_get_documents–consumes tokens within your AI application's context window. Because some Google developer documentation pages are quite large, fetching multiple documents can quickly lead to higher costs, slower model response times, and context window overflow.

To optimize performance and avoid an unexpected bill, craft specific prompts that target only the information you need. Avoid broad requests (for example, "Compare all Firebase products") that force the agent to ingest massive amounts of data at once.

Included documentation

See Corpus reference for information about which documents are searched by the server.

Known limitations

  • Content Scope: Only publicly visible pages on the Corpus reference are included. Content from other sources like GitHub, OSS sites, blogs, or YouTube is not included.
  • English-only results: The server only supports results in English.
  • Network-dependent: The server's tools rely on live Google Cloud services. If you experience persistent errors, check your internet connection and Developer Knowledge API key configuration.

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.

When Model Armor is enabled with logging enabled, Model Armor logs the entire payload. This might expose sensitive information in your logs.

Enable Model Armor

Follow the steps in Integrate with Google and Google Cloud MCP servers to enable 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 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

To stop Model Armor from automatically scanning traffic to and from Google MCP servers based on the project's floor settings, 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 project ID. Model Armor doesn't automatically apply the rules defined in this project's floor settings to any Google MCP server traffic.

Model Armor floor settings and general configuration can impact more than just MCP. Because Model Armor integrates with services like Vertex AI, any changes you make to floor settings can affect traffic scanning and safety behaviors across all integrated services, not just MCP.

Adjust Model Armor settings

If you're using Model Armor to protect your application, you might encounter 403 PERMISSION_DENIED errors for some queries. Because the Developer Knowledge MCP server only returns public documentation from trusted Google sources, we recommend setting Prompt Injection and Jailbreak (PIJB) filters to HIGH_AND_ABOVE confidence levels to reduce false positives. If your use case doesn't involve other tools that access private or sensitive data, you can also consider disabling PIJB filters.

Troubleshooting

If you encounter issues, verify the following: