Skip to main content
Glama
contentkueche

Google Ads MCP Server

Google Ads MCP Server

This repo contains the source code for running an MCP server that interacts with the Google Ads API.

Tools

The server uses the Google Ads API to provide several Tools and Resources for use with LLMs and AI agents.

Tools available

  • search: Retrieves information about the Google Ads account.

  • get_resource_metadata: Retrieves metadata about a Google Ads API resource type, for example "campaign". This is useful to understand the structure of the data and what fields are available for querying.

  • list_accessible_customers: Returns ids of customers directly accessible by the user authenticating the call.

  • audit_budget_pitfalls: Audits campaign budgets for shared budgets, spend without conversions, possible daily overdelivery, and projected monthly spend above a caller-provided cap.

  • update_campaign_status: Updates a campaign status to ENABLED or PAUSED. Defaults to validate-only mode.

  • update_campaign_budget: Updates a campaign average daily budget with guardrails for shared budgets, max daily budget caps, monthly 30.4x spend caps, and budget increases. Defaults to validate-only mode.

  • create_campaign_budget: Creates a guarded average daily campaign budget.

  • create_search_campaign: Creates a paused Search campaign against an existing budget after checking budget guardrails.

  • create_ad_group: Creates a Search standard ad group under a campaign.

  • create_keywords: Creates keyword criteria under an ad group.

  • create_responsive_search_ad: Creates a responsive search ad under an ad group.

  • create_search_campaign_bundle: Creates a complete Search campaign structure atomically with a non-shared budget, campaign, ad group, optional targeting criteria, optional keywords, and one responsive search ad.

By default, tool namespaces are enabled, so MCP clients expose these as budget_audit_budget_pitfalls, writes_update_campaign_status, and writes_update_campaign_budget, plus the writes_create_* tools listed above.

Configuring and Namespacing Tools

The Google Ads MCP server uses the tools_config.yaml to let you selectively enable or disable individual tools or tool categories (namespaces) and customize their namespace prefixes.

A default tools_config.yaml with all tools enabled is bundled with the package, so the server works out of the box with no extra setup. To customize your installation, the server resolves the configuration in the following order:

  1. An explicit path set via the GOOGLE_ADS_MCP_TOOLS_CONFIG environment variable.

  2. A tools_config.yaml file in the current working directory.

  3. The default tools_config.yaml bundled with the package.

If an explicitly requested configuration file (via the environment variable) is missing, or any resolved file is invalid, the server raises an error and fails to start.

Configuration Example:

namespaces:
  # Option 1: Enable category 'customers' with default prefix -> "customers_list_accessible_customers"
  customers: true

  # Option 2: Enable category 'search' with a custom prefix -> "query_search"
  search: "query"

  # Option 3: Fine-grained control over tools in a category
  metadata:
    enabled: true
    prefix: "metadata"
    enabled_tools:
      - get_resource_metadata: true

  # Option 4: Disable live-write-capable tools while keeping budget audits
  budget: true
  writes: false

Write Safety Model

The Google Ads API OAuth scope is https://www.googleapis.com/auth/adwords; there is no separate read-only OAuth scope. This server limits write risk at the MCP tool layer:

  • Write tools default to dry_run=true, which sends Google Ads mutate requests with validate_only=true.

  • Real writes require dry_run=false and confirm_write=true.

  • Campaign status writes are limited to ENABLED and PAUSED.

  • Budget writes require max_daily_budget_amount_micros.

  • Budget increases additionally require confirm_budget_increase=true, must stay within max_increase_percent, and must not exceed max_daily_budget_amount_micros.

  • If monthly_spend_cap_amount_micros is provided, budget writes are blocked when the target daily budget could exceed roughly 30.4x that monthly cap.

  • Explicitly shared budgets are blocked unless allow_shared_budget=true, because a shared budget can affect multiple campaigns.

  • Campaign creation tools default all newly-created serving entities to PAUSED.

  • create_search_campaign_bundle uses GoogleAdsService.Mutate with temporary resource names, so the budget, campaign, ad group, criteria, keywords, and ad validate or create as a single dependent structure.

  • Responsive search ad creation requires at least three headlines, two descriptions, and one final URL before the API call is attempted.

  • Search campaign creation requires an explicit EU political advertising declaration via contains_eu_political_advertising; the default is DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING.

For recurring optimization jobs, start with audit_budget_pitfalls and validate-only write calls. Only enable confirmed writes after reviewing the first reports and setting explicit account-level caps.

Resources available

  • discovery-document: Retrieve the Google Ads API discovery document. Provides the discovery document for the latest version of the Google Ads API, which describes the API surface, including resources, methods, and schemas. Host LLMs should access this resource to understand the structure of the Google Ads API and discover available features.

  • metrics: Retrieve information about the metrics available for reporting in the Google Ads API.

  • segments: Retrieve information about the segments available for reporting in the Google Ads API.

  • release-notes: Retrieve the release notes for the latest version of the Google Ads API.

Related MCP server: Google Ads MCP Server

Notes

  1. The MCP Server will expose your data to the Agent or LLM that you connect to it.

  2. If you have technical issues, please use the GitHub issue tracker.

  3. To help us collect usage data, you will notice an extra header has been added to your API calls: this data is used to improve the product.

Setup instructions

Setup involves the following steps:

  1. Configure Python.

  2. Configure Developer Token.

  3. Enable APIs in your project

  4. Configure Credentials.

  5. Configure your MCP client.

Configure Python

Install pipx.

Configure Developer Token

Follow the instructions for Obtaining a Developer Token.

Your developer token must have at least Explorer access to query production accounts. New tokens may be automatically upgraded to Explorer access; if not, you can apply through the API Center. See the access levels documentation for details.

If you see the error "The developer token is only approved for use with test accounts", your token does not yet have access to production accounts. See the access levels documentation for how to request the access level you need.

Enable APIs in your project

Follow the instructions to enable the following APIs in your Google Cloud project:

Configure Credentials

Option 1: Using FastMCP OAuth Proxy

The server supports FastMCP's OAuth proxy feature for dynamic user authentication. This is useful when running the server as a web service.

