Agent Tollbooth 402
This MCP server supports agent-payment tollbooth operations: quoting fees, checking wallet balances, issuing signed bearer receipts, verifying x402 payments, and generating checkout links.
Compute clearinghouse fee and developer net payout across Free/BYO x402, Hybrid, and Pro/Agency tiers in integer USD microdollars.
Inspect an agent wallet’s prepaid balance, status, and remaining UTC daily spend cap.
Issue short-lived Rail B
rcs_receipt_hs256bearer authorization tokens against prepaid credits, with optional method, audience, scheme, and idempotency controls.Verify x402 V2 payment payload signatures and expiry against requirements and replay records without executing on-chain transfers.
Generate Stripe Checkout or sandbox URLs to fund wallets ($1+) or buy Pro ($39) / Agency ($79) passes, without charging automatically.
Supports Cloudflare D1 as a nonce store for replay protection in the tollbooth middleware.
Provides edge middleware for Cloudflare Workers to add HTTP 402 payment gating to APIs and routes, with optional D1-based nonce replay protection.
Scans Express routes to identify endpoints that can be wrapped with tollbooth monetization.
Offers Hono middleware (honoTollbooth) to monetize Hono app routes with HTTP 402 payments.
Enables adding withTollbooth payment gating to Next.js route handlers and supports scanning Next.js App Router endpoints.
Integrates with Stripe for fiat-funded agent wallets and Stripe Connect payouts in the hybrid clearinghouse payment rail.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
Agent Tollbooth 402
Monetize APIs, Cloudflare Workers, Hono apps, Next.js routes, and MCP servers in under 60 seconds with dual-rail HTTP 402 payments.
Built by Red Center Studio for Google Antigravity and Claude Code.
3-Line Quickstart (30-Second Zero-Config Sandbox)
npm install
npm run validate
npm run test:sandboxZero API keys, zero crypto wallets, and zero Stripe setup required to run your first 402 -> sign -> 200 OK loop locally.
Related MCP server: Loop MCP DualRail
5-Line withTollbooth Setup
Copy-paste into any Cloudflare Worker, Web Fetch handler, or Next.js route:
import { withTollbooth } from "@redcenterstudio/agent-tollbooth-edge";
export default withTollbooth({ priceUsd: 0.01, mode: "hybrid" }, async (request) => {
return Response.json({ ok: true, path: new URL(request.url).pathname });
});Local test without wallets or keys: change
mode: "hybrid"tomode: "sandbox"and callcreateSandboxReceipt()orcreateSandboxX402Header().Hono middleware:
app.use("/api/*", honoTollbooth({ priceUsd: 0.01, mode: "hybrid" })).Cloudflare D1 replay protection: pass
nonceStore: new D1NonceStore(env.DB)insidewithTollbooth((env) => ({ ... }), handler).
Live Clearinghouse & Screenshots
Live clearinghouse portal & MCP endpoint: https://tollbooth.redcenterstudio.com (/pay · /demo/402)
Setup Walkthrough Video (MP4) — copying the install command, running the live
402check, and inspecting the browser checkout card.

