Google Analytics MCP
Provides read-only access to Google Analytics 4 accounts and properties, including listing accessible properties, retrieving property settings and metadata, and running reports with dimensions, metrics, filters, sorting, paging, batch reports, pivot tables, funnel analysis, and realtime activity.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google Analytics MCPHow did traffic change this month vs last month, by channel?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Analytics MCP: a free GA4 connector for Claude
Lets Claude read all of your Google Analytics 4 data: accounts, properties, traffic, conversions, revenue, funnels and realtime activity. It's free and open source (MIT).
Free: it talks straight to Google's own Analytics APIs, which cost nothing. No subscription, no third-party service, no server to host.
Private: your data only travels between your computer and Google. Your sign-in token stays on your machine.
Read-only: it can't change anything in Google Analytics.
Nothing extra to install: it needs only Node.js 18 or newer.
Works with Claude Code, Claude Desktop, Cursor and any other MCP client.
Quick start
1. Install
Claude Code: inside Claude Code, run:
/plugin marketplace add mmoasa00/google-analytics-mcp
/plugin install google-analytics@google-analytics-mcpThen restart Claude Code.
Claude Desktop, Cursor and other MCP clients: add this to the app's MCP config. In Claude Desktop that's Settings → Developer → Edit Config:
{
"mcpServers": {
"google-analytics": {
"command": "npx",
"args": ["-y", "github:mmoasa00/google-analytics-mcp"]
}
}
}2. Set it up: Claude walks you through it
Ask Claude:
"Help me set up Google Analytics"
In Claude Code you can also type /ga-setup. Claude checks what's already done and gives you one step at a time: which link to open, exactly what to click, and what you should see. It checks each step before moving on, and helps if something looks different or shows an error.
You are… | What you'll do | Time |
The first person on your team | Create a free Google "OAuth client" (a sign-in key for your team) in Google Cloud, then connect | ~10 min, once |
A teammate who received a | Put the file in your Downloads folder, then say "connect my Google Analytics" | ~2 min |
Prefer reading? The full step-by-step checklist is in docs/SETUP-GUIDE.md.
3. Ask questions
"Which GA properties do I have?"
"How did traffic change this month vs last month, by channel?"
"Top 20 landing pages by conversions in the last 90 days"
"How many people are on the site right now, and from where?"
/ga-report mysite.com last 30 days
Related MCP server: GA4 MCP Server
The OAuth client, in short
Google requires every app that signs people in to have an "OAuth client". It's free. One person creates it once, and the whole team uses the same file. The step-by-step guide covers each click. In summary:
Enable the Analytics Admin API and the Analytics Data API.
Google Auth Platform → Get started. Choose Internal if everyone is on one Google Workspace domain; otherwise choose External.
External only: Audience → Publish app. Or add test users, but then sign-ins expire every 7 days.
Clients → Create client → Desktop app → Download JSON straight away. Google shows the secret only once.
Say "connect my Google Analytics". The file is found in your Downloads folder automatically. You can also connect from a terminal:
npx -y github:mmoasa00/google-analytics-mcp login
Sharing with your team
Pick one:
Send the JSON file to teammates privately. They save it to their Downloads folder and say "connect my Google Analytics".
Fork this repo and save the file as
plugins/google-analytics/oauth-client.jsonin your fork (seeoauth-client.example.json). Teammates install from your fork and only have to click "Sign in". Google doesn't treat desktop-app client secrets as confidential, but a private fork is still the tidier choice.
Each person signs in with their own Google account and sees only the GA properties they already have access to.
Other ways to authenticate
The server checks for credentials in this order:
Method | How |
Service account (servers, automation, no browser) | Create a service account key in Google Cloud. In GA, go to Admin → Property access management and add the service account's email as Viewer. Then set |
Browser sign-in ( | Described above. The token is saved to |
gcloud | If you've already run |
Environment variables (all optional)
Variable | Purpose |
| Path to a service account or authorized-user JSON file |
| OAuth client, instead of a JSON file |
| Google Cloud project to bill API quota to. Free, but sometimes needed with gcloud credentials. |
| Where the client and token are stored. Default: |
Tools
Tool | What it does |
| Guided setup: detects what's done and returns the next step, with links and fixes |
| Connect, disconnect, or show the connected Google account |
| All accounts and GA4 properties you can access |
| Property settings, data streams, key events and linked Google Ads accounts |
| Every dimension and metric available, including custom ones |
| Any report: dimensions × metrics × date ranges, with filters, sorting and paging |
| Up to 5 reports in one call |
| Pivot tables |
| Funnel analysis |
| The last 30 minutes of activity |
Claude Code also gets a google-analytics skill, plus the /ga-setup, /ga-connect and /ga-report commands.
Limits
GA4 only. Google has shut down Universal Analytics data.
Google's free API quotas apply per property. They're generous for normal use.
Results are subject to GA's own sampling and thresholding. When that happens, the server includes it in the response.
Troubleshooting
Problem | Fix |
"No Google OAuth client file found" | Ask Claude "help me set up Google Analytics", or follow the guide. |
"API has not been used / is disabled" | Enable both Analytics APIs in the Google Cloud project that owns the OAuth client. |
403 on a property | The signed-in account doesn't have access to that property in GA. |
"Access blocked" when signing in | The app is in Testing and your email isn't a test user. See step 4 of the guide. |
"Google Analytics access was not granted" | Tick See and download your Google Analytics data on the Google consent screen. |
"rejected the saved credentials" | Run |
No browser opens | Copy the URL that |
License
MIT. Free forever.
This server cannot be deployed
Maintenance
Related MCP Connectors
GA4, Google Ads and Search Console in Claude. Read-only OAuth, multi-account for agencies.
Read-only Google Search Console and Google Analytics for AI agents.
Read-only Google Analytics 4 MCP server for AI assistants.
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
Related MCP Servers
- AlicenseAqualityBmaintenanceConnects Google Analytics 4 data to Claude, Cursor and other MCP clients, enabling natural language queries of website traffic, user behavior, and analytics data with access to 200+ GA4 dimensions and metrics.121,015 PyPI243MIT
- AlicenseAqualityCmaintenanceConnects MCP clients like Claude Desktop to Google Analytics 4 Data API, enabling natural language queries for reports, top pages, traffic sources, conversions, realtime users, and period comparisons.747 PyPIMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants like Claude, ChatGPT, and Cursor to query GA4 traffic, conversion, channel, e-commerce, and demographic reports conversationally, and to manage properties, data streams, audiences, key events, and other configuration through 62 read and write actions. Access can be scoped per account with read-only mode and destructive actions disabled by default.MIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP clients like Claude and Cursor to run read-only Google Analytics 4 queries — reports, funnels, realtime data, property and stream setup, custom dimensions, plus tracking-health checks for duplicate transactions and traffic attribution — with a one-time browser Google sign-in and no Google Cloud project required. GA4 data flows directly from the local machine to Google, and only read-only analytics access is requested.Apache 2.0