MCP server charges AI agents per call via x402 micropayments
The Toolstem Team built an MCP server that uses the x402 protocol to charge AI agents per tool call in USDC micropayments, with no human sign-up, Stripe account, or OAuth flow required.
Score breakdown
The x402 approach removes the human-in-the-loop billing requirement entirely, enabling AI agents to autonomously pay for tool calls on a per-use basis without Stripe accounts, OAuth flows, or subscription sign-ups.
- 01The x402 protocol revives HTTP 402 (reserved since 1996) as a machine-to-machine payment standard built on EIP-3009.
- 02Agents pay in USDC via a signed EIP-3009 `transferWithAuthorization`; only the server needs an ETH float for gas.
- 03Settlement confirms in under 2 seconds on Base mainnet with gas costs of roughly $0.001 per transaction.
The Toolstem Team built a Cloudflare Worker-based paywall proxy that sits between the public internet and an upstream MCP server, intercepting every request to enforce per-call USDC micropayments via the x402 protocol. The x402 protocol revives HTTP 402 — a status code reserved since 1996 — as a machine-to-machine payment standard built on EIP-3009. The flow works as follows: an agent makes a normal request, receives a 402 response containing the payment amount, recipient address, network, token, and nonce, then signs an EIP-3009 `transferWithAuthorization` and retries with an `X-Payment` header. The server verifies the signature, checks nonce freshness and amount, submits the on-chain transfer, and only then forwards the request upstream. Settlement confirms in under 2 seconds on Base mainnet; gas costs roughly $0.001, and the agent only needs USDC since the server holds the ETH float for gas.
The post notes that an earlier flat-rate pricing model of $0.005 across all tools generated $0 revenue over six weeks, motivating the tiered approach.
A key architectural constraint is that `initialize` and `tools/list` must remain unmetered — paywalling discovery prevents agents from ever calling the server and causes it to drop off directory listings such as Glama, mcp.so, and PulseMCP. The post also details a tiered per-tool pricing model on a SEC EDGAR server, ranging from $0.005 for a simple `getCompanyFilingsSummary` call up to $0.50 for `compareDisclosureSignals`, which cross-references insider trades, 13F institutional moves, and 8-K clusters across multiple companies — roughly 100x the compute of the cheapest tool. The post notes that an earlier flat-rate pricing model of $0.005 across all tools generated $0 revenue over six weeks, motivating the tiered approach. On the client side, a `createX402Fetch` wrapper for LangChain.js intercepts 402 responses, signs the authorization using the agent's private key, and retries transparently, with a configurable `maxPaymentUsd` cap per call to guard against misconfigured or malicious servers.
Key facts
- 01The x402 protocol revives HTTP 402 (reserved since 1996) as a machine-to-machine payment standard built on EIP-3009.
- 02Agents pay in USDC via a signed EIP-3009 `transferWithAuthorization`; only the server needs an ETH float for gas.
- 03Settlement confirms in under 2 seconds on Base mainnet with gas costs of roughly $0.001 per transaction.
- 04A Cloudflare Worker acts as a paywall proxy between the public internet and the upstream MCP server.
- 05`initialize` and `tools/list` calls are kept free so agents can discover tools and directory health-check probes continue to work.
- 06The SEC EDGAR server uses tiered pricing from $0.005 (`getCompanyFilingsSummary`) to $0.50 (`compareDisclosureSignals`), a 100x price spread reflecting ~100x compute difference.
- 07A flat $0.005 rate across all tools on the Finance MCP server generated $0 revenue over six weeks, motivating the tiered model.
Topics
Summary and scoring are generated automatically from the original article. We always link back to the publisher and never republish images or paywalled content. Last processed Jun 16, 2026 · 23:11 UTC. How this works →