Cloudflare Worker template
create-agent-gateway
Spin up a pay-per-call agent API in ~2 minutes. Bearer-key auth, mcent pricing, x402 crypto onramp, scoped keys, XP leaderboard, MCP server — all packaged as a scaffolder.
npx create-agent-gateway my-api
cd my-api
wrangler kv:namespace create KEYS
wrangler secret put ADMIN_KEY
wrangler deploy
What you get
- Bearer-token auth backed by Workers KV
- mcent pricing (1/1000¢) — sub-cent calls stored as integers
- x402 signup — strangers pay USDC on Base via Coinbase CDP facilitator
- Scoped keys (
crawl,label,read,all) for tiered access - XP + leaderboard + badges via a Durable Object (race-free)
- Refund policy with rate cap (blocks refund-farming)
- Agent Readiness well-known routes:
/llms.txt,/.well-known/mcp.json,/robots.txtwith Content Signals - MCP server at
/mcp— Claude Desktop / Cursor / Zed install with one config block
Why this pattern
Agents need (1) auth — bearer keys beat OAuth dashboards, (2) a balance — mcents so $0.01 buys 100 calls, (3) self-serve onramp — x402 so strangers mint keys programmatically, (4) reputation — XP and badges so the market rewards quality, (5) discoverability — Agent Readiness + MCP so agents find you. Stripe and OAuth add friction agents can't traverse. This stack skips all of that.