Google Ads

io.github.mharnett由 GitHub 帳號 mharnett 發布v1.0.1更新於 Oct 24, 2026

Google Ads MCP with MCC support: 35 tools for campaigns, keywords, reporting, GAQL.

已驗證STDIO僅桌面資料與分析商業與電商

概覽

AI 產生的概覽

一個面向 Google Ads API 的本機 MCP 伺服器,讓助理檢視帳戶、建立暫停狀態的廣告活動與廣告,並取得成效報表。

可以做什麼
依工作目錄辨識客戶帳戶,列出廣告活動、廣告群組、待審變更與轉換動作,支援管理員帳戶(MCC)與多客戶。建立廣告活動、廣告群組、回應式搜尋廣告、需求開發多素材廣告、圖片素材與關鍵字,皆以暫停狀態建立,並在建立前驗證廣告。啟用、暫停或移除項目,更新廣告活動預算與追蹤範本。透過共用否定關鍵字清單及廣告活動或廣告群組層級清單管理否定關鍵字。檢視關鍵字、廣告與搜尋字詞成效、關鍵字量預估,並執行原始 GAQL 查詢。
適用情境
適合管理多個客戶帳戶的 Google Ads 操作人員與代理商,希望讓助理草擬待審的廣告活動與廣告、分析成效,或在對話中直接執行 GAQL 查詢。
執行需求
以 npm 套件 mcp-google-ads 形式在本機 Node.js 上執行,透過 config.json 或環境變數設定。需要 Google Ads 開發人員權杖、OAuth 用戶端 ID 與密鑰、帳戶的 OAuth 重新整理權杖,以及 Google Ads API 存取權限核准。除非將 GOOGLE_ADS_MCP_WRITE 設為 true,否則寫入類工具不會顯示。
安裝前請注意
需要敏感憑證:GOOGLE_ADS_CLIENT_SECRET、GOOGLE_ADS_DEVELOPER_TOKEN 與 GOOGLE_ADS_REFRESH_TOKEN,其中重新整理權杖會由附帶指令碼輸出到標準輸出,請避免重導向到共用日誌。設定檔不要提交到版本控制。寫入類工具可修改線上廣告活動與預算並影響實際廣告花費;預設隱藏,新建項目為暫停狀態,但啟用後會影響線上廣告。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Google Ads,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

MCP Google Ads Server

An MCP (Model Context Protocol) server for the Google Ads API with built-in safeguards for review before changes go live. Production-proven with MCC (Manager Account) support, 36 tools for campaign management, reporting, and optimization. v1.2.0 adds Demand Gen campaign creation end-to-end.

Features

  • MCC Support: Works with Manager accounts and multiple client accounts
  • Auto-Context: Detects which client account based on your working directory
  • Safe by Default: All new items created in PAUSED state
  • Approval Workflow: Enable items only after manual review
  • Validation: Validates ads before creating to catch errors early
  • Resilience: Circuit breakers, retry with backoff, and timeout handling (cockatiel)
  • Structured Logging: Pino-based logging with build fingerprinting

Setup

1. Google Ads API Access

You need:

  • A Google Ads Developer Token (apply at Google Ads API Center)
  • OAuth credentials (Client ID & Secret from Google Cloud Console)
  • A Refresh Token for your MCC account
Getting OAuth Credentials
  1. Go to Google Cloud Console
  2. Create a project or select existing
  3. Enable the Google Ads API
  4. Go to Credentials → Create Credentials → OAuth Client ID
  5. Choose Desktop App
  6. Download the JSON (contains client_id and client_secret)
Getting a Refresh Token

Bring your own OAuth client (the client_id / client_secret from the step above) and run the bundled helper. It runs Google's installed-app loopback flow with PKCE (S256) and prints your refresh token. It reads nothing from your home directory and needs no shared OAuth keyfile.

bash
export GOOGLE_ADS_CLIENT_ID="YOUR_CLIENT_ID.apps.googleusercontent.com"export GOOGLE_ADS_CLIENT_SECRET="YOUR_CLIENT_SECRET"node get-refresh-token.cjs

