Table of contents
The GA4 MCP server is Google’s official Model Context Protocol server for Analytics 4 — a bridge that lets AI tools like Claude and Cursor query your GA4 property directly and answer questions in plain English, instead of you building custom reports. It exposes the GA4 Reporting and Admin APIs as a structured toolset an AI assistant can call, so “how many users visited last week?” becomes a real-time answer rather than a dashboard export.
Google just dropped something pretty cool for anyone working with analytics data and AI. They’ve built an official Model Context Protocol (MCP) server that connects your favourite AI tools directly to Google Analytics 4.
Think about it: instead of logging into GA4, clicking through dashboards, and copying numbers into spreadsheets, you can now just ask your AI assistant “How many users visited my site last week?” and get real answers.
I’m thrilled to announce the launch of our open-source Model Context Protocol (MCP) server for Google Analytics! This bridges the gap between the powerful conversational abilities of Large Language Models (LLMs), like Gemini, and the rich, specific data within your Google Analytics property.
Matt Landers, Head of Developer Relations at Google Analytics
Here’s Matt explaining the whole thing:
The server taps into both the GA4 Reporting API and Admin API, so you can pull metrics, dimensions, apply filters, and grab property details. It’s basically a bridge between your analytics data and any AI tool that supports MCP.
What can you actually do with it?
The GA4 MCP server comes packed with tools. Here’s the full lineup:
| Tool Name | What It Does |
|---|---|
| get_dimensions | Grabs all the dimensions for your property, including custom ones |
| get_metrics | Gets all available metrics for your property, including custom metrics |
| get_standard_dimensions | Lists standard GA4 dimensions |
| get_standard_metrics | Lists standard GA4 metrics |
| run_report_date_ranges_hints | Shows you what date ranges you can use |
| run_report_metric_filter_hints | Helps you understand how to filter metrics |
| run_report_dimension_filter_hints | Helps you understand how to filter dimensions |
GA4 MCP server vs the GA4 API vs the GA4 UI
Not sure which route fits how you work? Here’s how the three ways of getting data out of GA4 compare:
| GA4 MCP server | GA4 Reporting/Admin API | GA4 UI (dashboards) | |
|---|---|---|---|
| Setup effort | Low — enable 2 APIs, connect an AI client | Medium — write and maintain client code | None — already built in |
| How you query | Natural language, via an AI assistant | Code (Python, Node, etc.) | Point-and-click reports |
| Data freshness | Same as the underlying API | Same as the underlying API | Same data, occasional UI refresh lag |
| Best for | Fast, ad-hoc answers without writing code | Custom dashboards, pipelines, automation | Browsing standard, pre-built reports |
| Flexibility | High — ask follow-up questions conversationally | Highest — full programmatic control | Low — limited to built-in report types |
If you’re already comfortable in GA4’s own dashboards for routine reporting, the MCP server earns its keep on the ad-hoc, conversational questions that would otherwise mean building a new report from scratch. If you’re also weighing up analytics platforms more broadly, see how PostHog compares to Google Analytics.
Real questions you can ask
Here are some practical questions you can throw at your AI once it’s connected to your GA4 data:
- “What were my top 5 traffic sources last month?”
- “How did mobile vs desktop traffic perform this quarter?”
- “Which pages have the highest bounce rate?”
- “Show me conversion rates broken down by country”
- “What’s my real-time user count right now?”
- “How many new users did I get from organic search last week?”
- “Which campaigns drove the most revenue this month?”
- “What’s my average session duration trend over the past 3 months?”
The magic happens behind the scenes - your natural language questions get converted into proper GA4 API calls automatically.
Setting up the APIs
Before you can use this thing, you need to enable two APIs in Google Cloud Console:
1. Google Analytics Admin API
Head to Google Cloud Console and enable this one. It gives you programmatic access to your GA4 configuration data. Check out the API Explorer if you want to see what’s possible.
2. Google Analytics Data API
Enable this one at Google Cloud Console too. This is what actually pulls your report data. The API Explorer shows all the endpoints.
Running it locally
Want to run the server on your machine? Follow the official instructions, but here’s the gist.
You’ll need pipx (it’s like a virtual environment manager for Python CLI tools):
brew install pipx pipx ensurepath sudo pipx ensurepath –global brew update && brew upgrade pipx
Then follow the setup steps in the GitHub repo to get everything running.
Going remote with Cloudflare Workers
If you want something more robust, you can deploy this as a remote MCP server on Cloudflare Workers.
Cloudflare makes this pretty easy. They even had an MCP Demo Day where companies like Atlassian, Asana, Webflow, Linear, Sentry, PayPal, Stripe, and Intercom all built their MCP servers on Cloudflare.
The remote version gives you the same functionality as running it locally, but with Cloudflare’s global edge network handling the heavy lifting. It’s basically a serverless gateway for querying GA4 data via JSON-RPC.
You get all the same tools:
- get_account_summaries - List your GA accounts and properties
- get_property_details - Get property info
- run_report - Run standard GA4 reports
- run_realtime_report - Get real-time data
- get_dimensions - List available dimensions
- get_metrics - List available metrics
Connecting your AI tools
Once your server is running (either locally or on Cloudflare), connecting it to AI tools is straightforward. If you went the Cloudflare route, just add your worker URL (https://ga4-mcp.xxxxxx-xxx.workers.dev) to your MCP client.
Popular options include:
For developers, you might want to try:
Check out PulseMCP for a full list of MCP clients. MCP adoption is moving fast across the ecosystem, though it’s fair to ask whether MCP has staying power — an official server from Google Analytics is a strong signal that it does. If you want to trigger GA4 queries as part of a broader automation (e.g. a Slack alert when traffic spikes), pairing this with n8n’s MCP integration is worth a look too.
Authentication options
Here’s how the different auth methods stack up:
| Method | Description | Can Verify GA Permissions? | Acts on Behalf of User? | Notes |
|---|---|---|---|---|
| Application Default Credentials (ADC) | Uses environment variables or Google Cloud SDK setup | ✅ Yes | ⚠️ Not directly, unless using user creds | Good for server-to-server or local dev with gcloud auth application-default login |
| Service Account (via ADC) | JSON key for a service account | ✅ Yes | ❌ No | Service account needs GA property access in GA Admin UI |
| OAuth 2.0 | Interactive auth flow with user consent | ✅ Yes | ✅ Yes | Best for apps accessing GA data for multiple users. Handles token storage & refresh |
| API Key | Static project identifier key | ✅ Yes (limited) | ❌ No | Very limited; not great for user-specific GA data |
For MCP, you’ll typically use a Service Account with a JSON key. Here’s what you need to do:
- Share access to your GA4 property with the service account email (Viewer role or higher)
- Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your service account JSON file
- Make sure your credentials include the Google Analytics read-only scope: https://www.googleapis.com/auth/analytics.readonly
This is still pretty new, but it’s already changing how people interact with their analytics data. Instead of being a dashboard jockey, you can have actual conversations with your data. Pretty neat stuff.
We are on-track to deliver a 43% increase in inbound leads this year. There is no doubt the adoption of Growth Method is the primary driver behind these results.
Laura Perrott, Colt Technology Services
About Growth Method
If asking GA4 a question in plain English feels like a glimpse of where marketing is headed, that’s the bet we’re making at Growth Method too. We’re the agentic marketing platform for B2B teams: connect GA4 (plus PostHog, Search Console, Google Ads and more) once, and both your team and your AI agents can plan campaigns, ship them, and see what actually moved the needle — without stitching together exports and dashboards by hand.
The GA4 MCP server is a great way to ask your analytics a question. Growth Method is where you turn the answer into your next campaign, tracked from hypothesis through to result.
Book a call to see it running on your own data, or apply for early access to get started.
Frequently asked questions
What is the GA4 MCP server?
The GA4 MCP server is Google’s official Model Context Protocol server for Analytics 4. It exposes the GA4 Reporting and Admin APIs as a toolset that AI assistants like Claude and Cursor can call directly, so you can ask analytics questions in plain English instead of building custom reports or dashboards.
How do I connect GA4 to Claude or Cursor via MCP?
Enable the Google Analytics Admin API and Data API in Google Cloud Console, run the GA4 MCP server locally (via pipx) or deploy it remotely on Cloudflare Workers, then add the server to your MCP client (Claude Desktop, Cursor or another supported tool) using its command or worker URL.
Is the GA4 MCP server official?
Yes. It was built and released by Google Analytics as an open-source project, announced by Matt Landers, Head of Developer Relations at Google Analytics.
Does the GA4 MCP server cost anything to run?
The server itself is free and open-source. You’ll use your existing GA4 and Google Cloud access, and if you deploy it remotely on Cloudflare Workers you may incur Cloudflare’s standard usage costs, which are typically minimal for this kind of workload.
Resources and links
Want to dive deeper? Here are the key resources:
