Skip to main content
Glama
dhawalshah

google-analytics-mcp

Google Analytics MCP

A Model Context Protocol (MCP) server for Google Analytics 4. Connect Claude (or any MCP-compatible AI client) directly to your GA4 properties to query traffic, analyse user behaviour, inspect events, run funnel analysis, and more — all in natural language.

The server speaks the MCP authorization spec (2025-06-18), so it works as a remote connector anywhere Claude supports custom MCP servers — claude.ai (personal), Claude Desktop, and Claude Teams. Add one URL, click "Connect", sign in with Google, done. For a Teams plan, the org owner adds the URL once and each member individually authenticates on first use.

What you can do

Property Management

  • List all accessible GA4 accounts and their properties

Reporting & Analytics

  • Page views, active users, events, traffic sources, and device metrics

  • Run fully custom reports with any GA4 metric and dimension combination

  • Funnel analysis — track user drop-off across multi-step flows (experimental)

Real-time & Discovery

  • Active users in the last 30 minutes (Realtime API)

  • List all valid dimensions and metrics for a property — useful for building custom reports


Related MCP server: analytics-mcp

How auth works

There are two modes. Pick one.

Mode A — Local STDIO (one user, no server)

Use this if you only want it on your own machine. setup_local_auth.py runs the Google OAuth flow once and stores your token in ~/.config/google-analytics-mcp/token.json. Claude Desktop launches server.py as a subprocess. No Firestore, no Cloud Run, no public URL.

Mode B — Remote HTTP server (Claude Teams, claude.ai, multi-user)

The MCP server is also an OAuth 2.1 authorization server. When Claude connects:

  1. Claude discovers our metadata at /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server.

  2. Claude registers itself via Dynamic Client Registration (POST /oauth/register).

  3. Claude redirects the user to /oauth/authorize. We delegate identification to Google OAuth.

  4. After Google login, we issue our own opaque bearer token to Claude — Google credentials never leave the server.

  5. On each /mcp request Claude sends our bearer; we map it server-side to the right user's stored Google credentials and call the GA4 APIs.

The ?user=email query string from older versions is gone — there are no per-user URLs to copy around.


Prerequisites

  • Python 3.10+

  • A Google Analytics 4 property

  • A Google Cloud project


Step 1 — Set up Google Cloud

1a. Create a project and enable the GA4 APIs

  1. Go to the Google Cloud Console.

  2. Create or select a project.

  3. APIs & Services → Library, enable both:

    • Google Analytics Data API

    • Google Analytics Admin API

1b. Create OAuth 2.0 credentials

  1. APIs & Services → Credentials → Create Credentials → OAuth 2.0 Client ID.

  2. Application type: Web application.

  3. Add Authorized redirect URIs:

    • http://localhost:8080/auth/callback (local dev / setup_local_auth.py)

    • https://YOUR-CLOUD-RUN-URL/auth/callback (remote deployment — add after deploy)

  4. Click Create, then Download JSON → save as client_secret.json in the project root (gitignored). You can also copy the Client ID / Client Secret straight into env vars.

  1. APIs & Services → OAuth consent screen.

  2. Choose Internal for a Google Workspace org (recommended for teams), or External for personal/individual use.

  3. Add scopes:

    • https://www.googleapis.com/auth/analytics

    • https://www.googleapis.com/auth/analytics.readonly

  4. If using External in Testing mode, add each user's email under Test users.

1d. Enable Firestore (Mode B only)

The server stores OAuth bearer tokens and per-user Google credentials in Firestore.

  1. In Cloud Console, Firestore → Create database → Native mode, pick a region.

  2. Grant the Cloud Run service account Cloud Datastore User role under IAM & Admin → IAM.


Step 2 — Install

git clone https://github.com/dhawalshah/google-analytics-mcp
cd google-analytics-mcp
pip install -r requirements.txt
cp .env.example .env       # fill in values

Step 3 — Mode A: Local STDIO

python setup_local_auth.py

A browser opens, you sign in with Google, the script writes ~/.config/google-analytics-mcp/token.json.

Then add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "google-analytics": {
      "command": "python",
      "args": ["/absolute/path/to/google-analytics-mcp/server.py"],
      "env": {
        "OAUTH_CONFIG_PATH": "/absolute/path/to/client_secret.json",
        "MCP_USER_EMAIL": "you@yourcompany.com"
      }
    }
  }
}

