Google Analytics MCP Server

Google Analytics MCP Server

Enables AI assistants to query Google Analytics accounts, properties, and run reports using natural language through the Admin and Data APIs.

Category
Visit Server

README

Google Analytics MCP Server

PyPI version Python 3.10+ License

A Model Context Protocol (MCP) server for comprehensive Google Analytics API access. Built with FastMCP and maintained by Locomotive Agency for use with mcpanywhere.com.

This server provides access to the Google Analytics Admin API and Google Analytics Data API through MCP tools for LLM integration.

Features

The server provides the following MCP tools:

Account & Property Information

  • get_account_summaries - Retrieves information about Google Analytics accounts and properties
  • get_property_details - Returns details about a specific property
  • list_google_ads_links - Lists Google Ads account links for a property

Core Reports

  • run_report - Runs a Google Analytics report using the Data API
  • get_custom_dimensions_and_metrics - Retrieves custom dimensions and metrics for a property

Realtime Reports

  • run_realtime_report - Runs a Google Analytics realtime report using the Data API

Installation

Recommended (via uv)

uv tool install google-analytics-mcp-python

Alternative (via pip)

pip install google-analytics-mcp-python

Alternative (via pipx)

pipx install google-analytics-mcp-python

Configuration

1. Enable Google Analytics APIs

Enable the following APIs in your Google Cloud project:

2. Create Service Account

  1. Go to the Google Cloud Console
  2. Create a service account with the Analytics API scope
  3. Download the JSON key file

3. Set Environment Variables

export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"

Domain-Wide Delegation (Optional)

If you need to access Analytics properties on behalf of a user:

export ANALYTICS_MCP_SUBJECT="user@yourdomain.com"

Note: For backward compatibility, GOOGLE_IMPERSONATED_SUBJECT is also supported.

Required OAuth scope:

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

Usage with MCP Clients

Claude Desktop / Gemini

Add to your MCP settings file (~/.gemini/settings.json or Claude Desktop config):

{
  "mcpServers": {
    "google-analytics": {
      "command": "uvx",
      "args": ["google-analytics-mcp-python"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account-key.json",
        "ANALYTICS_MCP_SUBJECT": "user@yourdomain.com"
      }
    }
  }
}

Docker Deployment

Example Dockerfile for containerized deployment:

FROM python:3.12-slim

RUN pip install --no-cache-dir google-analytics-mcp-python

ENV GOOGLE_APPLICATION_CREDENTIALS=/var/secrets/service-account.json

CMD ["google-analytics-mcp"]

Required environment variables:

  • GOOGLE_APPLICATION_CREDENTIALS - Path to service account JSON
  • ANALYTICS_MCP_SUBJECT (optional) - User email for domain-wide delegation

Example Prompts

Once configured, you can interact with your Google Analytics data:

What are the most popular events in my Google Analytics property in the last 180 days?
Give me details about my Google Analytics property with 'xyz' in the name
What are the custom dimensions and custom metrics in my property?
Were most of my users in the last 6 months logged in?

Development

This server is maintained by Locomotive Agency as part of the MCP Anywhere ecosystem.

Original implementation by Google Analytics team. Enhanced with domain-wide delegation support for enterprise use cases.

License

Apache License 2.0 - See LICENSE file for details.

Contributing

Contributions welcome! See the Contributing Guide.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured