Delmain GA4 MCP
Enables querying Google Analytics 4 properties using natural language through MCP clients. Supports customizable reports with any dimensions and metrics, listing properties, and real-time data.
README
:Delmain GA4 MCP
A small MCP server that lets any MCP client (Claude Desktop, Claude Code, Cursor, ...) query Google Analytics 4.
It is intentionally neutral: tools take a property ID plus free-form dimensions and metrics, so it works for PPC, SEO, content, leadership, anyone. Each person authenticates with their own Google account (per-user OAuth), so everyone only sees the GA4 properties they already have access to.
Tools
| Tool | What it does |
|---|---|
list_properties |
List every GA4 account + property your account can read |
get_property |
Metadata for one property (name, timezone, currency) |
run_report |
Report with any dimensions/metrics over a date range |
run_realtime_report |
Active users / events in the last ~30 minutes |
run_report is the workhorse. Example dimensions: sessionSource,
sessionMedium, landingPage, date, country, deviceCategory,
eventName. Example metrics: sessions, totalUsers, newUsers,
screenPageViews, bounceRate, averageSessionDuration, conversions,
eventCount.
Installing with Claude Code
The fastest path. Open Claude Code (or the Code tab in the Claude Desktop App) and paste:
Install the MCP server from https://github.com/aline-delmain/delmain-ga4-mcp —
pip installit and add it to my MCP config as "delmain-ga4".
Claude will clone the repo, install the package, and wire up your MCP client config. Then you finish the two steps Claude can't do for you (by design, since every person authenticates as themselves):
- Paste the OAuth
client_id/client_secret(from the team vault) into~/.delmain-ga4-mcp/.env. - Run
delmain-ga4-mcp-setupand authorize in the browser with your own Google account.
Restart your MCP client and the GA4 tools show up.
Note: a plain chat at claude.ai cannot install software, only Claude Code or the Desktop Code tab can. And the admin setup below must be done once first, otherwise authorization fails with
org_internal/SERVICE_DISABLED.
One-time setup by an admin (do this once for the whole team)
- OAuth client — in the Google Cloud project that owns the ":Delmain GA4" app, create (or reuse) an OAuth client of type Desktop app. Note its client ID and client secret.
- Consent screen — so teammates don't each need to be added as test users:
- If everyone authorizes with an @delmain.co account, set the consent screen to Internal (org-only) and you're done.
- If people will use other Google accounts, set it to External and Publish the app (status: In production). While in Testing, only listed test users can authorize.
- Enable APIs in that project:
- Google Analytics Data API (
analyticsdata.googleapis.com) - Google Analytics Admin API (
analyticsadmin.googleapis.com)
- Google Analytics Data API (
- Put the client ID + secret in the team vault (1Password / Bitwarden). They are shared by everyone; only each person's refresh token is personal.
Per-user install
Requires Python 3.10+.
# 1. Install (from the repo, or once published, from GitHub)
pip install git+https://github.com/<org>/delmain-ga4-mcp.git
# or, working in a clone:
pip install -e .
# 2. Configure credentials
mkdir -p ~/.delmain-ga4-mcp
cp .env.example ~/.delmain-ga4-mcp/.env
# edit it and paste DELMAIN_GA4_CLIENT_ID + DELMAIN_GA4_CLIENT_SECRET
# (from the team vault). Leave the refresh token blank.
# 3. Generate YOUR personal refresh token (opens the browser)
delmain-ga4-mcp-setup
# sign in with the Google account that has your GA4 access, then authorize.
That writes your refresh token to ~/.delmain-ga4-mcp/.env. Done.
Connect it to your MCP client
The server runs over stdio via the delmain-ga4-mcp command.
Claude Desktop / Claude Code
Add to your MCP config (claude_desktop_config.json, or .mcp.json /
~/.claude.json for Claude Code):
{
"mcpServers": {
"delmain-ga4": {
"command": "delmain-ga4-mcp"
}
}
}
Cursor
~/.cursor/mcp.json:
{
"mcpServers": {
"delmain-ga4": { "command": "delmain-ga4-mcp" }
}
}
Restart the client. You should see the GA4 tools available.
Example prompts
- "List my GA4 properties."
- "For property 463688888, sessions and conversions by sessionSource/sessionMedium, last 30 days."
- "Top 10 landing pages by sessions for property 463688888 this month."
- "How many active users are on property 463688888 right now?"
Notes
- Read-only. The server only requests
analytics.readonly; it cannot change anything in GA4. - No secrets in git.
.env,*.jsoncredentials are gitignored. Share the OAuth client via the vault, never by committing it. - Access scope. You can only query properties your own Google account can
see.
list_propertiesshows exactly that set.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。