io.github.surendranb/google-analytics-mcp

السجل الرسمي التسويق والمبيعات

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

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

PYPI package google-analytics-mcp
Claude Code
claude mcp add google-analytics-mcp -e 'GOOGLE_APPLICATION_CREDENTIALS=<your google_application_credentials>' -e 'GA4_PROPERTY_ID=<GA4_PROPERTY_ID>' -- uvx google-analytics-mcp==2.11.7
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "google-analytics-mcp": {
            "command": "uvx",
            "args": [
                "google-analytics-mcp==2.11.7"
            ],
            "env": {
                "GOOGLE_APPLICATION_CREDENTIALS": "<your google_application_credentials>",
                "GA4_PROPERTY_ID": "<GA4_PROPERTY_ID>"
            }
        }
    }
}

متغيرات البيئة

  • GOOGLE_APPLICATION_CREDENTIALS إلزامي سري Absolute path to your Google Cloud service account JSON key with GA4 property access.
  • GA4_PROPERTY_ID إلزامي Numeric GA4 Property ID to query, for example 123456789.

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. Google Analytics 4 (GA4) MCP Server 📊
  2. ⚡ Quickstart
  3. 🤖 Client Setup
  4. 🛠️ Tools & Capabilities
  5. 🧠 Dynamic Skills & Guided Playbooks
  6. 🔒 Telemetry & Privacy
  7. 📄 License

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://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.

الأسئلة الشائعة

ما هو io.github.surendranb/google-analytics-mcp؟

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

كيف أثبّت io.github.surendranb/google-analytics-mcp؟

يعمل على جهازك. في Claude Code: claude mcp add google-analytics-mcp -e 'GOOGLE_APPLICATION_CREDENTIALS=<your google_application_credentials>' -e 'GA4_PROPERTY_ID=<GA4_PROPERTY_ID>' -- uvx google-analytics-mcp==2.11.7. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج io.github.surendranb/google-analytics-mcp إلى مفتاح API؟

نعم. يتطلب GOOGLE_APPLICATION_CREDENTIALS, GA4_PROPERTY_ID، وتضبطها في إعداداته.

هل io.github.surendranb/google-analytics-mcp مفتوح المصدر؟

نعم. شيفرته متاحة على GitHub بترخيص MIT.

من يصون io.github.surendranb/google-analytics-mcp؟

ينشره surendranb. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.