Your browser opens for Google sign-in; approve as the Google account that owns the Ads data. On success the helper prints one line to stdout:

GOOGLE_ADS_REFRESH_TOKEN=1//0a...

Set that value in your environment (or config.json, below). The OAuth scope requested is read from config.json (oauth.scope), falling back to config.example.json, so the helper and the running server always request the same scope. This MCP requests only the minimum scope it needs: https://www.googleapis.com/auth/adwords.

Do not run this with stdout redirected to a shared log file — the refresh token is printed to stdout by design.

Note: GOOGLE_ADS_DEVELOPER_TOKEN is a separate Google Ads API credential, not an OAuth scope — set it independently (see Environment Variables below).

2. Install

bash
npm install mcp-google-ads

Or clone and build from source:

bash
git clone https://github.com/mharnett/mcp-google-ads.gitcd mcp-google-adsnpm installnpm run build

Security: Never share your .mcp.json file or commit it to git -- it may contain API credentials. Add .mcp.json to your .gitignore.

3. Configure

bash
cp config.example.json config.json

Edit config.json with your credentials:

json
{  "oauth": {    "scope": "https://www.googleapis.com/auth/adwords"  },  "google_ads": {    "developer_token": "YOUR_DEVELOPER_TOKEN",    "client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",    "client_secret": "YOUR_CLIENT_SECRET",    "refresh_token": "YOUR_REFRESH_TOKEN",    "mcc_customer_id": "123-456-7890"  },  "clients": {    "my-client": {      "customer_id": "111-222-3333",      "name": "My Client",      "folder": "/path/to/client/workspace"    },    "another-client": {      "customer_id": "444-555-6666",      "name": "Another Client",      "folder": "/path/to/another/workspace"    }  },  "defaults": {    "create_paused": true,    "label_prefix": "claude-",    "require_approval_for_enable": true  }}

Environment Variables

Alternatively, set credentials via environment variables (these override config.json):

VariableRequiredDescription
GOOGLE_ADS_DEVELOPER_TOKENYesGoogle Ads API developer token
GOOGLE_ADS_CLIENT_IDYesOAuth 2.0 client ID
GOOGLE_ADS_CLIENT_SECRETYesOAuth 2.0 client secret
GOOGLE_ADS_REFRESH_TOKENYesOAuth 2.0 refresh token
GOOGLE_ADS_MCP_WRITENoSet to true to expose mutating tools (create/update/pause/enable/remove/apply). Default: read-only.
GOOGLE_ADS_MCP_OVERRIDE_LOGNoJSONL file that records every confirm_large_change override (timestamp, tool, entity, old -> new, reason). Default: overrides.jsonl in the per-user config directory.
GOOGLE_ADS_MCP_OVERRIDE_WEBHOOK_URLNoSlack-compatible incoming webhook; each override also posts one line here. A missing or failing webhook never fails the write.
GOOGLE_ADS_MCP_ALWAYS_LOADNoComma-separated tool names to mark as always-loaded, e.g. google_ads_get_client_context,google_ads_gaql_query. Default: unset (no tool is marked).

Always-loaded tools

Clients that defer tool schemas behind a tool-search step only load a tool once it is searched for. Naming tools in GOOGLE_ADS_MCP_ALWAYS_LOAD stamps them with _meta: {"anthropic/alwaysLoad": true} in tools/list, so those tools are offered directly. Names that match no tool are ignored, and the marker never exposes a tool that read-only mode hides.

Read-only by default

The server ships read-only. Mutating tools (anything that creates, updates, pauses, enables, removes, links, or applies) are hidden from the tool list until you set GOOGLE_ADS_MCP_WRITE=true in the MCP server environment. If a write tool is somehow invoked without that flag, the server returns a clear error pointing at the env var.

This is deliberate: a casual chat message like "activate the Fundraising campaign" should not move live ad spend without an explicit opt-in.

4. Add to Claude Code

Add to your Claude Code MCP settings (~/.claude/settings.json or project settings):

