关于 x402 Router
x402 Router 是用于查找 x402 按次付费端点的只读 MCP 服务和 API。它会探测端点并按可靠性和延迟评分,帮助 Agent 找到可用且价格明确的路由。
主要功能
- 01搜索在线 x402 端点
- 02路由至评分靠前的端点
- 03探测在线率和延迟
- 04查看注册表统计
适用场景
- 01按类别和链查找端点
- 02筛选达到最低评分的路由
- 03查看各链端点数量
- 04检查付费路由要求
MCP 相关
提供四个只读工具,用于搜索端点、路由请求、获取注册表统计和查询付费路由要求。服务不持有密钥,也不会付款。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
docker run -i --rm ghcr.io/camerxnduff/x402-router-mcp:0.1.0本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。
ghcr.io/camerxnduff/x402-router-mcp:0.1.0stdio工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
x402 Router:MCP 服务 + 免费 API,帮你找到并支付合适的 x402 端点
20,700 多个实时 x402 按次付费端点,遍布 3,100 多项服务;每 3 小时探测一次,并按可靠性评分(0–100)。 Agent 无需知道哪些 x402 API 可用。向路由器提问即可。
**关键词:**x402、MCP、MCP 服务、AI Agent、Agent 支付、按次付费 API、USDC、Base、Solana、x402 发现、x402 路由器、x402 注册表、HTTP 402。
- **实时路由器:**https://router-production-ab89.up.railway.app(OpenAPI:[/openapi.json](https://router-production-ab89.up.railway.app/openapi.json) · x402 发现:/.well-known/x402 · 健康状态:/health)
- **仪表板 / 注册表:**https://dashboard-production-4344.up.railway.app
- **面向大模型:**https://dashboard-production-4344.up.railway.app/llms.txt
快速开始(MCP,30 秒)
该服务为只读:不持有密钥,也不会进行支付。它提供四个工具:
search_x402_endpoints、route_x402_request、get_registry_stats、get_paid_route_requirements。
选项 A:uvx(无需克隆,无需 PyPI)
Claude Desktop(claude_desktop_config.json)或 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"]
}
}
}
选项 B:Docker
{
"mcpServers": {
"x402-router": {
"command": "docker",
"args": ["run", "-i", "--rm", "ghcr.io/camerxnduff/x402-router-mcp:latest"]
}
}
}
也可以自行构建:docker build -t x402-router-mcp .,并将 x402-router-mcp 用作镜像名称。
选项 C:从源代码运行
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 会在 http://localhost:8000/mcp 提供服务。
环境变量覆盖:X402_ROUTER_URL、X402_DASHBOARD_URL。
无需安装即可试用(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://dashboard-production-4344.up.railway.app/api/endpoints?q=weather&chain=Base&limit=5'
原因
存在数千个 x402 端点,其中许多已失效、配置错误或响应缓慢。路由器会逐一探测,检查其 402 响应正文是否有效(版本、方案、网络、payTo、资产、金额),并根据正常运行时间和延迟进行排名,让 Agent 获得一个价格已知且可用的端点。
HTTP API
| 端点 | 说明 |
|---|---|
GET /api/endpoints?q=&chain=&category=&max_price=&min_score=&sort=&limit=(仪表板) | 搜索实时端点,按最佳结果优先显示 |
GET /api/summary(仪表板) | 按链、类别和来源统计数量 |
GET /api/registry(仪表板) | 完整注册表(gzip) |
POST /route(路由器) | 最佳单一匹配,免费预览 |
POST /route/paid(路由器) | 相同结果,x402 付费:在 Base 上支付 $0.01 USDC(也接受 Solana) |
示例:examples/(curl、Python、TypeScript)。
支付
/route/paid 使用 x402 v2:优先使用 Base USDC,Solana USDC 作为备用,通过 PayAI facilitator 结算。路由器对路由的调用收取 1% 的费用。MCP 服务本身不会支付;支付由 Agent 的 x402 客户端完成。
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。