1. Conduid
  2. Developer Tools
  3. Google Analytics 4
MCP server · Developer Tools

Google Analytics 4

Google Analytics MCP Pack

Unclaimed MIT other
47Fair

Scored 10 days ago · breakdown

About Google Analytics 4

Google Analytics 4 is an MCP server published by leonardosepulvedat in the Developer Tools category: google Analytics MCP Pack.

The repository has 2 stars and 0 forks, with the last commit 2 months ago. Recent commit activity is the strongest signal that reported issues will get attention.

Install

Claude Code
claude mcp add google-analytics -- npx -y @toolsdk.ai/google-analytics-mcp
npx
npx -y @toolsdk.ai/google-analytics-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (16)

ga_batch_run_reportsMultiple reports in one request

Parameters not published.

ga_check_compatibilityValidate dimension/metric combos before reporting

Parameters not published.

ga_get_account_summariesAll accounts and properties in one call

Parameters not published.

ga_get_metadataAll available dimensions and metrics

Parameters not published.

ga_get_propertyDetails of the configured property

Parameters not published.

ga_list_accountsList accessible GA accounts

Parameters not published.

ga_list_custom_dimensionsCustom dimensions of the property

Parameters not published.

ga_list_custom_metricsCustom metrics of the property

Parameters not published.

ga_list_data_streamsData streams of the property

Parameters not published.

ga_list_google_ads_linksGoogle Ads accounts linked to the property

Parameters not published.

Show all 16 tools
ga_list_key_eventsKey events (conversions) of the property

Parameters not published.

ga_list_propertiesList GA4 properties

Parameters not published.

ga_run_funnel_reportFunnel analysis across event steps

Parameters not published.

ga_run_pivot_reportPivot table reports

Parameters not published.

ga_run_realtime_reportReal-time data (last 30 minutes)

Parameters not published.

ga_run_reportCustom reports with dimensions and metrics

Parameters not published.

Ask AI

✦

Ask AI about Google Analytics 4

Powered by Claude · Grounded in docs

I know everything about Google Analytics 4. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ✓README presentThe repository ships documentation.
  • ✓License declaredUsable under a stated license.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

3 checks have not been run yet.

Releases

v1.3.1v1.3.1 · 21 Aug 2026Quality/metadata release aimed at Smithery verification: full tool annotations, workflow prompts, icon, and a homepage link back to Smithery. npm: https://www.npmjs.com/package/mcp-google-analytics Smithery:…
v1.3.0v1.3.0 · 21 Aug 2026Multi-property mode (agencies) — every read tool now accepts an optional `propertyId` argument that overrides the configured `GA_PROPERTY_ID`, so a single conversation can query any property the service account can access. No…
v1.2.1v1.2.1 · 21 Aug 2026Distribution release: published to the Official MCP Registry (`io.github.leonardosepulvedat/mcp-google-analytics`) with a `server.json` manifest and `mcpName` field, added a one-click Install in Cursor button and downloads/CI badges to the…
v1.2.0v1.2.0 · 21 Aug 202626 tools total — this release widens the gap: full read coverage matching every competitor, plus write capabilities nobody else has. Added — 6 new read tools (Admin/Data API, read-only) `ga_get_account_summaries` — all accounts and…
v1.1.1v1.1.1 · 6 Aug 2026Documentation release: at-a-glance table of all 18 tools, five new Measurement Protocol usage examples (event validation, server-side conversions, ecommerce funnel with shared `client_id`, custom automation events, and send-and-verify),…

README

MCP Google Analytics Server

A Model Context Protocol (MCP) server for Google Analytics 4, providing comprehensive integration with both the Google Analytics Data API (for reading reports) and Measurement Protocol v2 (for sending events).

npm version

⚡ Token Optimization - READ THIS FIRST!

IMPORTANT: Google Analytics reports can return large datasets that consume significant tokens. This server is designed with token optimization in mind:

  • All read tools default to 10 results - Adjust the limit parameter as needed
  • Use specific date ranges - Avoid querying years of data at once
  • Select only needed dimensions/metrics - Don't request everything
  • Check TOKEN_OPTIMIZATION.md for detailed best practices

