AI Optimization Agency Springville, Utah

How to Set Up Google Analytics & Search Console MCP Servers

A Step-by-Step Guide to Connecting Claude AI to Your Marketing Data

What if you could ask Claude to analyze your website traffic, find your top-performing pages, or spot SEO opportunities? No exports. No spreadsheets. Just a conversation.

MCP servers make this possible. MCP (Model Context Protocol) is Anthropic's open standard that connects Claude Desktop directly to external tools and data sources. You ask Claude a question about your analytics, and it pulls the data live. I set this up for myself last month and honestly? It changed how I do reporting.

This guide walks you through setting up two MCP servers that every marketer should have: Google Analytics 4 and Google Search Console. When you're done, you'll be able to have conversations like:

  • "What were my top 10 landing pages last month?"
  • "Which queries are driving the most impressions but have low CTR?"
  • "Compare my organic traffic this month vs. last month"
  • "What pages should I optimize based on Search Console data?"

Let's get started.

Before You Begin

This guide assumes you're comfortable opening a terminal. If that sounds scary, don't worry. Every command is copy/paste ready, and I'll explain what each step does.

Prerequisites Checklist

  • Claude Desktop installed on your Mac or Windows computer (download here)
  • Google Cloud Console access (free tier works fine)
  • Python 3.10+ installed on your system
  • Admin access to a Google Analytics 4 property
  • Owner or Full access to a Google Search Console property

Note: If you're not sure whether Python is installed, open Terminal (Mac) or Command Prompt (Windows) and type python3 --version. You should see something like "Python 3.11.4". If not, download Python here.

Part 1: Setting Up Google Cloud (Required for Both)

Both MCP servers need access to Google's APIs. That means creating a Google Cloud project and service account. Sounds complicated, but it's a one-time setup. About 10 minutes.

Step 1: Create a Google Cloud Project

  1. Go to Google Cloud Console
  2. Click the project dropdown at the top of the page
  3. Click "New Project"
  4. Name it something memorable like "Claude MCP Servers"
  5. Click "Create" and wait for it to finish
  6. Make sure your new project is selected in the dropdown

Step 2: Enable the Required APIs

We need to enable three APIs. For each one:

  1. Go to APIs & Services → Library in the left sidebar
  2. Search for the API name
  3. Click on it and hit "Enable"

Enable these three APIs:

  • Google Analytics Admin API
  • Google Analytics Data API
  • Google Search Console API

Step 3: Create a Service Account

  1. Go to APIs & Services → Credentials
  2. Click "Create Credentials" → "Service Account"
  3. Name it "claude-mcp-access" (or similar)
  4. Click "Create and Continue"
  5. Skip the optional permissions steps — just click "Done"

Step 4: Download the JSON Key

  1. In the Credentials page, find your new service account
  2. Click on the service account email
  3. Go to the "Keys" tab
  4. Click "Add Key" → "Create new key"
  5. Select "JSON" and click "Create"
  6. A JSON file will download — keep this safe!

Move this file somewhere permanent. We recommend:

Mac/Linux
mkdir -p ~/.config/mcp-credentials mv ~/Downloads/your-project-*.json ~/.config/mcp-credentials/google-credentials.json
Windows (PowerShell)
mkdir "$env:USERPROFILE\.config\mcp-credentials" -Force mv "$env:USERPROFILE\Downloads\your-project-*.json" "$env:USERPROFILE\.config\mcp-credentials\google-credentials.json"

Important: Copy the service account email address (looks like claude-mcp-access@your-project.iam.gserviceaccount.com). You'll need it in the next steps to grant access to your GA4 and Search Console properties.

Part 2: Google Analytics 4 MCP Server

We'll use the mcp-server-ga4 package by harshfolio. It's the simplest GA4 MCP server I've found.