Restart Claude Desktop. You're done — skip the rest.


Step 3 — Mode B: Remote HTTP server (Claude Teams / claude.ai)

Deploy to Cloud Run

gcloud run deploy google-analytics-mcp \
  --source . \
  --region YOUR_REGION \
  --project YOUR_PROJECT_ID \
  --platform managed \
  --port 8080 \
  --allow-unauthenticated \
  --set-env-vars "GCP_PROJECT_ID=your-project-id,BASE_URL=https://YOUR-SERVICE-URL.run.app,GOOGLE_CLIENT_ID=...,GOOGLE_CLIENT_SECRET=...,ALLOWED_DOMAINS=yourcompany.com"

Recommended: store GOOGLE_CLIENT_SECRET as a Cloud Run secret rather than a plain env var.

After it's up, go back to APIs & Services → Credentials → your OAuth client and add the live callback URL:

https://YOUR-SERVICE-URL.run.app/auth/callback

Connect from Claude

Claude Teams (org owner adds it once for everyone):

  • Settings → Connectors → Add custom connector

  • URL: https://YOUR-SERVICE-URL.run.app/mcp

  • Each member clicks Connect, signs in with Google, done.

claude.ai personal:

  • Settings → Connectors → Add custom connector

  • URL: https://YOUR-SERVICE-URL.run.app/mcp

Claude Desktop with a remote server:

{
  "mcpServers": {
    "google-analytics": {
      "url": "https://YOUR-SERVICE-URL.run.app/mcp"
    }
  }
}

Claude Desktop will run the OAuth dance the first time you use it.


Environment Variables

Variable

Required

Description

BASE_URL

Mode B

Public URL of this service. Used for OAuth metadata and as the canonical resource URI tokens are bound to.

GCP_PROJECT_ID

Mode B

GCP project hosting Firestore.

GOOGLE_CLIENT_ID

Mode B†

Google OAuth client ID.

GOOGLE_CLIENT_SECRET

Mode B†

Google OAuth client secret.

OAUTH_CONFIG_PATH

Mode B†

Alternative to the two above: path to client_secret.json.

GOOGLE_REDIRECT_URI

No

Override the Google callback URL. Defaults to ${BASE_URL}/auth/callback.

ALLOWED_DOMAINS

No

Comma-separated email domain allowlist (e.g. acme.com,beta.com). Empty = no restriction.

MCP_USER_EMAIL

Mode A

Your email — set in Claude Desktop config.

PORT

No

HTTP port (default 8080).

LOG_LEVEL

No

Python log level (default INFO).

† Set either GOOGLE_CLIENT_ID + GOOGLE_CLIENT_SECRET or OAUTH_CONFIG_PATH.


Available Tools

Tool

Description

list_properties

List all accessible GA4 accounts and their properties

get_page_views

Page views by path or any dimension for a date range

get_active_users

Active user counts by date or any dimension

get_events

Event counts by event name or any dimension

get_traffic_sources

Sessions and users by source/medium

get_device_metrics

Sessions and page views split by device category

get_realtime_users

Active users in the last 30 minutes (Realtime API)

get_property_metadata

List all valid dimensions and metrics for a property

run_funnel_report

Multi-step funnel analysis — track drop-off across a user flow (experimental, v1alpha)

run_report

Fully custom report — any GA4 metrics and dimensions


Example Prompts

Show me page views for the last 30 days
How many active users do we have right now?
What are our top traffic sources this month?
Which device type drives the most sessions?
Show me a funnel from homepage to purchase for last quarter
What custom dimensions does this property have?
Run a report showing sessions and bounce rate by country for January

OAuth endpoint reference (Mode B)

For developers who want to verify the implementation or write their own MCP client.

Endpoint

Spec

Purpose

GET /.well-known/oauth-protected-resource

RFC 9728

Advertises the canonical resource URI and authorization server.

GET /.well-known/oauth-authorization-server

RFC 8414

Authorization server metadata.

POST /oauth/register

RFC 7591

Dynamic Client Registration.

GET /oauth/authorize

OAuth 2.1

Starts the auth code flow with PKCE; redirects to Google.

GET /auth/callback

—

Google redirects here; we mint our authorization code and bounce back to the MCP client.

POST /oauth/token

OAuth 2.1

Authorization code + refresh token grants.

A GET /mcp without a valid bearer returns 401 with a WWW-Authenticate: Bearer resource_metadata="…" header pointing at the protected-resource metadata document, which is how a standards-compliant MCP client discovers the rest.


