x402 Wallet

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

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

Values you need

VariableWhat it is
SOLANA_SECRET_KEYoptional secret Base58 (or JSON byte-array) Solana secret key that signs payments and holds the USDC. Not needed for the read tools (find_services, inspect_endpoint, or x402_wallet with an explicit address). Treat like cash.
SOLANA_RPC_URLoptional Solana mainnet RPC endpoint. Defaults to the public cluster — bring your own (Helius / Quicknode / Triton) for production traffic. Default: https://api.mainnet-beta.solana.com
MAX_PAY_USDoptional Max USD a single pay_and_call may spend. Bounds a runaway or injected payment. Default: 1
REQUIRE_CONFIRMoptional When on (default), pay_and_call refuses until re-issued with confirm:true. Set 0/false to disable the gate. Default: true
THREE_WS_BASEoptional Base URL of the three.ws API that serves /api/bazaar/search for find_services. Override only when self-hosting. Default: https://three.ws

npm (npx) verified

Requires Node.js 18+

Run in a terminal
claude mcp add x402-mcp -- npx -y @three-ws/x402-mcp@0.2.3
Add to claude_desktop_config.json
{
  "mcpServers": {
    "x402-mcp": {
      "args": [
        "-y",
        "@three-ws/x402-mcp@0.2.3"
      ],
      "command": "npx"
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "x402-mcp": {
      "args": [
        "-y",
        "@three-ws/x402-mcp@0.2.3"
      ],
      "command": "npx"
    }
  }
}
Add to .vscode/mcp.json
{
  "servers": {
    "x402-mcp": {
      "args": [
        "-y",
        "@three-ws/x402-mcp@0.2.3"
      ],
      "command": "npx",
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.x402-mcp]
command = "npx"
args = ["-y", "@three-ws/x402-mcp@0.2.3"]

For AI agents

  1. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  2. Restart or reload the client so it starts the server.
  3. Verify: the server should expose these tools: x402_wallet, find_services, inspect_endpoint, pay_and_call.
  4. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json