MCP Google Analytics 4 Server

MCP Google Analytics 4 Server

A comprehensive integration for Google Analytics 4 providing 54 tools for advanced reporting, configuration management, and compliance. It enables AI platforms to interact with GA4 data, manage properties, and automate business intelligence through the Model Context Protocol.

Category
Visit Server

README

MCP Google Analytics 4 Server

A comprehensive Model Context Protocol (MCP) server for Google Analytics 4 integration, providing advanced analytics capabilities for AI applications.

๐ŸŽฏ Overview

This MCP server enables AI applications to interact with Google Analytics 4 through a standardized protocol. It supports data retrieval, configuration management, compliance features, and business intelligence automation.

Compatibility: Works with Cursor, Claude Desktop, and any MCP-compatible AI platform.

๐Ÿ“Š Features

Phase 1: Advanced Reporting (8 tools)

  • Basic Metrics: Core GA4 metrics and KPIs
  • Traffic Analysis: Sources, pages, and user behavior
  • Real-time Reports: Live data (up to 29 minutes for standard properties)
  • Pivot Reports: Cross-dimensional analysis
  • Funnel Analysis: Conversion path tracking
  • Batch Processing: Multiple reports automation

Phase 2: Configuration Management (13 tools)

  • Custom Dimensions: Create, read, update, archive
  • Custom Metrics: Complete lifecycle management
  • Conversion Events: Configure and manage goals
  • Property Settings: Comprehensive configuration access

Phase 3: Platform Integrations (15 tools)

  • Google Ads: Campaign performance and attribution
  • BigQuery: Data warehouse connectivity
  • Data Streams: Multi-platform tracking setup
  • Measurement Protocol: Server-side event tracking

Phase 4: Compliance & Privacy (10 tools)

  • GDPR Compliance: Automated data subject rights
  • User Deletion: Privacy-compliant data removal
  • Data Retention: Automated lifecycle management
  • Access Control: Permission and audit management

Phase 5: Business Intelligence (8 tools)

  • Attribution Modeling: Multi-touch attribution analysis
  • Audience Management: Automated segmentation
  • Predictive Analytics: ML-powered insights
  • Custom Dashboards: Automated reporting

Total: 54 specialized tools across 5 phases

๐Ÿ”ง Installation

Prerequisites

  • Python 3.8+
  • Google Analytics 4 property
  • Google Cloud project with Analytics API enabled

Quick Setup

  1. Install the package:
pip install mcp-ga4-ultimate
  1. Configure authentication:
# Set up Application Default Credentials
gcloud auth application-default login \
  --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/analytics.edit
  1. Add to your MCP client:

For Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "ga4-ultimate": {
      "command": "python",
      "args": ["-m", "mcp_ga4_ultimate"],
      "env": {
        "GOOGLE_ANALYTICS_PROPERTY_ID": "your_property_id"
      }
    }
  }
}

For Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "ga4-ultimate": {
      "command": "python",
      "args": ["-m", "mcp_ga4_ultimate"],
      "env": {
        "GOOGLE_ANALYTICS_PROPERTY_ID": "your_property_id"
      }
    }
  }
}

๐Ÿš€ Usage Examples

Basic Analytics Query

"Show me the top 10 pages by traffic in the last 30 days"

Real-time Monitoring

"What's happening on my website right now? Show active users and top content"

Conversion Analysis

"Analyze the funnel from landing page to purchase completion"

Configuration Management

"Create a custom dimension for tracking user engagement score"

GDPR Compliance

"Process data deletion request for user ID abc123"

๐Ÿ“‹ API Coverage

This server implements comprehensive coverage of Google Analytics APIs:

API Coverage Tools
Analytics Data API Complete 15 tools
Analytics Admin API Complete 27 tools
Analytics Measurement Protocol Complete 8 tools
User Deletion API Complete 4 tools

Total API Coverage: 54 specialized tools

๐Ÿ”’ Security & Permissions

Required OAuth Scopes

  • https://www.googleapis.com/auth/analytics.readonly - Data access
  • https://www.googleapis.com/auth/analytics.edit - Configuration management
  • https://www.googleapis.com/auth/analytics.manage.users - User management

Data Privacy

  • No data stored locally
  • Direct API communication only
  • GDPR-compliant data handling
  • Audit logging for compliance

๐Ÿงช Testing & Validation

The server includes comprehensive testing:

  • Unit Tests: All 54 tools tested individually
  • Integration Tests: Real API validation
  • Success Rate: 92.3% (50/54 tools passing)
  • Error Handling: Graceful fallbacks and detailed error messages

Run tests:

python -m pytest tests/ -v

๐Ÿ“– Documentation

Complete API Reference

Development

๐Ÿ†š Comparison with Other Solutions

Feature This Server Google Official MCP Basic Packages
Total Tools 54 6 2-3
Platform Support Universal MCP Gemini only Varies
Real-time Data โœ… Advanced โœ… Basic โŒ
Configuration Management โœ… Complete โŒ โŒ
GDPR Compliance โœ… Built-in โŒ โŒ
Business Intelligence โœ… Automated โŒ โŒ
Write Permissions โœ… Full โŒ Read-only Varies
Multi-touch Attribution โœ… Advanced โŒ โŒ
Testing Coverage โœ… 92.3% Unknown Minimal

๐Ÿค Contributing

Contributions are welcome! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/your-org/mcp-ga4-ultimate.git
cd mcp-ga4-ultimate
pip install -e .[dev]

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ”— Links

๐Ÿ“ž Support


Note: This is an independent implementation. For the official Google Analytics MCP server, see googleanalytics/google-analytics-mcp.

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
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
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
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