ga4-mcp
Provides read-only access to Google Analytics 4 reporting data, including traffic overview, top pages, traffic sources, and conversion/engagement events, with flexible custom report queries.
Click on "Install 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., "@ga4-mcpWhat were my top pages for the last 7 days?"
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.
ga4-mcp
An MCP server that gives Claude (or any MCP client) read-only access to a Google Analytics 4 property's reporting data — traffic overview, top pages, traffic sources, and custom conversion/engagement events.
Built for goldvalleysolutions.com, but works for any GA4 property.
Tools
ga4_traffic_overview — sessions, active users, new users, engaged sessions, engagement rate for a date range.
ga4_top_pages — top pages by views.
ga4_traffic_sources — sessions broken down by channel (organic search, direct, referral, social, etc.).
ga4_conversion_summary — counts for custom events (
form_submission,cta_click,project_click,scroll_depthby default).ga4_run_report — flexible escape hatch: any GA4 dimensions + metrics combination.
All tools are read-only (no data is ever modified) and accept start_date/end_date as YYYY-MM-DD or GA4 relative keywords (today, 7daysAgo, 28daysAgo, etc.), plus a response_format of markdown or json.
Related MCP server: ga-mcp-full
One-time Google Cloud setup
Enable the API. In the Google Cloud Console, select (or create) a project, then go to "APIs & Services" > "Library", search for Google Analytics Data API, and click Enable.
Create a service account. "APIs & Services" > "Credentials" > "Create Credentials" > "Service account". Give it any name (e.g.
ga4-mcp-reader). No project-level IAM role is needed — access is granted at the GA4 property level in step 4.Create a JSON key. Open the new service account > "Keys" tab > "Add Key" > "Create new key" > JSON. This downloads a
.jsonfile — save it somewhere safe on your machine (not inside this repo; it's gitignored, but keep it outside the folder entirely to be safe, e.g.~/.config/ga4-mcp/service-account.json).Grant the service account access to GA4. In Google Analytics, go to Admin > Property Access Management (for the goldvalleysolutions.com property) > "+" > Add users. Paste in the service account's email address (looks like
ga4-mcp-reader@your-project.iam.gserviceaccount.com, found on the service account's details page) and give it the Viewer role.Find your GA4 Property ID. Admin > Property Settings. It's a number like
123456789— not the same as theG-XXXXXXXmeasurement ID used in the site's tracking snippet.
Install & configure
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# then edit .env: set GOOGLE_APPLICATION_CREDENTIALS to the path from step 3,
# and GA4_PROPERTY_ID to the number from step 5Run it / connect it to Claude
For local/stdio use (Claude Desktop, Claude Code, Cowork), add it as an MCP server pointing at:
python3 /absolute/path/to/ga4_mcp.pywith the environment variables from .env set in whatever config mechanism your client uses (Claude Desktop's claude_desktop_config.json env block, for example).
You can also run it directly to sanity-check it starts cleanly:
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json GA4_PROPERTY_ID=123456789 python3 ga4_mcp.pySecurity notes
The service account only ever needs Viewer access — never grant it Editor/Admin on the GA4 property.
Never commit the service account JSON key or
.envfile — both are already covered by.gitignore.All tools are read-only against the GA4 Data API; nothing in this server can modify your Analytics configuration or data.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables comprehensive integration with Google Analytics 4, allowing users to read analytics reports and send custom events through both the Data API and Measurement Protocol v2.184172MIT
- Alicense-qualityBmaintenanceProvides full Google Analytics 4 management and reporting capabilities via MCP, including property management, custom dimensions, audiences, events, data streams, and real-time reporting.MIT
- AlicenseAqualityBmaintenanceEnables querying Google Analytics 4 properties using natural language through MCP clients. Supports customizable reports with any dimensions and metrics, listing properties, and real-time data.4MIT
- Alicense-qualityCmaintenanceProvides read-only access to Google Ads account data including campaigns, ad groups, keywords, and performance reports. Enables querying via GAQL through an MCP interface.MIT
Related MCP Connectors
Read-only MCP access to sessions, funnels, campaigns, errors, live visitors, and anomalies.
Read-only Yandex Metrika MCP. Query visits, sources, geo, devices and more in plain language.
Query Churn Solution cancellation-flow metrics, revenue, and feedback analytics (read-only).
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mike-gvs/gvs-ga4-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server