Google Analytics

Analytics and monitoringMarketing and SEO

GA4 MCP server for AI agents: schema discovery, server-side aggregation, analysis-ready defaults.

Your AI app calls the Google Analytics MCP server, which does the analytics and monitoring and marketing and SEO work and sends the result back to the chat.

About Google Analytics

Google Analytics is a community MCP server from surendranb, filed in our directory under analytics and monitoring and marketing and seo. GA4 MCP server for AI agents: schema discovery, server-side aggregation, analysis-ready defaults.

Google Analytics runs on your own machine: your AI app starts it with the command uvx google-analytics-mcp==2.12.6 and talks to it over standard input and output. It needs GOOGLE_APPLICATION_CREDENTIALS and GA4_PROPERTY_ID set before Google Analytics starts.

Google Analytics is listed in the official MCP registry as io.github.surendranb/google-analytics-mcp, version 2.12.6.

At a glance

Publisher
surendranb (community)
Runs
Locally on your machine
Install from
Python package on PyPI: google-analytics-mcp
Written in
Python
License
MIT
GitHub stars
242
Official MCP registry
io.github.surendranb/google-analytics-mcp

How to set up Google Analytics

  1. Install uv on the machine that runs your AI app, because Google Analytics starts with uvx and fetches its Python package on first run.
  2. Create GOOGLE_APPLICATION_CREDENTIALS and GA4_PROPERTY_ID for Google Analytics in the connected service's own settings, scoped to the smallest permissions the job needs.
  3. Add Google Analytics to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Google Analytics tools to confirm the connection.
  5. Run one read-only task with Google Analytics first, and keep your app asking before each tool call until the results look right.

Google Analytics compared with similar servers

  • Facebook by HagaiHen has fewer GitHub stars than Google Analytics (239 against 242); both are community servers, and both run locally.
  • HomeLab Monitor by SikamikanikoBG has more GitHub stars than Google Analytics (246 against 242); both are community servers, and both run locally.
  • Parse Dmarc by dmarcguardhq has fewer GitHub stars than Google Analytics (238 against 242); both are community servers, and both run locally.

Before you connect Google Analytics

  • Give Google Analytics its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Google Analytics tool call until you trust what it does with them.
  • Treat text that Google Analytics fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Google Analytics on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Google Analytics

How marketing and sales teams put Google Analytics to work, by company size. Pick the size closest to yours and start Google Analytics on one use case.

Small business

  • A small business can ask Google Analytics where this month's customers came from and which channel is worth more budget.
  • Owners can use Google Analytics to get a weekly traffic and conversion summary in plain words, without learning the analytics tool.
  • A small business can ask Google Analytics which pages lost rankings this month and get a short fix list instead of a dashboard to interpret.
  • Google Analytics runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing teams can connect Google Analytics to answer attribution and funnel questions in a chat, then save the useful ones as reports.
  • Growth teams can have Google Analytics flag drops in signups or conversion the day they happen, with the page or source that changed.
  • Content teams can connect Google Analytics to plan briefs from live keyword data, then track which published pages moved after a refresh.
  • Start Google Analytics on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises can expose governed metrics through Google Analytics, so every team's AI answers use the same definitions as finance.
  • Large analytics teams can use Google Analytics to triage anomalies across regions and products before the weekly business review.
  • Enterprise SEO teams can run Google Analytics across many domains and markets to flag technical issues and cannibalized pages before a quarterly review.
  • Google Analytics is a community server, so have security review the code and pin a version before Google Analytics touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Google Analytics README

From surendranb/google-analytics-mcp on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

Google Analytics 4 (GA4) MCP Server 📊

Model Context Protocol (MCP) server for Google Analytics 4: real-time query exploration, schema discovery, metric aggregation, and audience insights for AI agents.

🌐 Live Documentation & Web Portal: https://ga4mcp.com/

⚡ Quickstart

# 1-Line Universal Installer (Auto-configures Claude Desktop, Cursor, Claude Code, Antigravity, VS Code, Zed, Windsurf)
curl -fsSL "https://ga4mcp.com/install" | bash

# Or run directly via your preferred runtime:
uvx google-analytics-mcp
uvx --from google-analytics-mcp ga4-mcp-server
python -m ga4_mcp
npx -y @surendranb/google-analytics-mcp

🤖 Client Setup

