@channel47/google-ads-mcp

中文文档
1.2.0发布于 2026/03/26MITES Module近 30 天下载 2673

Google Ads MCP Server - Query and mutate Google Ads data using GAQL

原始使用文档
文档目录15 节
  1. What It Does
  2. Installation
  3. For Claude Code Plugin Users
  4. Standalone Use
  5. Configuration
  6. Required
  7. Optional
  8. MCP Config Example
  9. Tools
  10. list_accounts
  11. query
  12. mutate
  13. Development
  14. Links
  15. License

@channel47/google-ads-mcp

npm version License: MIT

MCP server for Google Ads API access via GAQL (Google Ads Query Language). Built by a practitioner managing 25+ ad accounts daily — not a demo.

Part of channel47, the open-source ecosystem of profession plugins for Claude Code. Get the newsletter for weekly skill breakdowns from production use.

What It Does

  • List accounts accessible under your MCC or individual credentials
  • Query anything with raw GAQL — campaigns, ad groups, keywords, search terms, assets, any resource
  • Mutate entities — campaigns, ad groups, ads, keywords, budgets, assets with dry-run safety
  • Resources and prompts — bundled GAQL reference docs and operation templates

Installation

For Claude Code Plugin Users

Bundled with the media-buyer plugin. No manual install required.

Standalone Use

npx @channel47/google-ads-mcp@latest

Or install globally:

npm install -g @channel47/google-ads-mcp
google-ads-mcp

Configuration

Required

VariableDescription
GOOGLE_ADS_DEVELOPER_TOKENYour Google Ads API Developer Token
GOOGLE_ADS_CLIENT_IDOAuth 2.0 Client ID from Google Cloud
GOOGLE_ADS_CLIENT_SECRETOAuth 2.0 Client Secret
GOOGLE_ADS_REFRESH_TOKENOAuth 2.0 Refresh Token

Optional

VariableDescription
GOOGLE_ADS_LOGIN_CUSTOMER_IDMCC Account ID (10 digits, no dashes)
GOOGLE_ADS_DEFAULT_CUSTOMER_IDDefault account ID for queries
GOOGLE_ADS_READ_ONLYSet to true to hide the mutate tool entirely — query and list only

MCP Config Example

{
  "mcpServers": {
    "google-ads": {
      "command": "npx",
      "args": ["-y", "@channel47/google-ads-mcp@latest"],
      "env": {
        "GOOGLE_ADS_DEVELOPER_TOKEN": "your-developer-token",
        "GOOGLE_ADS_CLIENT_ID": "your-client-id",
        "GOOGLE_ADS_CLIENT_SECRET": "your-client-secret",
        "GOOGLE_ADS_REFRESH_TOKEN": "your-refresh-token",
        "GOOGLE_ADS_LOGIN_CUSTOMER_ID": "1234567890",
        "GOOGLE_ADS_READ_ONLY": "true"
      }
    }
  }
}

Remove GOOGLE_ADS_READ_ONLY or set to false to enable the mutate tool.

Tools

list_accounts

List all accessible Google Ads accounts.

Returns: Array of account objects with ID, name, currency, and status.

query

Execute any GAQL SELECT query. Returns clean JSON results.

Parameters:

  • customer_id (string, optional): Account ID (10 digits, no dashes)
  • query (string, required): GAQL SELECT query
  • limit (integer, optional): Max rows to return (default: 100, max: 10000)

Example:

{
  "customer_id": "1234567890",
  "query": "SELECT campaign.name, campaign.status FROM campaign WHERE campaign.status = 'ENABLED'",
  "limit": 50
}

mutate

Execute write operations using GoogleAdsService.Mutate.

Parameters:

  • customer_id (string, optional): Account ID
  • operations (array, required): Mutation operations
  • partial_failure (boolean, optional): Enable partial failure mode (default: true)
  • dry_run (boolean, optional): Validate without executing (default: true for safety)

Example:

{
  "customer_id": "1234567890",
  "operations": [
    {
      "campaignOperation": {
        "update": {
          "resourceName": "customers/1234567890/campaigns/123",
          "status": "PAUSED"
        },
        "updateMask": "status"
      }
    }
  ],
  "dry_run": false
}

Working with Responsive Search Ads (RSAs)

RSAs have two different resource types with different mutability:

ResourceEntityUse Case
customers/{id}/ads/{ad_id}adUpdate ad content (headlines, descriptions, URLs)
customers/{id}/adGroupAds/{ad_group_id}~{ad_id}ad_group_adChange ad status (pause, enable, remove)

Update RSA headlines/descriptions (use entity: 'ad'):