HTTP 402 Browser Checkout Card | Mobile Responsive Layout ( |
|
|
Dual-Rail Architecture & Browser 402 Checkout Card
agent-tollbooth-402 supports both x402 V2 on-chain USDC authorizations and Red Center Fiat Agent Wallets verified in <1ms via Web Crypto (HMAC-SHA256 / Ed25519).
Programmatic AI Agents (
Accept: application/json): Receive402 Payment Requiredwith Base64PAYMENT-REQUIRED,WWW-Authenticate, CORSAccess-Control-Expose-Headers,priceUsd,acceptedRails,code, and a plain-Englishfix_hint.Human Browser Requests (
Accept: text/html): Receive a responsive Red Center Studio402Checkout Card (#24181aIronstone,#d9622bRed Ochre,#e3a23cSpinifex Gold,#f5efe6Sand) displaying endpoint details, price, payment curl snippets, and a Fund Agent Wallet action link.
flowchart LR
Agent["AI Agent / Browser"] -->|1. Request API or /mcp| Edge["@redcenterstudio/agent-tollbooth-edge"]
Edge -->|2. Unpaid -> 402 JSON or HTML Card| Agent
Agent -->|3A. Rail A: PAYMENT-SIGNATURE x402 V2| Edge
Agent -->|3B. Rail B: Bearer rcs_receipt_... <1ms Web Crypto| Edge
Edge -->|4A. /verify & /settle| Facilitator["Clearinghouse Worker / Facilitator"]
Edge -->|4B. HMAC-SHA256 / Ed25519 + D1 used_nonces| NonceDB[("Cloudflare D1")]
Facilitator -->|Atomic Debit & Ledger| NonceDB
Edge -->|5. 200 OK + PAYMENT-RESPONSE| AgentPricing & Revenue Split
Tier | Price | Clearinghouse Fee (Developer Net) | What You Get |
Free / BYO x402 Mode |
|
| Unlimited |
Hybrid Fiat + x402 Clearinghouse |
|
| Enables Stripe-funded Fiat Agent Wallets ( |
Tollbooth Pro Pass |
|
| Drops clearinghouse fee from |
Done-For-You Integration | From | Custom | End-to-end custom MCP + HTTP 402 Tollbooth wrapping, D1 ledger setup, and verification by Red Center Studio. |
Plugin Installation (Antigravity + Claude Code)
Install in Claude Code:
/plugin install agent-tollbooth-402 --marketplace Red-Center-Studio/agent-tollbooth-402Install in Antigravity (~/.gemini/config/plugins/):
git clone https://github.com/Red-Center-Studio/agent-tollbooth-402.git ~/.gemini/config/plugins/agent-tollbooth-402Install the zero-dependency Edge Middleware in a Worker, Hono, or Next.js project:
npm install github:Red-Center-Studio/agent-tollbooth-402Remote MCP Server (
mcp_config.json&.mcp.json): Connects tohttps://tollbooth.redcenterstudio.com/mcpvia Streamable HTTP (tollbooth_pricing_quote,tollbooth_wallet_balance,tollbooth_issue_receipt,tollbooth_verify_x402). See our Privacy Policy.Skills (
skills/):scan-routes: Audits Cloudflare Workers, Hono, Next.js App Router, Express, and MCP endpoints.install-tollbooth: Auto-detects framework, previews diff, and injects 1-stepwithTollbooth(...).test-agent: Runs the 30-second zero-config sandbox402 -> sign -> 200 OKsmoke test.
Scoped Guardrails (
rules/http-402-guardrails.md): Enforces bypass exemptions, constant-time Web Crypto checks, replay protection, downstream5xxidempotency, integer microdollar math, and spend caps.
Troubleshooting FAQ
Error Code | Meaning | Fix ( |
| Request had neither | Attach an x402 V2 |
| Payment authorization or wallet balance is below | Authorize at least |
|
| Re-sign a fresh receipt or x402 authorization using synchronized UTC seconds. |
| The receipt | Generate a new unique |
| Web Crypto HMAC/Ed25519 verification failed, or | Confirm |
Browser CORS blocked reading headers | Browser client cannot read | Middleware automatically sets |
Reference Clearinghouse Note (
packages/clearinghouse-worker): Includes placeholder D1 IDs (wrangler.jsonc) and.dev.vars.exampleplaceholders. Supply your own D1 database and Wrangler secrets before deploying to your own Cloudflare account.
License
MIT — Red Center Studio (https://redcenterstudio.com)
Available Tools
5 toolstollbooth_create_topup_checkoutGenerate Checkout Link URLARead-onlyIdempotentInspect
Return a Stripe Checkout or sandbox link URL that a user can open in a browser to fund a wallet ($1+) or purchase a Pro ($39) / Agency ($79) Pass. Never charges automatically.
Inputs: passTier, walletId, amountUsd, developerId.
tollbooth_issue_receiptIssue Signed Bearer ReceiptAInspect
Issue a short-lived Rail B rcs_receipt_hs256 bearer authorization token against an existing prepaid credit balance. Does not move bank or crypto funds.
Inputs: audience (required), walletId (required), developerId (required), amountMicros (required), +3 more.
tollbooth_pricing_quotePricing & Net Revenue QuoteARead-onlyIdempotentInspect
Compute clearinghouse fee and developer net payout across Free BYO x402 (0%), Hybrid (7%), and Tollbooth Pro/Agency (3%) tiers in integer USD microdollars.
Inputs: priceMicros (required), callsPerMonth (required).
tollbooth_verify_x402Verify x402 V2 Payment HeaderARead-onlyIdempotentInspect
Verify an x402 V2 paymentPayload signature and expiry against paymentRequirements and replay records. Does not execute on-chain transfers.
Inputs: x402Version (required), paymentPayload (required), paymentRequirements (required).
tollbooth_wallet_balanceCheck Wallet Credit BalanceARead-onlyIdempotentInspect
Inspect an agent wallet credit balance, status, and remaining UTC daily spend cap. Read-only lookup.
Inputs: walletId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct stage of the payment lifecycle: quoting, balance lookup, receipt issuance, inbound x402 verification, and top-up checkout. The descriptions explicitly bound each tool (read-only, does not move funds, never charges automatically), so there is no realistic risk of misselection.
All tools share the tollbooth_ prefix and snake_case, giving a predictable namespace. Three follow verb_noun (issue_receipt, verify_x402, create_topup_checkout) while two are noun_noun (pricing_quote, wallet_balance), a minor deviation that remains readable.
Five focused tools covering quote, inspect, authorize, verify, and fund is well-scoped for a payment-authorization service. Each tool earns its place with no redundant or filler operations.
The core loop (quote → fund → check balance → issue receipt → verify payment) is covered end to end. Minor gaps exist: no way to introspect or revoke an issued receipt, and no spend/usage history beyond a point-in-time balance.
Maintenance
Related MCP Connectors
Pay-per-action access to APIs and MCP tools over Lightning L402 and Base USDC x402.
Monetize any MCP server: x402 paywall, pay-per-call billing in USDC on Base, agent marketplace.
Billing proxy for MCP servers. Adds Stripe and x402 crypto payments without writing billing code.
Free self-hosted x402 USDC billing for Cloudflare MCP servers, with a Base Sepolia test endpoint.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceHTTP 402 paywall middleware for MCP servers. XRPL/RLUSD native settlement, Phase 3 compliance receipts, zero API keys required.1MIT

Loop MCP DualRailofficial
AlicenseNot gradedqualityBmaintenanceEnables AI agents to pay for MCP tool calls using either Bitcoin/Lightning (L402) or USDC (x402) rails, with unified settlement and a 21% discount for Bitcoin payments.32 npmMIT- AlicenseNot gradedqualityDmaintenanceNon-custodial payment engine for AI agents supporting BTC, ETH, USDT, USDC, XRP, XMR, and ZEC. Exposes wallet, invoice, and payment tools over MCP with per-agent spend limits, plus x402 pay-per-call support.62 npmBusiness Source 1.1
- AlicenseBqualityCmaintenanceMCP server providing AI agents access to 38 pay-per-call APIs (LLM, image, code, audio, crypto, web, IPFS) via HTTP 402 micropayments in USDC/USDm.22140 npm1MIT

