local402 drops a payment wall in front of any local server or MCP tool — so you can test paying AI agents with no wallet, no chain, and no real money.
npx local402 --target http://localhost:3000 --price 0.001
You just want to check that your agent notices a 402 and retries with payment. That shouldn't mean funding a testnet wallet every run.
Stand up a facilitator, fund a testnet wallet, wait on-chain, and untangle payment logic from your app — every single test run. Reproducing the "unpaid" path is its own chore.
One reverse proxy in front of your server. Instant, deterministic 402s. Point your agent at it and watch it learn to pay. Tear it down just as fast.
local402 is a tiny reverse proxy with one opinion. It sits between your agent and your server and checks a single header.
No blockchain, no wallets, no waiting. Instant, deterministic 402s you can build against offline.
npx local402 and you're guarding a server. Nothing to install, nothing to configure.
If it speaks HTTP, local402 can wall it. Drop it in front of an API, a webhook, or an MCP server.
Real 402 bodies and headers your client can parse, plus a simulated settlement receipt on paid calls.
/__local402 stays open and unpaywalled, so you can health-check the proxy any time.
MIT-licensed, tiny, one dependency. Fork it, tweak the pricing logic, ship your own.
You don't even need to install it — npx fetches it fresh.
Any local API or MCP tool. Say it's listening on port 3000.
$ node server.js
Point local402 at it. It listens on :4020 by default.
$ npx local402 --target http://localhost:3000
Unpaid gets a 402. Add the header and it's proxied through.
$ curl :4020 -H "x-payment: simulated"
One command stands between your agent and its first 402. Go find out if it pays up.
npx local402 --target http://localhost:3000 --price 0.001