Developer

Google Analytics & Search Console MCP Setup Guide

Step-by-step guide to setting up Google Analytics MCP and Google Search Console MCP. Connect GA4 and GSC to Claude, Cursor, and OpenClaw in 20 minutes.

๐Ÿ•Last updated 4 March 2026

โšก TL;DR

You can connect both Google Analytics 4 and Google Search Console to Claude, Cursor, or OpenClaw using free, open-source MCP servers. The setup takes about 20 minutes and requires a Google Cloud service account. Once connected, you can query your site's traffic, keyword rankings, and SEO opportunities in plain English โ€” no more CSV exports.

I needed to give my AI agent access to our web analytics without manually exporting spreadsheets every time I wanted to answer a basic question like "which pages lost traffic this month?" Turns out there are solid open-source MCP servers for both GA4 and Google Search Console โ€” and once you've wired them up, the workflow genuinely changes. This guide walks through exactly how to do it.

What You'll Need

  • A Google account with access to GA4 and/or Google Search Console
  • A Google Cloud project (free tier is fine)
  • Python 3.10+ installed on your machine
  • An MCP-compatible client: Claude Desktop, Claude Code, Cursor, or OpenClaw
  • About 20โ€“30 minutes

Heads up: You'll need real credentials to pull live data. The MCP servers themselves are free and open-source, but GA4 and GSC data lives behind Google's APIs โ€” which require auth. This guide covers the full setup from scratch.

Part 1: Understanding GA4 MCP and GSC MCP

An MCP server is a small background process that sits between your AI client and an external data source. When you ask Claude "what were my top pages last week?", Claude doesn't scrape the Google Analytics UI โ€” it calls an MCP tool that makes an authenticated API request and returns structured data.

The GA4 MCP gives your AI agent access to the Google Analytics Data API. That means you can query dimensions, metrics, date ranges, segments โ€” the same data available in the GA4 interface, but through natural language. The best server currently is surendranb/google-analytics-mcp, which supports 200+ GA4 dimensions and metrics.

The GSC MCP connects to the Google Search Console API. It surfaces search analytics โ€” queries, impressions, clicks, CTR, average position โ€” along with URL inspection, sitemap status, and indexing data. The most capable server is AminForou/mcp-gsc with 460+ GitHub stars and 19 tools.

Together, they unlock something the individual dashboards don't: cross-referencing organic search performance with on-site behavior. Ask things like "show me pages with high impressions but low engagement" and your agent can correlate GSC click data with GA4 session data in a single response.

The MCP Servers to Use

GA4: google-analytics-mcp by surendranb

โญ 185 starsgithub.com/surendranb/google-analytics-mcpPython • MIT License

This is the most complete GA4 MCP server available. It supports 200+ dimensions and metrics from the Google Analytics Data API v1, including:

  • Traffic sources (sessions by channel, medium, source)
  • Page performance (pageviews, engagement rate, bounce rate)
  • User behavior (new vs returning, device, geography)
  • Conversion data (events, goals, e-commerce)
  • Date comparisons and custom date ranges

Install via pip:

pip install google-analytics-mcp

