Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

samarth-gtm-mcp

MCP server by samarthanalytics-sj Community

Connects AI assistants to Google Tag Manager and GA4 so they can read containers, run GA4 reports and audit tracking setups. Read-only by default, with writes gated behind flags and confirm=true. Aimed at analysts working on GTM and GA4.

  • Score 81
  • 4 stars
  • 909 a week
  • MIT
  • Updated

Install samarth-gtm-mcp

Built from the published package, never by AI.

claude mcp add samarth-gtm-mcp -e GOOGLE_OAUTH_CLIENT_ID=YOUR_GOOGLE_OAUTH_CLIENT_ID -e GOOGLE_OAUTH_CLIENT_SECRET=YOUR_GOOGLE_OAUTH_CLIENT_SECRET -- npx -y samarth-gtm-mcp

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install samarth-gtm-mcp in Claude Code

MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the samarth-gtm-mcp block.

About

samarth-gtm-mcp is an open-source Model Context Protocol server from Samarth Analytics, released under the MIT license. It lets AI assistants such as Claude Desktop, Claude Code and Cursor work with Google Tag Manager and GA4. The README describes coverage of the GTM API v2, including server-side containers, the GA4 Admin and Data APIs, and a built-in implementation audit.

Writes are off by default. Creating, updating, publishing and deleting each sit behind a separate environment flag, every write needs confirm=true, and a dry-run mode simulates writes. The server can run locally over stdio, as a hosted instance, or self-hosted with Docker. It is aimed at analysts and agencies who manage GTM and GA4 setups, and the README advises testing first on a sandbox container.

Written from the project's README and checked against it.

Tools it gives your assistant

  • ga4_run_reportRuns GA4 Data API reports, for reconciling intended tracking with actual data.
  • ga4_run_realtime_reportRuns GA4 Data API realtime reports.
  • ga4_*Read-only GA4 Admin tools for properties and configuration.
  • Audit toolInspects a GTM workspace for common GA4 and GTM implementation issues.
  • Export toolDumps a full GTM workspace as structured JSON.
  • GTM API v2 toolsManages accounts, containers, workspaces, tags, triggers, variables and versions.

What you need

  • Node.js 18 or newer
  • Git
  • A Google account with a Google Cloud OAuth client
  • Tag Manager API and GA4 APIs enabled in Google Cloud
  • Docker, only for the self-hosted stack
SettingNeededWhat it is
GOOGLE_OAUTH_CLIENT_IDEnvironment variableRequiredYour Google OAuth 2.0 client ID (Desktop app type)
GOOGLE_OAUTH_CLIENT_SECRETEnvironment variable, secretRequiredYour Google OAuth 2.0 client secret
GTM_MCP_ENABLE_WRITESEnvironment variableOptionalSet to 'true' to allow create/update operations (default: read-only)
GTM_MCP_ENABLE_PUBLISHEnvironment variableOptionalSet to 'true' to allow publish operations (default: disabled)
GTM_MCP_ENABLE_DELETESEnvironment variableOptionalSet to 'true' to allow delete operations (default: disabled)

From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.

Try asking

  • Audit my GTM workspace and list common GA4 implementation issues.
  • Run a GA4 report for the last 7 days on my property.
  • Export my GTM workspace as JSON so I can review it.

Good to know

  • Read-only by default. Write flags and confirm=true are needed for changes.
  • The hosted community instance is shared and best-effort, with no uptime promise.
  • Service accounts do not work with GTM by default. The README recommends OAuth 2.0.
  • OAuth apps in testing mode need re-authorizing every 7 days.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: README.md, package.json. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to samarth-gtm-mcp

All alternatives →
World Monitor koala73
98

World Monitor is a real-time global intelligence dashboard covering conflict, markets, energy, trade, shipping and cyber. Its MCP server gives AI assistants access to that data, and it is aimed at analysts, agents and scripts.

ACA Remote 91k
Power BI Authoring MCP Server (Local) microsoft
95

Lets AI agents create and change Power BI semantic models through a local MCP server. Built for developers who want natural language modeling in Power BI Desktop, Fabric workspaces and PBIP files.

AAA Local 9.7k/wk
Seal Open Data ariacom
95

Seal Open Data serves French public datasets from data.gouv.fr to AI assistants. It covers topics such as territories, companies, housing and population. It is aimed at users who want to query French open data from clients like Claude.

AAA Remote 1.7k
OpenMetadataopen-metadata
94

OpenMetadata MCP server lets MCP-compatible assistants search metadata, inspect lineage, and manage data quality tests. It is for data teams and AI agents that need governed context about enterprise data.

AAA Remote 16k
Flint Chart MCP microsoft
94

Compiles, validates and renders semantic chart specs for AI assistants through the Model Context Protocol. It is for agents that need reliable, good-looking and interactive charts across several chart libraries.

AAA Local 4.6k
PostHog PostHog
94

Query PostHog analytics, manage feature flags and experiments, and investigate errors from your AI assistant. It suits product teams and developers who already use PostHog for analytics, replays, and error tracking.

AFA Remote 41k

Compare with World Monitor, Power BI Authoring MCP Server (Local) or Seal Open Data

samarth-gtm-mcp: common questions

Can it change my GTM container?

Writes are off by default. Creating, updating, publishing and deleting each need a separate flag, and every write also needs confirm=true.

Does it support server-side GTM containers?

The README says the GTM API v2 coverage includes server-side containers, with environments, clients, transformations and zones.

Can I use a service account instead of OAuth?

The README says service accounts do not work with GTM by default. It recommends OAuth 2.0, and describes service accounts only as a workaround.

How do I install samarth-gtm-mcp?

In Claude Code run claude mcp add samarth-gtm-mcp -e GOOGLE_OAUTH_CLIENT_ID=YOUR_GOOGLE_OAUTH_CLIENT_ID -e GOOGLE_OAUTH_CLIENT_SECRET=YOUR_GOOGLE_OAUTH_CLIENT_SECRET -- npx -y samarth-gtm-mcp. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.

Is samarth-gtm-mcp the official server?

samarth-gtm-mcp is a community project by samarthanalytics-sj, not verified by a company domain.

Is samarth-gtm-mcp free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is samarth-gtm-mcp safe to use?

It scores 81 of 100. Grades: maintenance A, licence A, quality C. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to samarth-gtm-mcp?

Similar MCP servers: World Monitor, Power BI Authoring MCP Server (Local), Seal Open Data, OpenMetadata.

Does samarth-gtm-mcp work with ChatGPT?

Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.

samarth-gtm-mcp Install

Add to stack

Loading.