Skip to main content
Glama
gtm-mcp-server

gtm-mcp-server

by KUHL-HQ

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-server

Or 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:

  1. Pulls the latest code to /home/tay/projects/gtm-mcp/

  2. 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

  1. Work in your dev clone at /home/tay/dev/gtm-mcp/

  2. Create a feature branch

  3. Open a PR — CI must pass (npx tsc --noEmit) and 1 approval required

  4. Merge 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.js

GCP Service Account Setup

  1. Go to GCP Console > IAM > Service Accounts

  2. Create a service account — no special GCP IAM roles needed

  3. Enable the Tag Manager API on the project

  4. Create a JSON key and download it to secrets/service-account.json

  5. In GTM, add the service account email as a user with Publish permission (account level)

Docker (alternative)

npm run build
docker compose up --build

Mount the service account key via docker-compose.yml.

Tools

18 MCP tools covering the full GTM API v2:

Tool

Operations

gtm_account

get, list, update

gtm_container

create, get, list, update, remove, combine, lookup, moveTagId, snippet

gtm_workspace

create, get, list, update, remove, sync, getStatus, createVersion, quickPreview

gtm_tag

create, get, list, update, remove, revert

gtm_trigger

create, get, list, update, remove, revert

gtm_variable

create, get, list, update, remove, revert

gtm_built_in_variable

create, list, remove, revert

gtm_folder

create, get, list, update, remove, moveEntitiesToFolder, revert

gtm_template

create, get, list, update, remove, revert

gtm_client

create, get, list, update, remove, revert

gtm_transformation

create, get, list, update, remove, revert

gtm_environment

create, get, list, update, remove, reauthorize

gtm_version

get, live, publish, remove, setLatest, undelete, update

gtm_version_header

list, latest

gtm_zone

create, get, list, update, remove, revert

gtm_user_permission

create, get, list, update, remove

gtm_destination

get, list, link

gtm_gtag_config

create, get, list, update, remove

License

Apache-2.0 (forked from stape-io/google-tag-manager-mcp-server)

Available Tools

18 tools
gtm_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

    A3.6/5.0

    Scored across 18 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    All tools follow a strict gtm_<resource> snake_case convention with no mixing of styles. The pattern is predictable across the entire set.

    Tool Count4/5

    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.

    Completeness5/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables 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.
      26
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to manage Google Tag Manager accounts, containers, workspaces, tags, triggers, variables, and versions via the Tag Manager API v2.
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Manage 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