gtm-tag-architect
MCP server for Google Tag Manager that enables interactive setup, diagnostics, remediation, and dataLayer type generation.
README
gtm-tag-architect
A public, production-ready plugin for Google Antigravity, Claude Code, and Cursor that connects to Google Tag Manager via the Model Context Protocol (MCP).
It provides an interactive /setup command that interviews developers and marketers about their site, diagnoses container defects (duplicates, missing triggers, Consent Mode v2 violations), and generates optimized tracking taxonomies and dataLayer contracts for both TypeScript (Next.js/React) and PHP (WordPress/Laravel/Symfony).
Features
/setupInteractive Command: Guides you through a 3-stage interview and audit workflow.- Deep Container Diagnostics: Audits duplicate GA4/Meta tags, orphaned triggers, unconsented marketing pixels, and render-blocking scripts.
- Automated Remediation: Deduplicates tags and enforces Google Consent Mode v2 (or provides an explicit opt-out bypass for internal/US tools).
- Multi-Framework dataLayer Contracts: Generates typed TypeScript definitions (
dataLayer.d.ts) or native PHP classes (GtmDataLayer.php) for WordPress, Laravel, Symfony, and custom backends. - Industry Tracking Matrices: Pre-built taxonomy runbooks for E-Commerce, SaaS/PLG, B2B Lead Gen, and Technical Portfolios.
- Dual-Mode MCP Server: Runs live against Google Tag Manager REST API v2 or audits local exported container JSON files offline (Zero API setup).
Documentation & Guides
- 📖 Complete GTM MCP Setup & Credentials Guide: Detailed walkthrough for obtaining Google Cloud Service Account keys, GTM container permissions, GA4 Measurement IDs, Meta Pixels, LinkedIn Insight tags, and PostHog keys.
- 🛍️ E-Commerce Tracking Taxonomy
- 🚀 SaaS & Product Analytics Taxonomy
- 💼 Lead Generation & B2B Taxonomy
- 👨💻 Technical Portfolio & Peer Engagement Taxonomy
- 🛡️ Google Consent Mode v2 Reference
Quickstart: How to Connect via MCP
Mode 1: Offline JSON Export (Zero API Setup)
- In GTM, go to Admin > Export Container and save as
container.json. - Configure your MCP client to point to the file via
GTM_OFFLINE_CONTAINER_PATH.
Mode 2: Live Google Tag Manager API
- Enable Tag Manager API in Google Cloud Console.
- Create a Service Account, download the JSON key, and add the service account email in GTM Admin > User Management with Read or Edit permissions.
- Set
GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json.
(See the Complete Setup Guide for step-by-step instructions with screenshots and permission configurations.)
MCP Client Configuration
For Google Antigravity
Clone or place this repository into your workspace or global customizations directory:
# In your project's .agents/plugins/ or ~/.gemini/config/plugins/
git clone https://github.com/jarnielcataluna/gtm-tag-architect.git
Antigravity will automatically discover the plugin, expose the /setup slash command, and register the MCP server defined in mcp_config.json.
For Claude Code / Claude Desktop
Register the server in your claude_desktop_config.json or project MCP settings:
{
"mcpServers": {
"gtm-tag-architect": {
"command": "node",
"args": ["/path/to/gtm-tag-architect/bin/gtm-mcp.js"],
"env": {
"GTM_OFFLINE_CONTAINER_PATH": "./fixtures/sample-ecommerce-container.json"
}
}
}
}
For Cursor IDE
- Open Cursor Settings > Features > MCP Servers.
- Click + Add New MCP Server.
- Name:
gtm-tag-architect| Type:command| Command:node /path/to/gtm-tag-architect/bin/gtm-mcp.js
Usage
Run the /setup Command
Inside Antigravity or Claude Code:
/setup
The agent will interview you about:
- Site Type & Industry: E-Commerce, SaaS, Lead Gen, Content, Portfolio
- Framework: Next.js/React, WordPress, Laravel, Symfony, or Vanilla PHP
- Required Pixels: GA4, Meta, LinkedIn, Google Ads, PostHog
- Privacy Strategy: Enforce Consent Mode v2 (Strict GDPR) vs. Opt-Out / Direct Firing
It then performs a diagnostic audit and presents you with an action menu to fix defects, apply consent rules, and export clean dataLayer contracts.
Testing & Local Audit
You can run the offline diagnostic test harness against the included test fixture:
npm install
npm run audit-fixture
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。