MCP Catalogs
Home

ga4-mcp-server

by spindle79·0·Score 36

Google Analytics 4 MCP server exposing metrics to AI agents with daily/monthly breakdowns and dual MCP/REST endpoints.

ai-llmdeveloper-toolsproductivity
0
Forks
0
Open issues
this month
Last commit
2d ago
Indexed

Overview

This is a production-ready MCP server that provides access to Google Analytics 4 data through both Model Context Protocol and REST endpoints. It includes five useful tools: getUrlAnalytics, getUrlEngagement, getUrlSourceTraffic, getUrlConversions, and getUrlPageViews. The server features proper authentication using service accounts, structured response formats with time-based breakdowns, and comprehensive error handling. Built with TypeScript using the official @modelcontextprotocol/sdk, it demonstrates best practices with Jest tests, debug logging, and smoke scripts for both MCP and REST interfaces.

Try asking AI

After installing, here are 5 things you can ask your AI assistant:

you:AI agents analyzing website performance metrics for content optimization
you:Digital marketers extracting conversion data and traffic patterns for campaigns
you:Content creators evaluating page engagement metrics to improve user experience
you:What authentication method is required for this server?
you:Can I use this server with my existing Google Analytics 4 property?

When to choose this

Choose this when you need to integrate Google Analytics 4 data into AI systems and want both MCP and REST access options with proper time breakdowns.

When NOT to choose this

Avoid this if you need access to Universal Analytics data, require real-time analytics with sub-minute granularity, or need more than 5 concurrent API calls to Google.

Tools this server exposes

5 tools extracted from the README
  • getUrlAnalytics({ url: string, timeframe?: string, startDate?: string, endDate?: string, trafficSourceLimit?: number }) => AnalyticsResponse

    Get comprehensive analytics for a URL including engagement, traffic sources, and conversions

  • getUrlEngagement({ url: string, timeframe?: string, startDate?: string, endDate?: string }) => AnalyticsResponse

    Get engagement metrics for a URL such as average session duration and bounce rate

  • getUrlSourceTraffic({ url: string, timeframe?: string, startDate?: string, endDate?: string, limit?: number }) => AnalyticsResponse

    Get traffic source data for a URL showing how users are finding the page

  • getUrlConversions({ url: string, timeframe?: string, startDate?: string, endDate?: string }) => AnalyticsResponse

    Get conversion events and metrics for a URL

  • getUrlPageViews({ url: string, timeframe?: string, startDate?: string, endDate?: string }) => AnalyticsResponse

    Get page view statistics for a URL

Comparable tools

google-analytics-apiplausible-mcpumami-analyticsposthog-mcp

Installation

Installation

  1. Install dependencies:
pnpm install
  1. Set up environment variables:
GA_PROPERTY_ID=your_ga4_property_id
GOOGLE_APPLICATION_CREDENTIALS=path/to/your/credentials.json
PORT=3001 # optional, defaults to 3001
  1. Start the server:
pnpm dev

For Claude Desktop, add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "ga4": {
      "command": "node",
      "args": ["dist/index.js"],
      "env": {
        "GA_PROPERTY_ID": "your_ga4_property_id",
        "GOOGLE_APPLICATION_CREDENTIALS": "path/to/your/credentials.json"
      }
    }
  }
}

FAQ

What authentication method is required for this server?
The server requires Google service account authentication. You need to provide a service account JSON file and set the GOOGLE_APPLICATION_CREDENTIALS environment variable.
Can I use this server with my existing Google Analytics 4 property?
Yes, as long as your service account has appropriate permissions to access the GA4 property data. You'll need to configure it in the Google Cloud Console.

Compare ga4-mcp-server with

GitHub →

Last updated · Auto-generated from public README + GitHub signals.