SG

surendranb/google-analytics-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

244 stars 49 forks 质量 92 趋势 38MIT

surendranb/google-analytics-mcp 是从 https://github.com/surendranb/google-analytics-mcp. 导入的 MCP 服务器候选。

概览

surendranb/google-analytics-mcp 是从 https://github.com/surendranb/google-analytics-mcp. 导入的 MCP 服务器候选。

概述(AI 翻译)

Google Analytics 4 的模型上下文协议(MCP)服务器:实时查询探索、模式发现、指标聚合和受众洞察,适用于 AI 代理。

🌐 实时文档与网络门户:https://ga4.builditwithai.xyz


⚡ 快速开始



🤖 客户端设置

A. 克劳德·科德(CLI)

B. 光标与谷歌反重力(mcp.json)

C. Claude 桌面 (claude_desktop_config.json)

D. VS 代码(Cline / Roo Code / 继续)


🛠️ 工具与功能

工具名称 参数 描述 返回类型
get_ga4_data dimensions(列表), metrics (列表), date_ranges (列表), limit (int) 运行多维GA4报告,包含自动度量总和服务器端聚合。 JSON / Markdown
list_accounts (无) 列出所有可访问的Google Analytics账户及其权限等级。 JSON
list_properties account_id(可选) 列出与账户关联的所有GA4属性。 JSON
get_property_metadata property_id(可选) 获取完整的尺寸和度量模式、自定义定义及兼容性规则。 JSON

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

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://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
在 GitHub 查看完整 README

安装

uvx google-analytics-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "google-analytics": { "command": "uvx", "args": ["google-analytics-mcp"] } } }