Skip to content

Connecting Claude Code and Codex to Google Search Console and SEO data over MCP

Published · Updated

You can connect Claude Code and Codex directly to live Google Search Console, Bing Webmaster, PageSpeed, crawl findings, and a shared SEO work board over a hosted OAuth 2.1 MCP server, giving agents read-only analytics and approval-gated write tools without pasting CSV exports or sharing raw Google API keys.

Key takeaways

  • One hosted URL, standard OAuth 2.1: Point Claude Code or Codex at https://seoperch.com/mcp (or use a scoped personal access token with optional expiry) instead of maintaining local Python/Node scripts per developer.
  • Least-privilege scopes: Start agents on hub:read (metrics, findings, queries, indexing status) or add hub:write so they can save drafts and propose work while keeping publishing, redirects, robots.txt, and deletions strictly human-approved.
  • Multi-site and multi-project isolation: Scope each agent token to one project or workspace so an agent working on one domain cannot read or edit another client's sites.
  • Audit trail and impact measurement: Every draft, finding triage, and shipped URL is logged on a work item and automatically checked against Search Console 28-day before/after windows.

Why connect AI coding agents to SEO data over MCP instead of CSVs

When you ask Claude Code or Codex to improve organic traffic by pasting screenshots or CSV exports into chat, three things go wrong fast:

  1. Stale, partial context: A single CSV misses canonical mismatches, robots.txt blocks, URL inspection coverage states, and recent crawl findings on the same URL.
  2. Secret sprawl: Giving local scripts direct Google service-account JSON keys or Bing API keys puts production credentials inside every developer's workspace.
  3. Uncontrolled edits: Without a shared board and approval gate, agents guess which pages to rewrite, repeat already-shipped fixes, or push risky changes (redirects, noindex, sitemap edits) without a review trail.

The Model Context Protocol (MCP) solves this by exposing typed, scoped tools over HTTPS so your agent reads fresh connector data on demand and writes proposals into a human-reviewed inbox. For background on the architecture, see how to connect AI agents to SEO data over MCP.

Connecting Claude Code and Codex to SEO Perch

Connection methodBest forAuth flowToken lifecycle
Hosted OAuth 2.1 (/mcp)Interactive Claude Code or Codex sessionsDynamic client registration + browser consent at /connect/approveShort-lived access tokens with rotating refresh tokens
Scoped Personal Access Token (PAT)Headless runs, CI jobs, or scheduled workersAuthorization: Bearer <token> headerOptional expiry (default 90 days in Connect UI), instant revoke

Step 1: Connect your search and crawl data once

In SEO Perch, add your site and enable the connectors you need (Google Search Console, Search Console URL inspection, Bing Webmaster, PageSpeed, site audit, and AEO audit). SEO Perch handles scheduled syncs and quota pacing on the server, so your coding agents never touch raw Google credentials. See what you can automate in Google Search Console for exact scope boundaries.

Step 2: Add the MCP server to Claude Code or Codex

Point your MCP client at the hosted streamable HTTP endpoint:

{
  "mcpServers": {
    "seo-perch": {
      "type": "http",
      "url": "https://seoperch.com/mcp"
    }
  }
}

When your client makes its first tool call, SEO Perch returns an OAuth 2.1 discovery challenge and opens a consent screen where you choose:

  • Agent name (for example claude-code or codex) so every action is attributed cleanly in the activity feed.
  • Scopes (hub:read for read-only analysis, or hub:read + hub:write to draft copy, claim work, and record PR deliveries).
  • Project restriction (all workspace projects or one specific brand/project).

If you prefer a static bearer header for headless workers, create a scoped PAT under Connect with an expiration window (such as 30 or 90 days) and revoke it anytime with one click.

A safe daily workflow for Claude Code and Codex

Once connected, give your agent a deterministic loop instead of open-ended prompts:

  1. Orient first: Call list_projects and get_briefing for the target site. The briefing returns binding rules, verified brand facts, open findings, tracked keywords, goals, and active milestones.
  2. Inspect the exact URL: Before touching any route or template, call resolve_url to inspect 28-day Search Console clicks/impressions, index coverage state, open crawl findings, and related work items on that URL.
  3. Draft copy inside the hub: Use check_draft to run active rule checks (forbidden claims, live-page verification) and save_draft to store versioned copy in the Inbox for human approval.
  4. Ship through PRs and measure: Record pull requests with set_delivery, never self-merge external changes, and call ship_work once deployed so SEO Perch automatically compares 28-day Search Console performance before and after the change.

What stays human-approved by design

SEO Perch gives recommendations only. Even when an agent has hub:write, the server blocks self-approval and routes high-impact actions to your Inbox:

  • Publishing new pages or guides
  • Adding or changing redirects, robots.txt, or noindex directives
  • Deleting pages or submitting external directories/outreach
  • Editing binding rules, agent roles, or verified brand facts

Plans and limits

On the Free plan (EUR 0), you can test one site with 1 agent token (read and Inbox proposals, up to 100 reads/day and 25 proposals/month). On Pro (EUR 19 / month, up to 5 sites) and Agency (EUR 149 / month, up to 50 sites), agents get autonomous claim/work-board flows while keeping every gated site change behind your approval.

Frequently asked questions

Does my coding agent get access to my Google Search Console credentials?

No. Your Google OAuth token or service-account key stays encrypted inside SEO Perch. Claude Code and Codex only receive scoped MCP tool responses for the workspace and projects you authorize.

Can I run both Claude Code and Codex on the same SEO board without collisions?

Yes. Each agent authenticates under its own name and uses claim_work / next_work leases with explicit lane tags (for example lane:code vs lane:content), so two agents do not edit the same item at once.

What if an agent token leaks?

Revoke the token or OAuth connection in one click on the Connect page. Rotating OAuth refresh tokens also revoke the entire token family automatically if an older refresh token is ever replayed.