Perfect for non-coders, marketers, analysts, and founders who want to integrate GA4 insights into Claude Desktop using a Python-powered MCP server — all locally and securely.
What is an MCP Server?
MCP (Model Context Protocol) servers allow AI tools like Claude to interact with real-world data and tools via a standard protocol. Think of it like a bridge between your local data (like GA4 or Shopify) and Claude’s chat interface — so Claude can ask for data and act on it using well-defined tools, all running securely on your machine.
If you want to know more about How Marketers can use MCP servers, here’s a detailed guide, The End-to-End Model Context Protocol (MCP) Guide for Marketers
What You’ll Achieve
- Pull GA4 reports via Claude (e.g., “Show traffic for the last 7 days”)
- Run everything locally (no cloud or third-party hosting)
- Use Claude as a smart assistant connected to your actual GA4 data
Tools You’ll Need 🛠️
Tool | Why You Need It |
Claude Desktop | To access and chat with tools |
Python (3.10+) | To run the MCP server locally |
Git (optional) | To clone the project repository |
GA4 Access | Your credentials to connect to your property |
Need Help With the Setup?
If the setup feels too technical, our team is here to help.
Don’t worry, we’ve got your back!
👉 Click here to get expert assistance now!
Setup Methods
There are two ways to go about integrating your Google Analytics 4 with your Claude desktop with an MCP server:
Before starting either of the methods, make sure:
1. You have Python installed
Download it from python.org. During install:
- Check “Add Python to PATH” ( VERY IMPORTANT STEP)
- Then click Install Now

To confirm it’s installed:
Open your command line:
- Windows: Press Win + R, type cmd, and press Enter
- macOS: Press Cmd + Space, type Terminal, and hit Enter
- Linux: Press Ctrl + Alt + T, or open Terminal from your applications menu
Then run this text below:
python --version

