Marketing
gtm-mcp avatar

gtm-mcp

Operate Google Tag Manager via MCP. Handles OAuth, resource discovery, and CRUD operations for tags, triggers, and variables directly from your LLM agent.

Introduction

The gtm-mcp server provides a robust bridge between LLM environments—such as Claude Code or the Codex CLI—and the Google Tag Manager API. Designed for marketing engineers, web developers, and data analysts, this tool enables programmatic management of tracking infrastructure without requiring manual dashboard interaction. Users can automate the deployment of marketing tags, configure trigger conditions, and define dynamic variables, ensuring consistent implementation across complex web properties.

  • Full support for GTM Resource Lifecycle: Perform create, read, update, and delete (CRUD) operations on tags, triggers, and variables.

  • Authentication Management: Integrated OAuth 2.0 flow for secure Google Cloud project access, including consent URL generation and token exchange.

  • Generic API Access: Use the gtm_request tool to interact with any GTM API v2 endpoint, providing flexibility for edge-case requirements or undocumented API features.

  • Multiple Registration Scopes: Flexible MCP configuration allows for local, user, or project-specific installation, suitable for both isolated experiments and team-shared repository workflows.

  • Discovery Utilities: Built-in tools for listing accounts, containers, and workspaces, helping users navigate their GTM hierarchy efficiently before modifying configurations.

  • Prerequisites: Requires a Google Cloud project with the Tag Manager API enabled and valid OAuth client credentials (Client ID and Client Secret).

  • Configuration: Utilize the interactive setup script to generate a secure .env file; ensure redirect URIs are set to http://127.0.0.1:8085 for consistent OAuth handshakes.

  • Usage Sequence: Always begin by discovering resources using account and container listing tools, followed by specific resource modification requests.

  • Security: Operations require the https://www.googleapis.com/auth/tagmanager.edit.containers scope to modify container data.

  • Troubleshooting: If the MCP is not visible in your IDE or CLI, re-run the register script for the specific scope; clear existing configurations manually if duplicates prevent updates.

Repository Stats

Stars
0
Forks
0
Open Issues
0
Language
TypeScript
Default Branch
main
Sync Status
Idle
Last Synced
May 4, 2026, 12:45 AM
View on GitHub