How to connect Google Search Console to Claude Code

 

Google Search Console is notoriously hard to analyse. It’s always full of false positives and it’s easy to miss an actually important issue. So I was genuinely excited to be able to connect it to my Claude Code. But there was no official MCP and the community MCPs I could find were either lacking functionality or I did not trust them enough to install them on my machine. So this is what I did instead to connect GSC to Claude Code and let it build its own small MCP.

The same method should work with Codex or any other AI agent:

Step 1: Enable the Search Console API

Open the Google Cloud Console and create a project using the selector in the top bar. Name it something you will recognise in a year, like “search-console-mcp”.

Then go to APIs and services → Library, search for Google Search Console API, and click Enable.

The Cloud Console API Library search results for "Google Search Console API", returning a single public result card

Step 2: Create a service account

A service account is a robot user with its own email address and a permanent key file. We pick this form of authentication because it works without a browser window and without a token that expires every week.

In APIs and services → Credentials, choose Create credentials → Service account.

The Credentials page with the Create credentials menu open, showing API key, OAuth client ID and Service account options

Give it a name like “gsc-reader”. Google generates an email address from it, ending in .iam.gserviceaccount.com. Copy that address.

The Create service account form filled in with the name gsc-reader and the generated service account email address below it

The wizard then offers to grant the account a role on the project. Skip it. Those roles control other Google Cloud resources, which does not apply to GSC.

Finishing the wizard drops you back on the Credentials page. Scroll to the Service accounts table at the bottom and click the account’s email address to open the account settings. You should see a page with tabs along the top: Details, Permissions, Keys, Metrics, Logs. Open Keys and choose Add key → Create new key → JSON → Create.

The Keys tab of the gsc-reader service account with the Create private key dialog open and the JSON key type selected

If Add key is greyed out, your account is on a Google Workspace organisation that blocks service account keys by policy, and you will need whoever administers it to allow them for this project.

The JSON file downloads. Move it out of your Downloads folder to somewhere safe; for use with Claude Code, that would be ~/.config/gsc/gsc-key.json. Keep this file private, because anyone holding it could read your Search Console data.

Step 3: Add the email to your property

Now you will need to switch to Search Console, navigate to Settings → Users and permissions, which offers an Add user button. Click that button, then pick Full in the permissions dropdown.

The Search Console Add user dialog with the service account address pasted in and the permission set to Full

Step 4: Let Claude Code build the connection

Claude Code talks to outside systems through MCP servers, which are small programs that expose a set of tools it can call. For Search Console, that is around a hundred lines of Node.js.

You do not have to write them, nor download them from anywhere. Just give Claude Code this prompt, with your own property address substituted:

Build an MCP server for the Google Search Console API and register it with Claude Code.

- Auth: service account key at ~/.config/gsc/gsc-key.json
- Scope: https://www.googleapis.com/auth/webmasters.readonly
- My property is https://example.com/ (URL prefix)
- Tools: list the properties the account can see; clicks, impressions, CTR and
  average position per page over the last N days; index coverage status for a
  list of URLs via the URL Inspection API
- Pace the inspection calls to stay under 600 per minute
- Turn 401, 403 and 404 errors into a sentence naming the likely fix rather
  than a stack trace
- Install it in ~/.local/share/gsc-mcp/ and register it at user scope with
  claude mcp add

 

Two important details:

  1. The .readonly scope produces a connection that physically cannot change anything on your property, which is what most people want.
  2. And the property address has to match Google exactly, including the trailing slash, or sc-domain:example.com if you have a domain property rather than a URL prefix.

When it finishes, restart Claude Code and run /mcp. The server should be listed as connected.

The Claude Code MCP servers panel showing the gsc server marked Connected, with its tools listed underneath: gsc_list_sites, gsc_inspect_urls, gsc_search_analytics_pages, gsc_list_sitemaps and gsc_submit_sitemaps

 

Keep in mind that data runs two or three days behind, both in the API and in the regular interface. URL inspection is capped at 2,000 URLs per day, which is plenty for a normal site and easy to burn through by looping over a large sitemap.


Sources:

Jan Cerny, founder of JCweb.TECH
by Jan Cerny
I have worked with WordPress websites for over 10 years, focusing on security, scalability, and integrations with other systems. I focus on closing the bridge between technology and real world website needs.
Share this post

Related posts

view all