gtm-mcp-server
Provides tools for managing Google Tag Manager accounts, containers, workspaces, tags, triggers, variables, folders, templates, clients, transformations, environments, versions, zones, user permissions, destinations, and gtag configs via the GTM API v2, including publishing and version operations.
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., "@gtm-mcp-server list the tags in my main container's default workspace"
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.
GTM MCP Server (Self-Hosted)
Self-hosted MCP server for Google Tag Manager. Forked from Stape's GTM MCP and converted from Cloudflare Workers to a standard Node.js stdio server with GCP service account auth.
All GTM API calls go directly to Google — no third-party proxy.
Team Setup (on our server)
The production build lives at /home/tay/projects/gtm-mcp/ and auto-deploys when main is pushed via the GitHub webhook sync.
For team members
Run the shared MCP setup script to add the GTM MCP to your Claude Code config:
bash /srv/projects/mcps/setup.sh gtm-mcp-serverOr manually add to ~/.claude/settings.json:
{
"mcpServers": {
"gtm-mcp-server": {
"command": "node",
"args": ["/home/tay/projects/gtm-mcp/dist/index.js"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/home/tay/projects/gtm-mcp/secrets/service-account.json"
}
}
}
}Then restart Claude Code or run /mcp to reload.
How it works
MCP stdio servers are spawned by Claude Code on demand — each session gets its own process. There's no persistent server to keep running. The shared build at /home/tay/projects/gtm-mcp/dist/ is what every session launches from, and the shared service account key provides auth.
Auto-deploy
Pushes to main on KUHL-HQ/gtm-mcp trigger the GitHub webhook which:
Pulls the latest code to
/home/tay/projects/gtm-mcp/Runs
npm install && npm run build
New Claude Code sessions will use the updated build automatically.
Related MCP server: Google Tag Manager MCP Server
Development
Working on changes
Work in your dev clone at
/home/tay/dev/gtm-mcp/Create a feature branch
Open a PR — CI must pass (
npx tsc --noEmit) and 1 approval requiredMerge to
main— auto-deploys to production
Local dev
cd /home/tay/dev/gtm-mcp
npm install
npm run build
# Test locally:
GOOGLE_APPLICATION_CREDENTIALS=./secrets/service-account.json node dist/index.jsGCP Service Account Setup
Create a service account — no special GCP IAM roles needed
Enable the Tag Manager API on the project
Create a JSON key and download it to
secrets/service-account.jsonIn GTM, add the service account email as a user with Publish permission (account level)
Docker (alternative)
npm run build
docker compose up --buildMount the service account key via docker-compose.yml.
Tools
18 MCP tools covering the full GTM API v2:
Tool | Operations |
| get, list, update |
| create, get, list, update, remove, combine, lookup, moveTagId, snippet |
| create, get, list, update, remove, sync, getStatus, createVersion, quickPreview |
| create, get, list, update, remove, revert |
| create, get, list, update, remove, revert |
| create, get, list, update, remove, revert |
| create, list, remove, revert |
| create, get, list, update, remove, moveEntitiesToFolder, revert |
| create, get, list, update, remove, revert |
| create, get, list, update, remove, revert |
| create, get, list, update, remove, revert |
| create, get, list, update, remove, reauthorize |
| get, live, publish, remove, setLatest, undelete, update |
| list, latest |
| create, get, list, update, remove, revert |
| create, get, list, update, remove |
| get, list, link |
| create, get, list, update, remove |
License
Apache-2.0 (forked from stape-io/google-tag-manager-mcp-server)
Available Tools
18 toolsgtm_accountA
Performs all account-related operations: get, list, update. Use the 'action' parameter to select the operation.
Inputs: action (required), accountId (required), config.
gtm_built_in_variableC
Performs all built-in variable operations: create, list, remove, revert. The 'list' action returns up to itemsPerPage items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
gtm_clientB
Performs all client operations: create, get, list, update, remove, revert. The 'list' action returns up to itemsPerPage items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
gtm_containerB
Performs all container-related operations: create, get, update, remove, list, combine, lookup, moveTagId, snippet. The 'list' action returns up to itemsPerPage items per page.
Inputs: action (required), accountId (required), page, containerId, +6 more.
gtm_destinationC
Performs all destination operations: get, list, link, unlink. The 'list' action returns up to 50 items per page.
Inputs: action (required), accountId (required), containerId (required), page, +3 more.
gtm_environmentC
Performs all environment operations: create, get, list, update, remove, reauthorize. The 'list' action returns up to 50 items per page.
Inputs: action (required), accountId (required), containerId (required), page, +4 more.
gtm_folderB
Performs all folder operations: create, get, list, update, remove, revert, entities, moveEntitiesToFolder. The 'list' action returns up to 50 items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +8 more.
gtm_gtag_configA
Performs all Google tag config operations: create, get, list, update, remove. The 'list' action returns up to itemsPerPage items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
gtm_tagB
Performs all GTM tag operations: create, get, list, update, remove, revert. The 'list' action returns up to 20 items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
gtm_templateB
Performs all GTM custom template operations: create, get, list, update, remove, revert. The 'list' action returns up to itemsPerPage items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
gtm_transformationC
Performs all GTM transformation operations: create, get, list, update, remove, revert. The 'list' action returns up to itemsPerPage items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
gtm_triggerA
Performs all GTM trigger operations: create, get, list, update, remove, revert. The 'list' action returns up to 20 items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
gtm_user_permissionB
Performs all user permission operations: create, get, list, update, remove. The 'list' action returns up to 50 items per page.
Inputs: action (required), accountId (required), page, itemsPerPage, +2 more.
gtm_variableB
Performs all GTM variable operations: create, get, list, update, remove, revert. The 'list' action returns up to 20 items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
gtm_versionA
Performs all container version operations: get, live, publish, remove, setLatest, undelete, update. For 'get' and 'live' actions, use 'resourceType' to paginate specific resource arrays (up to 20 items per page) to avoid response truncation.
Inputs: action (required), accountId (required), containerId (required), page, +6 more.
gtm_version_headerB
Performs all container version header operations: list, latest. The 'list' action returns up to 50 items per page.
Inputs: action (required), accountId (required), containerId (required), page, +2 more.
gtm_workspaceB
Performs various workspace operations including create, get, list, update, remove, createVersion, getStatus, sync, quickPreview, and resolveConflict actions. The 'list' action returns up to 50 items per page.
Inputs: action (required), accountId (required), containerId (required), page, +6 more.
gtm_zoneB
Performs various zone operations including create, get, list, update, remove, and revert actions. The 'list' action returns up to 20 items per page.
Inputs: action (required), accountId (required), containerId (required), workspaceId (required), +5 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Each tool maps to a single distinct GTM resource, with the action parameter separating verbs within that resource, so there is no real overlap between tools. Closely related resources such as variable vs built_in_variable and version vs version_header are still clearly distinguished by name and description.
All tools follow a strict gtm_<resource> snake_case convention with no mixing of styles. The pattern is predictable across the entire set.
The 18 tools correspond to distinct Google Tag Manager resources and each earns its place, giving comprehensive API coverage. The count is slightly above the typical 3-15 range, but it reflects the breadth of the GTM resource model rather than redundancy.
The surface covers the full GTM lifecycle across accounts, containers, workspaces, tags, triggers, variables, templates, transformations, clients, folders, environments, versions, permissions, destinations, and gtag configs. Resource-specific action gaps such as account create/delete appear to reflect API limitations rather than missing tool coverage.
Maintenance
Related MCP Connectors
Let AI manage your Google Tag Manager containers — tags, triggers, variables, and more.
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
GA4, Google Ads and Search Console in Claude. Read-only OAuth, multi-account for agencies.
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables 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.26MIT
- 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.250Apache 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 gradedqualityDmaintenanceManage 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