How to Connect Google Search Console to Claude Code Using MCP
Connect Claude Code to Google Search Console with a remote MCP server, test authentication, and run real SEO checks from your terminal.
You can give Claude Code access to your Google Search Console data by adding an authenticated MCP server. For GSC Magic, run claude mcp add --transport http --scope user gsc-magic https://gscmagic.com/mcp, open /mcp, authorize the connection, and ask Claude to list your available properties. Run a small read-only query before trusting a larger SEO audit.
Why connect Search Console to a coding assistant?
Claude Code is useful when SEO work involves the website itself. You can inspect templates, fix redirects, change page titles, test a build and review a sitemap in the same development environment. But your source code cannot tell you which page lost 300 Google clicks last week.
Without Search Console access, an assistant can look at a page and make reasonable suggestions. It cannot distinguish between a high-priority problem and something nobody searches for. That difference is important when you have limited time.
An MCP connection adds a missing source of evidence. You can ask Claude Code to identify affected URLs from Search Console, compare them with local page templates and prepare code changes based on an actual investigation.
This guide covers the Claude Code terminal workflow, not the ordinary Claude website connector. If you work mainly in a browser, use our Claude Search Console setup guide.
What you need before running a command
You need Claude Code installed and working in a terminal, a Google account with access to the intended Search Console property, and an MCP server that can obtain that property’s data. The server can be self-hosted or remote.
The steps below use GSC Magic’s hosted endpoint. According to the GSC Magic documentation, it accepts the Streamable HTTP transport and supports OAuth-based sign-in or an access token. Your account must be provisioned and the service accessible; entering a valid URL does not automatically mean authentication has succeeded.
Start by confirming that Claude Code itself runs. Open it in a normal project and check that you can enter prompts. You do not need to clone your entire production website just to test a read-only Search Console connection.
Before connecting, decide whether the work is meant for one website or several. It is easy to select the wrong Search Console property when a Google account has access to client sites, staging domains and old URL-prefix properties.
Step 1: add the remote MCP endpoint
Open your terminal and run the following command:
claude mcp add --transport http --scope user gsc-magic https://gscmagic.com/mcp
Here is what each part means. claude mcp add registers a server with Claude Code. The http transport identifies a remote MCP service rather than a local executable. --scope user makes the connector available in your user-level configuration. The short name gsc-magic is just the identifier you will see in your tool list.
The URL is the remote endpoint documented for GSC Magic. It is not your Search Console property’s URL, your website’s sitemap or a Google API endpoint.
Why use user scope? If you do SEO work across multiple local projects, a user-scoped connection is convenient. For a shared repository or sensitive client environment, review Claude Code’s configuration scope rules and your team’s policy before adding external integrations.
You can find the general MCP command and transport guidance in Anthropic’s Claude Code documentation. Check it if a CLI option changes in a newer release.
Step 2: authenticate in Claude Code
Start Claude Code and enter:
/mcp
Select the gsc-magic server. If the client offers an Authenticate action, follow it and complete the browser-based sign-in. Use the Google account that has the correct Search Console property permissions.
Do not send your Google password, OAuth authorization code or access token as an ordinary chat message. Authentication is a separate step handled by the client and server. If your browser opens but authorization never completes, return to the MCP menu and inspect the connection status before repeating the attempt.
Some environments cannot complete browser-based OAuth. In those cases, GSC Magic documents personal access tokens under Connect → Access tokens in its dashboard. A token-based connection uses a header, for example:
claude mcp add --transport http --scope user gsc-magic https://gscmagic.com/mcp \
--header "Authorization: Bearer gsm_YOUR_TOKEN"
This is a template, not a working credential. Replace the placeholder in a secure local configuration workflow, and do not commit it to Git. If you only need analytics and indexing reports, create a read-only token. The platform’s documentation explains token expiration, revocation and permissions.
Step 3: prove that the connection is working
Do not begin with “audit my entire site and fix everything.” Ask for one response you can verify.
List the Google Search Console properties this connection can access. Include the exact property identifiers and their permission levels if available. Do not analyze a property until I select it.
This checks several things at once: the client can discover the server’s tools, the server can authenticate to Google, and your Google account can see at least one property.
Select the exact property identifier you need. A property formatted as sc-domain:example.com may include subdomains. A URL-prefix property such as https://www.example.com/ covers a narrower set of URLs. An unnoticed mismatch can make a traffic comparison look wrong even when the tool is functioning perfectly.
If the list is empty, first check your Google account and property permissions. Do not assume that the server is broken.
Step 4: run a useful first SEO comparison
A good first task is narrow, measurable and easy to repeat:
For the selected Search Console property, compare the last 28 complete reporting days with the preceding 28 days. Show the exact date ranges, total clicks, impressions and CTR, then list the ten pages with the largest absolute click losses. Use Search Console data, not estimates. Label possible explanations as hypotheses.
You can inspect that report inside the Search Console Performance interface. If the totals differ, verify aggregation choices, time zones, search types and whether the data is final. Google counts clicks and impressions according to its own reporting definitions, not GA4 session rules.
Next ask Claude Code to drill into one page:
For the largest-loss URL, compare its top ten queries between the periods. Group any material changes by device and country. Tell me which observations justify investigating the page template and which do not.
This is where a coding assistant becomes useful. If the page lost mobile visibility, you might review mobile navigation, responsive layout and rendering. If the page lost impressions for a narrow group of queries, you might examine the page’s content and internal links. But do not let the model treat correlation as proof.
Step 5: connect the data to your actual website code
Suppose Search Console identifies an important product URL with a declining click-through rate. Ask Claude Code to find the route or template responsible for the page’s HTML title, description and headings.
A sensible sequence looks like this:
- Locate the page or template in your project.
- Inspect the existing title, canonical URL, heading structure and primary content.
- Read the queries that led to impressions for the page.
- Suggest a limited improvement matching the page’s real content.
- Show a diff before making changes.
- Run your normal build and tests.
- Record the deployment date so you can compare later.
Not every low-CTR page needs a new title. A page could rank for broad informational queries with little click intent, or its average position could have changed. Use the low-CTR analysis guide before rewriting metadata based on one number.
Never tell Claude Code to delete or redirect pages merely because two URLs share a query. That can cause more damage than the original problem.
How to build a repeatable weekly workflow
You can save the analysis prompt in your notes or your project’s internal runbook. Claude Code does not need to remember the previous conversation if the prompt specifies the report parameters.
Ask for the same complete 7-day or 28-day windows each time, and include the selected property. Make the assistant return a table with URL, clicks in each period, absolute change, relative change and the largest query-level contributor. Keep the first version read-only.
After the report, ask for an action plan limited to three items. A useful action item has an observed signal, one proposed check, an owner and a way to measure the result.
For example: “The documentation page lost 120 clicks, mostly for setup-related queries on desktop. Check whether the page now answers the current version of the integration instructions; update only if the content is outdated.” That is much more actionable than “Improve content quality.”
If you schedule scripts or agents, control repeated calls and respect Search Console API quotas. Weekly reporting should not need hundreds of duplicate requests.
Troubleshooting common problems
| What you see | Likely next check |
|---|---|
| Server is registered but its tools are missing | Reopen /mcp; check transport and connection status |
| OAuth opens the wrong Google account | Sign out of the unintended account and review the authorized identity |
| Tools work but no sites appear | Verify Search Console ownership or delegated access |
| A query returns no rows | Check dates, search type, filters and whether the property had data |
| An inspection request fails | Check URL membership, scopes, provider quota and tool availability |
| A report looks inconsistent | Compare exact date windows and page-versus-property aggregation |
If the assistant reports a tool error, read the actual error before trying a different prompt. Rewording a query will not fix a revoked token or a site your account cannot access.
Google’s Search Analytics API reference documents date bounds, dimensions, limits and aggregation. Understanding those limits prevents a surprising number of false SEO diagnoses.
Permissions and safety when code and search data meet
Connecting Search Console data to a coding assistant is powerful because the assistant may also have filesystem access. That is precisely why you should separate investigation from implementation.
Treat reporting tools as read-only whenever possible. Ask for proposed code diffs and review them before the assistant writes or deploys anything. Use your normal Git workflow and checks. If you work with client properties, avoid combining unrelated clients’ data in one report.
GSC Magic documents read-only tokens and separate write-mode controls. Its Google Search Console tools include reading analytics and indexed URL status, while administrative actions such as submitting a sitemap require stronger permission. That separation is more important than how many tools the connector lists.
Remember that Google’s URL Inspection API does not request indexing. Its indexed-version results are different from a live URL test. The separate Google Indexing API has restricted supported content types and should not be used as a shortcut for ordinary pages.
Frequently asked questions
Can Claude Code access Google Search Console directly, without MCP?
Not by default. You would need another authorized path such as a custom API script or an imported export. MCP is one standard way to expose those calls as tools Claude Code can use.
Is this the same setup as Claude on the web?
No. Claude Code uses a CLI-managed MCP configuration. The Claude web app has its own connector interface. The data source can be the same, but the connection steps differ.
Can Claude Code fix technical SEO issues automatically?
It can help edit files it has permission to access, but Search Console evidence does not prove that every suggested change is correct. Review diffs, test builds and use human approval for deployment.
Will the agent know my Google conversions?
Only if you authorize an appropriate analytics source. Search Console reports search clicks and impressions; GA4 is needed for sessions and key events.
Which task should I try first?
Start with a comparison of two complete 28-day periods and the ten pages with the biggest click losses. You can confirm those numbers before involving any code changes.
The practical takeaway
Claude Code is best used as a bridge between measured search behavior and the website you can actually improve. Use the connector to identify a problem, the codebase to investigate it and your normal review process to make changes safely.
If you want the exact currently documented tools, token choices and connection options, keep the GSC Magic documentation open while configuring your client. For follow-up analysis ideas, use our 25 prompts for SEO agents.
Join the waitlist
Coming soon. Get 30% off Pro for 6 months when you join.