CCM
/MCP
SkillsMCPMarketplacesDigestLearnAdvertise

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by Category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP Servers by Category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by Category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control

Claude Code Marketplaces

Discover Claude Code plugins, extensions, and tools. Automatically updated directory of Anthropic Claude AI marketplaces with development tools, productivity plugins, and integrations.

Resources

  • Browse Skills
  • Browse MCP Servers
  • Browse Marketplaces
  • Plugins Reference

Community

  • About
  • Learn
  • Feedback
  • Privacy Policy
  • Advertise

Built for the Claude Code community with Claude Code by @mertduzgun

Independent project, not affiliated with Anthropic

Google Analytics Mcp

surendranb/google-analytics-mcp
21425 toolsauthSTDIOregistry active
Summary

The Google Analytics MCP server connects Google Analytics 4 data to AI agents and workflows, providing analysis-ready access to website traffic, user behavior, and performance metrics through tools like live schema discovery, server-side aggregation, and safe defaults that minimize data processing overhead. It enables agents to query GA4 properties directly via the Google Analytics Data API using a service account, reducing the need for manual data wrangling and making analytics insights accessible across Claude, ChatGPT, Cursor, and other MCP-compatible platforms. The server solves the problem of agents spending excessive time preparing raw analytics data for analysis by pre-aggregating results server-side and estimating large datasets to prevent workflow disruptions.

CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
Vibe Prospecting MCPVibe Prospecting MCP
Vibe Prospecting MCP
Connect Claude to +800M contacts, +150M companies. Find & Enrich leads in chat.
Try For Free →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →
CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
Vibe Prospecting MCPVibe Prospecting MCP
Vibe Prospecting MCP
Connect Claude to +800M contacts, +150M companies. Find & Enrich leads in chat.
Try For Free →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →

Tools

Public tool metadata for what this MCP can expose to an agent.

25 tools
GOOGLE_ANALYTICS_BATCH_RUN_REPORTSTool to return multiple analytics data reports in a batch. Use when you need to fetch multiple reports for one GA4 property in a single request.2 params

Tool to return multiple analytics data reports in a batch. Use when you need to fetch multiple reports for one GA4 property in a single request.

Parameters* required
propertystring
Required. The property resource name. Format: properties/{property_id}
requestsarray
Required. Up to 5 individual RunReportRequest objects.
GOOGLE_ANALYTICS_CHECK_COMPATIBILITYTool to list dimensions and metrics compatible with a GA4 report request. Use when you need to validate compatibility of chosen dimensions or metrics before running a report.6 params

Tool to list dimensions and metrics compatible with a GA4 report request. Use when you need to validate compatibility of chosen dimensions or metrics before running a report.

Parameters* required
metricsarray
Optional. List of metrics to check compatibility for.
propertystring
Required. GA4 property resource name. Format: properties/{property_id}.
dimensionsarray
Optional. List of dimensions to check compatibility for.
metricFilterobject
Optional. A FilterExpression for metrics; must follow GA4 FilterExpression JSON schema.
dimensionFilterobject
Optional. A FilterExpression for dimensions; must follow GA4 FilterExpression JSON schema.
compatibilityFilterstring
Compatibility status for dimensions or metrics.one of COMPATIBILITY_UNSPECIFIED · COMPATIBLE · INCOMPATIBLE
GOOGLE_ANALYTICS_CREATE_AUDIENCE_EXPORTTool to create an audience export. Use after configuring the audience and dimensions to produce a long-running Operation.3 params

Tool to create an audience export. Use after configuring the audience and dimensions to produce a long-running Operation.

Parameters* required
parentstring
Parent resource name. Format: properties/{property_id}.
audiencestring
Audience resource name to export. Format: properties/{property_id}/audiences/{audience_id}.
dimensionsarray
List of dimensions to include in the export.
GOOGLE_ANALYTICS_CREATE_AUDIENCE_LISTTool to create an audience list. Use when you need to define and asynchronously populate a new AudienceList resource under a GA4 property.4 params

Tool to create an audience list. Use when you need to define and asynchronously populate a new AudienceList resource under a GA4 property.

