Skip to main content
Glama
dhawalshah

google-analytics-mcp

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PORTNoHTTP port (default 8080).8080
BASE_URLNoPublic URL of this service. Used for OAuth metadata and as the canonical resource URI tokens are bound to. Required for Mode B (remote HTTP server).
LOG_LEVELNoPython log level (default INFO).INFO
GCP_PROJECT_IDNoGCP project hosting Firestore. Required for Mode B (remote HTTP server).
MCP_USER_EMAILNoYour email — set in Claude Desktop config for Mode A (local STDIO).
ALLOWED_DOMAINSNoComma-separated email domain allowlist (e.g. acme.com,beta.com). Empty = no restriction.
GOOGLE_CLIENT_IDNoGoogle OAuth client ID. Alternative to OAUTH_CONFIG_PATH for Mode B.
OAUTH_CONFIG_PATHNoPath to client_secret.json. Alternative to GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET; also used in Mode A.
GOOGLE_REDIRECT_URINoOverride the Google callback URL. Defaults to ${BASE_URL}/auth/callback.${BASE_URL}/auth/callback
GOOGLE_CLIENT_SECRETNoGoogle OAuth client secret. Alternative to OAUTH_CONFIG_PATH for Mode B.

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
list_propertiesA

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

get_page_viewsB

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

get_active_usersA

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

get_eventsC

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

get_traffic_sourcesC

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

get_device_metricsB

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

get_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.

get_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.

run_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" } } }

run_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.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
ga4_referenceGoogle Analytics 4 API reference documentation.

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