
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 分