Skip to content
MCP server

GA4 Analytics MCP

GA4 reports, realtime data and property setup, plus Search Console, from your agent

Runs locallyStatus and history
Pricing
Open source
Platforms
vscode, CLI
Runs
Locally
Version
26.11.13
Listing updated
2 days ago

About GA4 Analytics MCP

GA4 Analytics MCP is an open-source MCP server for analytics and data. It runs locally on your machine and is started by your AI client.

This server pairs 16 tools for Google Analytics 4 with Search Console tools, so one session can answer questions that need both, such as pages with search impressions but weak arrival traffic. run_report goes straight to the GA4 Data API and accepts multiple date ranges, so one call can compare two periods, and run_realtime_report covers the last 30 minutes.

Unlike Google's own read-only Analytics server, it has a ga4_admin tool that can list data streams, key events, audiences and Firebase links, create or update properties and streams, create key events and Measurement Protocol secrets, and delete properties, streams or key events, each delete needing confirm: true. It does not edit audiences or custom dimensions and cannot read Universal Analytics.

It runs locally as a VS Code extension or npm package (Node.js 22 or newer) with Application Default Credentials, a service account key or OAuth. Reads need access to the property and admin writes need the Editor role.

Install

Run in a terminal

claude mcp add ga4-mcp --env GOOGLE_OAUTH_CLIENT_SECRET='<GOOGLE_OAUTH_CLIENT_SECRET>' --env GOOGLE_OAUTH_REFRESH_TOKEN='<GOOGLE_OAUTH_REFRESH_TOKEN>' -- npx -y @renzo.johnson/ga4-mcp

Add to claude_desktop_config.json

{
  "mcpServers": {
    "ga4-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@renzo.johnson/ga4-mcp"
      ],
      "env": {
        "GOOGLE_OAUTH_CLIENT_SECRET": "<GOOGLE_OAUTH_CLIENT_SECRET>",
        "GOOGLE_OAUTH_REFRESH_TOKEN": "<GOOGLE_OAUTH_REFRESH_TOKEN>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "ga4-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@renzo.johnson/ga4-mcp"
      ],
      "env": {
        "GOOGLE_OAUTH_CLIENT_SECRET": "<GOOGLE_OAUTH_CLIENT_SECRET>",
        "GOOGLE_OAUTH_REFRESH_TOKEN": "<GOOGLE_OAUTH_REFRESH_TOKEN>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "ga4-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@renzo.johnson/ga4-mcp"
      ],
      "env": {
        "GOOGLE_OAUTH_CLIENT_SECRET": "<GOOGLE_OAUTH_CLIENT_SECRET>",
        "GOOGLE_OAUTH_REFRESH_TOKEN": "<GOOGLE_OAUTH_REFRESH_TOKEN>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "ga4-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@renzo.johnson/ga4-mcp"
      ],
      "env": {
        "GOOGLE_OAUTH_CLIENT_SECRET": "<GOOGLE_OAUTH_CLIENT_SECRET>",
        "GOOGLE_OAUTH_REFRESH_TOKEN": "<GOOGLE_OAUTH_REFRESH_TOKEN>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "ga4-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@renzo.johnson/ga4-mcp"
      ],
      "env": {
        "GOOGLE_OAUTH_CLIENT_SECRET": "<GOOGLE_OAUTH_CLIENT_SECRET>",
        "GOOGLE_OAUTH_REFRESH_TOKEN": "<GOOGLE_OAUTH_REFRESH_TOKEN>"
      }
    }
  }
}

Configuration

  • GOOGLE_APPLICATION_CREDENTIALSPath to a service account key or authorized_user JSON file. Optional if you use gcloud Application Default Credentials or the OAuth variables.
  • GOOGLE_OAUTH_CLIENT_IDOAuth client ID. Set together with the client secret and refresh token.
  • GOOGLE_OAUTH_CLIENT_SECRETOAuth client secret.
  • GOOGLE_OAUTH_REFRESH_TOKENOAuth refresh token with the Analytics, Search Console and Indexing API scopes.

Tools this server provides (7)

Taken from the project documentation; the running server may differ.

get_account_summaries
List accounts and properties your sign-in can open.
get_property_details
Property name, time zone, currency and industry.
run_report
Run a GA4 report.
run_realtime_report
Realtime report for the last 30 minutes.
get_custom_dimensions_and_metrics
List custom dimensions and metrics.
list_google_ads_links
Show linked Google Ads accounts.
ga4_admin
Read and change property setup.

What it does

Flexible reports
Any dimensions, metrics, filters and several date ranges.
Realtime reports
Activity over the last 30 minutes.
Property admin
Create properties, data streams and key events.
Confirmed deletes
Deleting a property, stream or key event needs confirmation.
Custom definitions
List custom dimensions and metrics.
Search Console included
Search performance, URL inspection and sitemap tools in the same install.

Good for

  • Compare sessions by channel against last month
  • Check new tracking right after a deploy
  • Create a property, web stream and key event
  • See which Google Ads accounts are linked
  • Find pages with impressions but poor arrival

Pricing

Open source

Free, MIT licensed

Prices change. Check renzojohnson.com before you buy.

GA4 Analytics MCP FAQ

How does it differ from Google's own server?

It can change property setup and includes Search Console, while Google's is read only.

Does it read Universal Analytics?

No, only GA4 properties.

Which APIs must be enabled?

The Analytics Data API, plus the Admin API for admin actions and Search Console API for search tools.

Is it free?

Yes, it is MIT licensed.

Is GA4 Analytics MCP free?

Yes. GA4 Analytics MCP is open source, so you can use and self-host it for free.

How do I add GA4 Analytics MCP to Claude Code?

Run this command in your terminal: claude mcp add ga4-mcp --env GOOGLE_OAUTH_CLIENT_SECRET='<GOOGLE_OAUTH_CLIENT_SECRET>' --env GOOGLE_OAUTH_REFRESH_TOKEN='<GOOGLE_OAUTH_REFRESH_TOKEN>' -- npx -y @renzo.johnson/ga4-mcp

What are the best alternatives to GA4 Analytics MCP?

The closest alternatives to GA4 Analytics MCP are Agent-Native Analytics, Google Ads + Meta Ads + SEO/GEO MCP, Tapetide - Indian Stock Market MCP, World Monitor and Calven.

Alternatives to GA4 Analytics MCP

  1. Open-source analytics app where an AI agent builds charts and dashboards from your data

    • Remote
    • Open source
    • 7.7K GitHub stars
    • Analytics and data
  2. Hosted MCP connector for managing Google Ads, Meta Ads, GA4 and Search Console from chat

    • 8 tools
    • Remote
    • Freemium
    • 8.1K GitHub stars
    • Marketing and SEO
  3. Indian NSE and BSE stock market data for AI assistants through 48 MCP tools

    • 17 tools
    • Remote
    • Freemium
    • 150 GitHub stars
    • Finance and payments
  4. World Monitor

    MCP server

    Live geopolitical intelligence dashboard with an API and MCP server for agents

    • Remote
    • Freemium
    • Analytics and data
  5. Calven

    MCP server

    Product marketing context from Calven delivered into Claude, ChatGPT and other AI tools

    Not checked yet
    • Remote
    • Free trial
    • 3 GitHub stars
    • Marketing and SEO
  6. CompanyData

    MCP server

    Search and enrich company records from official registers via the CompanyData API

    • 3 tools
    • Remote
    • Paid
    • 3 GitHub stars
    • Analytics and data