Last updated: 16 November 2026. Google Ads API (v26.2), Anthropic and OpenAI documentation checked that day.
Codex can talk to Google’s open-source Google Ads MCP server in two ways: as a local stdio process, or as a shared Streamable HTTP service your team deploys (for example on Cloud Run). This guide is the configuration reference we use, with the guardrails turned on.
Add the server
# Codex CLI: add the Google Ads MCP server as a local stdio server
codex mcp add google-ads \
--env GOOGLE_CLOUD_PROJECT=my-gcp-project \
--env GOOGLE_ADS_LOGIN_CUSTOMER_ID=1234567890 \
-- pipx run --spec google-ads-mcp==0.0.6 google-ads-mcp
# or, if your team runs it as a shared Streamable HTTP service:
codex mcp add google_ads --url http://localhost:8080/mcp
codex mcp login google_ads
codex mcp listThe codex mcp add … -- command form and the --url + codex mcp login form both come from the official docs (Codex MCP, google-ads-mcp README). Locally, generate ADC with the adwords scope first:
# 1) Google Cloud project: enable the Google Ads API (grants Test access),
# then apply for Explorer access on the "Google Ads API Overview" page.
# 2) Local ADC with the adwords scope (OAuth client JSON from the same project)
gcloud auth application-default login \
--scopes https://www.googleapis.com/auth/adwords,https://www.googleapis.com/auth/cloud-platform \
--client-id-file=client_secret.jsonThe full config.toml
# ~/.codex/config.toml (or a trusted project's .codex/config.toml)
[mcp_servers.google-ads]
command = "pipx"
args = ["run", "--spec", "google-ads-mcp==0.0.6", "google-ads-mcp"]
startup_timeout_sec = 60
enabled_tools = [
"customers_list_accessible_customers",
"search_search",
"metadata_get_resource_metadata",
"assets_create_asset",
]
disabled_tools = ["assets_upload_video_asset", "labels_manage_labels",
"labels_manage_label_associations"]
default_tools_approval_mode = "prompt"
[mcp_servers.google-ads.env]
GOOGLE_CLOUD_PROJECT = "my-gcp-project"
GOOGLE_ADS_LOGIN_CUSTOMER_ID = "1234567890"
GOOGLE_ADS_MCP_TOOLS_CONFIG = "/etc/pandawm/tools_config.readonly.yaml"
[mcp_servers.google-ads.tools.search_search]
approval_mode = "approve" # read tool: no prompt| Setting | Where | Effect |
|---|---|---|
| command / args | [mcp_servers.google-ads] | Starts the server via pipx (stdio) |
| env table | [mcp_servers.google-ads.env] | GOOGLE_CLOUD_PROJECT, login customer, tools config path |
| enabled_tools | server table | Allow list of tools Codex can see |
| disabled_tools | server table | Deny list, applied after enabled_tools |
| default_tools_approval_mode | server table | prompt / approve / … for all tools |
| tools. | per-tool table | Override, e.g. approve for read tools |
| startup_timeout_sec | server table | pipx cold start can exceed the 10 s default |

Tool names are namespaced since v0.0.6 (search_search, assets_create_asset and so on), so update allowlists you copied from older examples (Google’s guide).
Make it read-only on the server too
Client config lives on a laptop and can be edited. The stronger lock is the server’s tools_config.yaml: set labels and assets to false and those tools are never registered.
# tools_config.yaml - strictly read-only deployment
# (point GOOGLE_ADS_MCP_TOOLS_CONFIG at this file)
namespaces:
customers: true
search: true
metadata: true
labels: false
assets: false| Control | Codex side | Server side |
|---|---|---|
| Hide write tools | disabled_tools | tools_config.yaml: labels/assets false |
| Ask before writes | approval_mode = “prompt” | Propose & confirm (validate_only + checksum) |
| Limit accounts | AGENTS.md allowlist | Credentials only for authorised accounts |
| Production access | — | Cloud project access level (Explorer+) |