Attribution

Forked from gomarble-ai/google-analytics-mcp-server, with additions:

  • Local STDIO mode with token stored in ~/.config/google-analytics-mcp/token.json

  • setup_local_auth.py — one-shot local auth script

  • Multi-user HTTP server mode acting as an OAuth 2.1 authorization server (DCR + PKCE + RFC 8707 resource indicators)

  • Per-user OAuth token storage in Firestore

  • Google Cloud Run deployment support

  • 3 additional tools: realtime users, property metadata, funnel reports


About Dhawal Shah

I run a 40-plus person digital marketing agency out of Singapore, and I build the automation my own teams use. This server is one of those tools rather than a weekend project: it runs against live GA4 accounts every week, which is why the read-only surface is wide and the write surface is deliberately narrow.

Fourteen years building companies across Asia behind it. 5,000+ campaigns, 400+ brands, 30+ startups advised, and 300+ training sessions for teams including Sony, Toyota, DHL and Interpol. I am also an Accredited Director with the Singapore Institute of Directors, which in practice means I get asked what breaks, who is accountable and what it costs before anyone asks what it can do.

I write up the routines and agents I actually run at dhawalshah.net.

Worth reading alongside this repo: Claude Code for Marketing: Every Channel from One Terminal.


License

MIT

Available Tools

10 tools
get_active_usersGet Active UsersA

Get active users metrics for a specific date range from Google Analytics 4.

ParametersJSON Schema
NameRequiredDescriptionDefault
end_dateYesEnd date in YYYY-MM-DD format
dimensionsNoList of dimensions to group by (optional, defaults to ["date"])
start_dateYesStart date in YYYY-MM-DD format
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "123456789")

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries all responsibility for behavioral disclosure, but it only states that this is a query of active-user metrics from GA4. It does not disclose read-only status, authentication needs, rate-limit considerations, metric definitions (e.g., the lookback window for 'active users'), or any constraints on data availability. Nothing contradicts the annotations, but little behavioral context is added beyond the obvious read of 'Get'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single front-loaded sentence that states the verb, target resource, date-range scope, and data source with no filler or repetition of schema details. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read-only metric query, the one-sentence description combined with full parameter documentation and an output schema is nearly complete. However, the absence of any guidance about choosing this over closely related siblings such as get_realtime_users or run_report leaves a real contextual gap for an AI agent selecting among the nine sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents all four parameters including formats and defaults. The description's phrase 'specific date range' reinforces start_date and end_date but does not add meaning for property_id or dimensions beyond what the schema provides; therefore the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with the specific verb 'Get' and identifies the resource as 'active users metrics' in Google Analytics 4, which clearly differentiates it from sibling tools like get_page_views, get_events, or get_realtime_users. It also scopes the operation to a specific date range, so an agent can tell what this tool is for without inspecting the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied: an agent should call this when it needs active-user metrics for a historical date range. However, it does not state when not to use it, mention alternatives such as get_realtime_users for current users or run_report for more flexible reporting, or provide any context for choosing among the many sibling get_* metrics tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_device_metricsGet Device MetricsB

Get device metrics for a specific date range from Google Analytics 4.

ParametersJSON Schema
NameRequiredDescriptionDefault
end_dateYesEnd date in YYYY-MM-DD format
dimensionsNoList of dimensions to group by (optional, defaults to ["deviceCategory"])
start_dateYesStart date in YYYY-MM-DD format
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "123456789")

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the behavioral disclosure burden. The verb 'get' signals a read-only operation, and the GA4 source plus date-range scoping add context. However, it does not disclose pagination, authorization needs, or any other operational behavior, though the output schema helps fill the return-shape gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single front-loaded sentence with no filler, redundancy, or vague qualifiers. Every word contributes meaning about the tool's purpose and scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The combination of a 100%-covered schema and an output schema makes the definition mostly complete for invocation: required parameters are documented, the optional dimensions parameter has a clear default, and return shape is covered by the output schema. The main missing piece is usage guidance relative to sibling tools, which is accounted for above.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description reinforces the date-range parameters ('specific date range') but adds no semantic detail beyond what the input schema already provides for property_id, start_date, end_date, or dimensions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get'), the resource ('device metrics'), the source ('Google Analytics 4'), and the temporal filter ('specific date range'). It is not a tautology and can be distinguished from siblings by the 'device metrics' focus, though it does not explicitly contrast itself with any sibling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like run_report or get_page_views. There is no mention of exclusions, alternatives, or conditions that would help an agent choose this tool over similar GA4 query tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_eventsGet EventsC