json
{  "mcpServers": {    "google-ads": {      "command": "node",      "args": ["node_modules/mcp-google-ads/dist/index.js"]    }  }}

Or if installed from source:

json
{  "mcpServers": {    "google-ads": {      "command": "node",      "args": ["/path/to/mcp-google-ads/dist/index.js"]    }  }}

Restart Claude Code.

Claude Desktop: Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).

Usage

Workflow

1. cd into client folder → auto-detects account context2. Ask Claude to create campaigns/ads → all created PAUSED3. Review in Google Ads UI or Editor4. Tell Claude to enable approved items5. Claude enables (requires your approval prompt)

Available Tools (36)

Context & Discovery
ToolDescription
google_ads_get_client_contextDetect which account from working directory
google_ads_list_campaignsList all campaigns with status and metrics
google_ads_list_ad_groupsList ad groups in a campaign
google_ads_list_pending_changesShow paused items with claude- label
google_ads_list_conversion_actionsList conversion actions
Campaign Management
ToolDescription
google_ads_create_campaignCreate campaign (PAUSED). Supports SEARCH + DEMAND_GEN channels, richer bidding (MANUAL_CPC / MAXIMIZE_CLICKS / MAXIMIZE_CONVERSIONS / TARGET_CPA), geo + language targeting, start/end dates
google_ads_create_ad_groupCreate ad group (PAUSED). type accepts SEARCH_STANDARD (default) or DEMAND_GEN_MULTI_ASSET_AD_GROUP
google_ads_create_responsive_search_adCreate RSA with validation (PAUSED)
google_ads_create_image_assetUpload PNG/JPG/GIF image asset (validates ≤5MB, ≥600×314) for use in Demand Gen ads
google_ads_create_demand_gen_multi_asset_adCreate a Demand Gen multi-asset ad (PAUSED) — validates char/count caps before API call, fails fast if ad_group isn't DG
google_ads_create_keywordsCreate keywords (PAUSED)
google_ads_validate_adValidate RSA without creating
google_ads_enable_itemsEnable items (make LIVE) — requires approval
google_ads_pause_itemsPause active items
google_ads_pause_keywordsPause specific keywords
google_ads_update_campaign_budgetUpdate campaign daily budget
Tracking & URLs
ToolDescription
google_ads_get_campaign_trackingGet tracking templates and URL parameters
google_ads_update_campaign_trackingUpdate tracking templates
Negative Keywords
ToolDescription
google_ads_create_shared_setCreate shared negative keyword list
google_ads_link_shared_setLink shared set to campaign
google_ads_unlink_shared_setUnlink shared set from campaign
google_ads_add_shared_negativesAdd keywords to shared negative list
google_ads_remove_shared_negativesRemove keywords from shared list
google_ads_add_campaign_negativesAdd campaign-level negatives
google_ads_remove_campaign_negativesRemove campaign-level negatives
google_ads_remove_adgroup_negativesRemove ad group-level negatives
Performance & Reporting
ToolDescription
google_ads_keyword_performanceKeyword metrics with quality score
google_ads_keyword_performance_by_conversionKeyword metrics by conversion action
google_ads_ad_performanceAd-level performance metrics
google_ads_ad_performance_by_conversionAd metrics by conversion action
google_ads_search_term_reportSearch term query report
google_ads_search_term_report_by_conversionSearch terms by conversion action
google_ads_search_term_insightsSearch term category insights
google_ads_search_term_insight_termsTerms within insight categories
google_ads_keyword_volumeKeyword planner volume estimates
Advanced
ToolDescription
google_ads_gaql_queryRun raw GAQL queries

Example Commands

# Check which account you're working with"What Google Ads account am I connected to?"
# List campaigns"Show me all campaigns in this account"
# Create a new campaign"Create a Search campaign for brand terms with $50/day budget"
# Check what's pending review"What changes are pending my review?"
# After reviewing in Google Ads UI"Enable the approved ads in the Brand campaign"
# Performance analysis"Show me keyword performance for the last 30 days, sorted by cost"
# Run custom GAQL"Run a GAQL query to get all ad groups with CTR below 2%"

