Connecting Search Console to our AI workflow: an MCP setup log
Connecting Search Console to Claude Code with mcp-gsc: keeping credentials out of git, choosing a scope, and a loading trap that looks like a failed install.
Kai Wu
• Founder, Kaiwu TechEngineeringPublished Aug 3, 20264 min read
First, why we connected it. We recently shipped a round of SEO changes to our website: rebuilt internal links, rewrote the titles of our commercial pages and split up the solutions pages. All of it went live, but one awkward fact remained: measurement still amounted to "open the Search Console dashboard when we have time."
Optimization without measurement is a one-off guess. So we connected Search Console directly to the AI development environment we use every day. The AI changes the site structure, then pulls the data itself to check the effect, all in one loop.
Setup: one open-source MCP server is enough
We used the open-source mcp-gsc (MCP is the protocol standard that lets AI tools connect to external services). Three steps:
- In Google Cloud Console, enable the Search Console API, create a desktop OAuth credential and download the JSON
- Install uv (a Python toolchain, used to run the server)
- Register the server in Claude Code, with an environment variable pointing to the credential file path
The first call opens a browser for OAuth authorization. After that you can just ask: how many impressions in the last 28 days, which queries rank, whether the sitemap is healthy, which pages are not indexed yet. The whole setup took under half an hour. Compared with opening the dashboard, taking screenshots and pasting numbers by hand every time, it paid for itself within a week.
A note on the choice of tool: there are commercial platforms that integrate all kinds of data sources, but for a one-person company or a small team, a single-purpose open-source server is enough. No monthly fee, no features you do not need, and the credentials and data flow all stay on your own machine.
Credential discipline: two easy holes to fall into
Hole one: pasting credentials into the chat. The OAuth JSON contains a client secret, and pasting it into the chat leaves it in the conversation history. The right approach is to give the AI the file path and let it read the file. When we checked the credential format, we printed only the field names, never the values.
Hole two: the wrong scope puts the credential path under version control. MCP server registration is layered. Project scope creates a config file in the project directory that git tracks, and that is how your credential file path ends up pushed to GitHub. We chose local scope: the config is written to the user's home directory and applies only to this project, so the repo stays clean. After setup, git status must be clean. If it is not, you have fallen into this hole.
Trap: "Connected" does not mean the tools are loaded
After setup, the health check showed Connected, but the AI could not call a single GSC tool. It looked like a failed install. It was not.
When you add an MCP server partway through a session, its tools only load once you start a new session. Connected means the server is running, not that its tools are attached to the current conversation. Knowing this saves half an hour of pointless reinstalling.
First thing after connecting: record a baseline
Once the tools worked, the first step was not analysis but saving a snapshot: we recorded the current 28 days of impressions, clicks, average position, and the performance of each query and page in the project records. The effect of a change has to be judged as before versus after. Without a baseline, two weeks from now you will have a number with no control group.
We also cleaned up a leftover: Search Console still listed a sitemap from 2025, left over from the site's WordPress days (the full account of that migration is in moving a website without losing rankings (in Chinese)). We removed it from the dashboard.
Put measurement into the workflow and optimization becomes a loop. Otherwise every change is a single shot, and whether it lands is a matter of faith.
This order (connect the data, set a baseline, then talk about optimization) follows the same logic as the ad data integrations we build for clients (see our case studies).
Three self-checks before you connect a data source
- Where is your credential file right now? Inside the project directory, tracked by git, or ever pasted into a chat: all three count as potential leaks.
- Which of your AI tool settings end up in version control? If you cannot tell the scopes apart, assume all of them will be committed.
- Is your first move after connecting a data source analysis, or saving a baseline? Everyone who analyzes first regrets it two weeks later.
If you want to connect your own data sources (ad platforms, reporting systems, Search Console) to an AI workflow, tell us how your process works today.
Tags
Related posts
More notes on similar problems