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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.