Mentioned as one of the available integrations through the one-click MCP integration service, though specific capabilities aren't detailed in this README.
Enables access to Google Analytics 4 data with features for property management, page view analysis, active user tracking, event metrics, traffic source analysis, device metrics, and comprehensive custom reporting capabilities.
Referenced as 'Meta Ads' in the one-click integration section, though specific capabilities aren't detailed in this README.
Google Analytics MCP Server 📊
A FastMCP-powered Model Context Protocol server for Google Analytics 4 API integration with automatic OAuth 2.0 authentication
Connect Google Analytics 4 data directly to Claude Desktop and other MCP clients with seamless OAuth 2.0 authentication, automatic token refresh, comprehensive reporting, and analytics capabilities.
🌟 Open Source & Community
GoMarble AI Open Source Projects
Check out our other open source contributions at GoMarble AI GitHub:
Analytics Tools - Advanced analytics and reporting solutions
AI Integration - Tools for integrating AI with marketing platforms
MCP Servers - Additional Model Context Protocol implementations
Marketing Automation - Open source marketing automation tools
Join Our Community
Connect with other developers and marketers using AI in advertising:
Join our Slack Community - AI in Ads
💬 Discuss AI applications in advertising
🤝 Share your projects and get feedback
📚 Learn from industry experts
🚀 Collaborate on open source projects
🔧 Get help with technical implementation
🚀 Try Our One-Click Integration
Skip the manual setup and get started instantly:
One-Click MCP Integration - Connect Google Analytics and other tools to Claude Desktop in seconds
⚡ Instant Setup - No manual configuration required
🔐 Secure Authentication - Built-in OAuth handling
📊 Multiple Integrations - Google Analytics, Google Ads, Meta Ads, and more
📖 Documentation - Complete integration guide at gomarble.ai/docs
✨ Features
🔐 Automatic OAuth 2.0 - One-time browser authentication with auto-refresh
🔄 Smart Token Management - Handles expired tokens automatically
📊 Comprehensive Reporting - Access all GA4 metrics and dimensions
🏢 Property Management - List and manage Google Analytics properties
📈 Advanced Analytics - Page views, users, events, traffic sources, and more
🚀 FastMCP Framework - Built on the modern MCP standard
🖥️ Claude Desktop Ready - Direct integration with Claude Desktop
🛡️ Secure Local Storage - Tokens stored locally, never exposed
📋 Available Tools
Tool | Description | Parameters | Example Usage |
| List all GA4 accounts and properties |
(optional) | "List all my Google Analytics properties" |
| Get page view metrics |
,
,
,
(optional) | "Show me page views for last month" |
| Get active users metrics |
,
,
,
(optional) | "Get active users by day for last week" |
| Get event metrics |
,
,
,
(optional) | "Show me events data for property 123456789" |
| Get traffic source data |
,
,
,
(optional) | "Analyze traffic sources for last 30 days" |
| Get device-based metrics |
,
,
,
(optional) | "Show device breakdown for last month" |
| Comprehensive custom reporting |
,
,
,
,
, filters, etc. | "Create custom report with sessions and conversions by country" |
Note: All tools automatically handle authentication - no token parameters required!
🚀 Quick Start
Prerequisites
Before setting up the MCP server, you'll need:
Python 3.10+ installed
A Google Cloud Platform account
A Google Analytics 4 property with data access
🔧 Step 1: Google Cloud Platform Setup
1.1 Create Google Cloud Project
Go to
Create a new project:
Click "Select a project" → "New Project"
Enter project name (e.g., "Google Analytics MCP")
Click "Create"
1.2 Enable Google Analytics APIs
In your Google Cloud Console:
Go to "APIs & Services" → "Library"
Search for "Google Analytics Data API" and enable it
1.3 Create OAuth 2.0 Credentials
Go to "APIs & Services" → "Credentials"
Click "+ CREATE CREDENTIALS" → "OAuth 2.0 Client ID"
Configure consent screen (if first time):
Click "Configure Consent Screen"
Choose "External" (unless you have Google Workspace)
Fill required fields:
App name: "Google Analytics MCP"
User support email: Your email
Developer contact: Your email
Add scopes:
https://www.googleapis.com/auth/analytics
https://www.googleapis.com/auth/analytics.readonly
Click "Save and Continue" through all steps
Create OAuth Client:
Application type: "Desktop application"
Name: "Google Analytics MCP Client"
Click "Create"
Download credentials:
Click "Download JSON" button
Save file as
client_secret_[long-string].json
in your project directory
🔧 Step 2: Google Analytics Access
2.1 Ensure Analytics Access
Sign in to
Verify you have access to GA4 properties
Note your property IDs (found in GA4 Admin → Property Settings)
Ensure your Google account has at least Viewer access to the properties you want to query
🔧 Step 3: Installation & Setup
3.1 Clone and Install
3.2 Environment Configuration
Create a .env
file in your project directory:
Edit .env
with your credentials:
Example
🖥️ Step 4: Claude Desktop Integration
4.1 Locate Claude Configuration
Find your Claude Desktop configuration file:
macOS:
Windows:
4.2 Add MCP Server Configuration
Edit the configuration file and add your Google Analytics MCP server:
Real Example:
Important:
Use absolute paths for all file locations
On Windows, use forward slashes
/
or double backslashes\\
in paths
4.3 Restart Claude Desktop
Close and restart Claude Desktop to load the new configuration.
🔐 Step 5: First-Time Authentication
5.1 Trigger OAuth Flow
Open Claude Desktop
Try any Google Analytics command, for example:
"List all my Google Analytics properties"
5.2 Complete Authentication
Browser opens automatically to Google OAuth page
Sign in with your Google account (the one with Analytics access)
Grant permissions by clicking "Allow"
Browser shows success page
Return to Claude - your command will complete automatically!
5.3 Verify Setup
After authentication, you should see:
A
google_analytics_token.json
file created in your project directoryYour Google Analytics properties listed in Claude's response
📖 Usage Examples
Property Management
Page View Analysis
User Analytics
Traffic Source Analysis
Event Tracking
Custom Reports
🔍 Advanced GA4 Examples
Sessions and Users by Country
Device Performance Analysis
Traffic Sources with Conversions
Daily Trend Analysis
📁 Project Structure
🔒 Security & Best Practices
File Security
✅ Credential files are gitignored - Never committed to version control
✅ Local token storage - Tokens stored in
google_analytics_token.json
locally✅ Environment variables - Sensitive data in
.env
file✅ Automatic refresh - Minimal token exposure time
Recommended File Permissions
Production Considerations
Use environment variables instead of
.env
files in productionImplement rate limiting to respect API quotas
Monitor API usage in Google Cloud Console
Secure token storage with proper access controls
Regular token rotation for enhanced security
🛠️ Troubleshooting
Authentication Issues
Issue | Symptoms | Solution |
No tokens found | "Starting OAuth flow" message | ✅ Normal for first-time setup - complete browser authentication |
Token refresh failed | "Refreshing token failed" error | ✅ Delete
and re-authenticate |
OAuth flow failed | Browser error or no response | Check credentials file path and internet connection |
Permission denied | "Access denied" in browser | Ensure Google account has Analytics access |
Configuration Issues
Issue | Symptoms | Solution |
Environment variables missing | "Environment variable not set" | Check
file and Claude config
section |
File not found | "FileNotFoundError" | Verify absolute paths in configuration |
Module import errors | "ModuleNotFoundError" | Run
|
Python path issues | "Command not found" | Use absolute path to Python executable |
Claude Desktop Issues
Issue | Symptoms | Solution |
Server not connecting | No Google Analytics tools available | Restart Claude Desktop, check config file syntax |
Invalid JSON config | Claude startup errors | Validate JSON syntax in config file |
Permission errors | "Permission denied" on startup | Check file permissions and paths |
API Issues
Issue | Symptoms | Solution |
Invalid property ID | "Property not found" | Use numeric format:
|
API quota exceeded | "Quota exceeded" error | Wait for quota reset or request increase |
Invalid date format | "Invalid date" | Use YYYY-MM-DD format:
|
No data returned | Empty results | Check date range and property access |
Debug Mode
Enable detailed logging for troubleshooting:
🚀 Advanced Configuration
HTTP Transport Mode
For web deployment or remote access:
Claude Desktop config for HTTP:
Custom Token Storage
Modify token storage location in oauth/google_auth.py
:
🤝 Contributing
We welcome contributions! Here's how to get started:
Development Setup
Making Changes
Create a feature branch:
git checkout -b feature/amazing-feature
Make your changes with appropriate tests
Test thoroughly with different property configurations
Update documentation as needed
Commit changes:
git commit -m 'Add amazing feature'
Push to branch:
git push origin feature/amazing-feature
Open a Pull Request with detailed description
📊 API Limits and Quotas
Google Analytics API Quotas
Core Reporting API: 100,000 requests per day per project
Realtime API: 10,000 requests per day per project
Request rate: 10 queries per second per project
Best Practices for API Usage
Cache results when possible to reduce API calls
Use appropriate date ranges to limit data volume
Batch requests when supported
Monitor usage in Google Cloud Console
Implement retry logic for rate limit errors
Quota Management
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
📈 Roadmap
Upcoming Features
🔄 Enhanced real-time analytics with streaming data
📊 Built-in data visualization with charts and graphs
🤖 AI-powered insights and anomaly detection
📝 Custom dashboard creation tools
🔍 Advanced segmentation capabilities
🌐 Multi-property reporting
Made with ❤️ for the MCP community
Connect your Google Analytics 4 data directly to AI assistants and unlock powerful web analytics insights through natural language conversations.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A FastMCP-powered server that connects Google Analytics 4 data to Claude Desktop with automatic OAuth 2.0 authentication, enabling users to access GA4 metrics, properties, and reports through natural language queries.
- 🌟 Open Source & Community
- ✨ Features
- 📋 Available Tools
- 🚀 Quick Start
- 🔧 Step 1: Google Cloud Platform Setup
- 🔧 Step 2: Google Analytics Access
- 🔧 Step 3: Installation & Setup
- 🖥️ Step 4: Claude Desktop Integration
- 🔐 Step 5: First-Time Authentication
- 📖 Usage Examples
- 🔍 Advanced GA4 Examples
- 📁 Project Structure
- 🔒 Security & Best Practices
- 🛠️ Troubleshooting
- 🚀 Advanced Configuration
- 🤝 Contributing
- 📊 API Limits and Quotas
- 📄 License
- 📈 Roadmap
Related MCP Servers
- -securityAlicense-qualityAn MCP server implementation for accessing Google Analytics 4 (GA4) data, built using the Model Context Protocol TypeScript SDK.Last updated -55667MIT License
- -securityFlicense-qualityAn MCP server for Claude Desktop that allows users to query data from selected Google Cloud datasets by configuring project ID and datasets in the Claude Desktop configuration.Last updated -
- -securityFlicense-qualityConnects Google Analytics 4 data to Claude, Cursor and other MCP clients, enabling natural language queries of website traffic, user behavior, and analytics data with access to 200+ GA4 dimensions and metrics.Last updated -140
- -securityAlicense-qualityThis read-only MCP Server allows you to connect to Google Campaign Manager 360 data from Claude Desktop through CData JDBC Drivers. Free (beta) read/write servers available at https://www.cdata.com/solutions/mcpLast updated -MIT License