Stape
Contact salesTry for free

How to configure the MCP Server for Google Tag Manager

Uliana Lesiv

Uliana Lesiv

Author
Updated
Jul 4, 2025
Published
May 2, 2025

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. In this article, we will explain what the MCP Server is and how it works. We have also prepared a detailed MCP Server implementation guide.

Model Context Protocol Server definition

The Model Context Protocol (MCP) is an open standard that enables AI models to interact with APIs, databases, and various external services.

The MCP Server acts as a central intermediary. It provides a standardized interface for accessing tools, systems, and data sources. The MCP Server ensures that resources and tools are accessible to any AI app compatible with the protocol.

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:

  • Node.js (v18 or higher)
  • AI app or agent (in our case, it is the Claude app)

How to set up an MCP server for GTM

1. Open Claude Desktop and navigate to Settings → Developer → Edit Config. This opens the configuration file that controls which MCP servers Claude can access.

2. Replace the content with the following configuration.

{ "mcpServers": { "google-tag-manager-mcp-server": { "command": "npx", "args": [ "-y", "mcp-remote", "https://gtm-mcp.stape.ai/sse" ] } } }
Add script in Aclaude desktop config file
Add script in Aclaude desktop config file

If you are a Stape user and would like to install Stape MCP Server, follow the instructions from our Stape MCP Server configuration guide and paste the code below.

Please make sure to specify your Stape API key, the directions on how to get it can be found in our article on Stape MCP Server.

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

3. Once you restart Claude Desktop, a browser window will open showing your OAuth login page. Complete the authentication flow to grant Claude access to your MCP server.

MCP CLI Proxy is requesting access
MCP CLI Proxy is requesting access
Give the access to Google Account
Give the access to Google Account

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

Authorization successfull
Authorization successfull

Troubleshooting GTM 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!

author

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-sideright now!