Google Analytics MCP Server

Popular
Google Analytics
Analytics
Data Analysis
Reporting
GA4
Google Cloud
Official
Python

Google Analytics MCP Server

Official Google Analytics Model Context Protocol (MCP) server that provides local MCP server functionality to interact with Google Analytics Admin API and Data API. Enables LLMs to retrieve account information, run core reports, and access realtime analytics data.

Overview

The Google Analytics MCP Server is the official implementation from Google Analytics, offering direct integration with GA4 properties through the Admin API and Data API. It provides comprehensive access to account summaries, property details, reporting capabilities, and custom dimensions/metrics.

Tools

The server provides 6 powerful tools organized into three categories:

Account & Property Information

get_account_summaries

  • Retrieves information about user's Google Analytics accounts and properties
  • Returns account hierarchy and property list

get_property_details

  • Returns detailed information about a specific property
  • Includes configuration and settings

list_google_ads_links

  • Returns list of Google Ads account links for a property
  • Shows integration status

Core Reports

run_report

  • Runs Google Analytics reports using the Data API
  • Supports custom dimensions, metrics, and date ranges
  • Flexible query capabilities

get_custom_dimensions_and_metrics

  • Retrieves custom dimensions and metrics for a specific property
  • Shows configuration and data types

Realtime Reports

run_realtime_report

  • Runs Google Analytics realtime reports using the Data API
  • Access to live data (last 30 minutes)
  • Immediate insights into user activity

Installation

The Google Analytics MCP Server is a Python package that can be run via pipx:

pipx run analytics-mcp

Setup Instructions

Setup involves three main steps:

1. Configure Python

Ensure you have Python 3.10+ installed on your system.

2. Enable APIs in Google Cloud

Follow the instructions to enable the following APIs in your Google Cloud project:

3. Configure Credentials

Configure your Application Default Credentials (ADC). Make sure the credentials are for a user with access to your Google Analytics accounts or properties.

Required OAuth scope:

https://www.googleapis.com/auth/analytics.readonly

Setup ADC using gcloud

Option A: User credentials with OAuth client

Download your OAuth client JSON file, then run:

gcloud auth application-default login \
  --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform \
  --client-id-file=YOUR_CLIENT_JSON_FILE

Option B: Service account impersonation

gcloud auth application-default login \
  --impersonate-service-account=SERVICE_ACCOUNT_EMAIL \
  --scopes=https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform

After running the command, copy the credentials file path printed to the console:

Credentials saved to file: [PATH_TO_CREDENTIALS_JSON]

Configuration

Gemini CLI Configuration

Create or edit ~/.gemini/settings.json:

{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID"
      }
    }
  }
}

Replace:

  • PATH_TO_CREDENTIALS_JSON with your credentials file path
  • YOUR_PROJECT_ID with your Google Cloud project ID

Claude Desktop Configuration

Add to your Claude Desktop configuration file:

{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/credentials.json",
        "GOOGLE_PROJECT_ID": "your-project-id"
      }
    }
  }
}

Usage Examples

Launch your MCP client (Gemini CLI or Gemini Code Assist) and type /mcp to verify the server is listed.

Sample Prompts

Discover capabilities:

"What can the analytics-mcp server do?"

Get property information:

"Give me details about my Google Analytics property with 'website' in the name"

Analyze events:

"What are the most popular events in my Google Analytics property in the last 180 days?"

User analysis:

"Were most of my users in the last 6 months logged in?"

Configuration check:

"What are the custom dimensions and custom metrics in my property?"

Realtime data:

"Show me realtime user activity for the last 30 minutes"

Google Ads integration:

"List all Google Ads links for my property"

Compatible Clients

  • Gemini CLI
  • Gemini Code Assist
  • Claude Desktop
  • Any MCP-compatible client

APIs Used

  • Google Analytics Admin API - Account and property management
  • Google Analytics Data API - Reporting and data retrieval

Resources

Support

  • Status: Experimental
  • License: Apache 2.0
  • Version: v0.1.1 (latest)
  • Stars: 1.2k
  • Active Development: Yes
  • Discord: 🤖-analytics-mcp channel

Technical Details

  • Platform: Local Server (Python)
  • Language: Python 100%
  • Type: Local MCP Server
  • Authentication: Application Default Credentials (ADC)
  • Required Python: 3.10+
  • Installation Method: pipx

Unique Features

  • Official Google Analytics implementation - Maintained by the Google Analytics team
  • Direct API integration - Admin API + Data API access
  • Realtime reporting - Access to live data (last 30 minutes)
  • Custom dimensions and metrics - Full support for custom configuration
  • Account-level access - Manage multiple properties and accounts
  • Read-only security - Safe by design, no write operations
  • Experimental status - Early access to cutting-edge features

Security

  • Read-only access - The server only has read permissions
  • OAuth scope: analytics.readonly
  • No data modification - Cannot change GA configuration or data
  • ADC authentication - Industry-standard credential management

Roadmap

The Google Analytics team is actively developing new features:

  • Enhanced reporting capabilities
  • Additional Admin API tools
  • Improved error handling
  • Performance optimizations
  • GA4 feature parity

Community

Join the discussion and ask questions in the 🤖-analytics-mcp channel on Discord.

Contributing

Contributions are welcome! See the Contributing Guide for details on how to contribute to this project.

Repository

Clone the repository:

git clone https://github.com/googleanalytics/google-analytics-mcp
GitHub Stats
1783
Stars
410
Forks
13
Issues
Tool Details
Category
Analytics
PlatformCross-platform
Downloads0
Last Updated4/9/2026