x402 Wallet

v0.2.3
io.github.nirholas/x402-mcp Checked 2 hours ago Published 1 month ago

Self-custodial x402 wallet for AI agents: pay any service in USDC or $THREE from your own key.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

x402_wallet The agent's x402 spending wallet (address + balance)

Show a Solana wallet's address and live SOL + USDC balance. With no `address`, derives the wallet from the configured signer (SOLANA_SECRET_KEY) — call this before pay_and_call to confirm there's USDC to spend. Read-only; never moves funds.

ParameterTypeDescription
addressstringBase58 Solana address to inspect. Omit to use the configured signer wallet.

find_services Find paid x402 services the agent can call

Search the live x402 facilitator network (PayAI + Coinbase CDP bazaar) for paid services — HTTP APIs and MCP tools. Returns each match with its price, networks, and resource URL. Pass a resource into pay_and_call to use it. Read-only.

ParameterTypeDescription
query *stringWhat you need, e.g. "weather", "image upscale", "token intel".
limitintegerMax results (default 25).
max_price_usdcnumberOnly return services at or under this USDC price.
networkstringCAIP-2 network filter, e.g. "solana:*" or "eip155:8453".
typestringService kind to search.

inspect_endpoint Inspect an x402 endpoint (price + requirements, no payment)

Fetch an x402 endpoint and return its 402 payment requirements — every accepted scheme, network, asset, price and pay-to address — WITHOUT paying. If the endpoint is free, returns its result instead. No signer required. Use this to learn the cost before pay_and_call.

ParameterTypeDescription
url *stringThe x402 endpoint URL to inspect.
bodyobjectJSON body for a POST probe.
methodstringHTTP method to probe with.

pay_and_call Pay an x402 endpoint in USDC or $THREE and return its result

Call a paid x402 endpoint and settle the payment automatically, then return the result. Two modes: • Self-custodial (default): signs with SOLANA_SECRET_KEY or `secret` arg — you hold the key. • Session-governed: pass `session_token` (a three.ws Payment Session token) — the platform wallet signs on your behalf; the session's budget, allowlist, and per-tx cap are enforced by the platform. No private key required. Supports Solana USDC and Base USDC sessions. Pay in USDC (default) or, when the endpoint advertises it, in $THREE (set token:"three"). Bounded by max_usd and the MAX_PAY_USD c…

ParameterTypeDescription
url *stringThe x402 endpoint to pay and call.
bodyobjectJSON body for POST requests.
confirmbooleanMust be true to execute when REQUIRE_CONFIRM is on.
idempotency_keystringDeduplication key for this call. Recommended when using session_token to avoid double-charges on retries.
max_usdnumberHard ceiling for THIS call in USD. Can only lower the MAX_PAY_USD cap, never raise it.
methodstringHTTP method.
secretstringPer-call base58 signer override (defaults to SOLANA_SECRET_KEY). Ignored when session_token is set.
session_tokenstringthree.ws Payment Session token (pss_…). When provided, the platform wallet pays — no local key needed. Overrides `secret`.
tokenstringSettlement token. "usdc" (default) or "three" — the $THREE platform token; the endpoint must advertise it. Ignored when session_token is set.