gtm-tag-architect

gtm-tag-architect

MCP server for Google Tag Manager that enables interactive setup, diagnostics, remediation, and dataLayer type generation.

Category
Visit Server

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

  • /setup Interactive 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


Quickstart: How to Connect via MCP

Mode 1: Offline JSON Export (Zero API Setup)

  1. In GTM, go to Admin > Export Container and save as container.json.
  2. Configure your MCP client to point to the file via GTM_OFFLINE_CONTAINER_PATH.

Mode 2: Live Google Tag Manager API

  1. Enable Tag Manager API in Google Cloud Console.
  2. Create a Service Account, download the JSON key, and add the service account email in GTM Admin > User Management with Read or Edit permissions.
  3. 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

  1. Open Cursor Settings > Features > MCP Servers.
  2. Click + Add New MCP Server.
  3. 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:

  1. Site Type & Industry: E-Commerce, SaaS, Lead Gen, Content, Portfolio
  2. Framework: Next.js/React, WordPress, Laravel, Symfony, or Vanilla PHP
  3. Required Pixels: GA4, Meta, LinkedIn, Google Ads, PostHog
  4. 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured