Google Analytics MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| GA4_PROPERTY_ID | Yes | Your Google Analytics 4 Property ID (numeric, e.g., 123456789) | |
| GOOGLE_APPLICATION_CREDENTIALS | Yes | Path to your Google Analytics service account key JSON file |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Google Analytics 4 (GA4) Data API access for AI agents — query with schema-accurate names, interpret with skills.
IMPORTANT: your training data likely predates this property's GA4 schema. Universal Analytics was sunset 2023-07-01, and GA4's Data API field names differ from UA and from older GA4 — names you are confident about are frequently invalid here. Do NOT hand-type dimension or metric names.
How to work with this server:
DISCOVER names before querying: call search_schema to get the exact valid dimensions and metrics in THIS property (the only source of truth). Never guess.
INTERPRET with skills: for anything beyond a raw pull, call search_skills first — the skills library has proven field combinations and, more importantly, how to read the result. Fetching data is easy; interpreting it correctly is the hard part.
get_ga4_data validates every name against the live schema. On an invalid name it tells you why and how to find the correct one — read that and fix it; do not retry the same guess.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| check_for_updatesA | Check PyPI for newer versions of this MCP server and get upgrade instructions. |
| list_propertiesB | List all GA4 properties associated with an account. |
| search_schemaA | Search for a keyword across all dimensions and metrics for this property. Returns a ranked list of up to 10 matching fields scored by relevance. Returns: {"top_results": {"DIMENSION: api_name": score, "METRIC: api_name": score, ...}} Use this when you have a concept ("engagement", "revenue", "channel") and need exact API field names before calling get_ga4_data. Use list_dimension_categories or list_metric_categories instead if you want to browse all available fields without a specific keyword. Args: keyword: One or more keywords to search for (e.g., "user", "campaign revenue"). |
| get_property_schemaA | Returns the complete schema for the configured GA4 property, including all available dimensions and metrics (standard and custom). Warning: This can be a very large object (10k+ tokens). Use search_schema for most discovery tasks. |
| list_dimension_categoriesA | List all dimension categories for this GA4 property, with a count of dimensions in each category. Returns: {"dimension_categories": {"Category Name": count, ...}} Use this as the first step in dimension exploration — browse categories, then call get_dimensions_by_category with the name that fits your analysis. Use search_schema instead if you already have a keyword to search for. |
| list_metric_categoriesA | List all metric categories for this GA4 property, with a count of metrics in each category. Returns: {"metric_categories": {"Category Name": count, ...}} Use this as the first step in metric exploration — browse categories, then call get_metrics_by_category with the name that fits your analysis. Use search_schema instead if you already have a keyword to search for. |
| get_dimensions_by_categoryA | Return all dimensions in a specific category with their API names and descriptions. Returns: {"dimension_api_name": "description", ...} The category name must exactly match a value returned by list_dimension_categories. Use search_schema instead if you already have a keyword — it is faster and more targeted than browsing by category. Args: category: Exact category name from list_dimension_categories (case-insensitive). |
| get_metrics_by_categoryA | Return all metrics in a specific category with their API names and descriptions. Returns: {"metric_api_name": "description", ...} The category name must exactly match a value returned by list_metric_categories. Use search_schema instead if you already have a keyword — it is faster and more targeted than browsing by category. Args: category: Exact category name from list_metric_categories (case-insensitive). |
| get_ga4_dataA | Retrieve GA4 data with built-in intelligence for better and safer results. Returns on success: {"data": [...], "metadata": {...}, "_skills_tip": "..."}. For multi-row pulls (a time series like ['date'], or any breakdown) the result also carries "totals": {metric: value} — GA4 server-side aggregates across all rows. Read the period figure from "totals"; do NOT sum the rows yourself. (Additive metrics sum; rate metrics are period-computed by GA4.) Returns on volume warning: {"warning": "...", "estimated_rows": N, "suggestions": [...]} Returns on error: {"error": "..."} CRITICAL WORKFLOW — follow this sequence every time:
FIELD NAMES — GA4 API names vs common wrong guesses:
DATE RANGES:
SCOPE RULES — incompatible combinations return a 400 error:
FILTER STRUCTURE:
Args: dimensions: GA4 dimension names (verified via schema tools, e.g. ["date", "city"]). metrics: GA4 metric names (verified via schema tools, e.g. ["totalUsers", "sessions"]). date_range_start: Start date — 'YYYY-MM-DD' or '7daysAgo', '30daysAgo', 'yesterday'. date_range_end: End date — 'YYYY-MM-DD' or 'yesterday', 'today'. dimension_filter: Optional FilterExpression dict. camelCase and snake_case both accepted. limit: Max rows to return. Defaults to 1000. estimate_only: If True, returns only estimated row count without fetching data. proceed_with_large_dataset: Set True to bypass the 2500-row volume warning. enable_aggregation: If True, asks GA4 for server-side metric totals whenever a dimension splits the data across rows (e.g. a 7-day ['date'] pull), returned in a "totals" block so the model needn't sum rows. Default True. intent: Short plain-English description of what the user is trying to learn. E.g. "which channels drive most signups", "bot traffic audit for last month". |
| get_troubleshooting_guideA | Returns the troubleshooting/setup guide for a topic, served from inside the server (no network needed). Use whenever you hit a schema error, dimension_filter parse error, IAM / 403 authorization error, or a boot-time setup error. Args: topic: One of "setup", "iam", or "schema". |
| search_skillsA | Fetch analytical recipes and how-to guides from the GA4 skills library. Skills are domain-specific playbooks for common GA4 analysis patterns — exact dimensions, metrics, filters, and interpretation logic for each use case. Call this BEFORE querying get_ga4_data for any domain-specific analysis. Available skills: setup, gcp-setup, service-account-setup, traffic-diagnosis, attribution-scope, channel-acquisition, content-performance, geo-device-segmentation, ecommerce-analysis, ai-referral-analysis, bot-traffic-detection, common-metric-names, filter-structures, custom-dimensions, compatible-combinations, ua-to-ga4, date-ranges, ga4-limitations. Usage:
Args: query: A skill name (exact slug) or empty string to browse the full index. |
| setup_ga4_accessA | Interactively fix a broken GA4 MCP setup (missing property ID, missing or expired credentials, or missing GA4 access) by asking the user for the needed input through the client, then re-initializing without a restart. Call this whenever a configuration or authentication error is reported. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| traffic-deep-dive | Full GA4 traffic review for a period: volume, channels, content, geo/devices — using the server's proven query patterns. |
| find-whats-broken | Triage a GA4 MCP setup or configuration problem: pinpoint the exact blocker (credentials, property ID, IAM, expired auth) and fix it. |
| explain-my-traffic-drop | Diagnose why traffic fell: isolate the drop by channel, source, page, geo, and device using the traffic-diagnosis methodology. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| get_setup_guide | Provides instructions to the agent on how to heal the human's MCP setup. |
| get_fix_setup | |
| get_fix_iam | |
| get_fix_schema | |
| skill-index | GA4 analytical skill 'index' — the same recipe served by search_skills('index'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-ai-referral-analysis | GA4 analytical skill 'ai-referral-analysis' — the same recipe served by search_skills('ai-referral-analysis'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-attribution-scope | GA4 analytical skill 'attribution-scope' — the same recipe served by search_skills('attribution-scope'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-bot-traffic-detection | GA4 analytical skill 'bot-traffic-detection' — the same recipe served by search_skills('bot-traffic-detection'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-channel-acquisition | GA4 analytical skill 'channel-acquisition' — the same recipe served by search_skills('channel-acquisition'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-common-metric-names | GA4 analytical skill 'common-metric-names' — the same recipe served by search_skills('common-metric-names'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-compatible-combinations | GA4 analytical skill 'compatible-combinations' — the same recipe served by search_skills('compatible-combinations'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-content-performance | GA4 analytical skill 'content-performance' — the same recipe served by search_skills('content-performance'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-custom-dimensions | GA4 analytical skill 'custom-dimensions' — the same recipe served by search_skills('custom-dimensions'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-date-ranges | GA4 analytical skill 'date-ranges' — the same recipe served by search_skills('date-ranges'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-ecommerce-analysis | GA4 analytical skill 'ecommerce-analysis' — the same recipe served by search_skills('ecommerce-analysis'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-filter-structures | GA4 analytical skill 'filter-structures' — the same recipe served by search_skills('filter-structures'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-ga4-limitations | GA4 analytical skill 'ga4-limitations' — the same recipe served by search_skills('ga4-limitations'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-geo-device-segmentation | GA4 analytical skill 'geo-device-segmentation' — the same recipe served by search_skills('geo-device-segmentation'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-traffic-diagnosis | GA4 analytical skill 'traffic-diagnosis' — the same recipe served by search_skills('traffic-diagnosis'): proven dimensions, metrics, filters, and how to interpret the result. |
| skill-ua-to-ga4 | GA4 analytical skill 'ua-to-ga4' — the same recipe served by search_skills('ua-to-ga4'): proven dimensions, metrics, filters, and how to interpret the result. |
TDQS
Scored across 12 tools
Most tools are clearly distinct, but the schema-discovery cluster (search_schema, get_property_schema, list_dimension_categories, get_dimensions_by_category, list_metric_categories, get_metrics_by_category) creates six similar-feeling tools. What saves it is the explicit cross-referencing in descriptions that tells the agent when to prefer search_schema versus category browsing. setup_ga4_access and get_troubleshooting_guide('setup') also overlap slightly around setup errors.
All names are snake_case with clear verb prefixes (get_, list_, search_, check_, setup_) following a predictable verb_noun pattern. No camelCase/snake_case mixing at the tool level. Very consistent throughout.
12 tools is well within a reasonable scope for a data-analytics server and each maps to a distinct workflow phase (discovery, retrieval, troubleshooting, setup). The single meta-tool (check_for_updates) is slightly off-domain but harmless. A mild over-allocation to schema-browsing tools keeps it from a 5.
The surface covers the core workflow well: property listing, schema discovery, data retrieval, skills/recipes, troubleshooting, and interactive setup repair. Notable gaps include no explicit way to select/switch the active property (only list_properties) and no realtime or admin/configuration data beyond setup repair, but the analytics read path is complete.