Delmain GA4 MCP
This server lets you query Google Analytics 4 data directly from any MCP-compatible client (Claude, Cursor, etc.) using your own Google account credentials.
List GA4 Properties (
list_properties): Discover all GA4 accounts and properties your Google account has access to, returning account names, property names, and numeric property IDs.Get Property Metadata (
get_property): Retrieve details for a specific GA4 property, including its display name, time zone, and currency settings.Run Custom Reports (
run_report): Query historical GA4 data with full flexibility — choose any dimensions (e.g.,sessionSource,landingPage,date,country,deviceCategory,eventName) and metrics (e.g.,sessions,totalUsers,bounceRate,conversions,averageSessionDuration). Set date ranges using absolute dates (YYYY-MM-DD) or relative values (7daysAgo,today,yesterday), with control over row limits and sort order.Run Realtime Reports (
run_realtime_report): See live activity on a GA4 property (active users and events from roughly the last 30 minutes), filterable by dimensions likecountryordeviceCategory.
Read-only access: All operations are read-only and respect each user's existing GA4 permissions — users can only access properties their Google account is authorized to see.
Allows querying Google Analytics 4 properties for reports, real-time data, and property metadata.
Click on "Deploy 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., "@Delmain GA4 MCPList my GA4 properties."
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.
: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 every GA4 account + property your account can read |
| Metadata for one property (name, timezone, currency) |
| Report with any dimensions/metrics over a date range |
| 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.
Related MCP server: Google Analytics 4 MCP Server
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)
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
Quick install (one script)
There is a one-shot installer for each OS. It finds Python, installs the
package, registers the MCP with Claude Code using the full executable path (so a
missing PATH entry doesn't break it), writes your .env, and runs the browser
authorization.
Windows (install-delmain-ga4-mcp.ps1):
powershell -ExecutionPolicy Bypass -File .\install-delmain-ga4-mcp.ps1macOS / Linux (install-delmain-ga4-mcp.sh):
bash install-delmain-ga4-mcp.shIt will ask you to paste the OAuth client_id / client_secret from the team
vault. That's the only manual input. Then restart your MCP client.
Claude Desktop users: the script auto-registers only with Claude Code (via the
claudeCLI). If you use the Desktop app, the script prints a"mcpServers"JSON block with the full executable path. Copy that block into yourclaude_desktop_config.json(Settings → Developer → Edit Config), then restart the app. Same block works for Cursor's~/.cursor/mcp.json.
Manual 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.
Available Tools
4 toolsget_propertyA
Get metadata for one GA4 property: display name, time zone, currency.
property_id: numeric GA4 property ID (e.g. "463688888"). If omitted, uses DELMAIN_GA4_PROPERTY_ID from the environment when set.
| Name | Required | Description | Default |
|---|---|---|---|
| property_id | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must convey behavioral traits. It discloses the env var fallback but does not mention authentication requirements, rate limits, or whether it is read-only (though 'Get metadata' implies read). With no annotations, this is moderately informative but lacks depth.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two concise sentences with no wasted words. The first sentence front-loads the purpose, and the second details the parameter. It is appropriately sized for the tool's simplicity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the presence of an output schema, the description does not need to detail return values. It covers the parameter semantics and fallback behavior. For a simple one-parameter tool, this is complete enough, though it could mention potential error cases.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 0% description coverage for the parameter, but the description adds significant meaning: it specifies the expected format (numeric GA4 ID), gives an example, and explains the fallback to an environment variable. This compensates well for the schema gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it retrieves metadata for a single GA4 property, listing specific fields (display name, time zone, currency). This is distinct from sibling tools like list_properties (lists properties) and run_report (runs reports).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explains the property_id parameter and its fallback to an environment variable. It implicitly indicates when to use this tool (to get a single property's metadata) versus siblings, but does not explicitly state when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_propertiesA
List every GA4 account and property the authenticated user can read.
Use this first to discover property IDs. Returns account name, property name, and the numeric property_id needed by every other tool.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description covers the read-only nature and scope ('every' account/property the user can read). It lacks details about potential emptiness or rate limits, but for a simple list tool it's sufficient.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences, front-loaded with the core purpose, no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given a read-only list tool with no parameters and an output schema, the description fully covers what an agent needs: purpose, usage order, and output relevance.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
No parameters exist, so schema coverage is 100%. The description adds no parameter details, but baseline for 0 parameters is 4 as it doesn't need to compensate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'List' and the resource 'GA4 account and property', and distinguishes it from siblings like 'get_property' (specific) by listing all.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly advises 'Use this first to discover property IDs' and explains the returned fields are needed by every other tool, providing clear when-to-use guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_realtime_reportA
Run a GA4 realtime report (active users in roughly the last 30 minutes).
property_id: numeric GA4 property ID. dimensions: e.g. ["unifiedScreenName"], ["country"], ["deviceCategory"]. metrics: e.g. ["activeUsers"], ["screenPageViews"]. Defaults to ["activeUsers"].
| Name | Required | Description | Default |
|---|---|---|---|
| property_id | No | ||
| dimensions | No | ||
| metrics | No | ||
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries burden. It indicates a read operation but omits behavior like pagination, rate limits, or empty results. Limit parameter exists but not explained.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is concise with two clear sections: summary and parameter list. Every sentence adds value, though the lack of limit description is a minor omission.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Output schema exists so return values are covered. However, with 4 parameters and no annotations, the description misses the limit parameter and lacks guidance on choosing between this and run_report.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so description adds value for property_id, dimensions, and metrics with examples and defaults. However, the limit parameter is entirely undocumented, leaving a gap.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it runs a GA4 realtime report for active users in the last 30 minutes, distinguishing it from non-realtime report sibling tools like run_report.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage context is implied (realtime data), but no explicit when-to-use or when-not-to-use vs alternatives like run_report. No exclusions or prerequisites mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_reportA
Run a GA4 report with arbitrary dimensions and metrics.
property_id: numeric GA4 property ID. Call list_properties() to find it. dimensions: GA4 dimension API names, e.g. ["sessionSource", "sessionMedium"], ["landingPage"], ["date"], ["country"], ["deviceCategory"], ["eventName"]. Pass [] for a single totals row. metrics: GA4 metric API names, e.g. ["sessions", "totalUsers", "newUsers", "screenPageViews", "bounceRate", "averageSessionDuration", "conversions", "eventCount"]. Defaults to ["sessions"]. start_date / end_date: either "YYYY-MM-DD" or relative like "7daysAgo", "28daysAgo", "today", "yesterday". limit: max rows (default 50). order_by_metric: metric name to sort by (e.g. "sessions"). Empty = API default. order_desc: sort descending when order_by_metric is set.
| Name | Required | Description | Default |
|---|---|---|---|
| property_id | No | ||
| dimensions | No | ||
| metrics | No | ||
| start_date | No | 30daysAgo | |
| end_date | No | today | |
| limit | No | ||
| order_by_metric | No | ||
| order_desc | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses the core behavior: running a report with given parameters, default limit, sorting, and date formats. It does not cover error handling, rate limits, or permission requirements, but it is otherwise transparent about functionality.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with separate sections for each parameter in a bullet-like format. It is concise yet informative, front-loaded with the purpose, and every sentence adds value. No unnecessary repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 8 parameters, no schema descriptions, and no annotations, the description covers parameter semantics thoroughly. It also references a sibling tool for finding property ID. However, it lacks information about potential errors, permissions, or output structure (though output schema exists). For a data-fetching tool, this is close to complete but missing some operational context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, but the description thoroughly explains each parameter with examples and defaults. It adds significant value beyond the schema by providing GA4 dimension/metric API names, date formats, and sorting behavior. This fully compensates for the lack of schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool runs a GA4 report with arbitrary dimensions and metrics. It distinguishes itself from siblings like list_properties and run_realtime_report by emphasizing flexibility in dimensions/metrics and by referencing list_properties to find the property ID.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides detailed guidance on each parameter with examples and defaults, including how to find property_id via list_properties. However, it does not explicitly compare with run_realtime_report or state when to use one over the other. The context signals mention sibling tools, but the description itself lacks that contrast.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
get_property - First observed
list_properties - First observed
run_realtime_report - First observed
run_report
TDQS
Scored across 4 tools
Each tool has a clear, distinct purpose: get_property fetches metadata for one property, list_properties discovers all accessible properties, run_realtime_report provides real-time data, and run_report handles historical reports. There is no overlap, and agents can easily distinguish which tool to use.
All tool names follow a consistent verb_noun pattern in snake_case (get_property, list_properties, run_realtime_report, run_report), making naming predictable and easy to understand.
With only 4 tools, the set is on the smaller side for a GA4 server. While the tools cover basic property retrieval and reporting, additional tools for dimension/metric discovery, account management, or specialized reports (e.g., funnel, cohort) could be expected. The count is acceptable but leaves room for expansion.
The tool surface covers essential read-only operations: property discovery, metadata, real-time data, and historical reports. However, it lacks tools for listing dimension/metric definitions, managing properties, or running more advanced analysis types like funnels or cohorts. Users may need to rely on external knowledge for dimension/metric names.
Maintenance
Related MCP Connectors
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
Connect Google Analytics to ChatGPT. Query GA4 data in plain English and get instant insights.
The BigQuery remote MCP server is a fully managed service that uses the Model Context Protocol to connect AI applications and LLMs to BigQuery data sources. It provides secure, standardized tools for AI agents to list datasets and tables, retrieve schemas, generate and execute SQL queries through natural language, and analyze data—enabling direct access to enterprise analytics data without requiring manual SQL coding.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables LLM applications to query Google Analytics 4 data through standard MCP interfaces, supporting real-time data, custom reports, and metadata discovery.525 npm1MIT
- AlicenseBqualityDmaintenanceEnables managing Google Analytics 4 properties, data streams, conversions, and running reports using natural language through the Admin and Data APIs.23MIT
- AlicenseNot gradedqualityCmaintenanceEnables querying Google Analytics 4 data through MCP tools for running reports, listing properties, getting real-time metrics, and exploring metadata.1 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables querying Google Analytics 4 data through natural language, including running reports, comparing periods, and exploring realtime metrics across multi-tenant properties with OAuth-based authentication.-