Google Tag Manager MCP

Google Tag Manager MCP is a free MCP server that gives your AI agent seven tools for Google Tag Manager. Your agent can list accounts, containers, and workspaces, read every tag, trigger, and variable, and fetch the version that is live on your site. It can also make changes, such as creating a tag, pausing one, or publishing a version, with a confirmation step for anything destructive. It is its own VS Code extension, it runs on your machine, and it uses your own Google account.

There is no server to host and no config file to edit. You install the extension, sign in to Google once, and the tools appear in every agent it finds: VS Code Copilot, Claude Code, Cursor, OpenAI Codex, Google Gemini, Windsurf, Continue.dev, and Cline.

What you can ask

  • “Which containers do I have in Tag Manager?”
  • “List every tag in the default workspace and what fires it”
  • “Which tags have no firing trigger?”
  • “Is there a GA4 configuration tag, and which measurement ID does it use?”
  • “Create a GA4 event tag for form_submit, fired by the form trigger”
  • “Pause the old remarketing tag”

The seven Google Tag Manager MCP tools

Tool What it does What you can pass
gtm_list_accounts List the Tag Manager accounts you can open Nothing
gtm_list_containers List containers in an account, with their public IDs and where they are used The account ID
gtm_list_workspaces List the workspaces in a container Account and container
gtm_list_tags List tags with their type, firing and blocking triggers, and parameters Account, container, workspace
gtm_list_triggers List triggers with their type and conditions Account, container, workspace
gtm_list_variables List user-defined variables and the built-in ones that are switched on Account, container, workspace
gtm_get_live_version Read the published version of a container: its tags, triggers, and variables Account and container

The Google Tag Manager admin tool

Changes go through one tool, gtm_admin, with named actions.

Action What it does
create_tag Create a tag with its type, parameters, and triggers
update_tag Change a tag’s name, parameters, or triggers
pause_tag Pause or resume a tag
delete_tag Delete a tag (needs confirmation)
create_trigger Create a trigger
create_variable Create a variable
create_version Create a container version from a workspace
publish_version Publish a version to the live site (needs confirmation)

Destructive actions need explicit confirmation

delete_tag and publish_version only run with confirm: true. Without it the server changes nothing and returns a warning, so the agent has to ask you first. Reading never needs it.

Three things people use it for

A container audit

Ask for every tag with its triggers, then for the ones that are paused, have no trigger, or duplicate another tag. An audit that takes an hour of clicking through the interface becomes one request.

Checking tracking against the code

When the site pushes events to the data layer, ask the agent to compare the event names in your code with the triggers in the container. Mismatched names are the usual reason a tag never fires.

Documenting what is live

Ask the agent to read the live version and write it up: which tags run on which pages and what they send. That gives a new team member, or a privacy review, something to read.

Set it up in five steps

A setup wizard opens the first time you launch the extension. OAuth is the usual choice.

  1. Create a project in the Google Cloud Console, or pick one you already have.
  2. Enable the Tag Manager API under APIs and Services.
  3. Create an OAuth client ID of type Desktop app.
  4. Paste the client ID and secret into the wizard.
  5. Sign in to Google in the browser window that opens, and authorize.

If your consent screen is set to External, add yourself as a test user first. The wizard also accepts Application Default Credentials from the gcloud CLI and a service account key.

Your Google account needs at least read access to the container in Tag Manager.

Using Google Tag Manager MCP with Claude Code, Cursor and other agents

You do not add a server entry by hand. The extension writes the registration for each agent it finds: ~/.claude.json for Claude Code, ~/.cursor/mcp.json for Cursor, ~/.codex/config.toml for OpenAI Codex, ~/.gemini/settings.json for Gemini, and the matching files for Windsurf, Continue.dev, and Cline. VS Code Copilot picks it up through the VS Code API.

Open a new session in any of them and the tools are in the tool list. To limit which agents get them, switch the others off in VS Code settings under googleTagManagerMcp.agents. The command “Google Tag Manager MCP: Remove from All Agents” takes every registration back out.

Limits

  • It reads the container’s configuration. It does not see what fires in a visitor’s browser, so it is not a replacement for Preview mode.
  • Server-side containers are listed like any other. The tools were designed around web containers.

Common questions

Is Google Tag Manager MCP free?

Yes. The extension is free and MIT licensed.

Is this an official Google server?

No. It is an independent extension that calls the Tag Manager API with your own sign-in.

Does it work with GA4?

It reads the GA4 tags in your container. For the analytics data itself, see Google Analytics MCP.

Does it work with Claude Code and Cursor?

Yes. Both are registered automatically, along with Copilot and five other agents.

Where does my data go?

Nowhere except Google. The MCP server runs on your own machine and calls Google’s API with your credentials. There is no telemetry, and the sign-in token is kept in VS Code’s encrypted secret storage.

Install it

Google Tag Manager MCP is free and MIT licensed.

Related