Provides MCP access to Google Tag Manager for listing, creating, updating, and publishing GTM resources.
Configuration
View docs{
"mcpServers": {
"paolobtl-gtm-mcp": {
"command": "gtm-mcp",
"args": [],
"env": {
"GTM_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GTM_PROJECT_ID": "your-project-id",
"GTM_CLIENT_SECRET": "GOCSPX-your-client-secret"
}
}
}
}You deploy and use a Model Context Protocol (MCP) server that lets Claude interact with Google Tag Manager. It provides commands to list accounts and containers, manage tags, triggers, variables, and publish container versions, all through your MCP client. This guide shows you how to install, configure credentials, and start using the GTM MCP Server with your MCP client.
Once you have the GTM MCP Server configured and running, your MCP client can access GTM functionality through the following actions: list GTM accounts and containers, list and inspect tags, triggers, and variables, create and update items, and publish container versions. Use the provided tool endpoints to perform common workflows, such as creating a new tag in a workspace or publishing a container version after making changes.
# Prerequisites
python3.10+ # Ensure you have Python 3.10 or higher installed
pip install gtm-mcp
# Optional: initial setup and self-check
gtm-mcp-setup
```
Note: The setup wizard will guide you through creating Google Cloud OAuth credentials and configuring Claude Desktop automatically. If you prefer manual configuration, proceed with the Complete Setup Guide below.This MCP server uses OAuth 2.0 to securely access Google Tag Manager. You create OAuth credentials in your own Google Cloud project and configure them in Claude Desktop. The first authorization opens a browser window to grant the requested permissions, and your tokens are saved locally for future use.
Environment variables you configure for the MCP server are used to connect to GTM. You provide the Client ID, Client Secret, and your Google Cloud Project ID during setup and keep these credentials private.
Follow these steps to set up the GTM MCP Server from scratch.
- Start Claude Desktop after you have configured the MCP server so it can authenticate and access GTM resources. - Your OAuth credentials are user-specific and private. Treat the Client Secret like a password. - You can revoke access anytime from your Google account settings and delete local tokens if you need to re-authorize.
If you encounter issues, restart Claude Desktop, verify your MCP server command is accessible, and ensure environment variables are set correctly. Review Claude Desktop logs for MCP server errors and verify that the OAuth flow completes on first authorization.
Upgrade the MCP server package with:
```bash
pip install --upgrade gtm-mcp
```
This will install the latest version and keep your configuration intact.Your OAuth credentials and access tokens are stored locally and should be protected. Do not share your Client Secret. You can regenerate credentials in Google Cloud Console and revoke access from your Google account settings at any time.
To run tests during development, install the test dependencies and run the test suite.
The GTM MCP Server exposes a set of tools to manage GTM resources through MCP calls, including listing accounts, containers, tags, triggers, and variables, creating and updating resources, and publishing container versions.
List all GTM accounts accessible by your OAuth credentials.
List containers within a selected GTM account.
List tags within a specific workspace.
Retrieve detailed configuration for a specific tag.
Create a new tag in a workspace.
Update an existing tag.
List triggers in a workspace.
Create a new trigger.
List variables in a workspace.
Create a new variable (constant, data layer, cookie, URL, etc.).
Create and publish a new container version.