mcp-gtm
Enables LLMs to manage Google Tag Manager containers through exported JSON files, with full CRUD operations on tags, triggers, variables, and folders, plus validation and analysis tools.
README
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 dev
Or 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"
}
}
}
}
Tools (41 total)
| Tool | Description |
|---|---|
gtm_load_container |
Load a GTM container JSON file |
gtm_get_container_info |
Get container metadata |
gtm_get_container_state |
Get summary counts |
gtm_list_tags |
List all tags |
gtm_get_tag |
Get tag by ID or name |
gtm_create_tag |
Create a new tag |
gtm_update_tag |
Update an existing tag |
gtm_delete_tag |
Delete a tag |
gtm_find_tags_by_type |
Find tags by type (e.g. gaawe) |
gtm_list_triggers |
List all triggers |
gtm_get_trigger |
Get trigger by ID or name |
gtm_create_trigger |
Create a new trigger |
gtm_update_trigger |
Update a trigger |
gtm_delete_trigger |
Delete a trigger |
gtm_list_variables |
List user-defined variables |
gtm_get_variable |
Get variable details |
gtm_create_variable |
Create a variable |
gtm_update_variable |
Update a variable |
gtm_delete_variable |
Delete a variable |
gtm_list_builtin_variables |
List built-in variables |
gtm_list_folders |
List folders |
gtm_get_folder |
Get folder details |
gtm_create_folder |
Create a new folder |
gtm_delete_folder |
Delete a folder |
gtm_move_tag_to_folder |
Move a tag to/from a folder |
gtm_get_tag_dependencies |
Show tag trigger dependencies |
gtm_find_unused_entities |
Find unused tags/triggers/variables |
gtm_find_orphaned_triggers |
Find triggers not used by any tag |
gtm_validate_container |
Run full Zod validation |
gtm_export_container |
Export container state to JSON |
gtm_diff_containers |
Compare two container files |
Resources (4 total)
Read-only MCP resources for container state snapshots:
| Resource | URI | Description |
|---|---|---|
container_state |
gtm://container/state |
Entity counts and metadata |
container_tags |
gtm://container/tags |
Full tag listing |
container_triggers |
gtm://container/triggers |
Full trigger listing |
container_variables |
gtm://container/variables |
Full variable listing |
Prompts (4 total)
Pre-built prompt templates for common workflows:
| Prompt | Description |
|---|---|
inspect_container |
List all entities with resolved names |
audit_container |
Find unused/orphaned/disabled entities |
debug_tag |
Debug why a specific tag isn't firing |
compare_containers |
Compare two container files |
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 |
|---|---|
GTM_CONTAINER_FILE |
Path to a GTM export JSON file. Auto-loaded on startup. |
GTM_READ_ONLY |
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
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.