Google Analytics MCP
A GCP-hosted MCP server for Google Analytics GA4 where each user logs in with their own Google account and queries are scoped to that user's permissions.
README
Google Analytics MCP (shared, per-user OAuth)
A GCP-hosted MCP server for Google Analytics (GA4) where each user logs in with their own Google account and queries are scoped to that user's GA permissions — no shared service-account, no server-held keys, no ACL table.
It re-hosts the official analytics-mcp
tools under FastMCP so we get
streamable-HTTP + Google OAuth — the same pattern as the official Google Ads MCP
and the sibling Naver Search Ads MCP.
How it works
Claude (each teammate) ──streamable-HTTP + Google OAuth (analytics.readonly)──▶
FastMCP server (Cloud Run)
├ GoogleProvider : brokers Google login, forwards the user's Google token
├ credential shim : each request → Credentials(token=<user's Google token>)
└ analytics-mcp : 9 GA tools, now running as the calling user
└─▶ GA Admin/Data API (returns only what that user may see)
The one swap that makes it per-user: analytics_mcp.tools.client._get_credentials
is replaced (in server.py) with a resolver that reads the current request's
Google token via fastmcp.server.dependencies.get_access_token(). When there is
no authenticated request (local stdio), it falls back to Application Default
Credentials.
Tools (all read-only)
get_account_summaries, get_property_details, list_google_ads_links,
list_property_annotations, get_custom_dimensions_and_metrics, run_report,
run_realtime_report, run_funnel_report, run_conversions_report.
Local dev (stdio, ADC)
uv venv --python 3.12 .venv
uv pip install --python .venv/bin/python -e .
# Uses your gcloud ADC. GA_MCP_TRANSPORT defaults to stdio, no OAuth.
GA_MCP_TRANSPORT=stdio .venv/bin/google-analytics-mcp
Hosted (Cloud Run, per-user OAuth)
See DEPLOY.md. In short: create an Internal OAuth Web client
(with the analytics.readonly scope on the consent screen), store the secret in
Secret Manager, then run deploy/deploy.sh.
Environment
| Var | Purpose |
|---|---|
GA_MCP_TRANSPORT |
stdio (local) or http (hosted) |
GA_OAUTH_CLIENT_ID / GA_OAUTH_CLIENT_SECRET |
Google OAuth Web client. Presence activates OAuth. |
PUBLIC_BASE_URL |
Cloud Run HTTPS URL (OAuth redirect base; callback /auth/callback). |
GA_OAUTH_HD |
Workspace domain hint (e.g. yourcompany.com). |
GA_OAUTH_JWT_KEY |
Stable key so issued tokens survive redeploys. |
GCP_PROJECT_ID |
Enables Firestore OAuth-state persistence. |
GA_OAUTH_FIRESTORE_DATABASE / GA_OAUTH_FIRESTORE_COLLECTION |
Firestore location for OAuth state. |
Connect (teammates)
claude mcp add --transport http google-analytics <PUBLIC_BASE_URL>/mcp
# first use opens the browser for Google login
Credits
- The 9 GA tools come from Google's official analytics-mcp (Apache-2.0). This project imports them and overrides only the credential resolver so each request runs as the calling user.
- OAuth + streamable-HTTP transport are provided by FastMCP (Apache-2.0).
See NOTICE for attribution details.
License
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。