x402 Router

Поиск и маршрутизация для более чем 22 тыс. работающих платных API x402. Агенты находят наиболее высоко оценённый и быстрый эндпоинт x402 для задачи; бесплатная маршрутизация по топ-3, $0.01 за полный ранжированный список, $0.002 за проверку работающего эндпоинта (USDC в Base/Solana).

Документация

x402 Router: MCP server + free API to find and pay the right x402 endpoint

MCP x402 Chains USDC License: MIT Docker build

24,000+ LIVE x402 pay-per-call endpoints across 3,800+ services, probed every 3 hours and scored 0-100 for reliability. Agents don't need to know which x402 API is up. Ask the router.

Keywords: x402, MCP, MCP server, AI agents, agent payments, pay-per-call APIs, USDC, Base, Solana, x402 discovery, x402 router, x402 registry, HTTP 402.

Quick start (MCP, 30 seconds)

The server is read-only: it holds no keys and never pays. It exposes four tools: search_x402_endpoints, route_x402_request, get_registry_stats, get_paid_route_requirements.

Option A: uvx (no clone, no PyPI needed)

Claude Desktop (claude_desktop_config.json) or Cursor (~/.cursor/mcp.json):

{
  "mcpServers": {
    "x402-router": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/camerxnduff/x402-router-mcp#subdirectory=mcp-server", "x402-router-mcp"]
    }
  }
}

Option B: Docker

{
  "mcpServers": {
    "x402-router": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "ghcr.io/camerxnduff/x402-router-mcp:latest"]
    }
  }
}

Or build it yourself: docker build -t x402-router-mcp . and use x402-router-mcp as the image name.

Option C: from source

git clone https://github.com/camerxnduff/x402-router-mcp
cd x402-router-mcp/mcp-server
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
python test_client.py   # calls the live router, read-only
{"mcpServers":{"x402-router":{"command":"/abs/path/x402-router-mcp/mcp-server/.venv/bin/python","args":["/abs/path/x402-router-mcp/mcp-server/server.py"]}}}

Streamable HTTP: python server.py --http 8000 serves http://localhost:8000/mcp. Env overrides: X402_ROUTER_URL, X402_DASHBOARD_URL.

Try it with no install (curl)

# best live Base endpoint for a category (free preview)
curl -s -X POST https://router-production-ab89.up.railway.app/route \
  -H 'content-type: application/json' -d '{"category":"Finance","chain":"Base"}'

# search the registry
curl -s 'https://router-production-ab89.up.railway.app/api/endpoints?q=weather&chain=Base&limit=5'

Free trial of the paid route

3 free trial calls per wallet per day, no payment needed. Add X-402-Trial: <your wallet address> (EVM 0x… or Solana) to /route/paid and you get the same full ranked answer a paid call returns, with headers X-402-Trial: true and X-402-Trial-Remaining: N. Limits: 3 per wallet and 3 per IP per UTC day, from a shared pool of 100 a day. After that you get the normal x402 402 (plus X-402-Trial-Remaining: 0). Nothing is signed or charged.

curl -i -X POST https://router-production-ab89.up.railway.app/route/paid \
  -H 'content-type: application/json' -H 'X-402-Trial: 0xYourWalletAddress' -d '{"q":"weather"}'

Why

Thousands of x402 endpoints exist, and many are dead, misconfigured or slow. The router probes every one, checks that its 402 body is valid (version, scheme, network, payTo, asset, amount), and ranks by uptime and latency, so an agent gets a working endpoint with a known price.

HTTP API

EndpointWhat
GET /api/endpoints?q=&chain=&category=&max_price=&min_score=&sort=&limit=Search LIVE endpoints, best first
GET /api/summaryCounts by chain, category, source
GET /api/registryFull registry (gzip)
POST /route (router)Best match + top 3, free
POST /route/paid (router)$0.01 USDC (x402, Base; Solana accepted): full ranked list (up to 25) with latency, reliability, price, payTo/networks and a ready-to-pay best pick. Free trial: 3 calls per wallet per day with the X-402-Trial header
GET /check/paid?url= (router)$0.002 USDC (x402): fresh live probe of one endpoint: is it up, latency, the real price and payTo it asks for now

Examples: examples/ (curl, Python, TypeScript) and examples/frameworks/ (LangChain, CrewAI, Coinbase AgentKit, x402 clients). Guides: https://router-production-ab89.up.railway.app/integrations

MCP tools

ToolCost
search_x402_endpoints, route_x402_request, get_registry_stats, get_paid_route_requirementsFree
find_best_x402_endpoint$0.01 USDC per call
check_x402_endpoint$0.002 USDC per call

Paid tools pay inside the tool call. To enable them:

pip install "x402-router-mcp[pay] @ git+https://github.com/camerxnduff/x402-router-mcp#subdirectory=mcp-server"
export X402_EVM_PRIVATE_KEY=0x...      # a dedicated, low-balance Base wallet holding a little USDC
export X402_MAX_PAYMENT_USD=0.01       # per-call cap (default 0.01)

Without a key, the paid tools return the price and the x402 payment requirements instead of paying.

Trust and transparency

  • Public status page: /status (JSON) shows uptime, the last successful crawl, LIVE counts and every settled payment with a block-explorer link. Numbers come from the router's own counters and settle log; nothing is estimated.
  • Machine-readable discovery: /.well-known/x402, /.well-known/ard.json, /.well-known/agent-card.json, /openapi.json, /llms.txt.
  • This MCP server is read-only by default: no keys, no payments. The optional paid tools only pay when you set your own wallet key, and each call is capped by X402_MAX_PAYMENT_USD.

Payments

x402 v2: Base USDC first, Solana USDC as fallback, settled through the PayAI facilitator.

License

MIT