
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 分