{
  "operations": [{
    "entity": "ad",
    "operation": "update",
    "resource": {
      "resource_name": "customers/1234567890/ads/9876543210",
      "responsive_search_ad": {
        "headlines": [
          {"text": "New Headline 1"},
          {"text": "New Headline 2"},
          {"text": "New Headline 3"}
        ],
        "descriptions": [
          {"text": "New Description 1"},
          {"text": "New Description 2"}
        ]
      },
      "final_urls": ["https://example.com"]
    }
  }],
  "dry_run": false
}

Change RSA status (use entity: 'ad_group_ad'):

{
  "operations": [{
    "entity": "ad_group_ad",
    "operation": "update",
    "resource": {
      "resource_name": "customers/1234567890/adGroupAds/111222333~9876543210",
      "status": "PAUSED"
    }
  }],
  "dry_run": false
}

Creating Image Assets with File Paths

When creating image assets, you can provide a local file path instead of base64 data:

{
  "operations": [{
    "entity": "asset",
    "operation": "create",
    "resource": {
      "name": "My Image Asset",
      "image_file_path": "/path/to/image.png"
    }
  }]
}

The server will automatically read the file and convert it to the required base64 format.

Creating Campaigns

Campaign creation requires specific fields since Google Ads API v19.2 (September 2025):

FieldRequiredDescription
nameYesCampaign name
advertising_channel_typeYesCampaign type (SEARCH, DISPLAY, etc.)
campaign_budgetYesReference to budget resource
bidding strategyYesOne of: manual_cpc, maximize_conversions, target_cpa, etc.
contains_eu_political_advertisingAutoAuto-defaults to DOES_NOT_CONTAIN_EU_POLITICAL_ADVERTISING

Complete campaign creation example:

{
  "operations": [
    // 1. Create budget first (with temp ID for atomic creation)
    {
      "entity": "campaign_budget",
      "operation": "create",
      "resource": {
        "resource_name": "customers/1234567890/campaignBudgets/-1",
        "name": "My Budget",
        "amount_micros": 10000000,
        "delivery_method": "STANDARD"
      }
    },
    // 2. Create campaign referencing the budget
    {
      "entity": "campaign",
      "operation": "create",
      "resource": {
        "name": "My Search Campaign",
        "advertising_channel_type": "SEARCH",
        "status": "PAUSED",
        "campaign_budget": "customers/1234567890/campaignBudgets/-1",
        "manual_cpc": { "enhanced_cpc_enabled": false },
        "network_settings": {
          "target_google_search": true,
          "target_search_network": true
        }
      }
    }
  ],
  "dry_run": false
}

Supported bidding strategies:

  • manual_cpc - Manual cost-per-click
  • maximize_conversions - Maximize conversions
  • maximize_conversion_value - Maximize conversion value (with optional target_roas)
  • target_cpa - Target cost-per-acquisition
  • target_spend - Maximize clicks (target spend)
  • target_impression_share - Target impression share
  • bidding_strategy - Reference to portfolio bidding strategy

Development

git clone https://github.com/channel47/mcps.git
cd mcps
npm install    # workspaces — installs all servers
npm test       # runs all server tests

3 core tools. Dry-run by default. OAuth 2.0 with environment-based credentials.

Pairs with the media-buyer plugin, which adds skills, mutation validation hooks, and GAQL reference docs on top of this server.

License

MIT

版本与发布记录

@channel47/google-ads-mcp 共发布 11 个版本,首次发布于 2026/01/08;过去 12 个月发布了 11 个版本。

版本发布日期距今
1.2.0latest2026/03/267 个月前
1.1.12026/03/127 个月前
1.1.02026/02/268 个月前
1.0.82026/02/188 个月前
1.0.72026/01/149 个月前
1.0.62026/01/139 个月前

关于 @channel47/google-ads-mcp 的常见问题

@channel47/google-ads-mcp 是什么?

Google Ads MCP Server - Query and mutate Google Ads data using GAQL

如何安装 @channel47/google-ads-mcp?

在项目目录运行 npm install @channel47/google-ads-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 google-ads-mcp,可以用 npx google-ads-mcp 直接运行。

@channel47/google-ads-mcp 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/channel47__google-ads-mcp 是否存在。

@channel47/google-ads-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@channel47/google-ads-mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@channel47/google-ads-mcp 可以商用吗?

@channel47/google-ads-mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@channel47/google-ads-mcp 的下载量有多少?

根据 npm 官方下载统计,@channel47/google-ads-mcp 在 2026/10/10 – 2026/11/08 这 30 天内被下载 2,673 次,日均约 89 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@channel47/google-ads-mcp 还在维护吗?

最新版本 1.2.0 发布于 2026/03/26(7 个月前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2026/01/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。