How to configure the MCP Server for Google Tag Manager

Uliana Lesiv

Uliana Lesiv

Author
Updated
Jul 20, 2026
Also available in

Model Context Protocol (MCP) Server provides interoperability and coordination between AI models and tools. It is especially helpful in systems where many AI agents are working together. For the end user, it means smooth command performance and convenient data retrieval without the need to write API requests themselves.

We, at Stape, have developed the MCP Server for Google Tag Manager so you can manage and perform required actions more easily within a tool. Setting it up comes down to just a few steps:

  1. Make sure Node.js v18 or higher is installed and download the AI app you chose (in our case it's the Claude desktop app).
  2. Open the app and go to SettingsDeveloperEdit Config.
  3. Replace the config file content with the GTM MCP Server configuration snippet (Stape users can also add their specific API key script here).
  4. Save the config, restart Claude Desktop, and complete the OAuth authentication flow to grant the required permissions to your Google Account.
  5. Verify that the GTM tools are now available in Claude.

The full detailed guide with step-by-step instructions and configuration snippets is available further in this article.

🤔 Are you going to configure the GTM MCP server in Claude? Check our guide to Claude MCP to understand how the protocol works and see best practices for using MCP in Claude.

How does the MCP Server work?

After configuring the MCP Server (in our case, for Google Tag Manager), you can type any request in your AI app (e.g., the Claude app). Your request is sent to the MCP Server via the MCP Protocol (standard protocol for AI communication). Once the request is received, the MCP Server handles it (performs actions/commands or returns some data you requested).

The request can refer to most commands connected with GTM functionality and its entities. It includes, but is not limited to:

  • Creating, getting, updating, removing accounts, workspaces, containers, and environments.
  • Creating, getting, reverting, updating, removing clients, tags, triggers, variables, folders, and templates.
  • Listing, getting, and managing the latest GTM container and header versions.
  • Managing users’ permissions.
How MCP Server works
How MCP Server works

Before starting

To configure the MCP Server for GTM, you will need:

How to set up an MCP server for GTM

1. Open Claude Desktop and navigate to SettingsDeveloperEdit Config

This opens Claude's JSON configuration file, which is where Claude stores information about the MCP servers it can connect to. Every MCP server that you want Claude to use must be defined in this configuration file.

Claude's JSON configuration file

2. Replace the file content with the following configuration.

{ "mcpServers": { "google-tag-manager-mcp-server": { "command": "npx", "args": [ "-y", "mcp-remote", "https://gtm-mcp.stape.ai/mcp" ] } } }
configuration

Once done, save the changes.

3. Restart Claude.

When Claude starts again, it will attempt to connect to the added MCP server.

4. Authenticate with OAuth.

A browser window will open showing your OAuth login page. Complete the authentication flow to grant Claude access to your MCP server.

OAuth login page
grant Claude access to your MCP server

After you grant access, the tools will become available for you to use.

the tools will become available for you to use

You can always check the status of the MCP server if you open Settings → navigate to Developer tab → see the status next to the server name (if it works, the status must be "running").

if it works, the status must be "running"

5. Now you can type your request via chat.

Troubleshooting MCP server configuration

MCP remote stores all the credential information inside ~/.mcp-auth (or wherever your MCP_REMOTE_CONFIG_DIR points to). If you're having persistent issues, try running:

rm -rf ~/.mcp-auth

It will clear any locally stored state and tokens. Then restart your MCP client.

Conclusion

Setting up an MCP Server for Google Tag Manager significantly simplifies interacting with GTM resources. For a user, there is no need for manual API requests. With our implementation, you can integrate this functionality into your workflow. Whether you're managing tags, containers, or user permissions, the MCP Server acts as a reliable bridge between your AI tools and GTM. We hope this guide helps you get started quickly!

Want to start on the server side? Register now!

Uliana Lesiv

Uliana Lesiv

Author

Uliana is a Content Manager at Stape, specializing in analytics and integration setups. She breaks down complex tracking concepts into clear insights, helping businesses optimize data collection.

Comments

Try Stape for all things server-side