Skip to main content

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 Name Parameters Description Return Type
get_ga4_data dimensions (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_properties account_id (optional) Lists all GA4 properties associated with an account. JSON
get_property_metadata property_id (optional) Fetches complete dimension and metric schemas, custom definitions, and compatibility rules. JSON
run_realtime_report metrics (list), dimensions (list) Queries real-time active users and event counts from the last 30 minutes. JSON
search_skills query (string) Searches built-in GA4 analytical playbooks (e-commerce, channel attribution, bot filtering). Markdown
skill_read skill_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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google_analytics_mcp-2.11.3.tar.gz (48.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_analytics_mcp-2.11.3-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file google_analytics_mcp-2.11.3.tar.gz.

File metadata

  • Download URL: google_analytics_mcp-2.11.3.tar.gz
  • Upload date:
  • Size: 48.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for google_analytics_mcp-2.11.3.tar.gz
Algorithm Hash digest
SHA256 85e176931777852dbed21a4e6d9db8d98e44b58aa7664714106ae9c3ac72c4bd
MD5 ff31e9d29894620fefea3efe26fc76fa
BLAKE2b-256 b2d6b0563649682a387fbb6a7528f7d0c3a754081f13f78680b130e628f7eb29

See more details on using hashes here.

Provenance

The following attestation bundles were made for google_analytics_mcp-2.11.3.tar.gz:

Publisher: release.yml on surendranb/google-analytics-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file google_analytics_mcp-2.11.3-py3-none-any.whl.

File metadata

File hashes

Hashes for google_analytics_mcp-2.11.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0f5ccb9bd079e6963cc44b4589ac94888003ed3ffd2ed2f4d8f407aaa41b21e1
MD5 d0569cccb6f3cb94d506abd6390d4ef5
BLAKE2b-256 98452bf4829ad51129b672bceba08cb25b35ab0467688910d1acfde1512ebd82

See more details on using hashes here.

Provenance

The following attestation bundles were made for google_analytics_mcp-2.11.3-py3-none-any.whl:

Publisher: release.yml on surendranb/google-analytics-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

2.11.3 This release

2 files

2.11.2

2 files

2.11.1

2 files

2.11.0

2 files

2.10.0

2 files

2.9.0

2 files

2.8.4

2 files

2.8.3

2 files

2.8.2

2 files

2.8.1

2 files

2.8.0

2 files

2.7.7

2 files

2.7.6

2 files

2.7.5

2 files

2.7.4

2 files

2.7.3

2 files

2.7.2

2 files

2.7.1

2 files

2.7.0

2 files

2.6.5

2 files

2.6.4

2 files

2.6.3

2 files

2.6.2

2 files

2.6.1

2 files

2.6.0

2 files

2.5.5

2 files

2.5.4

2 files

2.5.3

2 files

2.5.2

2 files

2.5.1

2 files

2.5.0

2 files

2.4.1

2 files

2.4.0

2 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.9

2 files

2.1.8

2 files

2.1.7

2 files

2.1.6

2 files

2.1.5

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.0.10

2 files

1.0.9

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page