Google Analytics MCP Server
Enables AI assistants to query Google Analytics accounts, properties, and run reports using natural language through the Admin and Data APIs.
README
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-python
Alternative (via pip)
pip install google-analytics-mcp-python
Alternative (via pipx)
pipx install google-analytics-mcp-python
Configuration
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.readonly
Usage 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 name
What 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.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。