x402 Wallet
io.github.nirholas由 GitHub 帳號 nirholas 發布v0.2.3更新於 Oct 24, 2026
Self-custodial x402 wallet for AI agents: pay any service in USDC or $THREE from your own key.
概覽
給 AI 助理的自託管 x402 錢包:探索付費服務、查看價格,並用你自己的 Solana 金鑰以 USDC 付款。
- 可以做什麼
- 查詢錢包位址與即時 SOL/USDC 餘額,並從本機帳本檔案讀取依商家與日期彙總的支出報告。在即時 x402 市集中搜尋付費 HTTP 或 MCP 服務,可依類型、網路與最高價格篩選。在不付款的情況下檢視某個端點的 402 付款要求,包括方案、網路、資產、價格與收款位址。用你的 Solana 金鑰以 USDC 支付 x402 端點並回傳結果,受單次與全域美元上限限制。呼叫 17 個價格固定的 three.ws 服務,涵蓋天氣、碳排、網域 RDAP、研究、書籍、新聞、交通與地點。
- 適用情境
- 當助理需要向 Solana 上的 x402 服務購買資料或 API 結果,且你願意為錢包挹注資金時使用。適合需要在付款前先確認價格,或希望使用固定價格的具名工具而非自行拼湊付款呼叫的代理。
- 執行需求
- 透過 npx 以 stdio 在本機執行,需要 Node.js 20 或更新版本。需要 Solana 主網 HTTPS RPC 端點;SOLANA_RPC_URL 預設使用公用叢集,適合讀取但不建議用於付款流量。付款需要一個持有 USDC 的 Solana 錢包,以 base58 形式的 SOLANA_SECRET_KEY 或單次呼叫的 secret 提供,也可改用 three.ws 工作階段權杖。選用設定包括 MAX_PAY_USD、REQUIRE_CONFIRM、THREE_WS_BASE 與 X402_MCP_LEDGER_PATH。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 x402 Wallet,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@three-ws/x402-mcp
Give any AI agent a self-custodial x402 wallet — discover, inspect, and pay any paid service in USDC from your own Solana key.
[npm] [license] [node] [MCP Registry] [three.ws]
A Model Context Protocol server that turns any AI assistant into an autonomous economic agent on the x402 network. Search the live bazaar for paid services, read an endpoint's price before committing money, and
pay_and_callany x402 service in USDC — settled on Solana with your own key, never a custodial wallet.
This is the buyer side of the three.ws agent economy. The payment dance and Solana exact-scheme signing are handled by the real @x402/* libraries — nothing is mocked.
Install
Or run with npx:
Quick start
Claude Code, one line:
Claude Desktop / Cursor (claude_desktop_config.json or mcp.json):
SOLANA_SECRET_KEY is only needed to spend (pay_and_call, and x402_wallet defaulting to your wallet). find_services and inspect_endpoint work with no key.
Tools
Plus 17 named tools, one per fixed three.ws x402 service, each cheaper for a model to call correctly than composing a raw pay_and_call(url):
Each takes the same arguments as its endpoint (see src/tools.json for the full schemas) and pays with the same SOLANA_SECRET_KEY / session_token settlement modes as pay_and_call, gated by the same MAX_PAY_USD cap and REQUIRE_CONFIRM flag. Prefer a named tool over pay_and_call whenever one exists for the endpoint you need: the fixed schema and stated price make the model far less likely to misdial the call.
Safety
pay_and_call carries destructiveHint: true, so annotation-aware clients (Claude Code, Claude Desktop, Cursor) prompt before running it. Beyond the client hint, every payment is bounded server-side: it probes the 402 first and refuses if the price exceeds max_usd or MAX_PAY_USD (default $1) before any money moves, and with REQUIRE_CONFIRM on (default) the call refuses until re-issued with confirm: true. Only the Solana (solana:*) exact-scheme requirement is settled — with the key you control.
Input parameters
x402_wallet — address (optional base58; defaults to the signer wallet).
find_services — query (required), type (http | mcp, default http), network (CAIP-2 filter), max_price_usdc, limit (1–100).
inspect_endpoint — url (required), method (GET | POST), body (object).
pay_and_call: url (required), method (GET | POST), body (object), max_usd (lowers the cap for this call), secret (per-call signer override), confirm (must be true when REQUIRE_CONFIRM is on), session_token, token, idempotency_key.
It has two settlement modes:
- Self-custodial (default). Signs with
SOLANA_SECRET_KEY, or the per-callsecret. You hold the key. - Session-governed. Pass
session_token, a three.ws Payment Session token, and the platform wallet signs on your behalf while enforcing that session's budget, host allowlist, and per-transaction cap. No private key needed. Solana USDC and Base USDC sessions are both supported, andsecretandtokenare ignored in this mode.
token selects the settlement asset: usdc (default), or three for the $THREE platform token when the endpoint advertises it. idempotency_key deduplicates a call, which is recommended with session_token so a retry cannot double-charge.
Example
Examples
Runnable, no-payment examples live in examples/:
Both spawn this server over stdio and hit the real bazaar. Neither reads a key or
calls pay_and_call, so nothing is signed and nothing is spent. See
examples/README.md for expected output.
Protocol versions
pay_and_call speaks both x402 wire formats on the same Solana key: v2 (CAIP-2 network strings, e.g. solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp) and v1 (flat network strings, e.g. solana), the format most of the open x402 bazaar, and services built on the original x402/x402-fetch packages, still speak. When a seller advertises both, v2 is always preferred. Settlement receipts come back in the same shape (success, transaction, network, payer) regardless of which version paid, so nothing downstream needs to know which one was used.
Requirements
- Node.js >= 20.
- A Solana mainnet RPC endpoint (
https; onlyhttp://localhostis allowed for dev). Public cluster works for reads; bring your own for payment traffic. - To pay: a Solana wallet holding USDC, as a base58
SOLANA_SECRET_KEY(or per-callsecret).
Environment variables
X402_MCP_LEDGER_PATH points at the append-only JSON-lines file every settled payment (pay_and_call and the named tools) is recorded to; spending_report reads it back.
Links
- Homepage: https://three.ws
- MCP catalog: https://three.ws/docs/mcp
- Changelog: https://three.ws/changelog
- Issues: https://github.com/nirholas/three.ws/issues
- License: Apache-2.0, see LICENSE
Part of the three.ws SDK suite — 3D AI agents, on-chain identity, and agent payments.
Website · Changelog · GitHub
來源:packages/x402-mcp/README.md,提交 914d712
工具
0版本歷史
2- v0.2.3最新Oct 10, 2026
- v0.2.2Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分