GA4
- python
1
GitHub Stars
python
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"gatescrispy-mcp-ga4-ultimate": {
"command": "python",
"args": [
"-m",
"mcp_ga4_ultimate"
],
"env": {
"GOOGLE_ANALYTICS_PROPERTY_ID": "YOUR_PROPERTY_ID"
}
}
}
}You can run an MCP server that lets AI applications interact with Google Analytics 4 through a standardized set of tools. This server supports data retrieval, configuration management, privacy, and BI automation, enabling you to build AI-powered analytics workflows with ease.
How to use
You will run the GA4 MCP server locally or in your environment and connect it to your MCP client. Start by ensuring you have the required environment ready, then configure your client to point at the GA4 MCP server configuration. Use your client to send analytics queries, manage configurations, and perform privacy-compliant actions, such as data deletion requests, from your AI workflow. You can perform actions like requesting top pages, real-time activity, funnel analyses, and configuration tasks such as creating custom dimensions or conversion events. All interactions are routed through the MCP interface so you can integrate GA4 data into your AI prompts and automation pipelines.
How to install
Prerequisites you need before installing the GA4 MCP server include Python 3.8 or newer and access to a Google Analytics 4 property. You also need a Google Cloud project with the Analytics API enabled so the server can authenticate and query GA4 data.
# Install the MCP GA4 package
pip install mcp-ga4-ultimate
# Set up Application Default Credentials for Google APIs with the required scopes
gcloud auth application-default login \
--scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/analytics.edit
Configuration examples
To connect your MCP client to the GA4 MCP server, you add a GA4 MCP entry that runs the Python module responsible for the server. This example shows how to configure the GA4 MCP server for Cursor and Claude Desktop clients.
{
"mcpServers": {
"ga4_ultimate": {
"command": "python",
"args": ["-m", "mcp_ga4_ultimate"],
"env": {
"GOOGLE_ANALYTICS_PROPERTY_ID": "your_property_id"
}
}
}
}
Security & privacy
The server communicates directly with GA4 APIs and does not store data locally. It includes audit logging for compliance and supports GDPR-related data handling practices. Ensure you limit access to the MCP server and rotate credentials as part of your security workflow.
Usage patterns
Common tasks include: querying top pages by traffic, monitoring real-time activity, analyzing conversion funnels, creating custom dimensions, configuring conversion events, and managing access control. These actions can be composed into automated prompts or integrated into your AI agent’s data workflows.
Testing & validation
Run the test suite to verify tool coverage and integration with GA4 APIs. The server provides unit tests for individual tools and integration tests against real APIs, with comprehensive error handling and detailed messages to help you diagnose issues quickly.
Troubleshooting
If you encounter authentication or permission issues, ensure the correct OAuth scopes are granted and that the GOOGLE_ANALYTICS_PROPERTY_ID matches your GA4 property. Check that the Google Cloud project has Analytics API enabled and that your client configuration points to the right property.
Notes
This MCP server is designed to work with MCP-compatible AI platforms and supports advanced reporting, configuration management, platform integrations, compliance, and BI features across multiple phases.
Available tools
Analytics Data API Tool
Access core GA4 Analytics Data API to query metrics, dimensions, and reports.
Analytics Admin API Tool
Manage GA4 configuration, properties, and admin settings.
Analytics Measurement Protocol Tool
Support server-side event tracking via the Measurement Protocol.
User Deletion API Tool
Process GDPR data deletion requests and manage user deletions.