Parameters* required
parentstring
Parent property resource name. Format: properties/{property_id}.
audiencestring
Audience resource name. Format: properties/{property_id}/audiences/{audience_id}.
dimensionsarray
List of dimensions to include in the audience list output.
webhookNotificationobject
Configuration for receiving webhook notifications about operation status.
GOOGLE_ANALYTICS_CREATE_EXPANDED_DATA_SETTool to create an expanded data set for a property. Use when you need to combine specific dimensions and metrics into a custom dataset after property creation.2 params

Tool to create an expanded data set for a property. Use when you need to combine specific dimensions and metrics into a custom dataset after property creation.

Parameters* required
parentstring
Parent property resource name. Format: properties/{propertyId}
expandedDataSetobject
Definition of the ExpandedDataSet to create.
GOOGLE_ANALYTICS_CREATE_ROLLUP_PROPERTYTool to create a GA4 Roll-up Property and optionally initial source links.4 params

Tool to create a GA4 Roll-up Property and optionally initial source links.

Parameters* required
accountstring
Required. Parent account resource. Format: accounts/{account_id}
timeZonestring
Required. IANA time zone for the roll-up property.
displayNamestring
Required. Display name for the roll-up property.
sourcePropertiesarray
Optional. List of source property resource names to link. Format: properties/{property_id}.
GOOGLE_ANALYTICS_GET_ACCOUNTTool to retrieve a single Account by its resource name. Use when you need detailed account info after confirming the account resource name (e.g., accounts/100).1 params

Tool to retrieve a single Account by its resource name. Use when you need detailed account info after confirming the account resource name (e.g., accounts/100).

Parameters* required
namestring
Required. The resource name of the Account to retrieve. Format: accounts/{account_id}, e.g., 'accounts/100'.
GOOGLE_ANALYTICS_GET_AUDIENCE_EXPORTTool to get configuration metadata for an Audience Export. Use after creating an Audience Export to retrieve its status and details.1 params

Tool to get configuration metadata for an Audience Export. Use after creating an Audience Export to retrieve its status and details.

Parameters* required
namestring
Required. The resource name of the Audience Export to retrieve. Format: properties/{property}/audienceExports/{audienceExport}.
GOOGLE_ANALYTICS_GET_AUDIENCE_LISTTool to get configuration metadata about a specific audience list. Use after confirming the audience list resource name.1 params

Tool to get configuration metadata about a specific audience list. Use after confirming the audience list resource name.

Parameters* required
namestring
Required. The resource name of the Audience List to retrieve. Format: properties/{property}/audienceLists/{audienceList}.
GOOGLE_ANALYTICS_GET_KEY_EVENTTool to retrieve a Key Event. Use after confirming the key event resource name.1 params

Tool to retrieve a Key Event. Use after confirming the key event resource name.

Parameters* required
namestring
Required. Resource name of the Key Event to retrieve. Format: properties/{property}/keyEvents/{keyEvent}.
GOOGLE_ANALYTICS_GET_METADATATool to get metadata for dimensions, metrics, and comparisons for a GA4 property. Use when you need to discover available fields before building a report.1 params

Tool to get metadata for dimensions, metrics, and comparisons for a GA4 property. Use when you need to discover available fields before building a report.

Parameters* required
namestring
Resource name of the metadata to retrieve. Format: properties/{property_id}/metadata. Use property_id=0 to return only universal (non-custom) metadata.
GOOGLE_ANALYTICS_GET_PROPERTY_QUOTAS_SNAPSHOTTool to retrieve all property quotas organized by category for a given property. Use when you need to check current quota usage for a GA4 property.1 params

Tool to retrieve all property quotas organized by category for a given property. Use when you need to check current quota usage for a GA4 property.

Parameters* required
propertystring
Required. The property resource. Format: properties/{property_id}.
GOOGLE_ANALYTICS_LIST_ACCOUNTSTool to list all Accounts accessible by the caller. Use when you need to enumerate all Google Analytics accounts your credentials can access.3 params

Tool to list all Accounts accessible by the caller. Use when you need to enumerate all Google Analytics accounts your credentials can access.

Parameters* required
pageSizeinteger
Optional. Maximum number of accounts to return. Must be ≥1.
pageTokenstring
Optional. Token for retrieving the next page of results.
showDeletedboolean
Optional. Whether to include soft-deleted (trashed) Accounts.
GOOGLE_ANALYTICS_LIST_AUDIENCE_EXPORTSTool to list all audience exports for a GA4 property. Use when you need to fetch its export history after initiating exports.3 params

