# GA4 Analytics MCP

> GA4 Analytics MCP is an open-source MCP server for analytics and data. GA4 reports, realtime data and property setup, plus Search Console, from your agent. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** vscode, CLI
- **Website:** https://renzojohnson.com/contributions/ga4-mcp
- **MCP Registry name:** com.renzojohnson/ga4-mcp
- **Categories:** analytics and data, marketing and SEO
- **Listing updated:** 2026-11-15

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

```sh
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
```

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

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

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## Tools

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

## 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

- [Agent-Native Analytics](https://ai-powered.com/mcp/agent-native-analytics): Agent-Native Analytics is an open-source MCP server for analytics and data.
- [Google Ads + Meta Ads + SEO/GEO MCP](https://ai-powered.com/mcp/google-ads-meta-ads-seo-geo-mcp): Google Ads + Meta Ads + SEO/GEO MCP is a freemium MCP server for marketing and seo.
- [Tapetide - Indian Stock Market MCP](https://ai-powered.com/mcp/tapetide-indian-stock-market-mcp): Tapetide - Indian Stock Market MCP is a freemium MCP server for finance and payments.
- [World Monitor](https://ai-powered.com/mcp/world-monitor): World Monitor is a freemium MCP server for analytics and data.
- [Calven](https://ai-powered.com/mcp/calven): Calven is an MCP server for marketing and seo.
- [CompanyData](https://ai-powered.com/mcp/companydata): CompanyData is a paid MCP server for analytics and data.
- [MCP](https://ai-powered.com/mcp/mcp-mwhffe53): MCP is a freemium MCP server for marketing and seo.
- [ChartAnt](https://ai-powered.com/mcp/chartant): ChartAnt is a freemium MCP server for design and media.

---
Source: https://ai-powered.com/mcp/ga4-analytics-mcp
