How I Actually Deployed an x402 Pay-Per-Call API (And What Broke)
Real gotchas from shipping coinopai-mcp — from localhost to paid endpoints.
The Promise
x402 lets you gate API endpoints with USDC micropayments. Agents pay per call. You earn passively. The plumbing works. But getting from npm install to actually receiving payments took me three attempts and one silent infrastructure failure that would have blocked all revenue.
Here is the real path.
What I Built
coinopai-mcp — a local MCP server that serves crypto trading signals. Three paid tiers:
$0.05 — Basic signal (BTC/ETH price + trend)
$0.10 — Full technical analysis (RSI, MACD, EMA, Bollinger, ATR)
$0.15 — Narrative + wallet context
Stack: Express, x402 middleware, Coinbase CDP on Base Sepolia (testnet for now).
Attempt 1: Localhost Only
Got the server running on localhost:3456 . x402 middleware confirmed — 402 Payment Required responses on protected routes. Felt good.…