See the dedicated Token Optimization Guide for strategies to minimize token usage.

🚀 Quick Start

See QUICKSTART.md for a 5-minute setup guide, or follow the installation steps below.

📦 Installation

Option 1: Install globally via npm

npm install -g mcp-google-analytics

Option 2: Use with npx (no installation needed)

npx mcp-google-analytics

🔧 Configuration

This server requires different credentials for reading data vs sending events:

For Reading Data (Google Analytics Data API)

You need a Service Account with access to your GA4 property:

  1. Go to Google Cloud Console
  2. Create or select a project
  3. Enable the Google Analytics Data API
  4. Create a Service Account:
    • Go to "IAM & Admin" > "Service Accounts"
    • Click "Create Service Account"
    • Give it a name (e.g., "GA4 MCP Reader")
    • Grant the "Viewer" role
    • Create a JSON key and download it
  5. Add the service account email to your GA4 property:
    • Go to GA4 Admin > Property Access Management
    • Add the service account email with "Viewer" role
  6. Get your Property ID:
    • Go to GA4 Admin > Property Settings
    • Copy the Property ID (numeric, e.g., "123456789")

For Sending Events (Measurement Protocol)

You need a Measurement ID and API Secret:

  1. Go to GA4 Admin > Data Streams
  2. Select your data stream (web, iOS, or Android)
  3. Copy the Measurement ID (format: G-XXXXXXXXXX)
  4. Click "Measurement Protocol API secrets"
  5. Click "Create" to generate a new API secret
  6. Copy the secret value

Environment Variables

Set these environment variables:

# For Data API (reading)
export GA_SERVICE_ACCOUNT_JSON=/path/to/service-account.json
# Or provide JSON directly:
# export GA_SERVICE_ACCOUNT_JSON='{"type":"service_account","project_id":"..."}'

export GA_PROPERTY_ID=123456789

# For Measurement Protocol (writing)
export GA_MEASUREMENT_ID=G-XXXXXXXXXX
export GA_API_SECRET=your-api-secret-here

🔌 Integration with Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "google-analytics": {
      "command": "npx",
      "args": ["-y", "mcp-google-analytics"],
      "env": {
        "GA_SERVICE_ACCOUNT_JSON": "/path/to/service-account.json",
        "GA_PROPERTY_ID": "123456789",
        "GA_MEASUREMENT_ID": "G-XXXXXXXXXX",
        "GA_API_SECRET": "your-api-secret"
      }
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "google-analytics": {
      "command": "mcp-google-analytics",
      "env": {
        "GA_SERVICE_ACCOUNT_JSON": "/path/to/service-account.json",
        "GA_PROPERTY_ID": "123456789",
        "GA_MEASUREMENT_ID": "G-XXXXXXXXXX",
        "GA_API_SECRET": "your-api-secret"
      }
    }
  }
}

Restart Claude Desktop after updating the configuration.

🎯 Integration with Cursor

Add to your Cursor MCP settings file:

macOS/Linux: ~/.cursor/mcp.json Windows: %USERPROFILE%\.cursor\mcp.json

{
  "mcpServers": {
    "google-analytics": {
      "command": "npx",
      "args": ["-y", "mcp-google-analytics"],
      "env": {
        "GA_SERVICE_ACCOUNT_JSON": "/path/to/service-account.json",
        "GA_PROPERTY_ID": "123456789",
        "GA_MEASUREMENT_ID": "G-XXXXXXXXXX",
        "GA_API_SECRET": "your-api-secret"
      }
    }
  }
}

Restart Cursor after updating the configuration.

🛠️ Available Tools

Google Analytics Data API (Reading Data)

ga_run_report

Run custom reports with dimensions and metrics.

Common Dimensions: date, city, country, deviceCategory, browser, pagePath, eventName, sessionSource, sessionMedium, sessionCampaignName

Common Metrics: activeUsers, sessions, screenPageViews, conversions, totalRevenue, engagementRate, averageSessionDuration

Example:

{
  "dateRanges": [{"startDate": "7daysAgo", "endDate": "today"}],
  "dimensions": [{"name": "city"}],
  "metrics": [{"name": "activeUsers"}],
  "limit": 10
}

