Google Analytics MCP Server
Allows listing Google Ads account links associated with a Google Analytics property.
Provides tools for retrieving account summaries, property details, running reports (including realtime), and getting custom dimensions and metrics from Google Analytics properties.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google Analytics MCP ServerWhat is the user count for the last 7 days?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Analytics MCP Server
A Model Context Protocol (MCP) server for comprehensive Google Analytics API access. Built with FastMCP and maintained by Locomotive Agency for use with mcpanywhere.com.
This server provides access to the Google Analytics Admin API and Google Analytics Data API through MCP tools for LLM integration.
Features
The server provides the following MCP tools:
Account & Property Information
get_account_summaries- Retrieves information about Google Analytics accounts and propertiesget_property_details- Returns details about a specific propertylist_google_ads_links- Lists Google Ads account links for a property
Core Reports
run_report- Runs a Google Analytics report using the Data APIget_custom_dimensions_and_metrics- Retrieves custom dimensions and metrics for a property
Realtime Reports
run_realtime_report- Runs a Google Analytics realtime report using the Data API
Installation
Recommended (via uv)
uv tool install google-analytics-mcp-pythonAlternative (via pip)
pip install google-analytics-mcp-pythonAlternative (via pipx)
pipx install google-analytics-mcp-pythonConfiguration
1. Enable Google Analytics APIs
Enable the following APIs in your Google Cloud project:
2. Create Service Account
Go to the Google Cloud Console
Create a service account with the Analytics API scope
Download the JSON key file
3. Set Environment Variables
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"Domain-Wide Delegation (Optional)
If you need to access Analytics properties on behalf of a user:
export ANALYTICS_MCP_SUBJECT="user@yourdomain.com"Note: For backward compatibility, GOOGLE_IMPERSONATED_SUBJECT is also supported.
Required OAuth scope:
https://www.googleapis.com/auth/analytics.readonlyUsage with MCP Clients
Claude Desktop / Gemini
Add to your MCP settings file (~/.gemini/settings.json or Claude Desktop config):
{
"mcpServers": {
"google-analytics": {
"command": "uvx",
"args": ["google-analytics-mcp-python"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account-key.json",
"ANALYTICS_MCP_SUBJECT": "user@yourdomain.com"
}
}
}
}Docker Deployment
Example Dockerfile for containerized deployment:
FROM python:3.12-slim
RUN pip install --no-cache-dir google-analytics-mcp-python
ENV GOOGLE_APPLICATION_CREDENTIALS=/var/secrets/service-account.json
CMD ["google-analytics-mcp"]Required environment variables:
GOOGLE_APPLICATION_CREDENTIALS- Path to service account JSONANALYTICS_MCP_SUBJECT(optional) - User email for domain-wide delegation
Example Prompts
Once configured, you can interact with your Google Analytics data:
What are the most popular events in my Google Analytics property in the last 180 days?Give me details about my Google Analytics property with 'xyz' in the nameWhat are the custom dimensions and custom metrics in my property?Were most of my users in the last 6 months logged in?Development
This server is maintained by Locomotive Agency as part of the MCP Anywhere ecosystem.
Original implementation by Google Analytics team. Enhanced with domain-wide delegation support for enterprise use cases.
License
Apache License 2.0 - See LICENSE file for details.
Contributing
Contributions welcome! See the Contributing Guide.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/locomotive-agency/google-analytics-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server