Example: Create a Demand Gen Campaign End-to-End

# 1. Campaign: $75/day, DEMAND_GEN channel, MAXIMIZE_CONVERSIONS default,#    targeting Alaska (21134) + Maine (21141) in Englishgoogle_ads_create_campaign({  name: "DG - Spring Promo",  daily_budget: 75,  channel_type: "DEMAND_GEN",  geo_target_ids: ["21134", "21141"],  start_date: "2026-05-01",  end_date: "2026-06-30"})# → campaign_id: 555123
# 2. Ad group: DEMAND_GEN_MULTI_ASSET_AD_GROUPgoogle_ads_create_ad_group({  campaign_id: "555123",  name: "DG AG 1",  type: "DEMAND_GEN_MULTI_ASSET_AD_GROUP"})# → ad_group_id: 555456
# 3. Image assets (PNG/JPG/GIF, ≥600×314, ≤5MB). Returns {asset_id, ...}google_ads_create_image_asset({ name: "hero-landscape", file_path: "/abs/path/hero.png" })# → asset_id: 42001google_ads_create_image_asset({ name: "hero-square",    file_path: "/abs/path/square.png" })# → asset_id: 42002google_ads_create_image_asset({ name: "logo",           file_path: "/abs/path/logo.png" })# → asset_id: 42003
# 4. Demand Gen multi-asset ad (PAUSED). Validates char + count caps first.google_ads_create_demand_gen_multi_asset_ad({  ad_group_id: "555456",  final_urls: ["https://example.com/spring"],  business_name: "Example Org",  call_to_action: "LEARN_MORE",  marketing_image_asset_ids: ["42001"],          // 1.91:1 landscape, ≥1 required  square_marketing_image_asset_ids: ["42002"],   // 1:1 optional  logo_image_asset_ids: ["42003"],               // logo optional  headlines: ["Spring Sale Now On", "Save 20% Today"],     // max 5, ≤40 chars each  long_headlines: ["A longer pitch under ninety characters."], // max 5, ≤90 chars  descriptions: ["Shop the latest looks.", "Free returns."]   // max 5, ≤90 chars each})# → resource_name: customers/.../adGroupAds/555456~67890000

After all four calls the campaign, ad group, and ad all live in your account in PAUSED state and are labeled Claude-MM-DD-YY. Review in the Google Ads UI, then enable via google_ads_enable_items.

Safety Features

  1. Everything starts PAUSED — Nothing goes live until you explicitly enable it
  2. Label tracking — All Claude-created items get a claude-pending label
  3. Validation — Ads are validated before creation (headline/description lengths, etc.)
  4. Approval prompts — The enable_items tool requires explicit approval in Claude Code
  5. Client isolation — Working directory determines which account, preventing cross-client mistakes
  6. Magnitude ceilings — update_campaign_budget refuses a change larger than ±20% of the current budget unless confirm_large_change: true and a non-empty reason are passed; update_campaign_bidding does the same for targets. Every override is logged (see GOOGLE_ADS_MCP_OVERRIDE_LOG)
  7. expected_old — Update tools accept an optional expected_old: the value you believe you are overwriting. If the live value differs, the tool refuses, returns current vs expected and makes no write

Adding New Clients

Edit config.json to add clients. Map each client to a working directory:

json
{  "clients": {    "client-slug": {      "customer_id": "123-456-7890",      "name": "Client Name",      "folder": "/path/to/client/workspace"    }  }}

No server restart needed — config is read on each request.

Troubleshooting

"No client found for working directory"

  • Make sure you're in a folder that matches one of your clients entries
  • Check that the folder path in config.json matches exactly

"Developer token not approved"

  • New developer tokens need approval from Google
  • Use a test account while waiting for approval

"Authentication failed"

  • Refresh token may be expired — regenerate it
  • Check that client_id and client_secret are correct

License

MIT — see LICENSE for details.

來源:README.md,提交 cab425f

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分