switch402

How to Add Web Search to Claude Code with a Remote MCP Server

Add switch402 to Claude Code with one command and Claude Code gets a search tool (up to 10 ranked results, $0.008 per call) plus scrape_lite to read the pages it finds ($0.003 per call). Read the payment note first: paid tools need an x402-capable client.

Payment note: switch402 speaks MCP Streamable HTTP at https://api.switch402.com/mcp with no sign-in. The free quote tool works in any MCP client. The paid tools (scrape $0.008, scrape_lite $0.003, map $0.001, metadata $0.001, screenshot $0.008, screenshot_full $0.012, search $0.008, pdf $0.008) answer an unpaid call with x402 payment terms; a client that cannot pay x402 will show those terms instead of the page. To get pages, use an x402-capable MCP client or wrapper that retries with params._meta["x402/payment"], or call the HTTP API from code with an x402 library.

Steps

  1. Add the server. Run: claude mcp add --transport http switch402 https://api.switch402.com/mcp (the remote HTTP form in Claude Code's MCP docs). No sign-in or headers are needed.
  2. Check the tools. Run claude mcp list, or /mcp inside Claude Code, to see switch402 and its nine tools.
  3. Try the free tool. Ask Claude Code to call the switch402 quote tool on a URL. It returns the price, healthy-provider count and estimated latency.
  4. Search and read. search takes query (1 to 400 characters) and an optional limit (1 to 10). It costs $0.008 per call and is charged only when results come back. Pass a result URL to scrape_lite ($0.003) to read the page. Both are paid: without an x402-capable client they return payment terms.

Code

Claude Code: add the server

claude mcp add --transport http switch402 https://api.switch402.com/mcp
claude mcp list

curl: the same search tool call Claude Code makes

curl -s -X POST https://api.switch402.com/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -H 'User-Agent: my-agent/1.0' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search","arguments":{"query":"x402 payment protocol","limit":5}}}'
# Unpaid: an isError result with the x402 terms ($0.008). Paid: rank, title, url and snippet for each result.

MCP over curl (initialize, list, free quote)

# 1) initialize
curl -s -X POST https://api.switch402.com/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -H 'User-Agent: my-agent/1.0' \
  -d '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1"}}}'

# 2) list tools: scrape, scrape_lite, map, metadata, screenshot, screenshot_full, search, pdf, quote
curl -s -X POST https://api.switch402.com/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -H 'User-Agent: my-agent/1.0' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

# 3) free quote
curl -s -X POST https://api.switch402.com/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -H 'User-Agent: my-agent/1.0' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"quote","arguments":{"url":"https://example.com"}}}'

You pay only for the pages you actually fetch: $0.008 per standard page on /v1/scrape, $0.003 per lite call on /v1/scrape/lite, in USDC on Base and charged only on success. No subscription or unused credits; optional prepaid packs and a $10 monthly plan.

FAQ

Does Claude Code pay x402 by itself?
Not that we know of. Without an x402-capable wrapper the paid tools return payment terms; the free quote tool always works. From code, the HTTP API with an x402 library pays automatically.
What does a search return?
Up to 10 results, each with rank, title, url and snippet.
How do I remove it?
claude mcp remove switch402.

Related