Get event metrics for a specific date range from Google Analytics 4.

ParametersJSON Schema
NameRequiredDescriptionDefault
end_dateYesEnd date in YYYY-MM-DD format
dimensionsNoList of dimensions to group by (optional, defaults to ["eventName"])
start_dateYesStart date in YYYY-MM-DD format
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "123456789")

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It implies a read operation but does not disclose what qualifies as an event metric, how dates are processed, whether filtering is applied, or any limits. Minimal behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, front-loaded with the action and resource, no filler. It is appropriately brief but misses an opportunity to add clarifying context without becoming bloated.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists, so return format is covered. Given the tool's position among nine siblings and the optional dimensions parameter that controls grouping, a bit more context (e.g., that metrics are aggregated over the range) would help. Current description is minimal but not wholly inadequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description's reference to a 'date range' echoes the start_date/end_date parameters but adds no new meaning beyond the schema. No additional value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Get') and resource ('event metrics') with a date-range scope and source (GA4). 'Event metrics' clearly differentiates it from siblings like get_page_views and get_active_users, though it does not explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs the many sibling metric tools. There is no mention of alternatives, prerequisites, or exclusions – the agent must infer from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_page_viewsGet Page ViewsB

Get page view metrics for a specific date range from Google Analytics 4.

ParametersJSON Schema
NameRequiredDescriptionDefault
end_dateYesEnd date in YYYY-MM-DD format
dimensionsNoList of dimensions to group by (optional, defaults to ["pagePath"])
start_dateYesStart date in YYYY-MM-DD format
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "123456789")

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden. It correctly implies a read-only GA4 query and scopes it by date range, but adds nothing beyond the input schema (which already documents start_date/end_date) and does not disclose defaults, aggregation behavior, or pagination. It is not misleading, but it is thin on behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no filler. It conveys the verb, resource, and scope efficiently, earning a top score for structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is low-complexity, parameters are fully documented in the schema, and an output schema exists, so return values need no description. The remaining gap is usage guidance relative to sibling report/metric tools, which is the only reason this is not a 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and all four parameters have descriptions in the schema. The description adds no parameter-level meaning, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a clear verb ('Get'), resource ('page view metrics'), and scope ('specific date range from Google Analytics 4'). It is not a tautology and the page-view focus distinguishes it from sibling metric tools like get_active_users or get_events, though it does not explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given about when to prefer this tool over siblings like run_report or get_events. The only contextual hint is the date-range scope, which does not count as usage direction. There are no exclusions, prerequisites, or alternative-routing statements.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_property_metadataGet Property MetadataA

List all valid dimensions and metrics available for a Google Analytics 4 property.

Use this before calling run_report to discover which metric and dimension names are valid for a specific property. Different properties may have custom dimensions and metrics in addition to the standard GA4 ones.

ParametersJSON Schema
NameRequiredDescriptionDefault
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "123456789")

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must cover behavioral context. It discloses that the tool returns a list of valid dimensions/metrics and notes that output may vary by property due to custom entries. While it doesn't explicitly state 'read-only', the context strongly implies it, and the output schema handles return format. This is adequate but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no redundancy. The purpose is stated first, followed by usage context. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple metadata discovery tool with a single parameter and an output schema, the description is complete. It covers the essential use case, mentions property-specific variations, and directs the agent to the appropriate next step.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description covers property_id completely (100% coverage), and the tool description adds no additional parameter-level meaning. Baseline of 3 applies because the schema already documents the parameter adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('List') and resource ('valid dimensions and metrics for a GA4 property'), clearly distinguishing this from the sibling reporting tools like run_report and get_page_views. It leaves no ambiguity about what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly instructs the agent to use this tool before calling run_report to discover valid names, and notes that custom dimensions/metrics may vary per property. This gives clear when-to-use guidance and implies it is a discovery step, not a data retrieval step.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_realtime_usersGet Realtime UsersA

Get active users in the last 30 minutes from Google Analytics 4.

This uses the Realtime API — a different endpoint from standard reports. Data reflects activity within the last 30 minutes only; no date range applies.

