Marketing#Data analysis

GTM MCP Server: manage Google Tag Manager with an agent

Stape's Google Tag Manager MCP server uses the official GTM API to list, edit and publish tags, triggers and variables, hosted with OAuth or run locally.

Project and installation docs

View project

https://github.com/stape-io/google-tag-manager-mcp-server

Inherit a Google Tag Manager container that’s a few years old and you’ll usually find hundreds of tags, triggers and variables with messy names and no one sure which still fire. Clicking through them one by one in the GTM UI eats an afternoon. This MCP server, maintained by the server-side GTM host Stape, uses Google’s official Tag Manager API so an agent can read, tidy and change a container in bulk. The repo had about 230 stars as of 2026-10-06.

What it does

  • One tool per resource: 18 tools such as gtm_tag, gtm_trigger, gtm_variable, gtm_folder and gtm_template, each taking an action of list, get, create, update or remove.
  • Accounts through versions: gtm_account, gtm_container and gtm_workspace through gtm_version and gtm_environment. The default scopes cover everything from reading containers to publishing versions.
  • Server-side GTM: gtm_client, gtm_transformation and gtm_zone map to server container clients, transformations and zones.
  • Two ways in: a hosted server with Google OAuth in the browser and nothing to configure, or a local CLI on your own service account or refresh token, with no third party in the path.

Who it’s for

  • Marketing technologists inheriting an old container who want unused tags and duplicate triggers listed, then renamed consistently.
  • Agencies maintaining GTM for many clients who want a standard tracking setup applied to each new site.
  • Engineers setting up server-side GTM who want help configuring clients and transformations.

Setup

The hosted server is one command in Claude Code; a Google sign-in opens on first use:

claude mcp add --transport http gtm-mcp-server https://gtm-mcp.stape.ai/mcp

The local CLI (Node.js, data stays on your machine) takes a service account key:

claude mcp add gtm-mcp-server -e GOOGLE_SERVICE_ACCOUNT_KEY='{"type":"service_account", ... }' -- npx -y google-tag-manager-mcp-server

Our take

Google hasn’t shipped an official GTM server, and this is the best-documented, most actively maintained option. Grouping by resource keeps it to 18 tools, and the core logic is published as its own npm package if you want to build your own. The big risk is publishing: the default scopes include it, and a bad change pushed live breaks data collection on the site. Have the agent work in a separate workspace and publish after you review, or drop the publish scope with GTM_SCOPES. The hosted version routes data through Stape’s servers; use the local CLI if that matters. Some clients cap server name plus tool name at 60 characters, so keep the server name short. Licensed Apache-2.0.