Tool to list all audience exports for a GA4 property. Use when you need to fetch its export history after initiating exports.

Parameters* required
parentstring
Required. Resource name of the parent property. Format: properties/{property_id}
pageSizeinteger
Optional. Maximum number of results to return. Defaults to 200; larger values are coerced to 1000.
pageTokenstring
Optional. Token for retrieving the next page of results; other parameters must match original call when paginating.
GOOGLE_ANALYTICS_LIST_AUDIENCE_LISTSTool to list all audience lists for a GA4 property. Use when you need to retrieve a property's configured audience lists after confirming the property ID.3 params

Tool to list all audience lists for a GA4 property. Use when you need to retrieve a property's configured audience lists after confirming the property ID.

Parameters* required
parentstring
Required. Resource name of the parent property. Format: properties/{property_id}
pageSizeinteger
Optional. Maximum number of audience lists to return. Defaults to 200; maximum is 1000.
pageTokenstring
Optional. Token for retrieving the next page of results.
GOOGLE_ANALYTICS_LIST_AUDIENCESTool to list all audiences on a property. Use when you need to fetch all audiences for a GA4 property after confirming its existence.3 params

Tool to list all audiences on a property. Use when you need to fetch all audiences for a GA4 property after confirming its existence.

Parameters* required
parentstring
Required. Property ID or full resource name. Accepts: '123456789' or 'properties/123456789'
pageSizeinteger
Optional. Maximum number of Audiences to return.
pageTokenstring
Optional. Token for retrieving the next page of results.
GOOGLE_ANALYTICS_LIST_KEY_EVENTSTool to list Key Events. Use when you need to retrieve all key event definitions for a given property.3 params

Tool to list Key Events. Use when you need to retrieve all key event definitions for a given property.

Parameters* required
parentstring
Required. Resource name of the parent property. Format: properties/{property_id}.
pageSizeinteger
Optional. Maximum number of results to return. Must be between 1 and 200.
pageTokenstring
Optional. Token for retrieving the next page of results.
GOOGLE_ANALYTICS_LIST_PROPERTIESTool to list GA4 properties under a specific account. Use after obtaining an account ID; supports pagination and including soft-deleted properties.4 params

Tool to list GA4 properties under a specific account. Use after obtaining an account ID; supports pagination and including soft-deleted properties.

Parameters* required
accountstring
Required. The account resource name. Format: accounts/{account_id}
pageSizeinteger
Optional. Maximum number of properties to return; must be between 1 and 200.
pageTokenstring
Optional. Token returned from a previous call to retrieve the next page of results.
showDeletedboolean
Optional. Whether to include soft-deleted (trashed) properties.
GOOGLE_ANALYTICS_LIST_REPORTING_DATA_ANNOTATIONSTool to list all Reporting Data Annotations on a property. Use when you need to retrieve or inspect annotations for a GA4 property.4 params

Tool to list all Reporting Data Annotations on a property. Use when you need to retrieve or inspect annotations for a GA4 property.

Parameters* required
filterstring
Restricts which annotations are listed. Supported fields: name, title, description, annotationDate, annotationDateRange, color; operations: =, !=, <, >, <=, >=, :, =~, !~, NOT, AND, OR; helper functions: annotation_duration(), is_annotation_in_range(startDate,endDate).
parentstring
Resource name of the property. Format: properties/{property_id}.
pageSizeinteger
Optional. Maximum number of annotations to return. Defaults to 50, max 200.
pageTokenstring
Optional. Token for retrieving the next page of results.
GOOGLE_ANALYTICS_LIST_ROLLUP_PROPERTIESTool to list roll-up GA4 properties accessible to the caller. Use when you need to identify roll-up properties across all accessible accounts.1 params

Tool to list roll-up GA4 properties accessible to the caller. Use when you need to identify roll-up properties across all accessible accounts.

Parameters* required
pageSizeinteger
Optional. Maximum number of account summaries to return; must be between 1 and 200.
GOOGLE_ANALYTICS_LIST_SEARCH_ADS360_LINKSTool to list all SearchAds360Links on a property. Use when you need to fetch all Search Ads 360 links for a given property after authenticating.3 params

Tool to list all SearchAds360Links on a property. Use when you need to fetch all Search Ads 360 links for a given property after authenticating.

