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"]
}
}
}
🛠️ 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.
🔒 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.
Metadata
Release files for google-analytics-mcp 2.12.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| google_analytics_mcp-2.12.5.tar.gz | 65.6 kB | Without provenance | Details for google_analytics_mcp-2.12.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| google_analytics_mcp-2.12.5-py3-none-any.whl | Python 3 | none | any | Details for google_analytics_mcp-2.12.5-py3-none-any.whl |
Total release size: 124.2 kB
Release files / google_analytics_mcp-2.12.5.tar.gz
| Download URL | google_analytics_mcp-2.12.5.tar.gz |
|---|---|
| Size | 65.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a32c7c46625a5a25bd08546c969161f91229066a91c8a40394ba9d3b4a39050a
|
|
BLAKE2b-256 checksum How to use checksums |
adfbc1c901445e3a28a665a28713cbbae64ac2227784788b8ad8fc28c54eb918
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / google_analytics_mcp-2.12.5-py3-none-any.whl
| Download URL | google_analytics_mcp-2.12.5-py3-none-any.whl |
|---|---|
| Size | 58.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e19936d53252dc6d010795ed0bebeb39acab4a57859e58cbd3847a757c0c5f9f
|
|
BLAKE2b-256 checksum How to use checksums |
dc709393ccf0ef029e843e3427633c59e7f0dceaa5c74089a14f16d3ea165acb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for google-analytics-mcp 2.12.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.