x402 Wallet
io.github.nirholasPublished by GitHub account nirholasv0.2.3Updated Oct 24, 2026
Self-custodial x402 wallet for AI agents: pay any service in USDC or $THREE from your own key.
Overview
A self-custodial x402 wallet for AI assistants: discover paid services, check their prices, and pay them in USDC from your own Solana key.
- What you can do
- Look up a wallet's address and live SOL/USDC balance, and read a spending report of past payments by merchant and day, from a local ledger file. Search the live x402 bazaar for paid HTTP or MCP services, filtered by type, network and maximum price. Inspect an endpoint's 402 payment requirements, including scheme, network, asset, price and pay-to address, without paying. Pay an x402 endpoint in USDC from your Solana key and return its result, bounded by a per-call and global USD cap. Call 17 fixed three.ws services with stated prices, such as weather, carbon, domain RDAP, research, books, news, transit and places.
- When to use it
- Use it when an assistant should buy data or API results from x402 services on Solana and you are willing to fund a wallet. It suits agents that need to check a price before committing money, or that want fixed-price named tools instead of composing raw payment calls.
- Requirements
- Runs locally over stdio via npx, so Node.js 20 or newer is needed. A Solana mainnet HTTPS RPC endpoint is required; SOLANA_RPC_URL defaults to the public cluster, which is fine for reads but not recommended for payment traffic. Paying needs a Solana wallet holding USDC, supplied as the base58 SOLANA_SECRET_KEY or a per-call secret, or a three.ws session token instead. Optional settings include MAX_PAY_USD, REQUIRE_CONFIRM, THREE_WS_BASE and X402_MCP_LEDGER_PATH.
Installation
In SourceWeft
- Open x402 Wallet in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
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
Source: packages/x402-mcp/README.md at commit 914d712
Tools
0Version history
2- v0.2.3LatestOct 10, 2026
- v0.2.2Sep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
