Google Analytics contains a wealth of data about your website visitors, but extracting meaningful insights often feels like solving a puzzle. You have to navigate through multiple dashboards, remember which reports show what, and manually piece together information to answer simple business questions.
The Google Analytics MCP (Model Context Protocol) server changes this completely. It creates a direct connection between Claude and your Analytics data, letting you ask natural language questions and receive comprehensive answers instantly. Instead of hunting through reports, you can simply ask “How did my blog posts perform this month?” and get detailed analysis right away.
This guide walks you through the complete setup process, following Google’s official documentation to ensure everything works perfectly.
What you need before starting
Here’s what you’ll need to have ready: a Google Cloud Project (free to create if you don’t have one), access to the Google Analytics properties you want to analyze, admin rights to enable APIs in your Google Cloud account, and basic comfort with copying and pasting commands.
Don’t worry if you’re not technically inclined. We’ll walk through each step clearly.
The complete setup process
The setup involves three main steps that you need to follow exactly as documented by Google.
Step 1: Configure Python
Make sure you have Python installed on your system. Most modern computers come with Python pre-installed, but if you’re unsure, you can check by opening a terminal and typing python --version
.
Step 2: Configure credentials for Google Analytics
This is the most important part. Get this right and everything else will work smoothly.
Enable the required APIs
First, you need to turn on two specific APIs in your Google Cloud project. Follow the instructions to enable these APIs: Google Analytics Admin API and Google Analytics Data API.
Set up your authentication
Configure your Application Default Credentials (ADC). Make sure the credentials are for a user with access to your Google Analytics accounts or properties.
Your credentials must include the Google Analytics read-only scope: https://www.googleapis.com/auth/analytics.readonly
Check out Manage OAuth Clients for how to create an OAuth client.
Authentication commands
Here are the exact commands you’ll need. Pick the one that matches your setup:
For most users (using OAuth with downloaded client file):
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 advanced users (using 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
Step 3: Configure Gemini
Install Gemini
You’ll need either Gemini CLI or Gemini Code Assist.
Connect the MCP server
Create or edit the file at ~/.gemini/settings.json
, adding your 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"
]
}
}
}
Optional: Lock in specific credentials
Optional: Configure the GOOGLE_APPLICATION_CREDENTIALS
environment variable in Gemini settings. You may want to do this if you always want to use a specific set of credentials, regardless of which Application Default Credentials are selected in your current environment.
In ~/.gemini/settings.json
, add a GOOGLE_APPLICATION_CREDENTIALS
attribute to the env
object. Replace PATH_TO_ADC_JSON
in the following example with the full path to the ADC JSON file you always want to use for your MCP server:
{
"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"
}
}
}
}
Test your setup
Launch Gemini Code Assist or Gemini CLI and type /mcp
. You should see analytics-mcp
listed in the results.
Tip: If you’re not comfortable editing JSON files manually, try asking Claude or another AI tool to help you format the configuration correctly. Small syntax errors (like missing commas) can prevent the whole thing from working.
You found this article, didn’t you?
If you’re reading our article, it’s clearly we know how to get your website improved and visible on Google Search.
We can do the same for your business. Let us handle your website’s ongoing optimization, technical updates, and search visibility while you focus on growing your business.
Start getting answers
Once everything is connected, you can start asking real questions about your analytics data. Here are some examples to get you started:
Check what’s available:
Show me all the tools available in the analytics server
Analyze traffic patterns:
What were my top traffic sources over the past 3 months?
Event tracking insights:
Which user actions are driving the most conversions on my website?
User engagement analysis:
How long are visitors staying on my site compared to last quarter?
Property configuration review:
List all the tracking configurations I have set up for my main website
The beauty is that you can ask follow-up questions, combine different metrics, or dive deeper into any interesting patterns Claude identifies.
Benefits for website owners
Even though this setup has some technical steps, the payoff is huge for business owners. Instead of spending hours clicking through Google Analytics reports, you can get instant insights by asking specific questions and receiving immediate answers with context and explanations.
You’ll spot trends faster by identifying patterns in your data that might take forever to notice manually. This leads to better decision-making through quick comparisons between different time periods, traffic sources, or user segments.
The time savings alone make this worthwhile. No more hunting through menus or trying to remember how to set up complex reports. Plus, you’ll learn as you go since Claude explains what the data means and suggests related questions you might want to ask.
Frequently asked questions
What exactly can this MCP server access?
It connects to your Google Analytics data through official Google APIs. You get read-only access to all the reports and data you can normally see in Google Analytics, but through natural language queries.
Do I need to be technical to use this?
The setup requires following some technical steps, but once it’s running, you just ask questions in plain English. No need to learn Google Analytics navigation or remember metric names.
Is my analytics data secure?
Yes. The connection uses Google’s official APIs with read-only access. Your data stays in Google’s systems and the MCP server just translates your questions into API calls.
What if something goes wrong during setup?
Double-check that you’ve enabled both required APIs in Google Cloud and that your authentication includes the correct scopes. Most issues come from skipping or rushing through the credential setup.
Can I use this on mobile or tablets?
Currently, this setup works with Gemini CLI or Code Assist, which are primarily desktop tools. Mobile support may come in future updates.
Will this cost me money?
The Google Analytics APIs have generous free quotas that should cover normal usage. You’ll only pay if you make thousands of requests per day.
What’s next?
Once you have the Google Analytics MCP server running, you’ll probably discover new questions about your data that you never thought to ask before. The natural language interface makes it easy to explore your analytics in ways that would be time-consuming or difficult through the standard interface.
Start with basic questions about your most important metrics, then gradually explore more complex analysis as you get comfortable with the tool. You might be surprised by the insights you uncover when you can actually have a conversation with your data.