MCP client

AgentSEO MCP Setup for Claude Code

Connect AgentSEO to Claude Code when you need Google results for a specific query, market, and device. Start with one search results check and confirm you have a usable response before building a workflow around it.

Copy the setup first, validate one live workflow, then decide whether this path belongs in docs, automation, or your agent runtime.

Claude CodeHosted MCPLive SERP data

Before you start

You need Claude Code and an AgentSEO server-side API key. The free sample in the Claude SEO guide works with the bundled files and needs no AgentSEO account.

Use This Guide For

Set up the integration and check the result

Open the configuration, see a sample response, or review the API quickstart.

Core workflows

What you can do

  • Inspect the result types, competing pages, and search features for one query in a chosen market.
  • Turn a completed search result into a content brief or a follow-up check.
  • Use a workflow ID to identify calls from this setup.

Setup snapshot

Claude Code project MCP configuration

{
  "mcpServers": {
    "agentseo": {
      "type": "http",
      "url": "https://www.agentseo.dev/mcp",
      "headers": {
        "Authorization": "Bearer ${AGENTSEO_API_KEY}",
        "x-workflow-id": "claude-seo-starter"
      }
    }
  }
}

Discovery shows the available tools. Live execution uses your AgentSEO key and consumes credits according to the tool.

Implementation plan

How to set it up

  1. 1

    Create an AgentSEO API key without browser domain restrictions. Set AGENTSEO_API_KEY in the shell environment that will launch Claude Code.

  2. 2

    Save the sample as .mcp.json in your project root. If the file already exists, add the agentseo entry to its mcpServers object.

  3. 3

    Start Claude Code in that directory, approve the project server if prompted, and open /mcp to check discovery.

  4. 4

    Run the example below and inspect the returned result or job status.

Output shape

What users get back

  • A completed SERP analysis with result and feature data when available.
  • A job ID for an async result. Use agentseo_job_status until the job completes or fails.

Limits

What to check before you run it

  • Hosted MCP requires a server-side key without allowed domains.
  • The SERP tools show market results. Supply a Search Console export separately when you need your site's Google clicks or impressions.
  • Review costs and the first completed result before adding more tool calls.

Visual flow

Claude Code tool loop

One query gives you a bounded way to check the connection and review the evidence.

1

Prompt

User asks for SERP triage or page opportunity analysis.

2

MCP Tool

Claude calls agentseo_analyze_serp or another AgentSEO tool.

3

Job status

Poll the original job while it is queued, processing, or retrying.

4

Review

Read the result and confirm it supports the proposed action.

Concrete example

Run one live SERP check

Ask for one query and keep the result context with the recommendation.

Prompt for Claude Code

Use AgentSEO's agentseo_analyze_serp tool once with these arguments.
{"keyword":"claude seo","location":"United States","language":"en","device":"desktop","sync":false}

Save the returned jobId. While status is queued, processing, or retrying, wait retry_after_seconds from the submission response, or two seconds if absent, before each call to agentseo_job_status. Pass that same ID as job_id. Stop after two minutes and report the last status and jobId so I can resume polling later.
On completed, use result to show up to three direct result URLs and the intent they support. On failed, stop and report error.message. If the tool returns an error with no jobId, report it and stop.
If a redirect hides a destination, report its rank and title and mark the destination unknown.

What to check in the result

For queued, processing, or retrying, pass the original jobId as job_id to agentseo_job_status.
For completed, inspect result for SERP features and any direct result URLs.
For failed, report error.message. If the deadline passes, keep the same jobId for another status check.
  • The sample configuration tags requests with the claude-seo-starter workflow ID.
  • Record the query, market, language, device, and any collection time returned before comparing the result with another run.

FAQ

Questions this page should answer fast

Package-level docs

Why does MCP discovery work but the tool call returns 401?

Tool execution needs a valid AgentSEO key. Check that AGENTSEO_API_KEY is available in the environment that launched Claude Code and that the Authorization header uses Bearer followed by the key.

What should I check for a 403 or 402?

For a 403, check whether the key was revoked, expired, or has an allowed domain list. For a 402, check the account credit balance before retrying.

What if my first tool call returns a job ID?

Pass the returned jobId as job_id to agentseo_job_status. Keep polling with a delay while the job is queued, processing, or retrying, up to a deadline you set. Read result on completed or report error.message on failed.