Xenarch Agent MCP
OfficialXenarch — 用于 AI 代理支付的 x402 MCP 服务器
Xenarch 是一个非托管的 x402 MCP 服务器,允许 AI 代理使用 Base L2 上的 USDC 微支付来支付 HTTP 402 门控的 API 和内容。Claude、Cursor、LangChain 和 CrewAI 代理会自动解析 HTTP 402(“需要付款”)响应——无需 API 密钥、无需订阅、无需绑定信用卡。付款通过任何 x402 促进者直接在链上结算给发布者钱包。不依赖特定促进者,0% 手续费,无中间合约。
Xenarch 的独特之处
Cloudflare Pay-Per-Crawl | TollBit | Vercel | 其他 x402 MCP 服务器 | Xenarch | |
适用于任何主机 | ❌ (仅限 Cloudflare) | ❌ (企业级) | ⚠️ Vercel 优先 | ✅ | ✅ |
非托管 | ❌ | ❌ | 平台路由 | 不一 | ✅ 直接 USDC 转账 |
促进者选择 | ❌ | ❌ | ❌ | 锁定 | ✅ 每个网关的排名列表 |
手续费 | 平台费率 | 平台费率 | 平台费率 | 不一 | 结构性 0% |
开放标准 | 专有 | 专有 | x402 | x402 | x402 + pay.json (由 Xenarch 编写) |
发布者变现 | ✅ (Cloudflare 门控) | ✅ (仅限企业) | ❌ | ❌ | ✅ (任何技术栈) |
Related MCP server: pay-mcp
工作原理
1. Discover xenarch_check_gate("example.com")
→ { gated: true, accepts: [...], facilitators: [...] }
2. Pay xenarch_pay("example.com")
→ x402-fetch signs an EIP-3009 USDC transferWithAuthorization
→ Submits via the chosen facilitator on Base
→ Re-fetches the resource with proof of payment
→ { tx_hash, facilitator, content }无需 API 密钥。无需注册。代理直接在链上支付——Xenarch 从不持有资金,代理和发布者之间也没有中间合约。
MCP 工具
为 AI 代理提供的三个工具:
工具 | 描述 |
| 检查 URL/域名是否具有 x402 支付网关。返回接受的支付要求和排名后的促进者列表。 |
| 为门控内容付费。签署 EIP-3009 USDC 转账,通过 x402 促进者提交,返回交易哈希和门控内容。 |
| 查看此钱包进行的过往付款。 |
响应示例
{
"gated": true,
"gate_id": "7f3a1b2c-9d4e-4a8b-b6f1-2c3d4e5f6a7b",
"accepts": [
{
"scheme": "exact",
"network": "base",
"maxAmountRequired": "3000",
"resource": "https://example.com/article",
"payTo": "0xabc123...publisher_wallet",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"maxTimeoutSeconds": 60
}
],
"facilitators": [
{ "name": "PayAI", "url": "https://facilitator.payai.network", "priority": 1, "spec_version": "v1" },
{ "name": "xpay", "url": "https://facilitator.xpay.dev", "priority": 2, "spec_version": "v2" }
],
"seller_wallet": "0xabc123...publisher_wallet",
"network": "base",
"asset": "USDC"
}{
"success": true,
"gate_id": "7f3a1b2c-9d4e-4a8b-b6f1-2c3d4e5f6a7b",
"tx_hash": "0xdef456...abc789",
"facilitator": "PayAI",
"seller_wallet": "0xabc123...publisher_wallet",
"url": "https://example.com/article",
"wallet": "0x123...your_wallet",
"content": "...gated content here..."
}{
"payments": [
{
"domain": "example.com",
"amount_usd": "0.003",
"tx_hash": "0xdef456...abc789",
"paid_at": "2026-04-10T14:35:00Z"
}
],
"total_spent_usd": "0.003000",
"count": 1,
"wallet": "0x123...your_wallet"
}HTTP 402 — x402 终于激活了未使用的状态码
HTTP 402 Payment Required 是自 1997 年以来 HTTP 规范中为机器对机器支付保留的状态码。它几十年来一直未被使用,因为没有关于客户端应如何支付 402 响应的开放协议。
x402 就是该协议:服务器返回带有签名价格和支付详情的 HTTP 402,客户端在 Base L2 上签署 USDC 微支付,并使用付款证明重试请求。Xenarch 的 MCP 服务器为 AI 代理自动化了这两个环节——它读取 402 挑战,通过 x402-fetch 签署付款并重放请求,返回链上交易哈希以及门控内容。
了解更多:x402 规范 定义了支付握手;pay.json(由 Xenarch 编写)是配套的开放标准,用于在 /.well-known/pay.json 提供机器可读的定价——可以将其视为支付领域的 robots.txt。
使用 HTTP 402 进行 API 变现
Xenarch 是构建在 HTTP 402 规范之上的 API 变现原语。与需要订阅、仪表板和 API 密钥的 API 网关变现平台(Apigee、Kong、AWS API Gateway)不同,Xenarch 允许任何 API 按请求收费,无需创建账户,也无需配置密钥——调用者在 Base L2 上支付 USDC,API 验证链上交易,即可获得访问权限。
对于发布者而言,这意味着:
无需与 Stripe/信用卡处理器集成
无需订阅计划、定价层级或配额仪表板
平台不持有托管余额
按请求定价,统一适用于人类用户、机器人和 AI 代理
实时链上结算的 API 变现
Python SDK 包含一个单装饰器的 FastAPI 中间件;请参阅 xenarch-sdks/python 以了解发布者集成。
设置
配置您的钱包:
mkdir -p ~/.xenarch
cat > ~/.xenarch/wallet.json << 'EOF'
{
"privateKey": "0xYOUR_PRIVATE_KEY"
}
EOF
chmod 600 ~/.xenarch/wallet.json添加到 Claude Code:
claude mcp add xenarch -- npx @xenarch/agent-mcp或添加到 Claude Desktop / Cursor / 任何 MCP 客户端:
{
"mcpServers": {
"xenarch": {
"command": "npx",
"args": ["@xenarch/agent-mcp"],
"env": {
"XENARCH_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY"
}
}
}
}环境变量
变量 | 默认值 | 描述 |
| — | 钱包私钥(覆盖配置文件) |
|
| Base RPC 端点 |
|
| Xenarch 平台 API |
|
| 网络 ( |
| — | 自动批准无需提示的每次调用最大美元金额(在 x402-fetch 中默认为 0.1 USDC) |
示例
请参阅 xenarch-examples 获取可用的集成示例——Python 代理、LangChain、CrewAI、Claude Desktop 设置和发布者中间件。
开发
npm install
npm run build结构
packages/
shared/ — Payment logic, types, config (reused across servers)
agent/ — MCP server for AI agents常见问题解答
Claude 如何使用 Xenarch 支付 API?
安装 Xenarch MCP 服务器 (claude mcp add xenarch -- npx @xenarch/agent-mcp),为其提供一个钱包,Claude 就会自动通过 Base L2 上的 USDC 微支付来解析任何 HTTP 402 响应。
Xenarch 是否适用于 Cursor、LangChain 或 CrewAI? 是的。Xenarch 公开了一个任何 MCP 兼容客户端都可以使用的 MCP 服务器——Claude Code、Claude Desktop、Cursor、Cline、LangChain、CrewAI 以及任何其他支持模型上下文协议的客户端。
发布者是否支持 FastAPI?
是的,通过 Python SDK (pip install xenarch[fastapi])——一个单装饰器中间件返回带有价格的 HTTP 402 并验证链上支付。请参阅 xenarch-sdks/python。
Xenarch 是托管的吗? 不是。付款作为从代理钱包到发布者钱包的直接 USDC 转账在链上结算。资金从不触及 Xenarch 基础设施,也没有中间合约。
手续费是多少? 结构性 0%。Xenarch 从不介入资金流——代理通过任何 x402 促进者直接在链上向发布者付款。
每次调用的最高付款额是多少? 1 美元。
什么是 x402? x402 是 HTTP 402 Payment Required 的开放协议。服务器返回带有价格的 402,客户端在 Base L2(或其他支持的链)上签署 USDC 微支付,并使用付款证明重试请求。
什么是 HTTP 402? HTTP 402 Payment Required 是自 1997 年以来 HTTP 规范中为机器对机器支付保留的状态码。x402 是最终使用它的开放协议。
Xenarch 与 Cloudflare Pay-Per-Crawl 相比如何? Cloudflare Pay-Per-Crawl 仅适用于 Cloudflare 后面的站点,且是托管的。Xenarch 适用于任何主机,且是非托管的——发布者直接在链上获得付款。
Xenarch 与 TollBit 相比如何? TollBit 专注于企业许可。Xenarch 是自助服务、非托管的,适用于长尾发布者和任何无需企业合同的 AI 代理。
链接
许可证
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Pay for HTTP APIs and charge for your own: x402 micropayments in USDC on Base.
Payment rails for AI agents. Pay merchants in USDC on Base. Dual-protocol: x402 + OKX APP.
22 AI microservices with x402 micropayments: summarize, translate, code-review. USDC on Base.
Pay-per-query x402 business intelligence on Base, settled in USDC via the native 402 payment flow.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceDiscovers and queries x402-payable APIs at runtime — enables autonomous agents to find, evaluate, and pay for services via USDC micropayments on Base without API keys or subscriptions.MIT
- AlicenseNot gradedqualityBmaintenanceUSDC payments for AI agents on Base. Direct transfers, pre-funded tabs, x402 paywall handling, and service discovery.37 npmMIT

@arispay/payagent-mcpofficial
AlicenseAqualityAmaintenanceEnables AI agents to call paid APIs and settle HTTP 402 payment challenges with USDC on Base, without private keys ever being involved.7108 npmMIT- AlicenseNot gradedqualityBmaintenanceEnables AI agents to discover, pay for, and sell HTTP APIs using the x402 micropayment protocol, with USDC settlement on Base mainnet. Includes tools for payment requirements, paying and fetching resources, building seller configurations, and monitoring revenue.121 npm1MIT