Parameters* required
parentstring
Required. Resource name of the property. Format: properties/{propertyId} (e.g., properties/1234).
pageSizeinteger
Optional. Maximum number of results to return. Must be between 1 and 200. Defaults to 50.
pageTokenstring
Optional. Token for retrieving the next page of results.
GOOGLE_ANALYTICS_QUERY_AUDIENCE_EXPORTTool to query a completed audience export. Use when you need to fetch user rows with pagination.3 params

Tool to query a completed audience export. Use when you need to fetch user rows with pagination.

Parameters* required
namestring
Required. Resource name of the audience export. Format: properties/{property}/audienceExports/{audienceExport}.
limitinteger
Optional. Number of rows to return. Must be between 1 and 250000. Defaults to 10000.
offsetinteger
Optional. Zero-based start row index for pagination. Defaults to 0.
GOOGLE_ANALYTICS_QUERY_AUDIENCE_LISTTool to query an audience list. Use when you need to retrieve user rows from a GA4 audience list with pagination.3 params

Tool to query an audience list. Use when you need to retrieve user rows from a GA4 audience list with pagination.

Parameters* required
namestring
Required. Audience list resource to query. Format: properties/{property}/audienceLists/{audienceList}.
limitinteger
Optional. Number of rows to return; default 10,000; maximum 250,000.
offsetinteger
Optional. Zero-based row offset for pagination.
GOOGLE_ANALYTICS_RUN_FUNNEL_REPORTTool to run a GA4 funnel report. Use when you need a customized funnel analysis report for a given property.10 params

Tool to run a GA4 funnel report. Use when you need a customized funnel analysis report for a given property.

Parameters* required
limitinteger
Number of rows to return. Default 10000; max 250000.
funnelobject
Funnel configuration object following the API schema (must include 'steps').
propertystring
GA4 property resource name, format: properties/{property_id}.
segmentsarray
Up to 4 segments; each yields its own row in the report.
dateRangesarray
List of date ranges to read; overlapping ranges duplicate days across ranges.
dimensionFilterobject
Dimension-only filter expression.
funnelBreakdownobject
Breakdown dimension configuration for the funnel table sub-report.
funnelNextActionobject
Next-action dimension configuration for the funnel visualization sub-report.
returnPropertyQuotaboolean
If true, includes the property's current quota state.
funnelVisualizationTypestring
Visualization type: STANDARD_FUNNEL (default) or TRENDED_FUNNEL.one of STANDARD_FUNNEL · TRENDED_FUNNEL
GOOGLE_ANALYTICS_RUN_REPORTTool to run a customized GA4 data report. Use when you need event data after specifying dimensions, metrics, and date ranges.15 params

Tool to run a customized GA4 data report. Use when you need event data after specifying dimensions, metrics, and date ranges.

Parameters* required
limitinteger
Optional. Number of rows to return. Must be between 1 and 250000.
offsetinteger
Optional. 0-based start row for pagination. Must be >= 0.
metricsarray
Optional. The metrics to request and display. Each metric is an object with a 'name' field.
orderBysarray
Optional. Specify how rows are ordered. Each object defines dimension or metric ordering.
propertystring
Required. The property resource on which to run the report. Format: properties/{property_id}.
cohortSpecobject
Optional. Cohort specification. Requires requesting the cohort dimension.
dateRangesarray
Optional. The date ranges to read. Each range requires 'startDate' and 'endDate'.
dimensionsarray
Optional. The dimensions to request and display. Each dimension is an object with a 'name' field.
comparisonsarray
Optional. The comparison configuration. Adds a comparison column to the response.
currencyCodestring
Optional. The currency code to apply, in ISO 4217 format. Defaults to property currency.
metricFilterobject
Optional. The filter expression to restrict metric values. Applied after aggregation.
keepEmptyRowsboolean
Optional. If true, rows with all zero metrics will be returned; otherwise omitted.
dimensionFilterobject
Optional. The filter expression to restrict dimension values. Only dimensions are allowed.
metricAggregationsarray
Optional. Aggregation types to include over metrics, e.g., 'TOTAL', 'MINIMUM', 'MAXIMUM'.
returnPropertyQuotaboolean
Optional. If true, include the property's current quota state in the response.

Google Analytics MCP Logo

Google Analytics MCP Server

mcp-name: io.github.surendranb/google-analytics-mcp

PyPI version PyPI Downloads GitHub stars GitHub forks Python 3.10+ License: Apache 2.0 Made with Love

