The Google Analytics MCP Server bridges your GA4 data and a large language model. It runs locally as a Model Context Protocol server. Gemini CLI and Code Assist can then talk to it. The server wraps the Google Analytics Admin API and Data API. Your LLM gains a set of tools: fetch account summaries, pull property details, run core reports, and stream real-time metrics. Ask questions in plain English. Get answers without clicking through the GA4 interface.
The server exposes several tools for LLM consumption.
get_account_summaries — Lists all GA accounts and properties you can access.get_property_details — Returns full configuration details for a specific property.list_google_ads_links — Shows Google Ads accounts linked to a property.run_report — Executes a GA4 report via the Data API.get_dimensions — Returns available dimensions for a property, custom ones included.get_metrics — Returns available metrics for a property, custom ones included.get_standard_dimensions — Lists all standard dimensions.get_standard_metrics — Lists all standard metrics.run_report_date_ranges_hints — Suggests valid date range formats.run_report_metric_filter_hints — Suggests valid metric filter syntax.run_report_dimension_filter_hints — Suggests valid dimension filter syntax.run_realtime_report — Queries real-time GA4 data.get_realtime_dimensions — Lists dimensions available for real-time reports.get_realtime_metrics — Lists metrics available for real-time reports.Install pipx. It isolates the server environment.
In your Google Cloud project, turn on:
Set up Application Default Credentials (ADC). The authenticated user needs read access to the target GA accounts.
The credentials must include the read-only scope:
https://www.googleapis.com/auth/analytics.readonly
Example gcloud commands:
After downloading your OAuth client JSON file, 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
For 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
Install Gemini CLI or Gemini Code Assist.
Edit ~/.gemini/settings.json. Add the server to the mcpServers list:
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": [
"run",
"--spec",
"git+https://github.com/googleanalytics/google-analytics-mcp.git",
"google-analytics-mcp"
]
}
}
}
You can also pin a specific ADC file by setting an environment variable:
{
"mcpServers": {
"analytics-mcp": {
"command": "pipx",
"args": [
"run",
"--spec",
"git+https://github.com/googleanalytics/google-analytics-mcp.git",
"google-analytics-mcp"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_ADC_JSON"
}
}
}
}
Replace PATH_TO_ADC_JSON with the full path to your credentials file.
Start Gemini Code Assist or Gemini CLI. Type /mcp. You should see analytics-mcp listed.
Try these prompts:
Ask what the server can do:
what can the analytics-mcp server do?
Find a property by name fragment:
Give me details about my Google Analytics property with 'xyz' in the name
Analyze event popularity:
what are the most popular events in my Google Analytics property in the last 180 days?
Check login status of users:
were most of my users in the last 6 months logged in?
Inspect custom definitions:
what are the custom dimensions and custom metrics in my property?
The LLM translates your question into the right tool calls, fetches the data, and returns a readable summary. No more drilling through GA4 reports by hand.
Tencent HunyuanVideo-1.5: 8.3B Video Model Runs on 14GB GPUs
Embedding Atlas: Interactive Visualization for Large-Scale Embeddings
NeuralAgent: An Open-Source AI Agent for Native Desktop Automation
Open Deep Research: Customizable AI Agents for Automated Report Generation
Kodi Setup Guide: Building a Powerful Media Center on Any Device
Apple Doc MCP: SwiftUI & UIKit Documentation for Cursor & Claude
ERPNext Open Source ERP: Installation Guide for Accounting and Inventory
InvenTree Inventory: Self-Hosted Stock Control with REST API
Extract2MD: Convert PDF to Markdown using Local LLMs and OCR
TypeAgent: Build AI Agents With Structured Memory and Human-in-the-Loop
Jitsi Meet Review: Open-Source Video Conferencing That Just Works
ChatTTS: A Text-to-Speech Model Optimized for Dialogue