Google Analytics 4 MCP Server
Lets your AI agent pull Google Analytics 4 reports: traffic, user behavior and real-time data.
244 stars on GitHubby surendranbLicense MITUpdated 22 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add google-analytics -e GOOGLE_APPLICATION_CREDENTIALS="<your value>" -e GA4_PROPERTY_ID="<your value>" -- uvx google-analytics-mcp
What to fill in
| Name | What it is | Required |
|---|---|---|
GOOGLE_APPLICATION_CREDENTIALS | Absolute path to your Google Cloud service account JSON key with GA4 property access. | Yes |
GA4_PROPERTY_ID | Numeric GA4 Property ID to query, for example 123456789. | Yes |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
Why did traffic drop last Tuesday?
Show sessions by channel for the last 30 days.
What it is
This server gives AI agents analysis-ready access to Google Analytics 4. It can discover which dimensions and metrics a property has, run multi-dimensional reports with server-side totals, and show real-time users. It also includes built-in analysis playbooks, such as for traffic drops or ecommerce.
What it can do
get_ga4_data: run reports with dimensions, metrics and date rangeslist_accounts: list your GA accountslist_properties: list GA4 propertiesget_property_metadata: see dimension and metric schemasrun_realtime_report: active users and events from the last 30 minutessearch_skills,skill_readandskills_list: analysis playbooks
When to use
- βΊWhen you want to know why website traffic suddenly dropped
- βΊWhen you want a channel or ecommerce report without opening GA4
- βΊWhen you want to see how much traffic comes from ChatGPT, Claude or Perplexity
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
ai-visibilityHelps your agent measure how often AI tools like ChatGPT and Perplexity send visitors to your website, using your real Google Analytics data.google-analytics-automationAutomates Google Analytics tasks like reports and funnels. Useful for analyzing website data without manual intervention.google-analytics-data-api-basicsHelps your agent pull Google Analytics report data through the Analytics Data API, such as active users and page views by city or date.Frequently asked questions
Is it free and open source?
Yes, it is MIT licensed. You still need a Google Analytics 4 property.
What credentials does it need?
A GA4_PROPERTY_ID and Google credentials such as a service account file.
Does it collect telemetry?
It sends anonymous diagnostic data (commands, latency, error codes). Opt out with DO_NOT_TRACK=1 or MCP_TELEMETRY_OPT_OUT=1.
Does it send my queries?
The readme says no queries, credentials or personal data are collected.
Which clients work?
Claude Desktop, Claude Code, Cursor, VS Code, Zed, Windsurf and others.
Where do the playbooks come from?
They load dynamically from GitHub.
If it does not work
- βΊSet GA4_PROPERTY_ID and GOOGLE_APPLICATION_CREDENTIALS in the server env.
- βΊMake sure the service account has access to your GA4 property.
- βΊCheck that uvx or Node.js is installed, then restart your AI app.
5 new skills a week. 1 minute to read.