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-pay —
x402_fetchautomatically 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 distSecurity
Private keys are encrypted at rest using two layers:
| Layer | Method |
|---|---|
| User password | AES-256-CBC with PBKDF2 (600,000 iterations, SHA-512) |
| OS keychain | Electron 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:
| Tool | Description |
|---|---|
check_balance | Returns wallet address, network, and USDC balance |
send_usdc | Transfers USDC to an address (shows native confirmation dialog) |
get_transactions | Returns recent transaction history with timestamps and confirmations |
get_wallet_info | Returns address, network, USDC balance, ETH balance, and MCP port |
read_skill | Fetches and returns a SKILL.md file from a URL |
x402_fetch | Makes 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 dataClaude 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 blockchainThe 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:
- Check your balance — "How much USDC do I have?"
- Send USDC — "Send 5 USDC to 0xabc..." (requires confirmation in the wallet app)
- View transactions — "Show my last 10 transactions"
- Read skills — "Read the SKILL.md at https://api.402.md/api/v1/skills/my-skill/SKILL.md"
- Call paid APIs — "Fetch data from https://api.example.com/data" (auto-pays if 402)