Skip to content
Growth Method
Go back

Connecting to the Google Analytics GA4 MCP Server

Updated:

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 NameWhat It Does
get_dimensionsGrabs all the dimensions for your property, including custom ones
get_metricsGets all available metrics for your property, including custom metrics
get_standard_dimensionsLists standard GA4 dimensions
get_standard_metricsLists standard GA4 metrics
run_report_date_ranges_hintsShows you what date ranges you can use
run_report_metric_filter_hintsHelps you understand how to filter metrics
run_report_dimension_filter_hintsHelps you understand how to filter dimensions

Real questions you can ask

Here are some practical questions you can throw at your AI once it’s connected to your GA4 data:

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:

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.

Authentication options

Here’s how the different auth methods stack up:

MethodDescriptionCan 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 credsGood for server-to-server or local dev with gcloud auth application-default login
Service Account (via ADC)JSON key for a service account✅ Yes❌ NoService account needs GA property access in GA Admin UI
OAuth 2.0Interactive auth flow with user consent✅ Yes✅ YesBest for apps accessing GA data for multiple users. Handles token storage & refresh
API KeyStatic project identifier key✅ Yes (limited)❌ NoVery 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:

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

If you’re looking to get more from your marketing data and drive pipeline growth, Growth Method is the GrowthOS built for marketing teams focused on pipeline — not projects. Book a call to see how it can help streamline your growth efforts.

Want to dive deeper? Here are the key resources:


Share this post on:

Previous Post
Intro to Gemini 2.5 Flash Image (Nano Banana) for Marketers
Next Post
Master Converting Experiences through Precise A/B Testing Strategies