Skip to content
Application notes · 7 min read

Part of Google Search Console MCP Server: Setup for Claude, Cursor, ChatGPT

How to Add MCP Servers to Claude Code (With a Real SEO Example)

Claude Code MCP setup: add servers with claude mcp add or .mcp.json, pick a scope, authenticate with a key or OAuth, and connect a real SEO server.

To add an MCP server to Claude Code, run claude mcp add with a transport, a name and the server's URL or command, or write the entry in a .mcp.json file. Claude Code MCP servers then expose their tools to the agent in every session where they are in scope. Remote servers connect by URL over HTTP; local servers are a command Claude Code starts and talks to over stdio.

The Claude Code details below come from the Claude Code MCP documentation as of November 2026. The worked example connects a remote server that authenticates with a bearer key: IndexCyborg's indexing server, which brings Search Console's index status into the session. For the other ways to do that, see the Google Search Console MCP server guide.

Add a server with claude mcp add

Server names can contain only letters, numbers, hyphens and underscores. For candidates, see the best MCP servers for developers.

A remote HTTP server

Anthropic recommends HTTP for remote servers. It is the transport the MCP specification calls Streamable HTTP, where each message is a POST to a single endpoint. Credentials go in a header:

claude mcp add --transport http notion https://mcp.notion.com/mcp

claude mcp add --transport http secure-api https://api.example.com/mcp \
  --header "Authorization: Bearer your-token"

-t and -H are the short forms of --transport and --header. SSE (--transport sse) is deprecated. WebSocket servers go in through claude mcp add-json with "type": "ws". The remote MCP server guide covers transports and auth in depth.

A local stdio server

claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
  -- npx -y airtable-mcp-server

Everything after -- is passed to the server untouched, so Claude Code doesn't read the server's flags as its own. --env accepts several KEY=value pairs, so put another option between it and the server name, or the CLI reads the name as one more pair.

Servers you already configured elsewhere

claude mcp add-json <name> '<json>' takes a JSON entry copied from a server's README. claude mcp add-from-claude-desktop imports Claude Desktop's servers (macOS and WSL only). Connectors you added at claude.ai load automatically when you sign in to Claude Code with a claude.ai subscription. For other clients, see the Claude Desktop MCP and Cursor MCP guides.

Claude Code MCP servers: choose a scope

--scope (or -s) decides where the entry is stored and which sessions load it:

ScopeLoads inStored in
local (default)The current project, for you only~/.claude.json, under the project's path
projectThe current project, for everyone who clones it.mcp.json at the project root, committed to git
userEvery project on your machine, for you only~/.claude.json

Local is the default. Use --scope user for servers you want everywhere and --scope project for servers your team shares. When one name is defined at several scopes, Claude Code takes one whole entry, without merging fields: local first, then project, then user.

An interactive session asks before using a server from .mcp.json, which claude mcp list shows as Pending approval until you answer; claude mcp reset-project-choices clears your answers. claude -p and Agent SDK runs can't ask, so they load project servers without approval.

Write the .mcp.json file

--scope project writes .mcp.json for you, and you can edit it by hand. This is the documented shape of a remote entry:

{
  "mcpServers": {
    "api-server": {
      "type": "http",
      "url": "${API_BASE_URL:-https://api.example.com}/mcp",
      "headers": { "Authorization": "Bearer ${API_KEY}" }
    }
  }
}
  • type is required for remote entries. streamable-http is an accepted alias for http. An entry with a url and no type is read as stdio and skipped with an error, so add it to entries copied from clients that leave it out.
  • Variables expand. ${VAR} and ${VAR:-default} work in command, args, env, url and headers, so the key stays out of git. An unset variable with no default stays as literal text, and claude mcp list warns about it.
  • Some credentials never expand. In a remote server's url and headers, variables such as ANTHROPIC_API_KEY, AWS_BEARER_TOKEN_BEDROCK and NPM_TOKEN read as empty whether or not they are set. Give each service key its own variable, such as API_KEY.

Authenticate: bearer keys, OAuth and header helpers

  • A static key goes in --header or headers, as above.
  • OAuth. When a remote server answers 401 or 403, Claude Code flags it as needing authentication (if you set its Authorization header yourself, it reports a failed connection instead). Run /mcp and sign in in your browser, or run claude mcp login <name> from the shell. Tokens are stored and refreshed automatically. A pre-registered OAuth app takes --client-id, --client-secret and --callback-port.
  • Short-lived tokens. A headersHelper command prints a JSON object of headers. Claude Code runs it on each connection, with a 10-second limit, and again after a 401 or 403. For a server in a project's .mcp.json or at local scope, the helper only runs once you accept the trust dialog for that folder.

Manage servers and tool permissions

claude mcp list          # every server, with a health status
claude mcp get <name>    # one server's details
claude mcp remove <name>

Statuses include Connected, Needs authentication and Failed to connect. In a session, /mcp shows the same list, signs you in, and turns a server off for the current project without removing it.

Each tool is named mcp__<server>__<tool> and goes through the same permission system as Bash or file edits. To skip the prompt, add an allow rule with /permissions or in .claude/settings.json: mcp__github__* covers every tool of the github server. Per the permissions docs, an allow rule accepts a glob only after the literal mcp__<server>__ prefix, so mcp__* approves nothing.

