< Back to Blog

Connect Google Search Console to Claude Code with an MCP Server

A step-by-step guide to building a lightweight MCP server that lets Claude Code read your Google Search Console data directly. No more copy-pasting analytics into chat.

Connect Google Search Console to Claude Code with an MCP Server

I used to pull Google Search Console data by running a Python script, copying the JSON output, and pasting it into Claude Code. It worked, but it was brittle. The script broke when tokens expired. Context windows filled with raw API dumps. And every time I wanted a different cut of the data, I was back in the terminal editing query parameters.

There is a better way. An MCP server turns GSC into a native tool that Claude can call on demand, with structured inputs and clean outputs. You ask for last week's non-branded keywords. You get a table. No paste. No context bloat.

Here is exactly how to build it.

What You Need

If you have already connected GA4 or Google Calendar to Claude through an MCP, you already have the Cloud project. You just need to add the Search Console API and request a new refresh token with the right scope.

Quick Start Prompt

Once your MCP server is connected, copy and paste this into Claude Code:

Pull a Google Search Console performance report for [your-domain.com] over the last 28 days. Show me total clicks, impressions, CTR, and average position compared to the previous 28-day period. Then list the top 25 non-branded queries driving traffic, flag any pages ranking 8-20 with high impressions as near-page-1 opportunities, and highlight any queries with CTR under 1% that need title or meta description work.

Claude will call gsc_search_analytics with the right parameters, compare the two periods, and surface actionable opportunities. No script writing. No JSON parsing. Just a report.

Step 1: Get a Refresh Token

The Search Console API uses a separate OAuth scope from Analytics or Calendar. You need webmasters.readonly.

The fastest way is a small Python script that walks you through the browser flow:

Save that refresh token. You will not need to run this again. The MCP server exchanges it for an access token automatically.

Step 2: The Server

Create a new directory and initialize a Node project:

Create index.ts:

Compile and run:

Or add a build script to package.json and run npm run build.

Step 3: Wire It Into Claude Code

Add a block to your .mcp.json (or Claude Desktop config):

Use the absolute path. Relative paths break when Claude Code launches the server from different working directories.

Download the Skill

If you want Claude to run this workflow automatically - with the date math, opportunity flagging, and formatted report built in - you can add a skill file to your Claude Code workspace.

> Download the GSC Report Skill

Save it to .claude/skills/gsc-report/SKILL.md in your project. The skill has no hardcoded domains or credentials. It reads your property configs and handles the report logic so you can just type /gsc-report or ask for a GSC check by domain name.

What You Get

Once connected, your conversation changes. Instead of asking Claude to write you a Python script to pull GSC data, you ask for the data directly:

  • "Show me the last 28 days of search performance for echalupa.com"
  • "What non-branded queries drove impressions last week?"
  • "Is my pricing page indexed?"

Claude calls the tool, receives structured JSON, and formats it into a readable report. Here is what that looks like with generic data: