Google Ads MCP

Google Ads MCP

Enables AI agents to manage Google Ads campaigns (Search and UAC) through natural language, with read tools always available and guarded write operations for budgets, campaigns, ad groups, and keywords.

Category
访问服务器

README

Google Ads MCP

An MCP server that lets an LLM agent operate Google Ads — both Search and App/UAC campaigns. It exposes read tools (GAQL) always, and guarded write tools behind a mutation flag.

Status: Phase 1 — reads only (list_accessible_customers, search, describe_resource). Writes (budgets, campaigns, ad groups, keywords, ads, UAC) land in later phases behind ADS_MCP_ENABLE_MUTATIONS.

Design principles: every change will be reversible, confirmable, account- and budget-scoped. Reads are always safe.

Requirements

  • Python 3.12+
  • uv (curl -LsSf https://astral.sh/uv/install.sh | sh)
  • A Google Ads developer token, an OAuth2 client, and a refresh token.
  • Google Ads API version is pinned to v23 in src/google_ads_mcp/config.py.

Install

uv sync --extra dev

Getting credentials

You need five values in a google-ads.yaml file (copy from google-ads.yaml.example).

  1. developer_token — Google Ads UI → Tools → API Center. Basic Access is enough (15k operations/day).
  2. OAuth client (client_id, client_secret) — Google Cloud Console → APIs & Services → Credentials → Create OAuth client ID → Desktop app. Enable the Google Ads API for the project first.
  3. refresh_token — generate once with the OAuth consent flow for scope https://www.googleapis.com/auth/adwords. The official google-ads-python repo ships generate_user_credentials.py for exactly this; run it with your client id/secret and paste the resulting refresh token.
  4. login_customer_id — your manager (MCC) account id without dashes. Omit if you authenticate directly against a single account.

Then:

cp google-ads.yaml.example google-ads.yaml   # fill in real values (gitignored)
cp .env.example .env                          # set GOOGLE_ADS_CREDENTIALS to its path
export GOOGLE_ADS_CREDENTIALS="$PWD/google-ads.yaml"

Secrets are never committed. google-ads.yaml, .env, and *.audit.jsonl are gitignored.

Run

# stdio (default — what Claude Desktop uses)
uv run google-ads-mcp

# or HTTP (future Cloud Run hosting)
ADS_MCP_HTTP=true uv run google-ads-mcp

Connect to Claude Desktop

Edit Claude Desktop's config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add an entry (use absolute paths):

{
  "mcpServers": {
    "google-ads": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/Google Ads MCP",
        "run",
        "google-ads-mcp"
      ],
      "env": {
        "GOOGLE_ADS_CREDENTIALS": "/absolute/path/to/Google Ads MCP/google-ads.yaml"
      }
    }
  }
}

If uv isn't on Claude Desktop's PATH, use its absolute path (which uv). Restart Claude Desktop. The three read tools appear under the 🔌 connector menu.

First check

Ask Claude: "List my accessible Google Ads customers", then "Run this GAQL on account <id>: SELECT campaign.id, campaign.name, campaign.status FROM campaign LIMIT 10".

Tools (Phase 1)

Tool Description
list_accessible_customers() Customer ids the auth user can access.
search(customer_id, gaql, page_size=1000) Execute a GAQL query.
describe_resource(resource) Discover selectable/filterable fields for GAQL.

All return a unified envelope: {status, dry_run, resource_name, diff, message, data}.

Safety flags (parsed now, enforced from Phase 2)

Env var Default Purpose
ADS_MCP_ENABLE_MUTATIONS false Master switch for all write tools.
GOOGLE_ADS_ALLOWED_CUSTOMER_IDS (empty) CSV allowlist of customer ids.
GOOGLE_ADS_MAX_DAILY_BUDGET_USD 100 Budget/bid ceiling without override.
GOOGLE_ADS_DEFAULT_VALIDATE_ONLY true Mutations dry-run by default.
GOOGLE_ADS_AUDIT_LOG ./google-ads.audit.jsonl Applied-change log.

Security model

  • Secrets never enter git. google-ads.yaml, .env, and *.audit.jsonl are gitignored. The repo ships only *.example files with placeholders. Account ids and app ids in tests are fake.
  • Writes are off by default (ADS_MCP_ENABLE_MUTATIONS=false).
  • Allowlist — mutations are refused for any account outside GOOGLE_ADS_ALLOWED_CUSTOMER_IDS. Reads are unaffected.
  • Budget cap — a budget/bid above GOOGLE_ADS_MAX_DAILY_BUDGET_USD is refused unless the call passes override=true.
  • Two-key apply — a real change needs BOTH validate_only=false AND confirm=true. Otherwise the tool returns the diff (validate_only) or a preview, applying nothing.
  • New campaigns/ad groups/ads are created PAUSED — nothing serves until you deliberately enable it.
  • Audit log — every applied change (and every failure during apply) is appended to the JSONL audit log; dry-runs are not logged as applied.
  • Atomic batches — multi-operation tools (manage_keywords, manage_negative_keywords) are all-or-nothing by design (no partial_failure), so a batch never half-applies.

If a credential is ever exposed, rotate it: developer token in the Ads API Center, OAuth client secret in Google Cloud Console → Credentials.

Tests

uv run pytest          # offline tests (no network); live calls need real creds

Roadmap

  1. ✅ Skeleton + reads.
  2. ✅ Safety layer (validate_only wrapper, allowlist, budget guard, confirm, audit, error mapping) — see safety.py, audit.py, tests/test_guardrails.py.
  3. ✅ Search writes (budget → campaign → ad group → keywords/negatives → RSA → statuses) — writes_common.py, writes_search.py. New campaigns/ad groups/ads are created PAUSED; live validate_only verified.
  4. ✅ UAC writes (app campaign, app assets, target updates) — writes_app.py. App campaigns created PAUSED; create_app_campaign structurally validated against the live API. Real apply + manage_app_assets verify on the final account (where the app is provisioned).
  5. ✅ Hardening + packaging (green pytest suite, security model documented, secret scan, optional HTTP transport for Cloud Run).

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选