
Ainative Gtm Mcp
io.github.AINative-Studio由 GitHub 账号 AINative-Studio 发布v0.4.2更新于 Oct 24, 2026
Full Google Ads, Analytics & Tag Manager lifecycle MCP for AI agents — 57 tools.
概览
一个本地 MCP 服务器,让助手审计和编辑 Google Tag Manager 容器,并管理 Google Ads 的广告系列、预算、转化和定位。
- 可以做什么
- 列出 GTM 账户、容器、代码和触发器并读取其配置;更新或删除代码,创建或更新触发器;审计容器并给出健康分和问题列表,找出误触发的转化代码并重接其触发器;查看工作区待发布改动、创建版本并发布上线;创建和调整 Google Ads 广告系列、广告组、广告、素材、出价、预算、关键词、受众、附加信息、地域和语言定位、否定投放位置及自动应用建议;创建并上传基于 gclid 的离线转化,审计转化目标和账户表现。
- 适用场景
- 适合让助手不打开网页界面直接操作线上 Google Tag Manager 容器或 Google Ads 账户,例如审计在每个页面都触发的转化代码、发布代码修复,或以程序方式搭建和调整广告系列与预算。
- 运行要求
- 通过 npx 在本地运行(需要 Node.js)。需要启用 Tag Manager API 的 Google Cloud 服务账号 JSON 密钥,由 GTM_SERVICE_ACCOUNT_KEY_PATH 指定,并在 GTM 中把该服务账号添加为用户,授予读取或发布权限。Google Ads 工具需要 OAuth 凭据、GOOGLE_ADS_DEVELOPER_TOKEN 和 GOOGLE_ADS_CUSTOMER_ID。
安装
在 SourceWeft 中
- 打开 控制台中的 Ainative Gtm Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@ainative/gtm-mcp
Google Tag Manager and Google Ads MCP server — audit, fix, and manage GTM containers and Google Ads campaigns, budgets, conversions, placements, geo targeting, and auto-apply recommendations from AI agents (Claude, Cursor, and any MCP client).
Part of the AINative open-source tools.
57 tools across 7 categories: accounts, tags, triggers, audit, versions/publishing, and a complete Google Ads lifecycle (39 tools) — build, publish, track, and adjust campaigns end-to-end: create campaigns/ad groups/RSAs/RDAs/HTML5 ads, Performance Max, bidding strategy & bid control, ad extensions (sitelinks/callouts/snippets/call), audiences, offline gclid conversion import, geo/language targeting, budgets, placements, and auto-apply recommendations — fully programmatic, no UI required.
Keywords: google tag manager mcp, google ads mcp, gtm mcp server, google ads api mcp, conversion tracking mcp, campaign budget management, negative placement / click-fraud exclusion, geo targeting, auto-apply recommendations, recommendation subscriptions, conversion goals, Smart Bidding, PPC automation, ad spend control, Claude MCP, model context protocol, AI agent advertising tools.
Quick Start
1. Install
2. Set up Google Cloud authentication
The server authenticates via a Google Cloud service account with Tag Manager API access. There is no browser OAuth flow — it's designed for headless/agent use.
Step 1 — Enable the Tag Manager API
- Go to Google Cloud Console
- Select or create a project
- Navigate to APIs & Services → Library
- Search for Tag Manager API (
tagmanager.googleapis.com) and click Enable
Step 2 — Create a service account
- Go to IAM & Admin → Service Accounts
- Click Create Service Account
- Give it a name (e.g.
gtm-mcp-agent) - Skip role assignment at GCP level — GTM has its own permission system
- Click Done, then open the service account
- Go to Keys → Add Key → Create new key → JSON
- Download the JSON key file — keep it safe
Step 3 — Grant the service account access in GTM
This is the step most people miss. The GCP service account needs to be added as a user inside Google Tag Manager separately:
- Go to tagmanager.google.com
- Click Admin (top nav)
- Under Account, click User Management
- Click + → Add users
- Enter the service account email (e.g.
[email protected]) - Set permission to Publish (required for tag editing and publishing)
- Save
Note: If you only need read access (auditing), Read permission is sufficient.
Step 4 — Configure the env var
3. Connect to Claude Code
Or add a .mcp.json to your project root:
Security: Add
.mcp.jsonto.gitignoreif it contains key paths. Use.mcp.example.jsonas a template for teammates.
4. Verify it works
Ask Claude:
Expected: your GTM account name and ID. If you get an empty array [], the service account hasn't been added to GTM yet (Step 3 above).
Important: GTM vs Google Ads conversions
This MCP server manages Google Tag Manager containers — tags, triggers, variables, and publishing.
If you see events like ads_conversion_PURCHASE_1 in GA4, those may be coming from Google Ads auto-imported conversions (via GA4 ↔ Google Ads account linking), not GTM tags. In that case:
- If the event fires via a GTM tag → use
gtm_find_misfiring_conversion_tagsto fix it - If the event is a GA4-imported Google Ads conversion → fix it in Google Ads → Tools → Conversions, not in GTM
To tell the difference: if your GTM container has no tags (gtm_list_tags returns []), the conversion event is coming from outside GTM.
Example: Fix a misfiring conversion tag
The most common GTM billing issue — a Google Ads conversion tag fires on every page view instead of only on purchase confirmation.
Tool Reference
Account & Container (3 tools)
Tags (4 tools)
Triggers (4 tools)
Audit & Fix (3 tools)
Versions & Publishing (4 tools)
Google Ads (39 tools)
Full programmatic campaign lifecycle — an agent can build, launch, measure, and optimize a campaign end-to-end with no UI.
Build (campaigns, ad groups, ads, assets)
Bidding & bids
Ad control
Ad extensions (assets)
Audiences & conversions (attribution)
Conversions & reporting
Campaigns & budgets
Targeting & fraud protection
Auto-apply recommendations
Google Ads Authentication
The Google Ads tools use OAuth2 credentials. Provide them via environment variables or your ADC file:
Developer token: Get yours at Google Ads API Center. A test token works for sandbox accounts; a standard token is required for production.
Note on GA4-imported conversions: If you see events like
ads_conversion_PURCHASE_1in GA4 butgads_list_conversion_actionsreturns an empty list, those conversions are GA4-imported into Google Ads (configured under Google Ads → Tools → Conversions). They are not standalone conversion actions and must be managed through the Google Ads UI.
Troubleshooting
Development
License
MIT — AINative Studio
来源:README.md,提交 b858f34
工具
0版本历史
1- v0.4.2最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分