Google Analytics MCP Server

Google Analytics MCP server for accessing web analytics data

Local serverstdioTypeScript

What is the Google Analytics MCP server?

Google analytics mcp server lets Claude, Cursor and other MCP clients work with Google Analytics directly. Google Analytics MCP server for accessing web analytics data.

What Google Analytics does

An MCP server implementation for accessing Google Analytics 4 (GA4) data, built using the Model Context Protocol TypeScript SDK.

Key capabilities

  • Get page view metrics with customizable dimensions
  • Track active and new users over time
  • Analyze specific events and their metrics
  • Monitor user behavior metrics (session duration, bounce rate)
  • Flexible date range selection for all queries

Tools it exposes

Once connected, the assistant can call these 5 tools directly:

  • runReport — The runReport tool exposed by this server
  • getPageViews — The getPageViews tool exposed by this server
  • getActiveUsers — The getActiveUsers tool exposed by this server
  • getEvents — The getEvents tool exposed by this server
  • getUserBehavior — The getUserBehavior tool exposed by this server

Installing the google analytics mcp server

The server is distributed via npm as @smithery/cli, so most clients can run it without a manual build step. Add it to your MCP client's configuration and restart the client to pick it up — the copy-paste configs for Claude Desktop, Claude Code and Cursor are on this page.

Configuration

Before the server will start you need to supply 3 environment variables: GOOGLE_CLIENT_EMAIL, GOOGLE_PRIVATE_KEY, GA_PROPERTY_ID. Keep credentials in your client's env block or a secrets manager rather than committing them.

Requirements

  • Node.js 20 or higher - A Google Analytics 4 property. - A Google Cloud project with the Analytics Data API enabled. - A service account with credentials to access the API.

Where it fits

Developer-tool servers are usually the first ones people connect, because they turn "help me with this code" into an assistant that can actually read the repo and act on it. Google Analytics sits in that group, and the shape of its toolset — runReport, getPageViews, getActiveUsers among others — tells you what it is really for. Worth comparing against the other developer tools servers in this directory before you commit to one, since several overlap in scope but differ sharply in setup cost and permissions.

Practical notes

  • This server runs locally, so it operates with whatever access your machine and its credentials already have. Scope that deliberately rather than by default.
  • It will not start until its required credentials are present, so set those before wondering why the tools never appear.
  • Maintained by ruchernchong, written in TypeScript.
  • MCP clients ask for confirmation before each tool call by default. Keep that on while you learn what the google analytics mcp server actually does with your data.
  • Every entry in this directory is reviewed by hand before it goes live, and details are checked against the project's own documentation.

Available tools

ToolWhat it does
runReportThe runReport tool exposed by this server.
getPageViewsThe getPageViews tool exposed by this server.
getActiveUsersThe getActiveUsers tool exposed by this server.
getEventsThe getEvents tool exposed by this server.
getUserBehaviorThe getUserBehavior tool exposed by this server.

How to install the Google Analytics MCP server

{
  "mcpServers": {
    "google-analytics": {
      "command": "npx",
      "args": ["-y", "mcp-server-google-analytics"],
      "env": {
        "GOOGLE_CLIENT_EMAIL": "your-service-account@project.iam.gserviceaccount.com",
        "GOOGLE_PRIVATE_KEY": "your-private-key",
        "GA_PROPERTY_ID": "your-ga4-property-id"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Node.js 20 or higher - A Google Analytics 4 property. - A Google Cloud project with the Analytics Data API enabled. - A service account with credentials to access the API.
VariableDescriptionRequired
GOOGLE_CLIENT_EMAILConfiguration value read at startup.Optional
GOOGLE_PRIVATE_KEYCredential the server authenticates with.Yes
GA_PROPERTY_IDConfiguration value read at startup.Optional

Example prompts to try

  • Use Google Analytics to runReport.
  • Use Google Analytics to getPageViews.
  • Use Google Analytics to getActiveUsers.

Frequently asked questions

It connects Google Analytics to MCP-compatible AI assistants such as Claude and Cursor, exposing 5 tools (runReport, getPageViews, getActiveUsers, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Google Analytics directly.