GA4 + Google Search Console + Bing MCP server (Google Analytics 4, GSC and Bing Webmaster Tools for Claude, Cursor, Claude Code)


Hosted version: don't want to set up Google Cloud, or need it in claude.ai or ChatGPT on the web? Site Insights by KKV Labs is the same idea as a hosted connector: one Google sign-in, many sites, free for 1 site and 20 lookups a day. This repo stays free, MIT and fully usable on its own.
An open-source Model Context Protocol server that lets Claude Desktop, Claude Code, Cursor and any other MCP client answer questions from Google Analytics 4 (GA4), Google Search Console (GSC) and Bing Webmaster Tools in one place. It runs on your machine with your own credentials, asks only for read-only scopes, and joins the sources so you can ask "why did my traffic drop?" or "which platform sent fewer visitors?" in plain English.
- 36 read-only tools, three sources. GA4 sessions, key events and revenue next to GSC clicks, impressions, CTR and position, plus Bing clicks, crawl issues, backlinks and keyword data.
- Answers, not raw dumps. Why traffic dropped (with Google ranking updates in the window), keyword cannibalization, content decay, top movers, unusual days, AI Overview suspects, quick wins with a CTR benchmark, which platform dropped, attribution and funnels are calculated for you.
- Honest dates. Search Console data lags 2 to 3 days, so default ranges end on the last settled day. Every result carries a receipt with the property, dates and source.
- Local and read-only.
analytics.readonly and webmasters.readonly only. Calls go only to Google's APIs and Bing's API, over HTTPS, from your machine. No telemetry.
- Raw access when you need it.
run_ga4_report, batch, pivot and realtime reports, and search_console_query expose the full GA4 Data API and Search Analytics API. Tables can come back as CSV.
Contents
- Quick start
- First 5 questions to ask
- Credentials
- Example questions
- Tools
- Bing Webmaster Tools
- Configuration
- Security
- Troubleshooting
- How it compares
- Need many sites, no Google Cloud setup, claude.ai or ChatGPT on the web?
- Development
Quick start
You need Node.js 20 or newer and Google credentials (3 options below). Try it first with built-in fake data, no credentials needed:
GA4_GSC_MCP_DEMO=1 npx -y ga4-gsc-mcp check
Then let the setup wizard do the rest. It opens each Google Cloud page in order, signs you in once, checks what your credentials can see, and (if you say yes) adds the server to Claude Desktop and Cursor, keeping a backup of each config file:
npx -y ga4-gsc-mcp setup
Already have credentials? Check them:
npx -y ga4-gsc-mcp check
One-click installs: the Cursor and VS Code buttons at the top add the server to those editors. For Claude Desktop, download ga4-gsc-mcp.mcpb and open it (Settings > Extensions). The buttons only add the server; you still sign in once with setup or auth (or pick a service account key in the extension settings).
Claude Code
- Set up credentials.
- Add the server:
claude mcp add ga4-gsc --scope user -- npx -y ga4-gsc-mcp
With a service account, pass the key path: claude mcp add ga4-gsc --scope user -e GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json -- npx -y ga4-gsc-mcp
- Run
/mcp in Claude Code to confirm ga4-gsc is connected, then ask "How is example.com doing this month?"
Claude Desktop
- Set up credentials.
- Open Settings > Developer > Edit Config (
~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows) and add:{
"mcpServers": {
"ga4-gsc": {
"command": "npx",
"args": ["-y", "ga4-gsc-mcp"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/key.json"
}
}
}
}
Leave out the env block if you use gcloud or ga4-gsc-mcp auth credentials.
- Restart Claude Desktop. The tools appear under the tools icon in a new chat.
Cursor
- Set up credentials.
- Add this to
~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):{
"mcpServers": {
"ga4-gsc": {
"command": "npx",
"args": ["-y", "ga4-gsc-mcp"]
}
}
}
- Open Cursor Settings > MCP, check that
ga4-gsc shows a green dot, then ask in Agent mode.
Any other MCP client (Windsurf, VS Code, Cline, Zed, Goose) works the same way: the command is npx -y ga4-gsc-mcp over stdio.
First 5 questions to ask
- "How is example.com doing compared with last month?"
- "Why did my Google traffic drop last month? Was there a Google update?"
- "Give me 10 SEO quick wins with the page to fix for each."
- "Which platform sent fewer visitors this month: Google, Bing, ChatGPT, social or email?"
- "How many visits came from ChatGPT, Perplexity and Claude in the last 90 days, and where did they land?"
More in Example questions.
Credentials
The server looks for credentials in this order and uses the first it finds:
GOOGLE_APPLICATION_CREDENTIALS pointing to a service account key (or any ADC JSON file)
- A login saved by
npx ga4-gsc-mcp auth
- gcloud Application Default Credentials
Whichever you pick, first enable three APIs in a Google Cloud project you own (console, or with gcloud):
gcloud services enable analyticsadmin.googleapis.com analyticsdata.googleapis.com searchconsole.googleapis.com --project=YOUR_PROJECT_ID
These are the Google Analytics Admin API (lists properties), the Google Analytics Data API (reports) and the Google Search Console API (search analytics and URL inspection).
Option A: one-time browser login (recommended)
This is the only option where the saved token holds nothing but the two read-only scopes.
- In Google Cloud > Google Auth Platform (APIs & Services > OAuth consent screen), configure the consent screen as External and add your Google account under Test users (or Internal on Google Workspace).
- Go to Clients (APIs & Services > Credentials) > Create client > Desktop app, then download the JSON.
- Sign in once:
npx -y ga4-gsc-mcp auth --client-secret ~/Downloads/client_secret_XXXX.json
Your browser opens, you approve read-only access, and a refresh token is saved to ~/.config/ga4-gsc-mcp/oauth-token.json (%APPDATA%\ga4-gsc-mcp on Windows) with file mode 600.
While the consent screen is in Testing, Google expires refresh tokens after 7 days. Switch the publishing status to In production to keep the login (unverified apps for your own use show a warning screen you can click through), or run auth again.
Option B: gcloud Application Default Credentials
gcloud's built-in OAuth client is meant for Google Cloud APIs. For other Google APIs such as Analytics and Search Console, Google's gcloud docs say to create your own OAuth client and pass it with --client-id-file (steps 1 and 2 of Option A):
gcloud auth application-default login \
--scopes=https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/webmasters.readonly,https://www.googleapis.com/auth/cloud-platform \
--client-id-file=/path/to/client_secret_XXXX.json
With --client-id-file, the project that owns the OAuth client is used for quota. No environment variables are needed afterwards.
Be aware: gcloud requires the cloud-platform scope in this command, so the Application Default Credentials token it saves also has full access to your Google Cloud projects, and any other tool on your machine that uses ADC gets that access too. This server only calls the read-only Analytics and Search Console APIs with it, but if you do not already use ADC, prefer Option A.
Option C: service account (servers, CI, shared machines)
gcloud iam service-accounts create ga4-gsc-mcp --project=YOUR_PROJECT_ID
gcloud iam service-accounts keys create ~/ga4-gsc-mcp-key.json \
--iam-account=ga4-gsc-mcp@YOUR_PROJECT_ID.iam.gserviceaccount.com
Then give the service account's email (client_email in the key file) access to your data:
- GA4: Admin > Property access management > add the email with the Viewer role.
- Search Console: Settings > Users and permissions > Add user > the email with Restricted permission (enough for the reports this server reads; do not give it Owner). If URL inspection or sitemaps answer with a permission error, raise it to Full, which is still read-only through this server.
Lock the key file down so only your user can read it, then set GOOGLE_APPLICATION_CREDENTIALS=/path/to/ga4-gsc-mcp-key.json in your MCP client config:
chmod 600 ~/ga4-gsc-mcp-key.json
Keep the key file out of git and backups you share. Some organizations block key creation with the iam.disableServiceAccountKeyCreation policy; use Option A or B there.
Example questions
- "How is example.com doing compared with last month?"
- "What are my top 20 Google searches this quarter, and which ones lost clicks?"
- "Which pages get search clicks but few key events in GA4?"
- "Give me 10 SEO quick wins for example.com with the page to fix."
- "What pages lost the most traffic compared with the same period last year?"
- "How many visits came from ChatGPT, Perplexity, Claude, Gemini and Copilot in the last 90 days, and where did they land?"
- "Sessions by country and device for October." (uses
run_ga4_report)
- "Search Console clicks by day for /pricing in the last 28 days." (uses
search_console_query)
- "Is https://example.com/blog/new-post indexed?"
- "Why did my Google traffic drop last month? Was there a Google update?"
- "Which of my pages compete for the same keywords?"
- "Which pages have been slowly losing clicks for three months?"
- "Which platform sent fewer visitors this month: Google, Bing, ChatGPT, social or email?"
- "Which channels bring the most conversions and revenue, first touch?"
- "Where do visitors drop off between the pricing page and the sign-up event?"
- "How fast is my home page on mobile? What are the Core Web Vitals?"
- "Top Bing searches and crawl errors for example.com." (needs a Bing key)
Tools
All tools are read-only (readOnlyHint: true) and return JSON that starts with a receipt: the GA4 property, the Search Console site, the exact dates, the comparison range and any caveats.
Overview and search (GSC)