Remote server: what Codex needs
For a remote deployment, Google’s README notes that Codex only needs the MCP endpoint and its own OAuth authorisation; it does not need the server’s OAuth client secret or signing and storage keys. The Cloud Run setup itself is covered in Connect Claude.ai to Google Ads with a remote MCP server on Cloud Run.
Using it
- Interactive:
codex, then ask “list accessible customers, then show yesterday’s cost by campaign for 1234567890”. - Non-interactive:
codex execruns in a read-only sandbox by default, good for scheduled summaries ( - codex exec
- ).
- Rules: put account allowlists, PAUSED-only and micros conventions in AGENTS.md so every run follows them.
# AGENTS.md (repo root) - rules Codex reads before every task
## Google Ads automation rules
- Only touch customer IDs listed in accounts.allowlist (our own / client-authorised).
- Credentials come from ADC or a secret manager. Never print, log, commit or paste
client secrets or refresh tokens. No developer token is needed (sunset 2026-09-09).
- Every new campaign is created with status=PAUSED. Never enable campaigns or raise
budgets; output a change list for a human instead.
- Money fields are micros (1 unit = 1,000,000). Budget change > 20% needs a human.
- Run every mutate with validate_only=True first; commit only with --commit.
- Stay within our access level quota (Explorer: 2,880 ops/day on production).
- Ad text must follow Google Ads policies; flag health, finance, gambling,
employment, housing and political content for human review.
- Run `pytest -q` before proposing changes.Common errors
- Server does not start in time: raise
startup_timeout_sec, or install once withpipx install google-ads-mcpand usegoogle-ads-mcpas the command. - CLOUD_PROJECT_NOT_APPROVED_FOR_PRODUCTION: your project has Test access; apply for Explorer in the Google Ads API Overview page (
- developer token sunset
- ).
- Permission denied on a client account: set GOOGLE_ADS_LOGIN_CUSTOMER_ID to the manager account (10 digits, no hyphens) or pass login_customer_id per call.
How PandaWM uses Claude, Codex and Google Ads accounts to speed up client ad delivery
This guide focuses on Codex, but in day-to-day client work PandaWM combines Claude, Codex and Google Ads accounts to help companies going global move faster through the repetitive loop of account and conversion setup → campaign builds → ad copy and assets → reports and search terms → budget and negative-keyword changes, so media buyers spend their time on strategy, bidding judgement and creative.
- Ad accounts: the client’s own Google Ads account, or one opened compliantly through PandaWM’s account-opening service. The account belongs to the client and is never rented or shared; multi-account access goes through the client’s own manager account.
- Claude: natural-language reporting (GAQL) through Google’s open-source Google Ads MCP server, impression-share and search-term diagnosis, RSA headline/description and asset drafts, and asset or label creation in propose-and-confirm mode.
- Codex: writing and maintaining google-ads Python scripts (daily reports, search-term clean-up, paused campaign builds, validate_only pre-checks) that run in a sandbox, on a schedule or in CI.
- Human sign-off: a media buyer approves enabling campaigns, budget increases and bid-strategy changes, and a person makes the final call on Google Ads policy and landing-page compliance.
This describes a service capability only. There are no prices or rebates here, and PandaWM is not an official partner of Google, Anthropic or OpenAI. See Google Ads account opening & management (PandaWM service page) for account opening and management.
FAQ
Can Codex change budgets through this server?
No. The server cannot change campaigns, budgets or bids; use reviewed API scripts for that (Codex + Google Ads API Python campaign pipeline).
Should I use approve or prompt for asset creation?
Prompt. The server’s propose step already shows change_items, and a human should confirm the commit.
Do I need a developer token in config.toml?
No. Developer tokens were sunset on 9 September 2026.
Is this server hosted by Google?
No. It is Google’s open-source project that you run yourself, locally or on your own Cloud Run.
Compliance note: Use every workflow in this guide only on Google Ads accounts (including client accounts under a manager account) that your company owns or is formally authorised to manage, through Google’s official Google Ads API, Google’s open-source Google Ads MCP server or official tools such as Google Ads Editor. Follow the Google Ads API Terms and Conditions, API quotas and Google Ads policies, and keep a human review step before anything that can spend money. PandaWM does not sell, rent, share or transfer ad accounts, manager accounts or API credentials, does not help anyone bypass ad review, regional restrictions, identity verification or payment controls, and is not an official partner of Google, Anthropic or OpenAI. Claude and OpenAI services are only offered in their supported countries and regions; the account holder should be an entity legitimately established and operating in a supported region.
Related guides
- Google Ads account opening & management (PandaWM service page)
- Overseas AI Token service: account setup + API access (PandaWM)
- Codex + Google Ads API Python campaign pipeline
- Claude Code guardrails for Google Ads: read-only mode and approvals
- Connect Claude.ai to Google Ads with a remote MCP server on Cloud Run
- Google Ads MCP server: let AI agents work on your ads
- Codex config.toml for Meta ads MCP
- How to get an OpenAI API key
Talk to PandaWM: Google Ads accounts + AI-assisted delivery
Tell us where your company is registered, your industry, target countries, landing page and expected monthly budget, and which part you want to automate first (reporting, search terms, assets or campaign builds). We pre-check eligibility and landing pages, help you open your own Google Ads account compliantly, and wire Claude / Codex into your workflow.
WhatsApp: +852 5904 8602Telegram: @PANDA0134WeChat: szcwh99

Official sources
- Google: Google Ads MCP server – developer integration guide
- GitHub: googleads/google-ads-mcp
- Google: Developer token sunset (2026-09-09) and FAQ
- OpenAI: Codex and MCP
- OpenAI: Codex configuration reference
- OpenAI: Codex non-interactive mode (codex exec)
- OpenAI: Custom instructions with AGENTS.md
- OpenAI: Codex agent approvals & security
All official pages checked on 2026-11-16. API versions, tool names and permission requirements change; the official pages prevail.

微信扫一扫打赏
支付宝扫一扫打赏
