What You Need
- Claude Code installed
- The seller’s URL (e.g.
https://my-service.example.com) - A funded wallet with USDC on Base (testnet or mainnet)
For testnet, get free USDC from faucet.circle.com.
Step 1: Install Payments MCP
@coinbase/payments-mcp handles wallet signing and on-chain settlement. Install it with the interactive setup:
- Select Claude Code as your MCP client
- Choose automatic or manual configuration
- Complete the wallet login flow
~/.payments-mcp/ and the server is registered in your MCP config automatically.
See the Coinbase Payments MCP docs for detailed wallet setup and authentication.
Step 2: Add the Key0 Seller
Add the seller’s MCP server to your.mcp.json (project root) or use the CLI:
- .mcp.json
- CLI
.mcp.json
Finding the MCP URL
If the seller has MCP enabled, the URL is their base URL +/mcp:
How It Works
Once configured, just ask Claude to use the service. Claude handles the payment flow automatically:- Call
discover_plans— see available plans and pricing - Call
request_access— get a payment challenge (Key0 returns a PaymentRequired response) - Use
payments-mcp(make_http_request_with_x402) to sign and submit the USDC payment - Receive an access token (JWT) in the
AccessGrant - Call the protected API with the Bearer token
How payments-mcp works under the hood
This section explains what happens between step 2 and step 4 — the part that’s invisible from the CLI.Sequence diagram
What Key0 returns when payment is missing
When an agent callsrequest_access without a payment, Key0’s MCP integration returns:
structuredContent.accepts[]— thepaymentRequirementsarray to pass tomake_http_request_with_x402content[0].text— containsx402PaymentUrland human-readablepaymentInstructionsso the LLM can understand the next action even without structured content support
What payments-mcp does
Themake_http_request_with_x402 tool from @coinbase/payments-mcp:
- Receives the
x402PaymentUrl, the request body, and thepaymentRequirements(accepts array) - Signs an EIP-3009
transferWithAuthorizationoff-chain using the configured CDP (Coinbase Developer Platform) wallet - Base64-encodes the signed payload into the
payment-signatureheader - POSTs to
/x402/accesswith the header attached - Key0 settles the on-chain transfer via the gas wallet or facilitator
- Returns the
AccessGrantJSON to Claude
The buyer (Claude Code) never pays gas. The EIP-3009 authorization delegates the on-chain execution to Key0’s gas wallet, which covers all gas fees.
Try It Locally
Fund your wallet
Get Base Sepolia USDC from faucet.circle.com for your wallet address.
Troubleshooting
payments-mcp says 'wallet not funded'
payments-mcp says 'wallet not funded'
Your CDP wallet does not have sufficient USDC. Check the network — if the seller is on Base Sepolia, your wallet needs Base Sepolia USDC (not mainnet). Get free testnet USDC from faucet.circle.com.
Request fails with 'wrong network'
Request fails with 'wrong network'
The seller is on a different chain than your wallet. Check
GET /discover to see the seller’s network field (e.g., eip155:84532 = Base Sepolia, eip155:8453 = Base mainnet). Ensure your payments-mcp wallet is configured for the same network.Claude cannot find the 'discover_plans' tool
Claude cannot find the 'discover_plans' tool
The seller may not have MCP enabled. Verify by calling
GET https://my-service.example.com/.well-known/mcp.json. If you get a 404, the seller only supports x402 HTTP — use the Paying for Access guide instead with a custom script.payments-mcp is not installed or not in .mcp.json
payments-mcp is not installed or not in .mcp.json
Run
npx @coinbase/payments-mcp again to reinstall and re-register. Check ~/.mcp.json (global) or .mcp.json (project) to confirm the payments-mcp entry is present.CHALLENGE_EXPIRED error
CHALLENGE_EXPIRED error
The payment window (default 15 minutes) elapsed between the challenge being issued and the payment arriving. Ask Claude to retry — it will get a fresh challenge.
Next Steps
Paying for Access
Build a custom client: full EIP-3009 example with TypeScript and viem.
MCP Protocol Details
Full reference for the Key0 MCP tools, payment paths, and stateless architecture.
Building a Seller
Set up your own Key0-powered service that Claude Code can connect to.