MCP config block (Python 3):

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "python3",
      "args": ["-m", "ga4_mcp_server"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account-key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

GSC: mcp-gsc by AminForou

โญ 460 starsgithub.com/AminForou/mcp-gscPython • MIT License

The community favourite for GSC integration. Supports both OAuth (great for personal use) and service accounts (better for automation). Tools include:

  • list_properties โ€” see all your GSC-verified sites
  • get_search_analytics โ€” queries, impressions, clicks, CTR, position
  • get_performance_overview โ€” high-level summary for any date range
  • check_indexing_issues โ€” find pages with crawl/index problems
  • inspect_url_enhanced โ€” detailed URL inspection
  • get_sitemaps / submit_sitemap โ€” sitemap management

MCP config block (service account, after cloning repo):

{
  "mcpServers": {
    "gsc": {
      "command": "/path/to/mcp-gsc/.venv/bin/python",
      "args": ["/path/to/mcp-gsc/server.py"],
      "env": {
        "GSC_CREDENTIALS_PATH": "/path/to/service_account_credentials.json"
      }
    }
  }
}

Bonus: search-console-mcp (GSC + GA4 + Bing in one)

โญ 35 starsgithub.com/saurabhsharma2u/search-console-mcpNode.js • npm: search-console-mcp

If you want all three platforms in one server, this is worth considering. It combines GSC, Google Analytics 4, and Bing Webmaster Tools, with built-in "opportunity matrix" analysis and anomaly detection. It's more opinionated โ€” the server handles the complex SEO math so your AI gets curated insights rather than raw data.

{
  "mcpServers": {
    "search-console-mcp": {
      "command": "npx",
      "args": ["-y", "search-console-mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/credentials.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

Step-by-Step Setup: GA4 MCP

Step 1: Create a Google Cloud Project

  1. Go to console.cloud.google.com
  2. Click the project dropdown at the top โ†’ New Project
  3. Give it a name (e.g., "my-mcp-analytics") and click Create

If you already have a project you want to use, just select it. No need to create a new one.

Step 2: Enable the GA Data API

  1. In the left sidebar, go to APIs & Services โ†’ Library
  2. Search for "Google Analytics Data API"
  3. Click it โ†’ Enable

Pro tip: While you're here, also enable the Google Search Console API if you're setting up GSC in the same project.

Step 3: Create a Service Account

  1. Go to APIs & Services โ†’ Credentials
  2. Click Create Credentials โ†’ Service Account
  3. Name it something memorable (e.g., "mcp-analytics-reader")
  4. Click Create and Continue
  5. Skip the role assignment (you'll add access in GA4 directly) โ†’ Done

Step 4: Download the JSON Key

  1. Click your new service account in the list
  2. Go to the Keys tab
  3. Click Add Key โ†’ Create New Key โ†’ JSON โ†’ Create
  4. A JSON file downloads automatically โ€” save it somewhere safe (e.g., ~/.config/gcp/mcp-analytics-key.json)

Heads up: This file contains credentials. Don't commit it to git. Add it to your .gitignore if your config files live in a repo.

Step 5: Grant Service Account Access to GA4

  1. Open the JSON key file and find the client_email field โ€” it looks like [email protected]
  2. Go to analytics.google.com
  3. Select your GA4 property โ†’ Admin (gear icon)
  4. Under Property โ†’ Property access management
  5. Click + โ†’ Add users, paste the service account email, set role to Viewer, click Add

Also grab your Property ID: Admin โ†’ Property Details โ†’ numeric ID (like 123456789). This is different from the Measurement ID that starts with G-.

Step 6: Install and Configure the MCP Server

pip install google-analytics-mcp

Then add to your config file:

Claude Desktop โ€” Mac (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "python3",
      "args": ["-m", "ga4_mcp_server"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/Users/yourname/.config/gcp/mcp-analytics-key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

Claude Desktop โ€” Windows (%APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "python",
      "args": ["-m", "ga4_mcp_server"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "C:\\Users\\yourname\\.config\\gcp\\mcp-analytics-key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

Claude Code (run in terminal):

claude mcp add ga4-analytics -- python3 -m ga4_mcp_server

Then set the env vars in your project's .mcp.json.

Cursor (~/.cursor/mcp.json or project-level .cursor/mcp.json):

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "python3",
      "args": ["-m", "ga4_mcp_server"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    }
  }
}

Restart your AI client after saving the config. If it worked, you'll see "ga4-analytics" listed in the connected tools.

Step-by-Step Setup: GSC MCP

Step 1: Enable the Search Console API

If you didn't enable it earlier:

  1. In Google Cloud Console โ†’ APIs & Services โ†’ Library
  2. Search "Google Search Console API" โ†’ Enable

Step 2: Grant Service Account Access to GSC

You can reuse the same service account from the GA4 setup โ€” just add it to GSC too:

  1. Go to search.google.com/search-console
  2. Select your property โ†’ Settings โ†’ Users and permissions
  3. Click Add User, paste the service account email, set to Full (needed for URL inspection), click Add

Step 3: Clone and Install the GSC MCP Server

git clone https://github.com/AminForou/mcp-gsc.git
cd mcp-gsc
python3 -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt

Step 4: Add GSC Config to Your AI Client

Add alongside your existing GA4 entry (both can live in the same mcpServers block):

{
  "mcpServers": {
    "ga4-analytics": {
      "command": "python3",
      "args": ["-m", "ga4_mcp_server"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/key.json",
        "GA4_PROPERTY_ID": "123456789"
      }
    },
    "gsc": {
      "command": "/path/to/mcp-gsc/.venv/bin/python",
      "args": ["/path/to/mcp-gsc/server.py"],
      "env": {
        "GSC_CREDENTIALS_PATH": "/path/to/key.json"
      }
    }
  }
}

Note that both servers can use the same JSON key file โ€” you just reference it in both env blocks.

Top Skills to Pair with GA + GSC

Once you've got live analytics data flowing, these TrustedSkills skills pair really well:

๐ŸŽฏ SEO EEAT Checker

Audits your content for Google's E-E-A-T signals. Once GSC MCP shows you which pages are underperforming in rankings, the EEAT Checker can identify exactly what trust signals are missing โ€” author bios, dates, expertise signals.

๐Ÿ•ท๏ธ Decodo Scraper

When GA4 + GSC tells you a competitor is outranking you for a keyword, Decodo lets your agent scrape and analyze what they're doing differently. Pair it with GSC data for gap analysis.

๐Ÿ” Agent Deep Research

Uses Gemini's grounding capabilities to research topics at depth. Feed it your GSC "impressions without clicks" list and it can research what intent signals are driving those queries.

๐Ÿ’ป Code Runner

Run Python or JavaScript analytics scripts on the data your AI agent fetches. Useful for custom aggregations, visualizations, or exporting processed data to CSV or JSON.

โœ๏ธ Content Humanizer

After GSC surfaces pages with low CTR, your agent can rewrite meta descriptions and title tags. Content Humanizer ensures those rewrites don't sound like AI-generated text.

New Property Setup Checklist

Setting up MCP for a new site? Run through this checklist to make sure everything's connected before you start querying:

  • Create GA4 property in Google Analytics
  • Add tracking code (gtag.js or GTM) to your site
  • Verify GSC ownership (HTML file, DNS TXT record, or existing GA tag)
  • Link GA4 to GSC in GA4 Admin โ†’ Product Linking โ†’ Search Console
  • Create Google Cloud project and enable GA Data API + Search Console API
  • Create service account and download JSON key
  • Grant service account Viewer access in GA4 property
  • Grant service account Full access in GSC property
  • Install google-analytics-mcp via pip
  • Clone AminForou/mcp-gsc and install dependencies
  • Add both MCP config blocks to your AI client config
  • Restart the AI client
  • Test: ask "list my GSC properties" โ€” should return your site
  • Test: ask "show me top pages by sessions this week" โ€” should return GA4 data

What You Can Do Once Connected

Here are some prompts worth trying right after setup. These aren't hypothetical โ€” they actually work with these MCP servers:

  • "What pages got the most traffic last week?" โ€” GA4 returns pageview data by page path, sorted descending.
  • "Show me which keywords are driving clicks but not ranking in the top 3" โ€” GSC filters by position 4โ€“20, sorted by clicks.
  • "Compare this month vs last month organic traffic" โ€” GA4 date comparison query across sessions from organic search.
  • "Which pages have the highest impressions but lowest CTR?" โ€” GSC query sorted by impressions, filtered by CTR under 2%.
  • "Are there any pages with indexing issues?" โ€” GSC URL inspection across your top pages by traffic.
  • "What's my average position for brand vs non-brand queries?" โ€” GSC with regex filter on your brand name.
  • "Show me my top landing pages and their bounce rates" โ€” GA4 with landingPagePlusQueryString dimension and bounceRate metric.
๐Ÿ”ฌ From the field

I connected GSC MCP to Claude Code and asked it to find pages with more than 500 impressions but less than 2% CTR. It returned 23 pages in seconds โ€” a task that used to take 20 minutes of manual filtering through the Search Console interface, exporting to a spreadsheet, and sorting. The agent then ranked them by "opportunity score" (impressions รท position) and drafted updated meta descriptions for the top five. Total time: about four minutes.

Frequently Asked Questions

Do I need a paid Google account or API plan?

No. Both the Google Analytics Data API and the Search Console API are free, with generous quotas for personal or small-business use. You just need a Google Cloud project โ€” which is free to create. The only cost would be if you're making extremely high query volumes (tens of thousands of requests per day), which is unlikely for typical use.

Can I use the same service account for both GA4 and GSC?

Yes, and that's exactly what I'd recommend. Create one service account, download one JSON key, then grant that service account access to both your GA4 property and your GSC property. Both MCP configs can point to the same key file.

Does this work with Claude Code or just Claude Desktop?

Both โ€” and Cursor too. The MCP config format is essentially the same across Claude Desktop, Claude Code, and Cursor. The file location differs (Claude Desktop uses claude_desktop_config.json, Claude Code uses .mcp.json, Cursor uses mcp.json), but the JSON structure inside is identical.

What if I manage multiple sites or multiple GA4 properties?

The surendranb/google-analytics-mcp server is configured per property (you set a single GA4_PROPERTY_ID). If you have multiple properties, you can either add multiple server entries with different names in your config, or use the search-console-mcp package which supports zero-config multi-account access. The AminForou/mcp-gsc server shows all GSC properties the service account has access to, so you just specify the site URL when querying.

My AI agent returned "no data found" โ€” what's wrong?

The most common causes: (1) the service account hasn't been granted access to the property โ€” double-check in both GA4 and GSC admin; (2) the GA4 property ID is the numeric one (like 123456789), not the measurement ID (G-XXXXXXX); (3) the JSON key file path in your config is wrong or the file doesn't exist at that location; (4) you need to restart your AI client after changing the config. Check the client's MCP logs for specific error messages.

TT

TrustedSkills Team

The TrustedSkills team builds and tests AI agent integrations across Claude, OpenClaw, Cursor, and VS Code. We verify every skill in our registry and have set up hundreds of MCP configs across every major platform.