
Mcp X402 Pay
io.github.CryptoAPIs-io由 GitHub 账号 CryptoAPIs-io 发布v0.5.3更新于 Oct 25, 2026
MCP server that pays x402-gated HTTP endpoints — fetch, and on a 402 authorize, sign, retry
概览
本地 MCP 服务器,让 AI 代理发现 x402 付费 HTTP 资源,并在本地签名支付后重试请求完成付款。
- 可以做什么
- 从 facilitator 目录发现 x402 资源及其价格,支持筛选和分页,不花钱、不需要密钥或钱包。抓取 URL,若返回 402 Payment Required,则通过 CryptoAPIs 买方服务授权支付、在本地签名、带支付头重试,并返回已付费的响应和结算信息。可用允许网络列表、最高金额上限和允许主机列表限制支付,允许主机可固定在模型触及不到的位置。
- 适用场景
- 当代理需要调用 x402 付费 HTTP API 并按次从 CryptoAPIs 代理钱包付款时使用;也可先浏览 x402 目录查找付费资源及其价格。它只是买方工具;为自己的 API 收费的商户应使用单独的商户 SDK。
- 运行要求
- 以本地 stdio 进程运行 npm 包,需要 Node.js。需要具备 X402_BUYER 功能的 CryptoAPIs API 密钥、按区块链和网络各创建一次的代理钱包记录 id,以及每次工具调用传入的钱包私钥。目前支持 EVM(eip712,例如 Base USDC)和 Solana;网络值必须是 CAIP-2 id。需要访问目标 URL 和 CryptoAPIs 买方服务的网络连接。
安装
在 SourceWeft 中
- 打开 控制台中的 Mcp X402 Pay,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@cryptoapis-io/mcp-x402-pay
This is the BUYER side of x402 — the tool an agent uses to spend (pay for a resource). Merchants who want to charge for an API use the middleware SDK (
@cryptoapis-io/x402-merchant-sdk), not an MCP tool.
An MCP server that lets an AI agent find and pay x402-gated HTTP endpoints.
x402_pay— fetches a URL and, if the server returns402 Payment Required, authorizes the payment via the CryptoAPIs buyer service, signs locally, retries, and returns the paid response.x402_discover— browses the facilitator's catalogue of x402 resources and their prices, so an agent can find a paid API instead of only calling one it was handed.
Non-custodial: the private key is passed per request and never leaves the process (no HTTP server — stdio only).
Supported today: EVM (eip712, e.g. Base USDC) and Solana. Tron, Bitcoin/UTXO, XRP and Kaspa are
upcoming — wired but not yet enabled; paying on them returns a clear family_not_yet_supported
("coming soon") result.
Run
Prerequisite — an agent walletId
x402_pay pays from a CryptoAPIs agent wallet (walletId). Create one ONCE per blockchain+network
before paying — a single POST to the buyer API returns the id (non-custodial: you register only your
PUBLIC address):
network MUST be the CAIP-2 id (eip155:8453, solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp, …), not a
bare name — and exactly one of address (any chain; required for Solana/Kaspa) or xpub
(xpub-capable chains). A malformed body returns a clear 400 malformed_request. Set the returned id as
X402_WALLET_ID (or pass walletId).
Tool: x402_pay
Returns { status, paid, body, settlement? }. On a 402 with no acceptable option (or over maxAmount),
paid:false with a reason — nothing is signed or paid.
Tool: x402_discover
Browse the x402 "Bazaar" — the registered x402 resources and what each charges (spec §8).
Returns { resources: [{ resource, type, x402Version, accepts, lastUpdated, metadata? }], pagination }.
Public — no API key, no wallet, spends nothing, so it is always safe to call. Note accepts[].amount
is in atomic units (USDC 6-decimals: "10000" = $0.01) — convert before quoting a price to a user.
Pass a chosen resource to x402_pay to actually buy it.
Flow
fetch(url). Not 402 → return it.- 402 → pick an
acceptsentry (allowlist-aware), authorize via buyer/authorize→ the signing artifact. - Sign locally (
@cryptoapis-io/mcp-signerevm_signtyped-data) → build the x402PaymentPayload(wire scheme is alwaysexact; the family is innetwork). - Retry with the base64
X-PAYMENTheader; return the paid response + theX-PAYMENT-RESPONSEsettlement.
Security
The private key is a tool parameter and may be logged by MCP clients or stored in conversation
history — use only in trusted local environments. This mirrors @cryptoapis-io/mcp-signer.
来源:README.md,提交 847b9df
工具
0版本历史
4- v0.5.3最新Sep 24, 2026
- v0.5.2Sep 24, 2026
- v0.5.1Sep 23, 2026
- v0.4.0Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分