x402-micro-tollgate is a self-hosted lightweight toll gateway that sits in front of existing APIs or MCP tools, providing AI Agents with pay-per-use access. Its core mechanism is: when an Agent calls a paid route, the gateway returns HTTP 402 as a price tag (rather than directly rejecting); after the Agent pays a small amount of USDC (or configured USDT), the gateway proxies the request to the upstream service. By default, settlement uses the Base network + USDC, completed through Coinbase CDP, and multi-network acceptance configuration is driven by environment variables.
Main capabilities include: HTTP 402 paywall, MCP paid tool support, browser HTML payment page (supporting Coinbase Smart Wallet connection and EIP-3009 signatures), Agent discovery directory (GET /x402/discover and /.well-known/x402.json), merchant registry (optional multi-tenant), FeeSplitter contract for 99.9%/0.1% revenue splitting, and security hardening against payment proof replay, SSRF, upstream bypass, and Base congestion delays.
Usage: requires Node.js 22+. Can be started with a one-line npx command (--seller / -s sets X402_PAY_TO), default HTTP + /mcp port 8402; docker compose up --build can also be used. Runs in demo mode without CDP keys (returns protocol-shaped 402, no on-chain settlement). Provides a TypeScript buyer/Agent client helper library, wrapping @x402/fetch and @x402/evm ExactEvmScheme, with a default single maximum spend of 0.05 USDC, a total spend cap of 1.00 USDC, and a circuit breaker. Also provides a CLI proof of concept for human-delegated Agent credit.
Use cases: API sellers want Agents to pay per call without building a billing console; tool builders publish paid MCP endpoints to Cursor / Claude; operators want Visa-like take-rate economics (0.1%) rather than hosted invoices.
Limitations and caveats: default settlement relies on a single vendor, Coinbase CDP; payment proof idempempotency is by default only in-process (cleared on restart), while on-chain uniqueness is guaranteed by the facilitator; micropayments ($0.001–$0.01) rely on Base's low fees, and when L2 gas spikes it may erode most of the payment, with an optional dynamic minimum price; FeeSplitter's release() is delayed release after receipt, not atomic same-transaction splitting; flash liquidity pools and reverse bounties are only planned and not launched; not an official Coinbase product, not a complete Agent marketplace, and not fiat custody.