Connect Google Analytics 4 data to AI agents, agentic workflows, and MCP clients. Give agents analysis-ready access to website traffic, user behavior, and performance data with schema discovery, server-side aggregation, and safe defaults that reduce data wrangling.

Built for: AI agents, analyst copilots, and MCP runtimes across Claude, ChatGPT, Cursor, Windsurf, and custom hosts.

I also built a Google Search Console MCP that enables you to mix & match the data from both the sources

---

Why Agents Use This Server

  • Analysis-ready outputs with server-side aggregation, so agents spend more time answering questions and less time wrangling rows
  • Live schema discovery for each GA4 property, including category-based exploration for dimensions and metrics
  • Context-safe defaults that estimate large datasets before they blow up a conversation or workflow
  • Portable MCP surface that works across agent runtimes, IDE copilots, and custom automation

Prerequisites

Check your Python setup:

# Check Python version (need 3.10+)
python --version
python3 --version

# Check pip
pip --version
pip3 --version

Required:

  • Python 3.10 or higher
  • Google Analytics 4 property with data
  • Service account with Google Analytics Data API access and GA4 property access

Step 1: Setup Google Analytics Credentials

Create Service Account in Google Cloud Console

  1. Go to Google Cloud Console
  2. Create or select a project:
    • New project: Click "New Project" → Enter project name → Create
    • Existing project: Select from dropdown
  3. Enable the Analytics APIs:
    • Go to "APIs & Services" → "Library"
    • Search for "Google Analytics Data API" → Click "Enable"
  4. Create Service Account:
    • Go to "APIs & Services" → "Credentials"
    • Click "Create Credentials" → "Service Account"
    • Enter name (e.g., "ga4-mcp-server")
    • Click "Create and Continue"
    • Skip role assignment → Click "Done"
  5. Download JSON Key:
    • Click your service account
    • Go to "Keys" tab → "Add Key" → "Create New Key"
    • Select "JSON" → Click "Create"
    • Save the JSON file - you'll need its path

Add Service Account to GA4

  1. Get service account email:
    • Open the JSON file
    • Find the client_email field
    • Copy the email (format: ga4-mcp-server@your-project.iam.gserviceaccount.com)
  2. Add to GA4 property:
    • Go to Google Analytics
    • Select your GA4 property
    • Click "Admin" (gear icon at bottom left)
    • Under "Property" → Click "Property access management"
    • Click "+" → "Add users"
    • Paste the service account email
    • Select "Viewer" role
    • Uncheck "Notify new users by email"
    • Click "Add"

Find Your GA4 Property ID

  1. In Google Analytics, select your property
  2. Click "Admin" (gear icon)
  3. Under "Property" → Click "Property details"
  4. Copy the Property ID (numeric, e.g., 123456789)
    • Note: This is different from the "Measurement ID" (starts with G-)

Test Your Setup (Optional)

Verify your credentials:

pip install google-analytics-data

Create a test script (test_ga4.py):

import os
from google.analytics.data_v1beta import BetaAnalyticsDataClient

# Set credentials path
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "/path/to/your/service-account-key.json"

# Test connection
client = BetaAnalyticsDataClient()
print("✅ GA4 credentials working!")

Run the test:

python test_ga4.py

If you see "✅ GA4 credentials working!" you're ready to proceed.


Step 2: Install the MCP Server

There are two supported ways to launch the server:

  • ga4-mcp-server when the installed console script is available on your PATH
  • python -m ga4_mcp when you want to use a specific interpreter or virtual environment

Method A: Install from PyPI (Recommended)

python3 -m pip install google-analytics-mcp

If your machine uses python instead of python3, run:

python -m pip install google-analytics-mcp

Option 1: Use the console script

Use this when ga4-mcp-server is available on your PATH:

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "ga4-mcp-server",
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

Option 2: Use an explicit Python interpreter

Use this when you want to pin the exact Python runtime or when the console script is not on your PATH.

