mcp-server-google-analytics
Google Analytics MCP 服务器
用于访问 Google Analytics 4 (GA4) 数据的 MCP 服务器实现,使用模型上下文协议 TypeScript SDK 构建。
特征
获取具有可自定义维度的页面浏览量指标
跟踪一段时间内的活跃用户和新用户
分析特定事件及其指标
监控用户行为指标(会话时长、跳出率)
所有查询均可灵活选择日期范围
Related MCP server: MCP Search Analytics Server
先决条件
Node.js 20 或更高版本
Google Analytics 4 媒体资源
已启用 Analytics Data API 的 Google Cloud 项目
具有适当权限的服务帐户凭据
设置
创建 Google Cloud 项目并启用 Analytics Data API
创建服务帐户并下载凭证 JSON 文件
授予服务帐号对您的 GA4 资源的适当访问权限
设置环境变量:
export GOOGLE_CLIENT_EMAIL="your-service-account@project.iam.gserviceaccount.com"
export GOOGLE_PRIVATE_KEY="your-private-key"
export GA_PROPERTY_ID="your-ga4-property-id"安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 Google Analytics Server:
npx -y @smithery/cli install mcp-server-google-analytics --client claude手动安装
pnpm install mcp-server-google-analytics用法
启动服务器
pnpm startClaude Desktop中的配置
将其添加到您的 Claude Desktop 配置中:
{
"mcpServers": {
"google-analytics": {
"command": "npx",
"args": ["-y", "mcp-server-google-analytics"],
"env": {
"GOOGLE_CLIENT_EMAIL": "your-service-account@project.iam.gserviceaccount.com",
"GOOGLE_PRIVATE_KEY": "your-private-key",
"GA_PROPERTY_ID": "your-ga4-property-id"
}
}
}
}可用函数
获取页面浏览量
获取特定日期范围内的页面浏览量指标:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"dimensions": ["page", "country"] // Optional
}获取活跃用户
获取活跃用户指标:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31"
}获取事件
获取事件指标:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"eventName": "purchase" // Optional
}获取用户行为
获取用户行为指标:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31"
}安全注意事项
始终对敏感凭据使用环境变量
实施适当的 CORS 设置
设置服务帐户权限时遵循最小特权原则
定期轮换服务帐户凭据
监控 API 使用情况并根据需要实施速率限制
贡献
欢迎贡献代码!请阅读我们的贡献指南,详细了解我们的行为准则以及提交 Pull Request 的流程。
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides an interface to access Google Analytics Data API through Model Context Protocol (MCP), allowing users to retrieve reports and realtime data from Google Analytics 4 properties.1,2097MIT
- AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that provides unified access to Google Analytics 4 and Google Search Console data through real-time analytics queries.2MIT
- AlicenseBqualityDmaintenanceThis project is a Google Analytics 4 (GA4) automation server implemented as a Model Context Protocol (MCP) tool. It lets AI agents query GA4 data (reports, traffic sources, demographics, etc.) and also includes a simple connection test script.71MIT
- AlicenseNot gradedqualityDmaintenanceA powerful Model Context Protocol (MCP) server that provides comprehensive Google Analytics 4 (GA4), Google Search Console (GSC), and Google Merchant Center (GMC) integration for Claude Desktop and other MCP clients.Apache 2.0
Related MCP Connectors
MCP server for interacting with the Supabase platform
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ruchernchong/mcp-server-google-analytics'
If you have feedback or need assistance with the MCP directory API, please join our Discord server