MCP Web Search Server for AI Agents: $0.008 per Search, up to 10 Results
Give an MCP agent a web search tool. The search tool on https://api.switch402.com/mcp takes a query and returns up to 10 ranked results with title, URL and snippet for $0.008 USDC on Base per call, paid over x402. You are charged only when at least one result comes back.
Paid MCP tools answer an unpaid call with x402 payment terms (an isError result). A client that cannot pay x402 shows those terms instead of the result; use an x402-capable MCP client or wrapper that retries with params._meta["x402/payment"], or call the HTTP API from code. The quote tool is free.
- Tool arguments
query (1 to 400 characters) and an optional limit from 1 to 10 (default 10). The price is $0.008 either way.
- Ranked results
Each result has rank, title, url and snippet. Snippets, not full pages: pass a URL to scrape_lite ($0.003) to read it.
- Same tool over REST
GET /v1/search?q=...&limit=10 or POST {"q": "...", "limit": 10} returns the same results for the same price.
- Not charged for nothing
If no result comes back, or the call fails, the payment does not settle.
Cost: searches x $0.008. 5 searches per task for 100 tasks a month is $4.00; reading the top result with scrape_lite adds $0.003 per page.
Code examples
MCP: call the search tool (curl)
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). Retry with params._meta["x402/payment"].REST: unpaid call shows the price (HTTP 402)
curl -i -G https://api.switch402.com/v1/search \
-H 'User-Agent: my-agent/1.0' \
--data-urlencode 'q=x402 payment protocol' \
--data-urlencode 'limit=5'
# 200 after payment: {"query": "...", "count": 5, "results": [{"rank": 1, "title": "...", "url": "...", "snippet": "..."}], ...}FAQ
- What does the search tool return?
- query, count and results, each with rank, title, url and snippet. Up to 10 results per call.
- Can I filter by country, language, date or site?
- Not today. The inputs are the query and limit.
- How do I add it to Claude Code?
- claude mcp add --transport http switch402 https://api.switch402.com/mcp. See the Claude Code guide for the payment note.
- Is search the same price over MCP and REST?
- Yes: $0.008 per successful call, USDC on Base.