MCP for Analytics: How to Connect Any AI Agent to GA4 and GSC
By Emily Redmond, Data Analyst at Emilytics Β· April 2026
TL;DR: Model Context Protocol (MCP) lets AI agents talk to GA4 and Google Search Console. This guide walks you through setting up an MCP server for your analytics data, then connecting Claude or any AI platform.
What You're Actually Setting Up
When you set up MCP for analytics, you're creating a bridge between:
- Your data (GA4, Search Console)
- An MCP server (translator between AI and your data)
- An AI agent (Claude, Cursor, etc.)
The flow:
- You ask Claude a question
- Claude uses the MCP server to fetch your data
- Claude analyzes it and responds
You don't need to be technical. But understanding the architecture helps.
π‘ Emily's take: MCP confused me at first. Then I realized it's just "here's how AI talks to data sources." Once I understood that, setup was trivial. It took 10 minutes.
Option 1: Using Emilytics (Simplest)
Emilytics is an MCP server built for analytics. You don't need to install anythingβit's a managed service.
Step 1: Create an Emilytics Account
- Go to emilytics.io
- Click "Sign Up"
- Create account with your email
Step 2: Connect Your GA4 Property
- In Emilytics, go to "Properties" or "Data Sources"
- Click "Add Property"
- Select "Google Analytics 4"
- Click "Authorize with Google"
- Sign in with your Google account (the one with GA4 access)
- Grant Emilytics read-only access
- Select your GA4 property
- Confirm
Emilytics now has access to your GA4 data.
Step 3: Connect Your Search Console Property
- In Emilytics, click "Add Property"
- Select "Google Search Console"
- Repeat the OAuth flow
- Select your Search Console property
- Confirm
Step 4: Connect Claude (or Your AI Platform)
This depends on which AI you're using.
For Claude Web:
- Go to claude.ai
- Settings β Developer Tools or Integrations
- Find "MCP Servers"
- Click "Add Custom MCP Server"
- Paste Emilytics' MCP server endpoint
- Authenticate
For Cursor:
- Open Cursor Preferences
- Find "MCP" or "Model Context Protocol"
- Add Emilytics as an MCP server
- Paste the server details
For Other Platforms: If you're using a different AI platform, check their docs for MCP integration. Most major platforms support it now.
Step 5: Test It
Open Claude and type: "How many sessions did I get last week?"
Claude should fetch your data from GA4 and return the answer. If it works, you're done.
Total setup time: 10 minutes
Option 2: Using Anthropic's Official MCP Server (Advanced)
Anthropic maintains official MCP servers for Google Analytics. This is free but requires some technical setup.
Step 1: Install Node.js
The MCP server runs on Node.js. If you don't have it:
- Go to nodejs.org
- Download LTS version
- Install
Step 2: Set Up the GA4 MCP Server
Create a directory for your MCP setup:
mkdir mcp-analytics
cd mcp-analytics
Install the official GA4 MCP server:
npm install @anthropic-ai/ga4-mcp
Step 3: Create a Config File
Create a file called .env:
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=http://localhost:3000/oauth/callback
(Get these from Google Cloud Console)
Step 4: Authenticate with Google
Run the server:
npm start
The server will prompt you to authenticate with Google OAuth. Complete the flow. The server saves your credentials.
Step 5: Connect to Claude
Add the MCP server to your Claude settings:
For Cursor:
[mcp_servers.ga4]
command = "node"
args = ["path/to/ga4-mcp-server/index.js"]
For Claude Web: Go to Settings β Developer Tools β Add MCP Server β Point to localhost
Step 6: Test It
Open Claude: "What are my top 5 pages?"
Claude queries your GA4 data via MCP.
Total setup time: 20β30 minutes (first time)
What You Can Query Now
After setup, you can ask Claude:
Traffic & Users:
- "How many sessions did I get last week?"
- "Which countries drive the most traffic?"
- "What's my user growth rate this month?"
Conversions:
- "What's my conversion rate by traffic source?"
- "Which landing pages convert best?"
Keywords:
- "What are my top 10 keywords from organic search?"
- "Which pages drive the most organic traffic?"
- "Are any of my rankings declining?"
Comparisons:
- "How does this month compare to last month?"
- "Show me week-over-week growth rates"
Anomalies:
- "Did anything unusual happen to my traffic?"
- "Why did bounce rate spike Thursday?"
Claude handles all of these instantly.
Troubleshooting Common Issues
"Claude can't find the MCP server"
- Verify the server is running
- Check the endpoint URL is correct
- Verify OAuth tokens are valid
- Restart Claude/Cursor
"Permission denied when accessing GA4"
- Verify you authorized with the correct Google account
- Check that account has GA4 access
- Re-authenticate (delete cached tokens and re-authorize)
"Data doesn't match my dashboard"
- Verify you selected the correct GA4 property
- Check the date range in your question matches what you expect
- GA4 data takes 24β48 hours to fully process; very recent data might be delayed
"Rate limit errors"
- Google has API quotas (typically 100k requests per day)
- If you're making 1,000+ queries per hour, you might hit this
- Wait an hour or increase your quota in Google Cloud Console
"Port 3000 already in use" (if running locally)
- Change the port in your config
- Or stop whatever else is using port 3000
Security Notes
Data Protection:
- MCP servers only have read-only access to your analytics
- Your credentials are stored securely (usually encrypted)
- Data is fetched on-demand; nothing is cached
Best Practices:
- Use Google OAuth, not API keys
- Set up a service account if you need multiple MCP servers
- Rotate credentials every 90 days if they're shared
For Emilytics specifically:
- All data is encrypted in transit
- Tokens are stored securely
- You can revoke access anytime in Google settings
What Data Is Actually Accessible?
Your MCP server can access:
From GA4:
- Audience data (users, sessions, demographics)
- Event data (custom events you've tracked)
- Goal conversion data
- Traffic source breakdown
- Device/browser data
- Geo data
- Landing page and exit page data
From Search Console:
- Search queries and their performance
- Click-through rates
- Impressions
- Average position
- Search appearance data
- Landing pages from organic search
What It CAN'T access:
- User IDs or personally identifiable information
- Deleted data
- Data you haven't shared (private properties)
- Adsense or other third-party integrations
The MCP server respects all your privacy settings.
Advanced: Custom MCP Server for Your Needs
If you need more than GA4/GSC, you can build a custom MCP server.
This is for developers, but it's doable:
// Simple MCP server example
class AnalyticsMCPServer {
async query_ga4(params) {
// Connect to your GA4 API
// Return results
}
async get_top_pages(limit) {
// Custom logic to fetch top pages
}
async compare_periods(metric, period1, period2) {
// Compare two date ranges
}
}
Custom servers let you:
- Add proprietary data sources
- Create custom queries
- Build domain-specific tools
But for most use cases, Emilytics + Claude is enough.
The Real Power: Integration
Once MCP is set up, you can:
- Ask Claude questions about your data in any Claude interface (web, Cursor, API)
- Build workflows that combine AI analysis with data queries
- Automate reports by having Claude generate them
- Integrate analytics into your development workflow
Example: Developer in Cursor wants to check traffic impact before merging a change.
Developer: "Has traffic changed since last deploy?"
Claude (via MCP): Fetches traffic data, compares to previous deploy
Claude: "Traffic is up 8% since last deploy. Good sign."
Developer: Merges with confidence
That's the power of AI + MCP.
Next Steps
- Choose your setup: Emilytics (easier) or Anthropic's official MCP (more control)
- Follow the steps above to authenticate
- Test with a simple question to verify it works
- Start asking real questions about your data
- Share with your team so they can use it too
For how to use Claude + GA4 effectively, read about Claude + GA4.
For understanding what MCP is conceptually, read about Model Context Protocol.
The Bottom Line
MCP is the bridge between AI and your analytics. Set it up once, then never think about it again. Just ask questions.
10 minutes to setup. Unlimited insight after.
Emily Redmond is a data analyst at Emilytics β the AI analytics agent watching your GA4, Search Console, and Bing data around the clock. 8 years experience. Say hi β