google-analytics-mcp AGENTS.md

google-analytics-mcp AGENTS.md is an instructions file for Codex, OpenCode from surendranb/google-analytics-mcp. It costs 1,032 tokens per session, scanned C, original, MIT.

An operating guide for Google Analytics MCP, a server that lets AI assistants query Google Analytics 4 reports and administration data through Google's APIs.

In plain words
What is it for?
Use it when connecting an AI assistant to Google Analytics 4, running reports, or configuring the server through an MCP configuration file.
Why use it?
It shows how to install and connect the server, avoiding manual configuration mistakes involving commands, property identifiers, and service-account credentials.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/surendranb/google-analytics-mcp/agents-md
Clone the repo
git clone --depth 1 https://github.com/surendranb/google-analytics-mcp

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for google-analytics-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/surendranb/google-analytics-mcp/agents-md.svg)](https://agentmods.dev/instructions/surendranb/google-analytics-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/surendranb/google-analytics-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/surendranb/google-analytics-mcp/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,032 This file is loaded in full into every session.
When invoked 1,032 The same file — it is already loaded in full.
Security scan C 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01032 $0.01032
Opus 5 $0.00516 $0.00516
Sonnet 5 $0.00206 $0.00206
Haiku 4.5 $0.00103 $0.00103

Measured 4d ago against content hash 9203eb305115, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

google-analytics-mcp AGENTS.md scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

curl -fsSL "https://ga4.builditwithai.xyz/install" | bash

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -fsSL "https://ga4.builditwithai.xyz/install" | bash
AGENTS.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md — Agent Operating Manual

For AI Agents (Claude Code, Cursor, Codex, Gemini, Antigravity, OpenCode, Aider) connecting to or executing google-analytics-mcp.


⚡ 1. Fast Install & Client Wiring (Start Here)

In 90% of cases, you just need to install and configure this MCP server for your user:

# 1-Line Universal Auto-Installer (Configures Claude Code, Cursor, Claude Desktop & Antigravity)
curl -fsSL "https://ga4.builditwithai.xyz/install" | bash

# Or launch directly via stdio:
uvx google-analytics-mcp
npx -y google-analytics-mcp

Client Config Snippet (mcp.json / claude_desktop_config.json)

{
  "mcpServers": {
    "google-analytics": {
      "command": "uvx",
      "args": ["google-analytics-mcp"],
      "env": {
        "GA4_PROPERTY_ID": "123456789",
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service_account.json"
      }
    }
  }
}

📖 2. What This Repo Is

A production MCP server for Google Analytics 4 (GA4). It gives you direct access to the Google Analytics Data API v1beta and Admin API v1alpha.

Primary Tools Available:

  • get_ga4_data: Run multi-dimensional reports with date ranges, metric totals, and server-side aggregation.
  • list_accounts & list_properties: Discover all GA4 properties the credentials can access.
  • get_property_metadata: Fetch exact dimension/metric schemas and custom event definitions for a property.
  • run_realtime_report: Fetch live active users and 30-minute event streams.
  • search_skills: Access pre-engineered analytical recipes (traffic drops, e-commerce, bot filtering).

👤 3. How to Handle the Human (Auth & Setup)

If credentials are not yet configured, do not fail or dump a raw Python traceback on the human. Guide them with these exact steps:

  1. Ask for their 9-digit GA4 Property ID:
    • "You can find your numeric Property ID in Google Analytics under Admin → Property Settings → Property Details."
  2. Ask for a Google Cloud Service Account JSON Key:
    • The human needs a Service Account with the Viewer role on their GA4 Property in Google Analytics Admin → Property Access Management.
    • Once they have the .json file, set:
      export GA4_PROPERTY_ID="123456789"
      export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service_account.json"
      
  3. If Auth Fails: Call get_troubleshooting_guide(topic="setup") or get_troubleshooting_guide(topic="iam") to guide the human through permission repair.

Read the full file on GitHub · 92 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 92 lines · 1,032 tokens per session scan C 9203eb305115

Subscribe to this mod's changes

google-analytics-mcp AGENTS.md is an instructions file published in the GitHub repository surendranb/google-analytics-mcp (240 stars, last pushed 2d ago), licensed MIT. It adds 1,032 tokens to every session, about $0.0052 per session on Opus 5. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.