drio
Open app

Google Analytics MCP Server

Source

Mirror of

Catalog onlyCatalog onlySTDIO

Overview

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

To use the server, set up a Google Cloud project, enable the Analytics Data API, create a service account, and configure the server with your credentials. Start the server using the provided commands.

  • Retrieve page view metrics with customizable dimensions. - 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 website traffic and user engagement metrics.
  2. Monitoring user behavior to improve website performance.
  3. Tracking specific events like purchases or sign-ups.

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": {
    "ruchernchong-mcp-server-google-analytics-mcp-mirror": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-ruchernchong-mcp-server-google-analytics-mcp-mirror"
      ]
    }
  }
}

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": {
    "ruchernchong-mcp-server-google-analytics-mcp-mirror": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-ruchernchong-mcp-server-google-analytics-mcp-mirror"
      ]
    }
  }
}

Claude Code

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

.mcp.json (project root)

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

VS Code (Copilot)

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

.vscode/mcp.json

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

Windsurf

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

~/.codeium/windsurf/mcp_config.json

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

Cline

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

Cline MCP Settings (via UI)

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

FAQ

What are the prerequisites for using this server?

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

How do I install the server?

You can install it using the command `pnpm install mcp-server-google-analytics`.

Is it secure to use service account credentials?

Yes, but always use environment variables for sensitive information and follow security best practices.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":588,"uuid":"a4ba0d00-a210-4ca0-940c-4a0e353c5c7b","name":"ruchernchong_mcp-server-google-analytics","title":"Google Analytics MCP Server","description":"Mirror of","avatar_url":"https://avatars.githubusercontent.com/u/192820360?v=4","created_at":"2024-12-30T03:23:38.988Z","updated_at":"2025-02-23T07:15:13.072Z","status":"created","author_name":"MCP-Mirror","author_avatar_url":"https://avatars.githubusercontent.com/u/192820360?v=4","tags":"google-analytics,mcp-server,data-access","category":"research-and-data","is_featured":false,"sort":1,"url":"https://github.com/MCP-Mirror/ruchernchong_mcp-server-google-analytics","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":null,"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"}]]}]