mcpField
G
Google Analytics MCP Server

Google Analytics MCP Server

Local
ga4mcp.comData & Analytics243Updated today

About Google Analytics MCP Server

Google Analytics MCP Server is an MCP server for Google Analytics 4 (GA4) that gives AI agents access to website traffic, user behavior and performance data. It offers schema discovery and server-side aggregation, suited to teams and developers who want faster GA4 analysis.

Key features

  1. 01GA4 multi-dimensional report queries
  2. 02Server-side metric aggregation and totals
  3. 03Account and property listing
  4. 04Dimension and metric schema discovery
  5. 05Real-time report for the last 30 minutes
  6. 06On-demand analytical skills loaded from GitHub

Use cases

  1. 01Diagnosing the cause of a sudden traffic drop
  2. 02Analyzing channel acquisition and attribution
  3. 03Reviewing e-commerce revenue and conversion funnels

MCP support

This project is an MCP server that exposes tools such as get_ga4_data, list_accounts and run_realtime_report, along with skill listing and reading tools, to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"google-analytics": {
"command": "uvx",
"args": [
"google-analytics-mcp"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "<GOOGLE_APPLICATION_CREDENTIALS>",
"GA4_PROPERTY_ID": "<GA4_PROPERTY_ID>"
}
}
}
}
Run commanduvx google-analytics-mcp
Environment variables to set
GOOGLE_APPLICATION_CREDENTIALSSecretAbsolute path to your Google Cloud service account JSON key with GA4 property access.
GA4_PROPERTY_IDNumeric GA4 Property ID to query, for example 123456789.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypigoogle-analytics-mcp2.11.7

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

Google Analytics MCP Logo

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.

CI PyPI version npm version OpenSSF Scorecard License: MIT

🌐 Live Documentation & Web Portal: https://ga4.builditwithai.xyz


⚡ Quickstart

# 1-Line Universal Installer (Auto-configures Claude Desktop, Cursor, Claude Code, Antigravity, VS Code, Zed, Windsurf)
curl -fsSL "https://ga4.builditwithai.xyz/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"]
    }
  }
}

🛠️ Tools & Capabilities

Tool NameParametersDescriptionReturn Type
get_ga4_datadimensions (list), metrics (list), date_ranges (list), limit (int)Runs multi-dimensional GA4 reports with automated metric totals and server-side aggregation.JSON / Markdown
list_accounts(none)Lists all accessible Google Analytics accounts and permission levels.JSON
list_propertiesaccount_id (optional)Lists all GA4 properties associated with an account.JSON
get_property_metadataproperty_id (optional)Fetches complete dimension and metric schemas, custom definitions, and compatibility rules.JSON
run_realtime_reportmetrics (list), dimensions (list)Queries real-time active users and event counts from the last 30 minutes.JSON
search_skillsquery (string)Searches built-in GA4 analytical playbooks (e-commerce, channel attribution, bot filtering).Markdown
skill_readskill_name (string)Dynamically loads procedural skills and analytical guides from GitHub.Markdown
skills_list(none)Lists all available live GA4 analytical skills.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.

🔒 Telemetry & Privacy

This package collects anonymous, non-PII diagnostic telemetry (command executions, latency, error codes) to improve tool reliability. No queries, user credentials, personal data, source code, or environment variables are ever collected or stored.

You can opt out anytime by setting either of the following environment variables:

export DO_NOT_TRACK=1
# or
export MCP_TELEMETRY_OPT_OUT=1

📄 License

MIT License. See LICENSE for details.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.