Step 1: Grant Access in Google Analytics

  1. Go to Google Analytics
  2. Select your property
  3. Click the gear icon (Admin) in the bottom left
  4. Under "Property", click "Property Access Management"
  5. Click the "+" button → "Add users"
  6. Paste your service account email
  7. Select "Viewer" role (that's all it needs)
  8. Click "Add"

Step 2: Find Your GA4 Property ID

While you're in GA4 Admin:

  1. Click "Property Settings" under the Property column
  2. Look for "Property ID" at the top — it's a number like 123456789
  3. Copy this number — you'll need it for the config

Step 3: Install the MCP Server

Open Terminal (Mac) or Command Prompt (Windows) and run:

pip install mcp-server-ga4

If you get a permissions error, try:

pip install --user mcp-server-ga4

Step 4: Configure Claude Desktop

Now we need to tell Claude Desktop about the MCP server. Open your Claude Desktop config file:

Mac
open ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows
notepad "$env:APPDATA\Claude\claude_desktop_config.json"

If the file doesn't exist, create it. Add or update the contents to include:

{ "mcpServers": { "google-analytics": { "command": "mcp-server-ga4", "args": ["--property-id", "YOUR_PROPERTY_ID"], "env": { "GOOGLE_APPLICATION_CREDENTIALS": "/Users/YOURUSERNAME/.config/mcp-credentials/google-credentials.json" } } } }

Replace:

  • YOUR_PROPERTY_ID with your GA4 property ID (the number from Step 2)
  • /Users/YOURUSERNAME/ with your actual home directory path

Step 5: Restart Claude Desktop

Completely quit Claude Desktop (not just close the window) and reopen it. You should see a small hammer icon indicating MCP servers are connected.

Step 6: Test It!

Try asking Claude:

  • "What were my top 10 pages by pageviews in the last 7 days?"
  • "Show me my traffic sources for last month"
  • "What's my bounce rate trend over the past 30 days?"

Part 3: Google Search Console MCP Server

For Search Console, we'll use mcp-gsc by AminForou. It's the most popular GSC server (130+ GitHub stars) and the documentation is solid.

Step 1: Grant Access in Search Console

  1. Go to Google Search Console
  2. Select your property
  3. Click "Settings" in the left sidebar
  4. Click "Users and permissions"
  5. Click "Add user"
  6. Paste your service account email
  7. Select "Full" permission
  8. Click "Add"

Step 2: Clone and Set Up the Repository

Open Terminal and run these commands:

# Navigate to where you want to store MCP servers cd ~/Documents # Clone the repository git clone https://github.com/AminForou/mcp-gsc.git # Enter the directory cd mcp-gsc # Create a virtual environment python3 -m venv .venv # Activate it (Mac/Linux) source .venv/bin/activate # Or on Windows: # .venv\Scripts\activate # Install dependencies pip install -r requirements.txt

Step 3: Configure the Server

Copy your Google credentials file to the mcp-gsc folder:

cp ~/.config/mcp-credentials/google-credentials.json ~/Documents/mcp-gsc/service_account_credentials.json

Step 4: Update Claude Desktop Config

Open your Claude Desktop config file again and add the GSC server. Your file should now look like this:

{ "mcpServers": { "google-analytics": { "command": "mcp-server-ga4", "args": ["--property-id", "YOUR_PROPERTY_ID"], "env": { "GOOGLE_APPLICATION_CREDENTIALS": "/Users/YOURUSERNAME/.config/mcp-credentials/google-credentials.json" } }, "google-search-console": { "command": "/Users/YOURUSERNAME/Documents/mcp-gsc/.venv/bin/python", "args": ["/Users/YOURUSERNAME/Documents/mcp-gsc/src/mcp_gsc/server.py"], "env": { "GSC_CREDENTIALS_PATH": "/Users/YOURUSERNAME/Documents/mcp-gsc/service_account_credentials.json" } } } }

Replace /Users/YOURUSERNAME/ with your actual home directory path throughout.

Step 5: Restart and Test

Restart Claude Desktop again. Now try:

  • "What are my top 10 queries by clicks in Search Console?"
  • "Which pages have the highest impressions but lowest CTR?"
  • "Show me queries where I rank between positions 5-15"

Troubleshooting Common Issues

"Permission Denied" Errors

This usually means the service account doesn't have access to your property. Double-check that:

  • You added the correct service account email (not your personal email)
  • You granted at least "Viewer" role in GA4 or "Full" in GSC
  • You're using the right property — make sure it matches what you configured

"API Not Enabled" Errors

Go back to Google Cloud Console and verify all three APIs are enabled:

  • Google Analytics Admin API
  • Google Analytics Data API
  • Google Search Console API

MCP Server Not Showing in Claude

  • Make sure your config file is valid JSON (no trailing commas!)
  • Check that all file paths in the config actually exist
  • Completely quit and restart Claude Desktop (not just close the window)
  • On Mac, you can check logs at ~/Library/Logs/Claude/

"Module Not Found" Errors

If Python can't find the MCP server:

  • Make sure you installed it with the same Python that Claude is using
  • Try using the full path to the Python executable in your config
  • For GSC, make sure the virtual environment is set up correctly

What You Can Do Now

Both servers are connected. Now the fun part. Here are some prompts to try:

Google Analytics Prompts

  • "What's my traffic trend over the last 30 days? Show me a breakdown by source."
  • "Which landing pages have the highest bounce rate?"
  • "Compare mobile vs desktop traffic for the past week"
  • "What are my top converting pages?"

Search Console Prompts

  • "Find queries where I'm ranking on page 2 that might be easy wins"
  • "What new queries appeared in the last 7 days?"
  • "Which pages lost the most clicks compared to last month?"
  • "Show me branded vs non-branded query performance"

Combined Analysis

  • "Compare my Search Console impressions data with my GA4 organic traffic — are there discrepancies?"
  • "What pages get good search traffic but have high bounce rates?"
  • "Identify content gaps: queries with high impressions but no dedicated landing page"

The best part? You can ask follow-up questions. "Why did traffic drop on Tuesday?" "Which of these pages should I prioritize?" It's like having a data analyst who never gets tired of your questions.

Next Steps

You now have Claude connected to your two most important data sources. And frankly, the MCP ecosystem is growing fast. There are already servers for CRMs, email platforms, social media, and more.

A few ideas for what to do next:

  • Weekly check-ins: I ask Claude to summarize my key metrics every Monday morning. Takes 30 seconds.
  • Custom reports: Have Claude pull exactly the data you need, formatted how you want it
  • Spot patterns: Ask questions you'd never bother running manually. "What days do I get the most traffic?" "Which posts are underperforming?"
  • Try more servers: The MCP servers directory has integrations for Slack, GitHub, databases, and more

Here's what I've noticed: once you start asking your data questions in plain English, you ask more questions. You get curious. And that curiosity is where the good insights hide.

Want Help Getting More From Your Data?

Setting up MCP servers is just the start. The real value comes from knowing what questions to ask and how to act on the insights.

We help businesses turn their marketing data into actionable strategies — whether that's optimizing for AI visibility, improving conversion rates, or finding untapped opportunities.

Let's Talk About Your Data

Quick reply guaranteed. No pushy sales calls.