If python3 --version worked:

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "python3",
      "args": ["-m", "ga4_mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

If python --version worked:

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "python",
      "args": ["-m", "ga4_mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

Method B: Install from a local clone

git clone https://github.com/surendranb/google-analytics-mcp.git
cd google-analytics-mcp
python3 -m venv .venv
source .venv/bin/activate
python -m pip install .

If you plan to modify the package locally, use python -m pip install -e . instead.

MCP Configuration:

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "/full/path/to/google-analytics-mcp/.venv/bin/python",
      "args": ["-m", "ga4_mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

Step 3: Update Configuration

Replace these placeholders in your MCP configuration:

  • /path/to/your/service-account-key.json with the absolute path to your JSON key
  • 123456789 with your numeric GA4 Property ID
  • /full/path/to/google-analytics-mcp/.venv/bin/python with your virtual environment's Python path (Method B only)

Usage

Once configured, ask your MCP client questions like:

Discovery & Exploration

  • What GA4 dimension categories are available?
  • Show me all ecommerce metrics
  • What dimensions can I use for geographic analysis?

Traffic Analysis

  • What's my website traffic for the past week?
  • Show me user metrics by city for last month
  • Compare bounce rates between different date ranges

Multi-Dimensional Analysis

  • Show me revenue by country and device category for last 30 days
  • Analyze sessions and conversions by campaign and source/medium
  • Compare user engagement across different page paths and traffic sources

E-commerce Analysis

  • What are my top-performing products by revenue?
  • Show me conversion rates by traffic source and device type
  • Analyze purchase behavior by user demographics

Quick Start Examples

Try these example queries to see the MCP's analytical capabilities:

1. Geographic Distribution

Show me a map of visitors by city for the last 30 days, with a breakdown of new vs returning users

This demonstrates:

  • Geographic analysis
  • User segmentation
  • Time-based filtering
  • Data visualization

2. User Behavior Analysis

Compare average session duration and pages per session by device category and browser over the last 90 days

This demonstrates:

  • Multi-dimensional analysis
  • Time series comparison
  • User engagement metrics
  • Technology segmentation

3. Traffic Source Performance

Show me conversion rates and revenue by traffic source and campaign, comparing last 30 days vs previous 30 days

This demonstrates:

  • Marketing performance analysis
  • Period-over-period comparison
  • Conversion tracking
  • Revenue attribution

4. Content Performance

What are my top 10 pages by engagement rate, and how has their performance changed over the last 3 months?

This demonstrates:

  • Content analysis
  • Trend analysis
  • Engagement metrics
  • Ranking and sorting

🚀 Performance Optimizations

This MCP server includes built-in optimizations to prevent context window crashes and ensure smooth operation:

Smart Data Volume Management

  • Automatic row estimation - Checks data volume before fetching
  • Interactive warnings - Alerts when queries would return >2,500 rows
  • Optimization suggestions - Provides specific recommendations to reduce data volume

Server-Side Processing

  • Intelligent aggregation - Automatically aggregates data when beneficial (e.g., totals across time periods)
  • Smart sorting - Returns most relevant data first (recent dates, highest values)
  • Efficient filtering - Leverages GA4's server-side filtering capabilities

User Control Parameters

  • limit - Set maximum number of rows to return
  • proceed_with_large_dataset=True - Override warnings for large datasets
  • enable_aggregation=False - Disable automatic aggregation
  • estimate_only=True - Get row count estimates without fetching data

Example: Handling Large Datasets

# This query would normally return 2,605 rows and crash context window
get_ga4_data(
    dimensions=["date", "pagePath", "country"],
    date_range_start="90daysAgo"
)
# Returns: {"warning": True, "estimated_rows": 2605, "suggestions": [...]}

# Use monthly aggregation instead
get_ga4_data(
    dimensions=["month", "pagePath", "country"], 
    date_range_start="90daysAgo"
)
# Returns: Clean monthly data with manageable row count

Available Tools

The server provides a suite of tools for data reporting and schema discovery.

  1. search_schema - Searches for a keyword across all available dimensions and metrics. This is the most efficient way to discover fields for a query.
  2. get_ga4_data - Retrieve GA4 data with built-in intelligence for better and safer results (includes data volume protection, smart aggregation, and intelligent sorting).
  3. list_dimension_categories - Lists all available dimension categories.
  4. list_metric_categories - Lists all available metric categories.
  5. get_dimensions_by_category - Gets all dimensions for a specific category.
  6. get_metrics_by_category - Gets all metrics for a specific category.
  7. get_property_schema - Returns the complete schema for the property (Warning: this can be a very large object).

Dimensions & Metrics

Access to 200+ GA4 dimensions and metrics organized by category:

Dimension Categories

  • Time: date, hour, month, year, etc.
  • Geography: country, city, region
  • Technology: browser, device, operating system
  • Traffic Source: campaign, source, medium, channel groups
  • Content: page paths, titles, content groups
  • E-commerce: item details, transaction info
  • User Demographics: age, gender, language
  • Google Ads: campaign, ad group, keyword data
  • And 10+ more categories

Metric Categories

  • User Metrics: totalUsers, newUsers, activeUsers
  • Session Metrics: sessions, bounceRate, engagementRate
  • E-commerce: totalRevenue, transactions, conversions
  • Events: eventCount, conversions, event values
  • Advertising: adRevenue, returnOnAdSpend
  • And more specialized metrics

Troubleshooting

If ga4-mcp-server is not found:

  • Use the explicit interpreter launch style instead: python -m ga4_mcp
  • Reinstall with the same Python interpreter your MCP client will use

If you get No module named ga4_mcp:

/full/path/to/python -m pip install google-analytics-mcp

Install the package with the exact interpreter you reference in your MCP configuration.

Permission errors:

# Try user install instead of system-wide
python -m pip install --user google-analytics-mcp

If the server says the credentials file is missing:

  1. Verify the JSON file path is absolute, correct, and accessible
  2. Check service account permissions:
    • Go to Google Cloud Console → IAM & Admin → IAM
    • Find your service account → Check permissions
  3. Verify GA4 access:
    • GA4 → Admin → Property access management
    • Check for your service account email

If the server says GA4_PROPERTY_ID is invalid or queries return no data:

  • Use the numeric Property ID (for example 123456789)
  • Do not use the Measurement ID (for example G-XXXXXXXXXX)
  • Confirm the service account has at least Viewer access on that property

API quota/rate limit errors:

  • GA4 has daily quotas and rate limits
  • Try reducing the date range in your queries
  • Wait a few minutes between large requests

Project Structure

google-analytics-mcp/
├── ga4_mcp/                # Main package directory
│   ├── server.py           # Core server logic
│   ├── coordinator.py      # MCP instance
│   └── tools/              # Tool definitions (reporting, metadata)
├── pyproject.toml          # Package configuration for PyPI
├── requirements.txt        # Dependencies for local dev
├── README.md               # This file
└── ...

License

Apache License 2.0

Featured
CodeRabbit
CodeRabbit
AI writes the code. CodeRabbit catches the slop.
Try For Free →
Make your agent a DeFi expert
Make your agent a DeFi expert
Agent, run crypto. Access onchain data & trade routes via 1inch.
Install now →
Make money from your Skills
Make money from your Skills
On Capafy, your Skill runs online 24/7 as an agent product, and you get paid every time someone uses it.
Start earning →
AppSignal
AppSignal
Monitor with ease. Code with confidence.
Start Free Trial →
Vibe Prospecting MCPVibe Prospecting MCP
Vibe Prospecting MCP
Connect Claude to +800M contacts, +150M companies. Find & Enrich leads in chat.
Try For Free →
Context.devContext.dev
Context.dev
Integrate web data into your AI product. One API to scrape website & brand data.
Get API Key Now →

Configuration

YOUR_API_KEY*secret

Your API key for the service

Categories
Monitoring & ObservabilityData & Analytics
Registryactive
Packagegoogle-analytics-mcp
TransportSTDIO
AuthRequired
UpdatedSep 9, 2025
View on GitHub

Related Monitoring & Observability MCP Servers

View all →
Mcp Observability

io.github.infoinlet-marketplace/mcp-observability

Observability for incident agents — query Loki (LogQL), Prometheus (PromQL), Elasticsearch.
Monitor

betterdb-inc/monitor

BetterDB MCP server - Valkey observability for Claude Code and other MCP clients
1.1k
Datadog

com.mcparmory/datadog

Monitor infrastructure, manage agents and deployments, track metrics, logs, and events
25
Observability Mcp

thotischner/observability-mcp

Unified observability gateway for AI agents — Prometheus, Loki & more, with anomaly detection.
5
Datadog Mcp

io.github.tantiope/datadog-mcp

Full Datadog API access: monitors, logs, metrics, traces, dashboards, and observability tools
4
Datadog

io.github.us-all/datadog

Datadog MCP — 165 tools for metrics, monitors, logs, APM, RUM, incidents, CI/CD, fleet
1