To enable it, set the following environment variables:

  • GOOGLE_ADS_MCP_OAUTH_CLIENT_ID: Your Google Cloud OAuth 2.0 Client ID.

  • GOOGLE_ADS_MCP_OAUTH_CLIENT_SECRET: Your Google Cloud OAuth 2.0 Client Secret.

  • GOOGLE_ADS_MCP_BASE_URL: (Optional) The base URL where the server is accessible (defaults to http://localhost:8080).

  • GOOGLE_ADS_MCP_ALLOWED_REDIRECT_URIS: (Optional) Comma-separated redirect URI patterns for MCP OAuth clients. Defaults to ChatGPT connector callbacks and loopback client callbacks.

  • GOOGLE_ADS_MCP_ALLOW_MISSING_OAUTH_CLIENTS: (Optional) Set to false to disable recovery for clients whose Dynamic Client Registration state was lost after a deploy. Recovery still validates redirects against GOOGLE_ADS_MCP_ALLOWED_REDIRECT_URIS.

Once this is enabled, you can authenticate to the API through your MCP client: for example, in Gemini CLI, the command /mcp auth google-ads-mcp triggers the authentication flow.

When these variables are set, the server automatically switches to the streamable-http transport (SSE/HTTP) instead of stdio.

You will need to run the server as a separate process and configure your MCP client to connect to the SSE endpoint (e.g., http://localhost:8080/mcp).

For direct Python FastMCP client scripts, use the bundled persistent OAuth helper instead of auth="oauth". FastMCP's bare OAuth shortcut stores tokens in memory; the helper below stores OAuth tokens and dynamic client registration data on disk, using SHA-256-hashed filenames for URL-derived keys:

import anyio

from ads_mcp.fastmcp_client import create_google_ads_mcp_client


async def main():
    async with create_google_ads_mcp_client(
        "https://ck-google-ads-mcp.onrender.com/mcp"
    ) as client:
        tools = await client.list_tools()
        print([tool.name for tool in tools])


anyio.run(main)

By default the token store is created in the user's application state directory, for example ~/Library/Application Support/google-ads-mcp/oauth on macOS. Override it with GOOGLE_ADS_MCP_CLIENT_TOKEN_STORE=/path/to/oauth-store. If the browser callback needs a stable port, set GOOGLE_ADS_MCP_CLIENT_CALLBACK_PORT=8765.

Option 2: Configure credentials using Application Default Credentials

Configure your Application Default Credentials (ADC). Make sure the credentials are for a user with access to your Google Ads accounts or properties.

Credentials must include the Google Ads API scope:

https://www.googleapis.com/auth/adwords

Check out Manage OAuth Clients for how to create an OAuth client.

Here are some sample gcloud commands you might find useful:

  • Set up ADC using user credentials and an OAuth desktop or web client after downloading the client JSON to YOUR_CLIENT_JSON_FILE.

    gcloud auth application-default login \
      --scopes https://www.googleapis.com/auth/adwords,https://www.googleapis.com/auth/cloud-platform \
      --client-id-file=YOUR_CLIENT_JSON_FILE
  • Set up ADC using service account impersonation.

    gcloud auth application-default login \
      --impersonate-service-account=SERVICE_ACCOUNT_EMAIL \
      --scopes=https://www.googleapis.com/auth/adwords,https://www.googleapis.com/auth/cloud-platform

When the gcloud auth application-default command completes, copy the PATH_TO_CREDENTIALS_JSON file location printed to the console in the following message. You will need this for a later step!

Credentials saved to file: [PATH_TO_CREDENTIALS_JSON]

Option 3: Configure credentials using the Google Ads API Python client library.

Follow the instructions to setup and configure the Google Ads API Python client library

If you have already done this and have a working google-ads.yaml , you can reuse this file!

In the utils.py file, change get_googleads_client() to use the load_from_storage() method.

Configure your MCP client

Add the server to your MCP client's configuration. Below are examples for popular clients.

Gemini CLI / Gemini Code Assist

  1. Install Gemini CLI or Gemini Code Assist.

  2. Create or edit the file at ~/.gemini/settings.json, adding your server to the mcpServers list.

  • Option 1: Using FastMCP OAuth Proxy (Streamable HTTP)

    You can run the server as a separate process and configure your MCP client to connect to the SSE endpoint (e.g., http://localhost:8080/mcp). This also allows using FastMCP's OAuth proxy feature for dynamic user authentication.

    {
      "mcpServers": {
        "google-ads-mcp": {
          "httpUrl":"http://localhost:8080/mcp",
          "env": {
            "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID",
            "GOOGLE_ADS_DEVELOPER_TOKEN": "YOUR_DEVELOPER_TOKEN"                        
          }
        }
      }
    }
  • Option 2: the Application Default Credentials method

    Replace PATH_TO_CREDENTIALS_JSON with the path you copied in the previous step.

    We also recommend that you add a GOOGLE_CLOUD_PROJECT attribute to the env object. Replace YOUR_PROJECT_ID in the following example with the project ID of your Google Cloud project.

    {
      "mcpServers": {
        "google-ads-mcp": {
          "command": "pipx",
          "args": [
            "run",
            "--spec",
            "git+https://github.com/googleads/google-ads-mcp.git",
            "google-ads-mcp"
          ],
          "env": {
            "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
            "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID",
            "GOOGLE_ADS_DEVELOPER_TOKEN": "YOUR_DEVELOPER_TOKEN"
          }
        }
      }
    }
  • Option 3: the Python client library method

    {
      "mcpServers": {
        "google-ads-mcp": {
          "command": "pipx",
          "args": [
            "run",
            "--spec",
            "git+https://github.com/googleads/google-ads-mcp.git",
            "google-ads-mcp"
          ],
          "env": {
            "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID",
            "GOOGLE_ADS_DEVELOPER_TOKEN": "YOUR_DEVELOPER_TOKEN"
          }
        }
      }
    }

Login Customer Id

If your access to the customer account is through a manager account, you will need to add the customer ID of the manager account to the settings file.

See here for details.

The final file will look like this:

{
  "mcpServers": {
    "google-ads-mcp": {
      "command": "pipx",
      "args": [
        "run",
        "--spec",
        "git+https://github.com/googleads/google-ads-mcp.git",
        "google-ads-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID",
        "GOOGLE_ADS_DEVELOPER_TOKEN": "YOUR_DEVELOPER_TOKEN",
        "GOOGLE_ADS_LOGIN_CUSTOMER_ID": "YOUR_MANAGER_CUSTOMER_ID"
      }
    }
  }
}

Other MCP clients (Claude Code, Cursor, VS Code, etc.)

The mcpServers block format is the same across all MCP clients. Add the configuration shown above to the appropriate settings file for your client (e.g., ~/.claude/settings.json for Claude Code, .cursor/mcp.json for Cursor, .vscode/mcp.json for VS Code with Copilot).

Deployment to Google Cloud Platform

Instead of hosting this MCP server locally, you can host it on Google Cloud Run or on any other cloud-based infrastructure. This is useful if you want to share the server across different agents or run it as a web service.

Note that this only supports authentication with an OAuth Client ID and Client Secret pair through the OAuth proxy (Option #1 above).

Prerequisites

  1. A Google Cloud project.

  2. The gcloud CLI installed, authenticated, and active project set.

    gcloud config set project YOUR_PROJECT_ID

Step 1: Build and Push Docker Image

You can use Cloud Build to build and push the image to Artifact Registry without needing Docker installed locally.

  1. Create a repository in Artifact Registry:

    gcloud artifacts repositories create mcp-servers --repository-format=docker --location=us-central1
  2. Build and submit the image:

    gcloud builds submit --tag us-central1-docker.pkg.dev/YOUR_PROJECT_ID/mcp-servers/google-ads-mcp:latest .

    Replace YOUR_PROJECT_ID with your Google Cloud project ID.

Step 2: Deploy to Google Cloud Run

Make sure to set the required environment variables:

  • GOOGLE_PROJECT_ID: Your Google Cloud project ID.

  • GOOGLE_ADS_DEVELOPER_TOKEN: The developer token you want the MCP server to use (see above).

  • GOOGLE_ADS_MCP_OAUTH_CLIENT_ID: The OAuth Client ID you want the MCP server to use.

  • GOOGLE_ADS_MCP_OAUTH_CLIENT_SECRET: The OAuth Client secret you want the MCP server to use.

  • GOOGLE_ADS_MCP_BASE_URL: The base URL where your MCP server is accessible: this will be automatically assigned by Google Cloud Run after your first deployment. You can update the environment variables after deployment.

  • FASTMCP_HOST: Set this to 0.0.0.0 to allow FastMCP to accept connections from all IP addresses.

gcloud run deploy google-ads-mcp \
  --image us-central1-docker.pkg.dev/YOUR_PROJECT_ID/mcp-servers/google-ads-mcp:latest \
  --platform managed \
  --region us-central1 \
  --allow-unauthenticated \
  --set-env-vars="GOOGLE_PROJECT_ID=YOUR_PROJECT_ID,GOOGLE_ADS_DEVELOPER_TOKEN=YOUR_DEVELOPER_TOKEN,GOOGLE_ADS_MCP_OAUTH_CLIENT_ID=YOUR_CLIENT_ID,GOOGLE_ADS_MCP_OAUTH_CLIENT_SECRET=YOUR_CLIENT_SECRET,GOOGLE_ADS_MCP_BASE_URL=YOUR_BASE_URL,FASTMCP_HOST=0.0.0.0"

Step 3: Configure MCP Client

Once deployed, update your MCP client configuration (e.g., ~/.gemini/settings.json) to use the Cloud Run URL.

{
  "mcpServers": {
    "google-ads-mcp": {
      "httpUrl": "https://your-cloud-run-url.a.run.app/mcp"
    }
  }
}

Try it out

Launch your MCP client. You should see google-ads-mcp listed in the available servers.

Here are some sample prompts to get you started:

  • Ask what the server can do:

    what can the ads-mcp server do?
  • Ask about customers:

    what customers do I have access to?
  • Ask about campaigns

    How many active campaigns do I have?
    How is my campaign performance this week?

Note about Customer ID

Your agent will need and ask for a customer id for most prompts. If you are moving between multiple customers, including the customer ID in the prompt may be simpler.

How many active campaigns do I have for customer id 1234567890

Skills

This repository also provides Agent Skills, which are specialized workflows and instructions that give AI agents specific expertise.

Skills available

  • account-performance-diagnostics: Diagnose account performance issues such as conversion loss, low lead flow, and lost opportunities. Located in ads_mcp/skills/account-performance-diagnostics.

How to install skills

To use these skills, you need to point your skills-compatible AI agent to the skill directory.

For example, if you are using Gemini CLI, you can install the skill by copying the folder to your skills directory or referencing it. See the Gemini CLI Skills documentation for detailed instructions.

While that guide is specific to Gemini CLI, Agent Skills are an open standard and can be loaded by any compatible agent or LLM tool that supports the format (e.g., Claude Code, Cursor).

Contributing

Contributions welcome! See the Contributing Guide.

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/contentkueche/google-ads-mcp-render'

If you have feedback or need assistance with the MCP directory API, please join our Discord server