mcp-gtm
Allows interaction with Google Tag Manager through exported JSON container files, providing tools for managing tags, triggers, variables, folders, and performing container analysis and validation.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-gtmfind unused tags and triggers"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-gtm
An MCP (Model Context Protocol) server that lets LLMs interact with Google Tag Manager through exported JSON container files. Zero auth setup, fully offline.
Quick Start
npm install
npm run devOr configure in your MCP client:
{
"mcpServers": {
"gtm": {
"command": "npx",
"args": ["tsx", "/path/to/mcp-gtm/src/index.ts"],
"env": {
"GTM_CONTAINER_FILE": "/path/to/your-container.json"
}
}
}
}Related MCP server: Google Tag Manager MCP Server
Tools (47 total)
Container
Tool | Description |
| Load a GTM container JSON file |
| Get container metadata |
| Get summary counts |
Tags
Tool | Description |
| List tags with trigger assignments and consent settings |
| Get tag by ID or name |
| Create a new tag |
| Update metadata, firing/blocking triggers, and additional consent checks |
| Delete a tag |
| Find tags by type (e.g. gaawe) |
Triggers
Tool | Description |
| List all triggers |
| Get trigger by ID or name |
| Create a new trigger |
| Update a trigger |
| Delete a trigger |
Variables
Tool | Description |
| List user-defined variables |
| Get variable details |
| Create a variable |
| Update a variable |
| Delete a variable |
| List built-in variables |
Folders
Tool | Description |
| List folders |
| Get folder details |
| Create a new folder |
| Delete a folder |
| Move a tag to/from a folder |
| Move a trigger to/from a folder |
| Move a variable to/from a folder |
Analysis
Tool | Description |
| Show tag trigger dependencies |
| Find unused tags/triggers/variables |
| Find triggers not used by any tag |
| Run full Zod validation |
Lifecycle
Tool | Description |
| Deterministic firing order, sequencing deps, conflicts |
| Consent analysis aware of Google built-in checks, explicit checks, and GTM built-in triggers |
| Per-tag lifecycle phase, consent relationships, issues |
Server-Side GTM
Tool | Description |
| List all zones |
| Get zone details |
| List all clients |
| Get client details |
| List all transformations |
| Get transformation details |
| List all custom templates |
| Get custom template details |
Export
Tool | Description |
| Export container state while preserving version or workspace JSON format |
| Compare version or workspace container files |
Search
Tool | Description |
| Full-text search across entity names and notes |
Undo/Redo
Tool | Description |
| Undo the last mutation |
| Redo the last undone mutation |
Resources (4 total)
Read-only MCP resources for container state snapshots:
Resource | URI | Description |
|
| Entity counts and metadata |
|
| Full tag listing |
|
| Full trigger listing |
|
| Full variable listing |
Prompts (5 total)
Pre-built prompt templates for common workflows:
Prompt | Description |
| List all entities with resolved names |
| Find unused/orphaned/disabled entities |
| Debug why a specific tag isn't firing |
| Compare two container files |
| Audit consent setup, firing order, and tag lifecycle |
Why JSON Files?
Zero auth (no GCP project, no service account)
Fully offline and testable
Diffable and version-controllable
Import back into GTM with one click
Configuration
Environment Variable | Description |
| Path to a GTM export JSON file. Auto-loaded on startup. |
| Set to any value to disable all write tools (create, update, delete, move, export). Only read and analysis tools will be available. |
Development
npm test # Run tests
npm run dev # Run server
npm run build # TypeScript check
npm run lint # Biome lint
npm run format # Biome formatLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Let AI manage your Google Tag Manager containers — tags, triggers, variables, and more.
SEO & marketing toolkit for AI agents: GA4, Search Console, AdSense, GTM, PageSpeed, Trends.
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
A read-only verified record of agent-operable GTM tools: search, fetch, compare, track changes.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables comprehensive management of Google Tag Manager accounts, containers, workspaces, tags, triggers, and variables through OAuth2 authentication, allowing users to create, update, and publish GTM configurations via natural language.2621 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables interaction with Google Tag Manager through its API with built-in Google OAuth authentication. Allows managing GTM containers, tags, triggers, and variables through natural language.101 npm216Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to manage Google Tag Manager accounts, containers, workspaces, tags, triggers, variables, and versions via the Tag Manager API v2.2Apache 2.0
- AlicenseNot gradedqualityBmaintenanceManage Google Tag Manager from Claude Desktop, Cursor, or any MCP-compatible client using natural language. 19 tools cover the full GTM v2 API locally, with credentials kept on your machine.MIT