b402-mcp
v0.3.17
Published
Private DeFi MCP server. 12 tools. ZK proofs. Gasless. Every DeFi primitive on Base — privately.
Downloads
1,762
Maintainers
Readme
b402-mcp
Model Context Protocol server for b402 payments and private DeFi.
Works with Claude Desktop, Cursor, Copilot, and other MCP-compatible clients.
5-line quickstart
export WORKER_PRIVATE_KEY=0xYOUR_BASE_KEY
export SEQUENCER_URL=https://your-sequencer-url
npx -y [email protected] --help
claude mcp add b402 --scope user -e WORKER_PRIVATE_KEY=$WORKER_PRIVATE_KEY -e SEQUENCER_URL=$SEQUENCER_URL -- npx -y [email protected]
# then ask Claude: "run b402_balance"Claude Desktop / MCP config snippet
{
"mcpServers": {
"b402": {
"command": "npx",
"args": ["-y", "[email protected]"],
"env": {
"WORKER_PRIVATE_KEY": "0x...",
"SEQUENCER_URL": "https://your-sequencer-url"
}
}
}
}Payment tools
| Tool | Description |
|------|-------------|
| b402_pay | Gasless b402 sequencer payment |
| b402_balance | Sequencer credit or wallet/pool balance |
| b402_create_invoice | Creates invoice payload + b402://pay URL |
| pay_via_b402 | Standard HTTP 402 verify+settle flow with payment signature retry |
Private DeFi tools
| Tool | Description |
|------|-------------|
| shield_usdc | Move USDC into the Railgun privacy pool |
| check_pool_balance | Show wallet + shielded balances and positions |
| get_swap_quote | Read-only DEX quote across Base liquidity |
| private_swap | Swap in privacy pool with ZK proof |
| lend_privately | Lend from pool into Morpho vault |
| redeem_privately | Redeem from Morpho vault back to pool |
| run_strategy | Multi-step private strategy (swap + lend + reserve) |
Copy-paste E2E prompt
1) Run b402_balance with my agentId.
2) Create an invoice for 0.05 USDC with memo "demo call".
3) Run pay_via_b402 on my paid API URL.
4) Run b402_balance again and summarize the delta.Network notes
pay_via_b402parses both Base and BNB x402 payment requirements.- Automatic funding (
fundIncognito) currently uses Base USDC only. - Base private DeFi tools (
shield_usdc,private_swap,lend_privately, etc.) remain Base-focused.
Environment
| Variable | Required | Description |
|----------|----------|-------------|
| WORKER_PRIVATE_KEY | Yes | Base wallet private key used by b402 |
| SEQUENCER_URL | For b402_pay / credit tools | b402 sequencer endpoint |
| BASE_RPC_URL | No | Custom Base RPC URL |
| BNB_RPC_URL | No | Optional RPC used when x402 requirement is BNB |
| FACILITATOR_URL | No | Custom b402 facilitator URL |
Links
- SDK: @b402ai/sdk
- Package: b402-mcp
- GitHub: b402ai/b402-sdk
