402.md

x402 Wallet

Desktop USDC wallet with embedded MCP server and automatic x402 payments

Features

  • Create or import an Ethereum wallet (private key)
  • Send and receive USDC on Base or Base Sepolia
  • Transaction history with block confirmations and direction labels
  • Network toggle between Base mainnet and Base Sepolia testnet
  • Embedded MCP server on port 3402 — 6 tools for AI integration
  • x402 auto-payx402_fetch automatically handles HTTP 402 responses

Install

Download the latest .dmg (macOS) or installer from the releases page.

Or build from source:

git clone https://github.com/402-md/x402-wallet.git
cd x402-wallet
npm install
npm run dist

Security

Private keys are encrypted at rest using two layers:

LayerMethod
User passwordAES-256-CBC with PBKDF2 (600,000 iterations, SHA-512)
OS keychainElectron safeStorage (macOS Keychain, Windows DPAPI)

Additional protections:

  • 15-minute auto-lock — wallet locks after inactivity, clearing keys from memory
  • Password-gated sends — native confirmation dialog before every USDC transfer
  • Sandbox mode — Electron context isolation enabled, no Node access from renderer

Embedded MCP server

The wallet runs an MCP server on http://localhost:3402/mcp (port configurable in settings). It exposes 6 tools:

ToolDescription
check_balanceReturns wallet address, network, and USDC balance
send_usdcTransfers USDC to an address (shows native confirmation dialog)
get_transactionsReturns recent transaction history with timestamps and confirmations
get_wallet_infoReturns address, network, USDC balance, ETH balance, and MCP port
read_skillFetches and returns a SKILL.md file from a URL
x402_fetchMakes HTTP requests with automatic x402 payment handling

x402_fetch

The x402_fetch tool wraps HTTP requests with the x402 payment protocol. When a server responds with HTTP 402, the tool automatically signs a USDC payment and retries the request — no manual intervention needed.

Agent calls x402_fetch("https://api.example.com/data")
  → Server responds 402 Payment Required ($0.05 USDC)
  → Wallet signs USDC transfer on Base
  → Retries request with X-402-Payment header
  → Returns 200 OK with data

Claude extension

The x402 Wallet Extension is an .mcpb bundle that bridges Claude Desktop to the wallet via stdio-to-HTTP forwarding.

Install the extension

Double-click the x402-wallet-extension.mcpb file. Claude Desktop will prompt you to install it.

Manual setup

If you prefer manual configuration, add to your claude_desktop_config.json:

{
  "mcpServers": {
    "x402-wallet": {
      "command": "node",
      "args": ["/path/to/x402-wallet-extension/server.js"],
      "env": {
        "WALLET_PORT": "3402"
      }
    }
  }
}

Set WALLET_PORT to match the port configured in the wallet app (default: 3402).

How it works

Claude Desktop ←stdio→ Extension (server.js) ←HTTP→ Wallet MCP (port 3402) ←→ Base blockchain

The extension re-exposes all 6 wallet tools over stdio. Each tool call is forwarded as an HTTP request to the wallet's MCP server. If the wallet app is not running, the extension returns an error message asking you to start it.

Available tools in Claude

Once connected, Claude can: