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.

TL;DR

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://mcp.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://mcp.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://mcp.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:

Use only read-only tools for the selected Search Console property. Propose two adjacent, complete 28-day reporting windows in Pacific Time and print their inclusive dates. Set the Search Console search type to web, request final data and use JSON output. First request a separate property total for each window with no grouping dimensions, no page/query filters and property aggregation. Show clicks, impressions and CTR. Then request at most ten page rows per window as exploratory samples. Print the row limits and truncation flags. Do not sum these samples into a property total, treat a missing page as zero or call them the site’s ten largest losses. If a request fails, show the original error and stop rather than retrying the same failing call. Do not edit files, submit URLs or change settings.

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. Leave out recent days that are not yet finalized; Google’s performance-data guide says data is typically available after two to three days. Do not assume that yesterday is complete just because the calendar day ended.

For GSC Magic’s gsc_query_analytics, the bounded total request uses dimensions: [], aggregation_type: "byProperty", search_type: "web", data_state: "final", format: "json" and limit: 10, plus the selected site and explicit start_date / end_date. These are MCP tool arguments, not the Google API’s camelCase request fields. For the page sample, use dimensions: ["page"] and aggregation_type: "byPage" instead. A ten-row cap keeps the first check inspectable; it does not make the result exhaustive.

Why not ask for the biggest losses immediately? Each period can return a different set of pages. A URL absent from one ten-row response may simply be outside that response, not at zero clicks. Google’s API also does not guarantee all underlying rows, and query-level data omits anonymized searches. Rank changes only within a clearly identified, comparable set; if you need a broader loss report, define its coverage and collection budget separately. A zero or empty baseline that you cannot validate is not a basis for a percentage-growth claim.

Next ask Claude Code to drill into one page:

For this selected exact URL, reuse the two printed date windows, Web search and final data. First request its page-aggregated total for each period with no grouping dimensions and an equals page filter. Then fetch at most ten query rows per period with that same filter and JSON output. Compare shared queries and label queries seen in only one sample as unmatched, not zero. Report truncation and the gap between visible query rows and the URL total without claiming to recover hidden queries. Suggest one device or country check only if the observations justify it, and wait for approval before expanding the audit or editing code.

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:

  1. Locate the page or template in your project.
  2. Inspect the existing title, canonical URL, heading structure and primary content.
  3. Read the queries that led to impressions for the page.
  4. Suggest a limited improvement matching the page’s real content.
  5. Show a diff before making changes.
  6. Run your normal build and tests.
  7. 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. For each explicitly measured URL, return clicks in both periods, absolute change and relative change only when the baseline is verified and nonzero. Keep sample-only URLs and unmatched queries separate. A visible query change is a possible contributor, not necessarily the largest contributor across hidden or unreturned queries. 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 seeLikely next check
Server is registered but its tools are missingReopen /mcp; check transport and connection status
OAuth opens the wrong Google accountSign out of the unintended account and review the authorized identity
Tools work but no sites appearVerify Search Console ownership or delegated access
A query returns no rowsCheck dates, search type, filters and whether the property had data
An inspection request failsCheck URL membership, scopes, provider quota and tool availability
A report looks inconsistentCompare 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 separate property totals for two complete 28-day periods, then a clearly labeled sample of at most ten pages from each. Confirm an exact URL’s totals before drilling into its query samples or involving code changes. Do not present a limited sample as a sitewide loss ranking.

Working across several approved client sites

A developer maintaining more than one client site should not share Google passwords or accidentally let an agent query another customer’s data. Prefer delegated Search Console access, an OAuth-based connector and explicit property selection in every prompt. For a team, confirm whether the workspace can scope properties separately per analyst or group.

This is distinct from configuring Claude Code itself. A successful MCP command proves the client can reach the connector, not that every connected property should be available to every team member.

For the full setup and a security test, see connecting multiple client websites to Claude. If you need scheduled client reports rather than a terminal query, see agency SEO client reporting.

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.

Ready to verify one property before investigating your code? Create a GSC Magic account, connect the intended data source and start with the bounded read-only check above.

, Founder of GSC Magic

Łukasz builds GSC Magic, the MCP server that gives AI agents access to Google Search Console, Bing Webmaster Tools and GA4. He writes about using Search Console data with Claude, ChatGPT and coding agents, and about the SEO workflows those tools make possible.

lukaszblania.comgithub.com/lumizone

Give your agent your search data.

GSC Magic connects Claude, ChatGPT and Cursor to Google Search Console, Bing and GA4. Free plan, 7-day Pro trial, no card.

Start free