Google Analytics MCP Server
Allows querying Google Ads campaign, ad group, and keyword performance when a GA4 ↔ Google Ads link is configured.
Provides SEO and paid reporting tools for Google Analytics 4, including organic/paid search performance, landing page analysis, channel and campaign breakdowns, conversions by source, realtime active users, and a flexible report runner.
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 MCP Server show me organic search performance for the last month"
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
Local MCP server for Google Analytics 4. Wraps the GA4 Data API behind tools focused on SEO and Paid reporting.
Tools
Tool | Purpose |
| SEO: Organic Search sessions/users/engagement/conversions by landing page, source, country, or device |
| Paid: Paid Search sessions/conversions/cost/CPC by campaign, landing page, keyword, or source |
| Paid: all paid channels (Search + Social + Video + Display) with cost and ROAS |
| Paid: Google Ads campaign × ad group × keyword (requires GA4 ↔ Google Ads link) |
| Top landing pages by sessions/engagement/conversions (optional channel filter) |
| Default channel group rollup |
| Campaign × source × medium breakdown |
| Conversions and key events by source/medium/channel |
| Active users in last 30 min |
| Flexible escape hatch — any dimensions + metrics |
Setup
git clone https://github.com/ZLeventer/google-analytics-mcp-server.git
cd google-analytics-mcp-server
npm install
npm run buildCredentials
Copy .env.example to .env and fill in:
GA4_PROPERTY_ID— numeric property ID from GA4 Admin → Property Settings (e.g.123456789). Not the Measurement ID (G-XXXXXXX).GOOGLE_APPLICATION_CREDENTIALS— absolute path to the service account JSON key file.
Create the service account
Go to console.cloud.google.com → pick/create a project
APIs & Services → Library → enable Google Analytics Data API
IAM & Admin → Service Accounts → Create service account (name it
ga4-mcpor similar)On the created account → Keys → Add key → Create new key → JSON → download
Save the JSON as
service-account.jsonin this directory (already in.gitignore)In GA4 → Admin → Property Access Management, click + → paste the service account email (
ga4-mcp@project-id.iam.gserviceaccount.com) → assign Viewer
The Google SDK auto-reads GOOGLE_APPLICATION_CREDENTIALS — no code changes needed.
Install into Claude Code
claude mcp add google-analytics \
--env-file "/absolute/path/to/google-analytics-mcp-server/.env" \
-- node "/absolute/path/to/google-analytics-mcp-server/dist/index.js"Or add to ~/.claude.json manually:
{
"mcpServers": {
"google-analytics": {
"command": "node",
"args": ["/absolute/path/to/google-analytics-mcp-server/dist/index.js"],
"env": {
"GA4_PROPERTY_ID": "123456789",
"GOOGLE_APPLICATION_CREDENTIALS": "/absolute/path/to/google-analytics-mcp-server/service-account.json"
}
}
}
}Restart Claude Code after install.
Date formats
All date args accept GA4 formats:
YYYY-MM-DD(e.g.2026-04-01)NdaysAgo(e.g.28daysAgo,90daysAgo)yesterday,today
Defaults: 28daysAgo → yesterday.
Verification
After credentials are in place:
node -e '
import("./dist/tools/reports.js").then(m =>
m.channelPerformance({ start_date: "7daysAgo", end_date: "yesterday", limit: 10 })
).then(r => console.log(JSON.stringify(r, null, 2)))
'If that returns rows, everything works. Expected errors:
GA4_PROPERTY_ID is not set— check.envPERMISSION_DENIED— service account isn't granted Viewer on the property403 Google Analytics Data API has not been used— enable the API in the GCP project
Roadmap
Admin API tools (list custom dimensions, conversion events, audiences) once needed
Search Console MCP as sibling server for rankings / impressions / CTR data (complements this one)
Pair with Demandbase MCP to join GA4 traffic with firmographics (account-level attribution)
Available Tools
10 toolsga4_all_paid_performanceA
Paid: all paid channels (Search + Social + Video + Display + Other) broken down by channel × campaign × source × medium, with cost and ROAS.
Inputs: start_date, end_date, property_id, limit.
ga4_campaign_performanceB
Campaign × source × medium breakdown with sessions/conversions/revenue. Optional channel filter.
Inputs: start_date, end_date, property_id, limit, +1 more.
ga4_channel_performanceB
Default channel group rollup: sessions/users/conversions/revenue for Organic Search, Paid Search, Email, Direct, Referral, etc.
Inputs: start_date, end_date, property_id, limit.
ga4_conversions_by_sourceB
Conversions and key events broken down by session source × medium × channel group. Sorted by key events desc.
Inputs: start_date, end_date, property_id, limit.
ga4_google_ads_performanceA
Paid: Google Ads campaign × ad group × keyword performance (impressions, clicks, cost, CPC, conversions, ROAS). Requires Google Ads ↔ GA4 link.
Inputs: start_date, end_date, property_id, limit.
ga4_landing_page_performanceA
Top landing pages by sessions/engagement/conversions. Optional channel filter (e.g. 'Organic Search', 'Paid Search').
Inputs: start_date, end_date, property_id, limit, +1 more.
ga4_organic_search_performanceA
SEO: sessions/users/engagement/conversions for Organic Search traffic, broken down by landing page (default), source, country, or device.
Inputs: start_date, end_date, property_id, limit, +1 more.
ga4_paid_search_performanceB
Paid: sessions/conversions/cost/CPC for Paid Search traffic, broken down by campaign (default), landing page, keyword, or source.
Inputs: start_date, end_date, property_id, limit, +1 more.
ga4_realtime_active_usersB
Current active users (last 30 min) broken down by screen/page, country, device, or audience.
Inputs: property_id, breakdown, limit.
ga4_run_reportA
Flexible GA4 Data API runReport. Pass any dimensions + metrics. Use for custom reports the preset tools don't cover.
Inputs: dimensions (required), metrics (required), start_date, end_date, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct area of GA4 data: all paid, specific channels, campaigns, conversions, landing pages, organic/paid search, realtime, and a generic report. No two tools have overlapping purposes that would cause confusion.
All tool names consistently follow the 'ga4_<descriptive_name>' format using snake_case. The naming pattern is predictable and uniform across the entire set.
10 tools is well within the ideal 3-15 range for a focused analytics server. Each tool serves a clear purpose, and the count feels neither excessive nor insufficient for covering core GA4 queries.
The set covers acquisition, behavior, conversions, and realtime analytics well. Minor gaps exist (e.g., user demographics, event details), but the flexible ga4_run_report tool allows agents to fill these gaps for custom reports.
Related MCP Connectors
Hosted MCP server for GA4, Google Ads and Search Console. Google OAuth, nothing to install.
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
SEO MCP server for keyword research, SERP analysis, audits, and Search Console workflows.
SEO MCP server for keyword research, live SERPs, backlinks, site audits and AI visibility.