ParametersJSON Schema
NameRequiredDescriptionDefault
dimensionsNoDimensions to break down by (optional, defaults to ["unifiedScreenName"]) Other useful values: "country", "deviceCategory", "eventName"
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "123456789")

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of behavioral disclosure. It discloses the key behavioral trait: it uses the Realtime API and only reflects the last 30 minutes of activity. However, it does not mention potential limitations like data latency, sampling, or that the Realtime API may have different data freshness characteristics, which would be useful for an agent to know.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured. It front-loads the core purpose in the first sentence, then adds the key differentiator (Realtime API) and the time-window constraint in the following sentences. Every sentence earns its place with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params, 1 required) and the presence of an output schema, the description is largely complete. It explains the key behavioral constraint (30-minute window) and the API distinction. It could be more complete by mentioning what the output looks like, but the output schema likely covers that, and the description adequately covers the essential context for an agent to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters. The description adds context about the real-time nature but does not add meaning beyond the schema for the parameters themselves. The default dimension value is already in the schema, so the description adds no extra parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: retrieving active users from GA4 within the last 30 minutes. It explicitly distinguishes itself from standard reports by mentioning the Realtime API, which helps differentiate it from siblings like get_active_users and run_report.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use this tool (for real-time data within the last 30 minutes) and explicitly notes that no date range applies, which is a key usage constraint. However, it does not explicitly name alternative tools or state when not to use it, though the real-time vs. standard distinction implies this.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_traffic_sourcesGet Traffic SourcesC

Get traffic source metrics for a specific date range from Google Analytics 4.

ParametersJSON Schema
NameRequiredDescriptionDefault
end_dateYesEnd date in YYYY-MM-DD format
dimensionsNoList of dimensions to group by (optional, defaults to ["source", "medium"])
start_dateYesStart date in YYYY-MM-DD format
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "123456789")

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It doesn't state whether the operation is read-only, how it handles invalid date ranges, pagination limits, or authentication requirements. The description is a bare statement of intent without any operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no redundant wording. It states the action, target, and scope efficiently. Every word earns its place, and it's easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the presence of an output schema, the description lacks essential behavioral context such as error handling, rate limits, or usage conditions. For a tool with 4 parameters and no annotations, it feels incomplete for an agent to know how to call it correctly in various situations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters like property_id, start_date, end_date, and dimensions are already documented in the schema. The description adds no additional semantic meaning beyond what the schema provides, so a baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves traffic source metrics from Google Analytics 4 for a date range. The verb 'get' and resource 'traffic source metrics' are specific, and it distinguishes from siblings like get_page_views and get_active_users, though it doesn't explicitly name them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios like comparing traffic sources or conditions that would make run_report more appropriate. There's no explicit when-to-use or when-not-to-use information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_propertiesList PropertiesA

List all Google Analytics 4 accounts with their associated properties in a hierarchical structure.

ParametersJSON Schema
NameRequiredDescriptionDefault
account_idNoOptional specific Google Analytics account ID to list properties for. If not provided, will list all accessible accounts with their properties.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden for behavioral disclosure. It states the output is a hierarchical listing but does not mention permissions, error handling, pagination, or any side effects. For a simple read-only listing tool, this is acceptable but leaves room for more detail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence that efficiently conveys the core purpose without wordiness. Every part is meaningful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple nature (one optional parameter), an output schema, and clear purpose, the description covers what an agent needs to decide whether and how to call it. It lacks details on error conditions or precise response shape, but those are partially covered by the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the schema already explains the optional account_id and the 'list all' behavior. The description adds no new semantic information beyond what the schema provides, so the baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('list'), resource ('Google Analytics 4 accounts with their associated properties'), and clarifies the hierarchical structure. It is clearly distinct from sibling tools that focus on metrics and reports.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description conveys when to use the tool (to list accounts/properties) and includes behavior for when account_id is omitted. It does not explicitly reference alternatives, but the sibling tools are obviously unrelated (metrics/reports), so the context is clear without explicit exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_funnel_reportRun Funnel ReportA

Run a funnel analysis report for a Google Analytics 4 property.

WARNING: EXPERIMENTAL: This uses the GA4 Data API v1alpha endpoint which is unstable and may break or change without notice.

A funnel shows how many users complete each step in a sequence — e.g. homepage -> product page -> add to cart -> purchase.