Worked example: add an SEO MCP server to Claude Code

IndexCyborg runs a remote, stateless MCP server at https://indexcyborg.com/api/mcp. It speaks Streamable HTTP and takes an API key in the Authorization header. Its tools read Google's index status for the pages in your sitemaps, and queue IndexNow notifications and Request indexing.

1. Create a scoped key

In the dashboard, open Settings → API keys and choose the scopes the agent needs: read for status, issues and reports, notify to queue scans, IndexNow notifications and indexing requests, and manage if the agent should register URLs your last sitemap scan hasn't found yet. Restrict to websites limits the key to the sites you pick. The key starts with ic_ and is shown once.

2. Add the server

For yourself, in every project:

claude mcp add --transport http --scope user indexcyborg https://indexcyborg.com/api/mcp \
  --header "Authorization: Bearer ic_your_key"

For a team repository, commit a .mcp.json that reads the key from each developer's environment:

{
  "mcpServers": {
    "indexcyborg": {
      "type": "http",
      "url": "https://indexcyborg.com/api/mcp",
      "headers": { "Authorization": "Bearer ${INDEXCYBORG_API_KEY}" }
    }
  }
}

Each developer exports INDEXCYBORG_API_KEY before starting claude and approves the server once.

3. Check the connection

Run claude mcp list; the server should show Connected. Failed to connect usually means the key: IndexCyborg answers 401 to a missing, malformed, unknown or revoked key, and Claude Code reports that as a failed connection because you configured the header. With .mcp.json, check that the variable is set in the shell that started Claude Code. In a session, /mcp shows the server with its ten tools.

4. Allow the read-only tools

Add allow rules to .claude/settings.json:

{
  "permissions": {
    "allow": [
      "mcp__indexcyborg__list_websites",
      "mcp__indexcyborg__get_*",
      "mcp__indexcyborg__generate_indexing_report"
    ]
  }
}

Claude then reads status without asking, while notify_search_engines, request_google_indexing and the other tools that queue work still prompt.

5. Ask in plain language

  • “Which pages on example.com does Google not index, and what reason does it give?” Claude calls get_unindexed_pages, which lists only pages Google has inspected, grouped by status, then get_indexing_status for a page's reason in Google's own wording, such as Crawled - currently not indexed.
  • “I just shipped /docs/webhooks. Notify IndexNow and queue it for Request indexing.” Claude calls notify_search_engines and request_google_indexing. Without the manage scope, a URL the last sitemap scan didn't find comes back as not_in_inventory.
  • “Summarize indexing for this site.” Claude calls generate_indexing_report, which states coverage against the inspected pages only.

The full tool table is in check indexing with MCP. To have Claude Code find the noindex or canonical bug in your repository first, see Claude Code for SEO.

Troubleshooting Claude Code MCP setup

  • The server is missing in another project. It was added at the default local scope. Add it again with --scope user.
  • An error says the entry has a url but no type. Add "type": "http" to it.
  • A server times out at startup. MCP_TIMEOUT=10000 claude sets a 10-second startup timeout.
  • A tool result is too large. Claude Code warns when tool output passes 10,000 tokens and caps it at 25,000 by default; MAX_MCP_OUTPUT_TOKENS=50000 raises the cap.
  • Untrusted servers. Anthropic's docs tell you to trust each server before connecting it, since a server that fetches outside content can expose the session to prompt injection.

What the IndexCyborg server will and won't do

It applies the same gates as the dashboard: no IndexNow notification before your domain and IndexNow key are verified, and no inspection without a linked Search Console property. request_google_indexing queues up to 50 URLs per call for the IndexCyborg Chrome extension, which you load from the dashboard's Settings and which clicks Request indexing in your own Search Console session, at most 10 per property per rolling 24 hours. Each key gets 60 requests a minute.

An accepted IndexNow notification isn't a crawl, and Google isn't on IndexNow's list of participating engines. A requested URL is queued for crawling, and Google says a crawl request doesn't guarantee inclusion in search results. The server doesn't read Search Analytics data such as clicks and queries. The Google indexing MCP guide covers the request flow.

Frequently asked questions

Does Claude Code support remote MCP servers?

Yes. Add one with claude mcp add --transport http, a name and the server URL. Anthropic's docs recommend this HTTP transport (Streamable HTTP in the MCP specification) for remote servers; SSE still works but is deprecated, and WebSocket servers are added with claude mcp add-json.

Can Claude Code use the MCP servers I set up in Claude Desktop or claude.ai?

Yes. claude mcp add-from-claude-desktop imports servers from Claude Desktop's config on macOS and WSL. Connectors you added at claude.ai appear in Claude Code automatically when you are signed in to Claude Code with a claude.ai subscription.

How many MCP servers can Claude Code use at once?

Anthropic's docs give no fixed number. Claude Code doesn't cap tools per server, and tool search is on by default, so only tool names and server instructions load when a session starts and full definitions load when Claude needs them. The docs say the practical limit is your context window budget.

Can Claude Code itself run as an MCP server?

Yes. claude mcp serve starts Claude Code as a stdio MCP server that another client, such as Claude Desktop, can connect to. It exposes Claude Code's own tools, and the connecting client is responsible for asking the user to confirm each tool call.