drio
Open app

Google Analytics MCP Server

Source

Model Context Protocol server for Google Analytics, enabling LLMs to fetch and analyze web analytics data

Catalog onlyCatalog onlySTDIO

Overview

Google Analytics MCP Server is an implementation of the Model Context Protocol that allows users to access and analyze data from Google Analytics 4 (GA4) using a TypeScript SDK.

To use the server, set up a Google Cloud project, enable the Analytics Data API, create a service account, and configure it with the required environment variables. Start the server and integrate it with your Claude Desktop configuration.

  • Fetch customizable page view metrics - Track active and new users over time - Analyze specific events and their metrics - Monitor user behavior metrics, such as session duration and bounce rate - Flexible date range selection for all queries
  1. Analyzing user engagement on a website over a specified period.
  2. Monitoring specific events, such as purchases and user sign-ups.
  3. Gathering insights into user acquisition and retention metrics.

Add to your AI client

Use these steps to connect Google Analytics MCP Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.

Cursor

Add this to your .cursor/mcp.json file in your project root, then restart Cursor.

.cursor/mcp.json

{
  "mcpServers": {
    "mcp-server-google-analytics-ruchernchong": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-google-analytics-ruchernchong"
      ]
    }
  }
}

Claude Desktop

Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "mcp-server-google-analytics-ruchernchong": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-google-analytics-ruchernchong"
      ]
    }
  }
}

Claude Code

Add this to your project's .mcp.json file. Claude Code will detect it automatically.

.mcp.json (project root)

{
  "mcpServers": {
    "mcp-server-google-analytics-ruchernchong": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-google-analytics-ruchernchong"
      ]
    }
  }
}

VS Code (Copilot)

Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.

.vscode/mcp.json

{
  "servers": {
    "mcp-server-google-analytics-ruchernchong": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-google-analytics-ruchernchong"
      ]
    }
  }
}

Windsurf

Add this to your Windsurf MCP config file, then restart Windsurf.

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mcp-server-google-analytics-ruchernchong": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-google-analytics-ruchernchong"
      ]
    }
  }
}

Cline

Open Cline settings, navigate to MCP Servers, and add this server configuration.

Cline MCP Settings (via UI)

{
  "mcpServers": {
    "mcp-server-google-analytics-ruchernchong": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mcp-server-google-analytics-ruchernchong"
      ]
    }
  }
}

FAQ

What are the prerequisites for using this server?

You need Node.js 20 or higher, a Google Analytics 4 property, and credentials from a Google Cloud project with the Analytics Data API enabled.

Is there a specific configuration needed for Claude Desktop?

Yes, you'll need to add specific environment variables and configuration settings into the Claude Desktop setup to run the server.

Can I customize the metrics I want to retrieve?

Yes, you can customize the dimensions and metrics according to your analytics needs.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":343,"uuid":"21d22ce1-675c-40dc-aada-23f0338b0103","name":"mcp-server-google-analytics","title":"Google Analytics MCP Server","description":"Model Context Protocol server for Google Analytics, enabling LLMs to fetch and analyze web analytics data","avatar_url":"https://avatars.githubusercontent.com/u/10343662?v=4","created_at":"2024-12-13T13:20:27.947Z","updated_at":"2024-12-13T15:09:10.232Z","status":"created","author_name":"ruchernchong","author_avatar_url":"https://avatars.githubusercontent.com/u/10343662?v=4","tags":"[]","category":"research-and-data","is_featured":false,"sort":1,"url":"https://github.com/ruchernchong/mcp-server-google-analytics","target":"_self","content":"$29","summary":"$2a","img_url":"https://camo.githubusercontent.com/bd6752d1d4537f01329a03d4f19e2b214edb36958dc5d10cbe78b9ce305a9113/68747470733a2f2f6d736565702e6e65742f70722f7275636865726e63686f6e672d6d63702d7365727665722d676f6f676c652d616e616c79746963732d62616467652e706e67","type":null,"metadata":"{\"star\":\"22\",\"license\":\"MIT license\",\"language\":\"TypeScript\",\"is_official\":false,\"latest_commit_time\":\"2025-05-04 18:15:26\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]