Each step in steps must be a dict with:

  • "name": human-readable step label (e.g. "Homepage")

  • "filterExpression": a GA4 funnel filter expression dict

STEP FORMAT EXAMPLES:

Page path step: { "name": "Homepage", "filterExpression": { "funnelFieldFilter": { "fieldName": "pagePath", "stringFilter": {"matchType": "EXACT", "value": "/"} } } }

Event step: { "name": "Purchase", "filterExpression": { "funnelEventFilter": { "eventName": "purchase" } } }

ParametersJSON Schema
NameRequiredDescriptionDefault
stepsYesList of funnel step dicts (minimum 2 steps)
end_dateYesEnd date in YYYY-MM-DD format
start_dateYesStart date in YYYY-MM-DD format
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "123456789")
breakdown_dimensionNoOptional dimension to break down funnel by (e.g. "deviceCategory")

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the behavioral disclosure burden. It does disclose the experimental, unstable nature of the GA4 Data API v1alpha endpoint, which is valuable. However, it does not mention permissions, rate limits, output behavior, or whether the operation has side effects, leaving several behavioral aspects unaddressed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is longer than average, but the added length is justified by the experimental warning and detailed step-format examples, both of which are essential for correct use. Information is front-loaded with purpose and warning before examples, and there is minimal filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with an output schema and fully described input parameters, the description covers the trickiest part—how to construct funnel step filters. It leaves some contextual gaps, such as explicit guidance on selecting this over run_report, but it is largely complete given the available structured information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100%, the description adds substantial meaning beyond the schema by specifying the required structure of each step dict and providing full JSON examples for page-path and event steps. It also clarifies the minimum step count, which is not present in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Run a funnel analysis report for a Google Analytics 4 property.' It clearly defines what a funnel report does and includes a concrete example sequence, distinguishing it from the generic sibling run_report and other analytics tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use for funnel analysis but does not explicitly state when to use this tool versus alternatives like run_report, nor does it mention when not to use it. An agent must infer the use case from the name and examples rather than receiving direct routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_reportRun ReportA

Execute a comprehensive Google Analytics 4 report with full customization capabilities.

IMPORTANT: Use STRING ARRAYS for metrics and dimensions, NOT objects!

CORRECT FORMAT:

  • metrics: ["sessions", "totalUsers", "screenPageViews"]

  • dimensions: ["country", "deviceCategory"]

INCORRECT FORMAT (will fail):

  • metrics: [{"name": "sessions"}]

  • dimensions: [{"name": "country"}]

VALID GA4 METRICS:

  • sessions, totalUsers, activeUsers, newUsers

  • screenPageViews, pageviews, bounceRate, engagementRate

  • averageSessionDuration, userEngagementDuration, engagedSessions

  • conversions, totalRevenue, purchaseRevenue

  • eventCount, eventsPerSession

COMMON METRIC MISTAKES:

  • uniquePageviews (not valid) → use screenPageViews

  • pageViews (not valid) → use screenPageViews

  • users (not valid) → use totalUsers or activeUsers

  • sessionDuration (not valid) → use averageSessionDuration

  • conversionsPerSession (not valid) → use eventsPerSession

  • conversionRate (not valid) → calculate manually

VALID GA4 DIMENSIONS:

  • country, city, region, continent

  • deviceCategory, operatingSystem, browser

  • source, medium, campaignName, sessionDefaultChannelGroup

  • pagePath, pageTitle, landingPage

  • date, month, year, hour, dayOfWeek

  • sessionSource, sessionMedium, sessionCampaignName

COMMON DIMENSION MISTAKES:

  • channelGroup (not valid) → use sessionDefaultChannelGroup

  • sessionCampaign (not valid) → use sessionCampaignName

  • campaign (not valid) → use campaignName

SORTING (order_bys) - EXPERIMENTAL:

  • For metrics: [{"metric": {"metricName": "sessions"}, "desc": true}]

  • For dimensions: [{"dimension": {"dimensionName": "country"}, "desc": false}]

  • WARNING: Sorting may fail due to JSON parsing issues. Test without sorting first.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoOptional maximum number of rows (default: 100)
