File size: 1,809 Bytes
f4adf21
a5112d7
 
 
 
f4adf21
 
a5112d7
f4adf21
 
a5112d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: create-agent-gateway
emoji: 🛡️
colorFrom: purple
colorTo: pink
sdk: static
pinned: false
license: mit
---

# create-agent-gateway

A Cloudflare Worker template for pay-per-call agent gateways.

Bearer-key auth + mcent pricing + x402 signup + scoped keys + XP leaderboard + MCP server — packaged as a scaffolder so anyone can stand up their own agent API in ~2 minutes.

**Repo:** [github.com/walter-grace/create-agent-gateway](https://github.com/walter-grace/create-agent-gateway)

## Quickstart

```bash
npx create-agent-gateway my-api
cd my-api
wrangler kv:namespace create KEYS
wrangler secret put ADMIN_KEY
wrangler deploy
```

Replace the `/v1/example` handler in `src/index.ts` with your actual paid tool.

## What's in the box

- **Bearer-token auth** backed by Workers KV
- **mcent pricing** (1/1000¢) — sub-cent calls legible + storable 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 to block refund-farming
- **Agent Readiness** well-known routes (`/llms.txt`, `/.well-known/mcp.json`, `/robots.txt` with Content Signals)
- **MCP server** at `/mcp` — Claude Desktop / Cursor / Zed install in one config block

## Why

Agents need:
1. A way to authenticate — bearer keys beat OAuth dashboards
2. A balance to draw down — mcents so $0.01 covers 100 calls
3. A self-serve onramp — x402 so strangers mint keys programmatically
4. Reputation primitives — XP, levels, badges so markets reward quality
5. Discoverability — Agent Readiness + MCP so agents find you

Stripe, OAuth, and dashboards add friction agents can't traverse. This stack skips all of that.