A. Claude Code (CLI)
claude mcp add google-analytics -- uvx google-analytics-mcp
B. Cursor & Google Antigravity (mcp.json)
{
  "mcpServers": {
    "google-analytics": {
      "command": "uvx",
      "args": ["google-analytics-mcp"]
    }
  }
}
C. Claude Desktop (claude_desktop_config.json)
{
  "mcpServers": {
    "google-analytics": {
      "command": "uvx",
      "args": ["google-analytics-mcp"],
      "env": {
        "GA4_PROPERTY_ID": "your_ga4_property_id",
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service_account.json"
      }
    }
  }
}
D. VS Code (Cline / Roo Code / Continue)
{
  "mcpServers": {
    "google-analytics": {
      "command": "npx",
      "args": ["-y", "@surendranb/google-analytics-mcp"]
    }
  }
}

Telemetry

On by default. The boot event sends config_status, shell, term_program, system_lang, is_ci, and env_var_names, environment variable names only, never their values.

Tool events send the tool name, status, latency, rows returned, and a scrubbed error category. Credentials are never sent. Before anything leaves the process, property IDs become <id>, custom field names <redacted>, and URLs, file paths, and emails are stripped.

get_ga4_data does send the intent string and the dimension and metric names you pass; search_skills sends its query.

Opt out before boot with any one of these:

export DO_NOT_TRACK=1
export DISABLE_TELEMETRY=1
export NO_TELEMETRY=1
export GA_MCP_TELEMETRY=false

🛠️ Tools & Capabilities

Tool Name Parameters Description Return Type
get_ga4_data dimensions (list), metrics (list), date_range_start (str), date_range_end (str), dimension_filter (dict), limit (int), estimate_only (bool), proceed_with_large_dataset (bool), enable_aggregation (bool), intent (str), all optional Runs multi-dimensional GA4 reports with automated metric totals and server-side aggregation. JSON / Markdown
list_properties account_id (str, optional) Lists GA4 properties. When GA4_PROPERTY_ID is set, returns that property. JSON
search_schema keyword (str, required) Ranks dimensions and metrics by relevance for a keyword (up to 10). Use before pulling data. JSON
get_property_schema (none) Returns the full dimension and metric schema for the configured property (large; prefer search_schema). JSON
list_dimension_categories (none) Lists dimension categories with counts. First step of category browsing. JSON
list_metric_categories (none) Lists metric categories with counts. First step of category browsing. JSON
get_dimensions_by_category category (str, required) Returns all dimensions in a category with API names and descriptions. JSON
get_metrics_by_category category (str, required) Returns all metrics in a category with API names and descriptions. JSON
search_skills query (str, required) Fetches analytical recipes and how-to guides (traffic diagnosis, attribution, ecommerce, AI referrals, bot detection). Markdown
get_troubleshooting_guide topic (str, required: setup | iam | schema) Returns an in-server troubleshooting guide for setup, IAM/403, or schema errors. Markdown
setup_ga4_access (none) Interactively fixes a broken setup (property ID, credentials, access) and re-initializes without a restart. Markdown
check_for_updates (none) Checks PyPI for a newer release and returns upgrade instructions. JSON

🧠 Dynamic Skills & Guided Playbooks

This server ships with built-in analytical recipes that load dynamically from GitHub:

  • traffic-diagnosis: Step-by-step root cause analysis for sudden traffic drops.
  • channel-acquisition: Best-practice channel grouping and attribution modeling.
  • ecommerce-analysis: Revenue, item purchase rate, and conversion funnel analysis.
  • ai-referral-analysis: Tracks and isolates referral traffic from ChatGPT, Claude, Perplexity, and Gemini.

📄 License

MIT License. See LICENSE for details.

Questions about Google Analytics

What is the Google Analytics MCP server?

GA4 MCP server for AI agents: schema discovery, server-side aggregation, analysis-ready defaults. Google Analytics is maintained by surendranb on GitHub at surendranb/google-analytics-mcp, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Google Analytics MCP server?

Add Google Analytics to your AI app's MCP config with the command uvx google-analytics-mcp==2.12.6. In Claude Code, run claude mcp add --transport stdio google-analytics -- uvx google-analytics-mcp==2.12.6. To run Google Analytics this way you need uv installed.

Does Google Analytics need an API key?

Yes. Google Analytics expects GOOGLE_APPLICATION_CREDENTIALS and GA4_PROPERTY_ID to be set. Create the key for Google Analytics in the connected service's own settings, give it the smallest permissions the job needs, and keep it out of shared config files.

Is Google Analytics an official MCP server?

No. Google Analytics is a community server maintained by surendranb. Community servers can be excellent; read the code and the open issues before you give Google Analytics access to company data.

What license is Google Analytics under?

Google Analytics is released under the MIT license, according to its GitHub repository. The license covers the code of Google Analytics; the service it connects to has its own terms.