offsetNoOptional number of rows to skip (default: 0)
metricsYesArray of metric names as STRINGS (e.g., ["sessions", "totalUsers"])
end_dateYesEnd date in YYYY-MM-DD format (e.g., "2025-01-31")
order_bysNoOptional sorting - see format above
dimensionsNoOptional array of dimension names as STRINGS (e.g., ["country", "deviceCategory"])
start_dateYesStart date in YYYY-MM-DD format (e.g., "2025-01-01")
property_idYesGoogle Analytics 4 property ID (numeric, e.g., "421301275")
metric_filterNoOptional filter for metrics
keep_empty_rowsNoOptional boolean to include empty rows
dimension_filterNoOptional filter for dimensions

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It warns that sorting is 'EXPERIMENTAL' and 'may fail due to JSON parsing issues,' and it details common mistakes that will cause failures. It also clarifies required input formats ('Use STRING ARRAYS... NOT objects') and provides a correction list. This goes beyond a basic description and helps the agent anticipate failure modes. It does not state read-only status or rate limits, but given the operational warnings, it is quite transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but well-structured with clear sections (IMPORTANT, CORRECT FORMAT, VALID GA4 METRICS, COMMON METRIC MISTAKES, etc.). Each part adds necessary detail for correct usage, and the most critical format warning is front-loaded. It could arguably be trimmed, but for an 11-parameter tool with many pitfalls, the length is justified and the organization is logical.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (11 parameters, no annotations, but an output schema exists), the description covers the core behavior, formatting requirements, valid values, and known failure modes. It does not elaborate on metric_filter or dimension_filter beyond generic schema descriptions, but those are optional and the schema provides basic context. The output schema presumably covers the return structure, so that gap is acceptable. Overall it is quite complete for a complex reporting tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already covers 100% of parameters with descriptions, but the description adds substantial extra semantics: it enumerates valid GA4 metrics and dimensions, flags common invalid aliases, and specifies the exact structure for order_bys. For example, the metrics parameter schema just says 'Array of metric names as STRINGS,' while the description lists which strings are valid and which are not. This significantly enriches parameter meaning beyond the schema, so it earns a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'Execute a comprehensive Google Analytics 4 report with full customization capabilities,' which gives a specific verb (execute) and resource (GA4 report). It implies it is the general-purpose reporting tool, distinguishing it from sibling tools like get_page_views or get_active_users that target specific metrics. However, it does not explicitly name alternatives or contrast itself with run_funnel_report, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides extensive guidance on parameter formatting and valid metric/dimension names, but it does not address when to use this tool versus its siblings. There is no mention of 'use this for general reporting, or get_page_views for a quick single metric' or any exclusion conditions. The purpose of 'comprehensive' implies a default choice, but no explicit routing guidance is given, so the agent must infer selection.

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.

  1. 10 tool updatesv0.1.0
    • First observedget_active_users
    • First observedget_device_metrics
    • First observedget_events
    • First observedget_page_views
    • First observedget_property_metadata
    • First observedget_realtime_users
    • First observedget_traffic_sources
    • First observedlist_properties
    • First observedrun_funnel_report
    • First observedrun_report

TDQS

A3.6/5.0

Scored across 10 tools

Disambiguation4/5

Most tools are clearly distinct by metric type (page views, active users, events, traffic sources, devices, realtime users). However, get_active_users and get_realtime_users both measure active users, differing only by time window, which could cause confusion. run_report and run_funnel_report are distinct but run_report's broad scope overlaps somewhat with the individual metric getters.

Naming Consistency4/5

Tool names follow a consistent get_<metric>_metrics pattern, with list_properties, get_property_metadata, run_report, and run_funnel_report as readable exceptions. The naming is mostly consistent, though run_report and run_funnel_report use a different verb style than the get_* tools.

Tool Count5/5

10 tools is well-scoped for a Google Analytics MCP server. Each tool covers a distinct reporting need, and the count is within the ideal 3-15 range.

Completeness4/5

The server covers property discovery, metadata exploration, standard reports, realtime data, and funnel analysis. Minor gaps include no tool for creating/updating properties or managing audiences, but the core analytics querying surface is well covered.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    A local MCP server for Google Analytics 4 that provides tools for SEO and paid reporting, enabling queries on organic and paid search performance, landing pages, channels, campaigns, and real-time data.
    10
    13 npm
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for querying Google Analytics accounts, properties, reports, and realtime data using the Data API and Admin API.
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    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.
    Apache 2.0
  • F
    license
    Not graded
    quality
    C
    maintenance
    Production-ready MCP server integrating Google Search Console, GA4, and PageSpeed Insights for SEO and analytics intelligence, enabling natural-language queries to Google analytics data.
    -