If installed correctly, you should see it return something like: Python 3.10.13
( Note: the number next to Python might differ based on the version you have downloaded )
2. You’ve installed Claude Desktop
Claude Desktop is required to use MCP servers.
Download the desktop app from Anthropic’s official Claude site. ( https://claude.ai/download )
Once installed, we’ll configure it later to recognize the Facebook Ads tool.
This repository offers two ways to install and set up this server:
Method 1: Quick Setup Option (Paid) — Connect GA4 to Claude in 2 Steps
Prefer to skip the manual setup? Connect your GA4 data to Claude in under 2 minutes using our secure, ready-to-use extension — no coding, no hassle.
How it works:
- Install Claude Desktop and Python from the prerequisites
- Click here to Authenticate & Pay $10 — Use our secure Razorpay checkout to verify your GA4 account and generate your private file
- Drag & Drop the file into Claude Desktop’s Extensions panel.
Windows Version:
- Go to File > Settings

- Once inside your settings → you should see Extensions on the side bar as displayed below:

- Simply drag and drop the file on this window. It will automatically show you a button to install. After installation ensure you restart Claude. ( Keep in mind that you will have to completely close Claude from the background )

Claude will instantly connect to your GA4 property using your verified credentials. No coding, no terminal — fully private, all local!
Mac Version:
- Open Claude settings as shown below

- Once inside your settings → you should see Extensions on the side bar as displayed below:

- Simply drag and drop the file on this window. It will automatically show you a button to install. After installation, ensure you restart Claude.
Method 2: Technical Installation: Step By Step (free)
Step 1: Install Python + Add to PATH
- Download Python from: https://www.python.org/downloads
- Run the installer
- Important: ✅ Check “Add Python to PATH”
- Click Install Now

To confirm it’s installed:
Open your command line:
- Windows: Press Win + R, type cmd, and press Enter
- macOS: Press Cmd + Space, type Terminal, and hit Enter
- Linux: Press Ctrl + Alt + T, or open Terminal from your applications menu
Then run this text below:
python --version

If installed correctly, you should see it return something like: Python 3.10.13
( Note: the number next to Python might differ based on the version you have downloaded )
Step 2: Download the GA4 MCP Project
Option A: Clone with Git (Recommended)
git clone <https://github.com/smacient/mcp-ga4.git>
cd mcp-ga4
Option B: Download ZIP
- Visit: https://github.com/smacient/mcp-ga4
- Click Code → Download ZIP
- Extract to a folder (e.g., Documents/mcp-ga4)

Step 3: Set Up Python Virtual Environment
- Open Command Prompt (CMD)
- Navigate to the project folder:
cd C : \\Users\\YourName\\Documents\\mcp-ga4\\mcp-ga4-main
1. Create a virtual environment by using the line below:
python -m venv .venv
2. Activate it:
.venv\\Scripts\\activate
Your CMD should now show: (.venv) before the prompt
Step 4: Install MCP + Dependencies
Inside the same activated terminal:
pip install uv
uv sync
You should see a lot of dependencies being downloaded, and the sync would have given
Step 5: Get Your GA4 Credentials
Getting your credentials is the only step where you’ll need to log into the Google Cloud Console. Follow this carefully — it’s easier than it sounds!
- Visit https://console.cloud.google.com and log in with your Google account.
- Click “Select a project” (top menu) → “New Project”, and give it a name like “Claude GA4 MCP”
- After it’s created, click “APIs & Services → Library” in the sidebar
- Search for “Google Analytics Data API”, click it, and press Enable
- Next, go to “Credentials” in the sidebar
- Click “Create Credentials → Service Account”, and fill in a name like “Claude GA4 Bot”
- Skip roles/permissions for now (you can click Done)
- After creation, click into your new service account → Go to the “Keys” tab → Click “Add Key → Create New Key” → Choose JSON and download the file
- Rename this downloaded file to credentials.json
- Move this file into the main folder of your project (where ga4_server.py is located)
- Then in your Google Analytics property settings, share access with the email address shown in the JSON file (it ends with @<project>.iam.gserviceaccount.com) and give it Viewer or Analyst access
Step 6: Add a .env File
- Open the mcp-ga4-main folder where you extracted or cloned the project.
- Go inside the localserver folder.
- Right-click in the folder → choose New → Text Document → name it exactly .env (delete the .txt extension if it appears).
- Open this file and paste the following line:
GOOGLE_APPLICATION_CREDENTIALS=C:\\Users\\YourName\\Documents\\mcp-ga4\\mcp-ga4-main\\credentials.json
Tip: On Windows, this line works as-is. You don’t need to double the slashes like you would in Python scripts.
Step 7: Install the Server into Claude
Run this in your terminal (with the virtual env still active):
uv run mcp install localserver/ga4_server.py
This registers the server with Claude Desktop.
Step 8: Configure Claude Desktop
Open Claude → Settings → Developer → Edit Config


- A folder will open and Add this script below inside claude.json under “mcpServers”:
Step 9 : Ask Claude!
( Pro Tip : After saving the claude.json document, close Claude completely. Make sure you remove any instance of Claude running. You can use the task manager to ensure this. )
Launch Claude Desktop and ask:
Get a GA4 report for the last 7 days.
“Google Analytics 4”: {
“command”: “uv”,
“args”: [
“run”,
“–with”,
“mcp[cli]”,
“mcp”,
“run”,
“C:\\Users\\YourName\\Documents\\mcp-ga4\\mcp-ga4-main\\localserver\\ga4_server.py”
],
“env”: {
“VIRTUAL_ENV”: “C:\\Users\\YourName\\Documents\\mcp-ga4\\mcp-ga4-main\\.venv”,
“PATH”: “C:\\Users\\YourName\\Documents\\mcp-ga4\\mcp-ga4-main\\.venv\\Scripts;${PATH}”,
“GOOGLE_APPLICATION_CREDENTIALS”: “C:\\Users\\YourName\\Documents\\mcp-ga4\\mcp-ga4-main\\credentials.json”
}
}
Claude will:
- Detect the GA4 MCP server
- Ask for permission to use it
- Fetch your data using tools like get_report, compare_report_metrics, etc.
Troubleshooting Tips
❌ No tools visible in Claude? → Double-check your claude.json paths and restart Claude
❌ Env not loaded? → Confirm .env is in the right folder and dotenv.config() is in the script
❌ Permission error from GA4? → Make sure your service account has correct GA4 access in GA settings
That’s It!
You now have a fully running local Python-powered GA4 analytics server talking to Claude. Secure, private, and easy to modify — no cloud hosting required.
Check out our other blogs for more information on MCP servers and various other tools that will end up making your life easy:
- The End-to-End Model Context Protocol (MCP) Guide for Marketers
- Top AI Tool Libraries To Find the Best AI Tools
- Notebook LM: A Guide with Use Cases and Examples
FAQs
The Model Context Protocol (MCP) Server acts as a bridge between Google Analytics 4 and Claude Desktop, enabling seamless context-aware data flow for enhanced tracking and analysis.
Not necessarily. While basic familiarity with APIs and configuration files is helpful, this guide breaks down the integration steps in a user-friendly, non-technical manner.
You’ll be able to access behavioral insights, user events, traffic sources, and engagement metrics, all contextualized within Claude Desktop’s AI-driven interface.
Yes, when configured properly, the integration follows GA4’s data privacy standards and MCP’s secure data transfer protocols, ensuring compliance with GDPR and similar regulations.
We access Google Workspace data only to provide core user-facing features. We do not use it for ads, analytics, or share it externally. Our use complies with the Google API Services User Data Policy, including the Limited Use Requirements.