ga_run_realtime_report

Get real-time data (last 30 minutes).

Example:

{
  "metrics": [{"name": "activeUsers"}],
  "dimensions": [{"name": "country"}],
  "limit": 10
}

ga_get_metadata

Get all available dimensions and metrics for your property.

Warning: Returns 500+ items. Use sparingly.

ga_list_accounts

List all GA accounts accessible to the service account.

ga_list_properties

List GA4 properties, optionally filtered by account ID.

ga_get_property

Get details about the configured property.

ga_list_data_streams

List data streams for the configured property.

ga_run_pivot_report

Run pivot table reports with row/column dimensions.

Example:

{
  "dateRanges": [{"startDate": "7daysAgo", "endDate": "today"}],
  "dimensions": [{"name": "country"}, {"name": "deviceCategory"}],
  "metrics": [{"name": "activeUsers"}],
  "pivots": [{"fieldNames": ["deviceCategory"], "limit": 5}]
}

ga_run_funnel_report

Run funnel analysis to track user progression.

Example:

{
  "dateRanges": [{"startDate": "7daysAgo", "endDate": "today"}],
  "funnelSteps": [
    {"name": "page_view"},
    {"name": "add_to_cart"},
    {"name": "begin_checkout"},
    {"name": "purchase"}
  ]
}

ga_batch_run_reports

Run multiple reports in a single request.

Warning: Can return large datasets. Limit to 2-5 reports per batch.

Measurement Protocol (Sending Events)

ga_send_event

Send custom events to GA4.

Example:

{
  "events": [{
    "name": "button_click",
    "params": {
      "button_id": "cta_signup",
      "page": "/landing"
    }
  }],
  "user_id": "user123"
}

ga_validate_event

Validate events before sending (uses debug endpoint).

ga_send_pageview

Send page view events.

Example:

{
  "page_location": "https://example.com/products",
  "page_title": "Products",
  "user_id": "user123"
}

ga_send_purchase

Send ecommerce purchase events.

Example:

{
  "transaction_id": "T12345",
  "value": 99.99,
  "currency": "USD",
  "items": [{
    "item_id": "SKU123",
    "item_name": "Product Name",
    "price": 99.99,
    "quantity": 1
  }]
}

ga_send_login

Send login events.

ga_send_signup

Send user registration events.

ga_send_add_to_cart

Send add-to-cart events.

ga_send_begin_checkout

Send checkout initiation events.

📖 Usage Examples

See EXAMPLES.md for practical usage examples in Spanish.

Example: Get users by country (last 7 days)

Show me active users by country for the last 7 days

Claude will use ga_run_report:

{
  "dateRanges": [{"startDate": "7daysAgo", "endDate": "today"}],
  "dimensions": [{"name": "country"}],
  "metrics": [{"name": "activeUsers"}],
  "limit": 10,
  "orderBys": [{"metric": {"metricName": "activeUsers"}, "desc": true}]
}

Example: Track a purchase

Send a purchase event for order #12345, $99.99 USD

Claude will use ga_send_purchase:

{
  "transaction_id": "12345",
  "value": 99.99,
  "currency": "USD",
  "items": [{
    "item_id": "product_1",
    "item_name": "Example Product",
    "price": 99.99,
    "quantity": 1
  }]
}

🔍 Debugging

Enable debug logging by setting:

export DEBUG=mcp-google-analytics:*

For Measurement Protocol, use ga_validate_event to check events before sending them live.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT License - see LICENSE file for details.

🔗 Links

🆘 Support

For issues and questions:

📝 Changelog

See CHANGELOG.md for version history.


README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About Google Analytics 4

How do I install Google Analytics 4?

Run claude mcp add google-analytics -- npx -y @toolsdk.ai/google-analytics-mcp, then add the server to your MCP client's configuration.

Is Google Analytics 4 safe to use with an AI agent?

Its trust score is 47 out of 100 (fair). It passes 2 of the 3 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Google Analytics 4 still maintained?

Yes — the latest release is v1.3.1 (21 Aug 2026), and the last commit was 2 months ago. The repository has 2 stars.