MCP Google Analytics 4 Server
A comprehensive integration for Google Analytics 4 providing 54 tools for advanced reporting, configuration management, and compliance. It enables AI platforms to interact with GA4 data, manage properties, and automate business intelligence through the Model Context Protocol.
README
MCP Google Analytics 4 Server
A comprehensive Model Context Protocol (MCP) server for Google Analytics 4 integration, providing advanced analytics capabilities for AI applications.
🎯 Overview
This MCP server enables AI applications to interact with Google Analytics 4 through a standardized protocol. It supports data retrieval, configuration management, compliance features, and business intelligence automation.
Compatibility: Works with Cursor, Claude Desktop, and any MCP-compatible AI platform.
📊 Features
Phase 1: Advanced Reporting (8 tools)
- Basic Metrics: Core GA4 metrics and KPIs
- Traffic Analysis: Sources, pages, and user behavior
- Real-time Reports: Live data (up to 29 minutes for standard properties)
- Pivot Reports: Cross-dimensional analysis
- Funnel Analysis: Conversion path tracking
- Batch Processing: Multiple reports automation
Phase 2: Configuration Management (13 tools)
- Custom Dimensions: Create, read, update, archive
- Custom Metrics: Complete lifecycle management
- Conversion Events: Configure and manage goals
- Property Settings: Comprehensive configuration access
Phase 3: Platform Integrations (15 tools)
- Google Ads: Campaign performance and attribution
- BigQuery: Data warehouse connectivity
- Data Streams: Multi-platform tracking setup
- Measurement Protocol: Server-side event tracking
Phase 4: Compliance & Privacy (10 tools)
- GDPR Compliance: Automated data subject rights
- User Deletion: Privacy-compliant data removal
- Data Retention: Automated lifecycle management
- Access Control: Permission and audit management
Phase 5: Business Intelligence (8 tools)
- Attribution Modeling: Multi-touch attribution analysis
- Audience Management: Automated segmentation
- Predictive Analytics: ML-powered insights
- Custom Dashboards: Automated reporting
Total: 54 specialized tools across 5 phases
🔧 Installation
Prerequisites
- Python 3.8+
- Google Analytics 4 property
- Google Cloud project with Analytics API enabled
Quick Setup
- Install the package:
pip install mcp-ga4-ultimate
- Configure authentication:
# Set up Application Default Credentials
gcloud auth application-default login \
--scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/analytics.edit
- Add to your MCP client:
For Cursor (.cursor/mcp.json):
{
"mcpServers": {
"ga4-ultimate": {
"command": "python",
"args": ["-m", "mcp_ga4_ultimate"],
"env": {
"GOOGLE_ANALYTICS_PROPERTY_ID": "your_property_id"
}
}
}
}
For Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"ga4-ultimate": {
"command": "python",
"args": ["-m", "mcp_ga4_ultimate"],
"env": {
"GOOGLE_ANALYTICS_PROPERTY_ID": "your_property_id"
}
}
}
}
🚀 Usage Examples
Basic Analytics Query
"Show me the top 10 pages by traffic in the last 30 days"
Real-time Monitoring
"What's happening on my website right now? Show active users and top content"
Conversion Analysis
"Analyze the funnel from landing page to purchase completion"
Configuration Management
"Create a custom dimension for tracking user engagement score"
GDPR Compliance
"Process data deletion request for user ID abc123"
📋 API Coverage
This server implements comprehensive coverage of Google Analytics APIs:
| API | Coverage | Tools |
|---|---|---|
| Analytics Data API | Complete | 15 tools |
| Analytics Admin API | Complete | 27 tools |
| Analytics Measurement Protocol | Complete | 8 tools |
| User Deletion API | Complete | 4 tools |
Total API Coverage: 54 specialized tools
🔒 Security & Permissions
Required OAuth Scopes
https://www.googleapis.com/auth/analytics.readonly- Data accesshttps://www.googleapis.com/auth/analytics.edit- Configuration managementhttps://www.googleapis.com/auth/analytics.manage.users- User management
Data Privacy
- No data stored locally
- Direct API communication only
- GDPR-compliant data handling
- Audit logging for compliance
🧪 Testing & Validation
The server includes comprehensive testing:
- Unit Tests: All 54 tools tested individually
- Integration Tests: Real API validation
- Success Rate: 92.3% (50/54 tools passing)
- Error Handling: Graceful fallbacks and detailed error messages
Run tests:
python -m pytest tests/ -v
📖 Documentation
Complete API Reference
- Tool Documentation - All 54 tools detailed
- Configuration Guide - Setup and customization
- Examples - Common use cases
- Troubleshooting - Common issues
Development
- Contributing Guide - How to contribute
- Architecture - Technical design
- Testing - Test suite details
🆚 Comparison with Other Solutions
| Feature | This Server | Google Official MCP | Basic Packages |
|---|---|---|---|
| Total Tools | 54 | 6 | 2-3 |
| Platform Support | Universal MCP | Gemini only | Varies |
| Real-time Data | ✅ Advanced | ✅ Basic | ❌ |
| Configuration Management | ✅ Complete | ❌ | ❌ |
| GDPR Compliance | ✅ Built-in | ❌ | ❌ |
| Business Intelligence | ✅ Automated | ❌ | ❌ |
| Write Permissions | ✅ Full | ❌ Read-only | Varies |
| Multi-touch Attribution | ✅ Advanced | ❌ | ❌ |
| Testing Coverage | ✅ 92.3% | Unknown | Minimal |
🤝 Contributing
Contributions are welcome! Please see our Contributing Guide for details.
Development Setup
git clone https://github.com/your-org/mcp-ga4-ultimate.git
cd mcp-ga4-ultimate
pip install -e .[dev]
📄 License
MIT License - see LICENSE file for details.
🔗 Links
📞 Support
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Note: This is an independent implementation. For the official Google Analytics MCP server, see googleanalytics/google-analytics-mcp.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。