{
  "markdown": "<div align=\"center\">\n\n# 🍋 LemonCake\n\n**The billing, budget & identity layer for software for agents.** `Private Beta · Open core`\n\n*Monetize any MCP/API in minutes, and let AI agents pay for it safely — each agent gets a spend-capped identity (budget, usage, pause/revoke). Buyers pay by card; **no crypto wallet**.*\n*First 3,000 calls free (lifetime). Then 3% only when your API earns.*\n\n[![License: MIT (SDK)](https://img.shields.io/badge/license-MIT_(SDK)-green.svg)](LICENSE)\n[![Open core](https://img.shields.io/badge/model-open--core-brightgreen.svg)](#-open-core)\n[![MCP Compatible](https://img.shields.io/badge/MCP-compatible-blue.svg)](https://modelcontextprotocol.io)\n[![x402 native](https://img.shields.io/badge/x402-native-blueviolet)](https://x402.org)\n[![npm: agent-payment-mcp](https://img.shields.io/npm/v/agent-payment-mcp?label=agent-payment-mcp)](https://www.npmjs.com/package/agent-payment-mcp)\n[![FSA-confirmed](https://img.shields.io/badge/Japan_FSA-registration_not_required-blue)](https://lemoncake.xyz/security)\n[![Glama score](https://glama.ai/mcp/servers/evidai/lemon-cake/badges/score.svg)](https://glama.ai/mcp/servers/evidai/lemon-cake)\n\n**[🚀 Get started](#-get-started) · [💲 Pricing](https://lemoncake.xyz/pricing) · [📚 Docs](https://lemoncake.xyz/docs) · [🌐 Live](https://lemoncake.xyz)**\n\n<br>\n\n<img src=\"https://raw.githubusercontent.com/evidai/agent-unleashed/main/demo.gif\" alt=\"An AI agent pays for paid API calls on its own — spend-capped, no crypto\" width=\"760\">\n\n<sub>☝️ A real AI agent buys API calls by itself ($0.01 each), stops at its cap, and the API owner earns — no human, no crypto. · <a href=\"https://github.com/evidai/agent-unleashed\">demo source</a></sub>\n\n</div>\n\n---\n\n## 🚀 Get started\n\n**Monetizing an MCP/API? Start here — one command:**\n\n```bash\nnpx create-lemon-mcp my-paid-mcp     # a paid MCP server, running in sandbox now\n# then add a Seller Key in /app and set LEMONCAKE_SELLER_KEY → it charges for real (no code change)\n```\n\nPick your path:\n\n| I want to… | Do this |\n|---|---|\n| **Monetize my MCP/API** (sellers) | **`npx create-lemon-mcp`** → add a Seller Key in [/app](https://lemoncake.xyz/app) to go live |\n| Add billing to a server I **already have** | [`@lemon-cake/mcp-sdk`](https://www.npmjs.com/package/@lemon-cake/mcp-sdk) — wrap a tool with `lc.charge()`, or route through the gateway (no code) |\n| **Let an agent pay** for paid APIs (buyers) | `npx -y agent-payment-mcp` — 8 free demo tools, no signup |\n\n<details>\n<summary>Buyer-side MCP — try in 30 seconds</summary>\n\n```bash\nnpx -y agent-payment-mcp\n```\n```json\n{ \"mcpServers\": { \"lemon\": { \"command\": \"npx\", \"args\": [\"-y\", \"agent-payment-mcp\"] } } }\n```\nAsk your agent to run `list_demos` / `call_demo`. To call **paid** APIs, set `LC_PAY_TOKEN` (get one at [lemoncake.xyz/app](https://lemoncake.xyz/app)).\n\n</details>\n\n---\n\n## What is LemonCake?\n\nLemonCake is an **x402 payment rail** for monetizing MCP servers and HTTP APIs. Sellers register an endpoint and set a price per call. Buyers prepay by card and receive a spend-capped Pay Token. Agents call the gateway with that token, and LemonCake verifies, meters, forwards, and records usage.\n\n```mermaid\nsequenceDiagram\n    participant A as 🤖 AI Agent\n    participant G as 🍋 LemonCake Gateway\n    participant API as Your API\n    A->>G: POST /g/:id (no token)\n    G-->>A: 402 + accepts[] (price, mintUrl)\n    A->>G: mint Pay Token (off-session, capped)\n    A->>G: Bearer :jwt\n    G->>API: forward (upstream key hidden)\n    API-->>A: 200 + result\n    Note over A,G: budget exhausted → 402 → agent self-funds → continues\n```\n\n**Sellers** register any HTTP API and set a price per call.\n**Buyers / agents** prepay with a card → Pay Token issued automatically → agent calls the API within budget.\nBudget exhausted → 402 challenge → agent self-funds → continues. No humans.\n\n---\n\n## 🧱 Open core\n\n| Layer | Status | Where |\n|---|---|---|\n| Buyer-side MCP (`agent-payment-mcp`) | ✅ MIT | [npm](https://www.npmjs.com/package/agent-payment-mcp), [src](./mcp-server) |\n| Seller SDK (`@lemon-cake/mcp-sdk`) | ✅ MIT | [npm](https://www.npmjs.com/package/@lemon-cake/mcp-sdk), [src](./lemoncake-mcp-sdk) |\n| Starter templates | ✅ MIT | [examples/](./examples) |\n| Docs site | ✅ Public | [lemoncake.xyz/docs](https://lemoncake.xyz/docs) |\n| **Gateway + billing engine** | 🔒 Hosted | lemoncake.xyz |\n| **Dashboard** (analytics, usage ledger) | 🔒 Hosted | lemoncake.xyz/app |\n\n---\n\n## 💳 How payment works\n\n### For buyers (human or agent)\n\n1. Open a **buy link** (`lemoncake.xyz/buy/<shortId>`)\n2. Pay with a card → **Pay Token (JWT) issued automatically**\n3. Pass `Authorization: Bearer <token>` to the gateway\n4. Gateway verifies, meters, forwards to the real API\n5. Budget exhausted → 402 challenge returned with payment instructions\n\n### For agents (fully autonomous)\n\n1. Issue a **Buyer Key** (`bk_...`) at [/app](https://lemoncake.xyz/app) → Pay Tokens pane\n2. Save a card once at [/agent/fund](https://lemoncake.xyz/agent/fund)\n3. Agent calls `POST /api/lc/agent/tokens` (Bearer bk_) → off-session card charge → JWT\n4. Agent uses JWT to call gateway — **hard-capped, no human in the loop**\n\n```json\n// MCP config for agent with pre-issued Pay Token\n{\n  \"mcpServers\": {\n    \"lemon\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"agent-payment-mcp\"],\n      \"env\": {\n        \"LC_PAY_TOKEN\": \"<jwt from Pay Token>\"\n      }\n    }\n  }\n}\n```\n\n---\n\n## 🏗 Publish your API on LemonCake (sellers)\n\nMonetize any HTTP API or MCP server:\n\n1. Sign in at [lemoncake.xyz/app](https://lemoncake.xyz/app)\n2. **Add API** — paste your URL, set price per call (e.g. `$0.01`)\n3. Share the **buy link**, or issue a **Seller Key** (`sk_live_…`) to charge from your own server\n4. **You keep 97%.** LemonCake takes 3% (Stripe Connect Direct Charge). Never holds funds.\n\n**Scaffold a paid MCP in one command** — sandbox by default, production with one env var:\n\n```bash\nnpx create-lemon-mcp my-paid-mcp     # demo runs with no key\n# then: set LEMONCAKE_SELLER_KEY=sk_live_… → it charges for real (no code change)\n```\n\nAdd billing to any tool with the SDK ([`@lemon-cake/mcp-sdk`](https://www.npmjs.com/package/@lemon-cake/mcp-sdk) v1, no crypto):\n\n```typescript\nimport { createLemonCakeSDK } from \"@lemon-cake/mcp-sdk\";\n\nconst lc = createLemonCakeSDK();   // reads LEMONCAKE_SELLER_KEY (demo without it)\n\nserver.tool(\"my_premium_tool\", \"desc\", { q: z.string() },\n  lc.charge({ price: 0.01 })(async ({ q }) => {\n    return { content: [{ type: \"text\", text: \"result\" }] };\n  }),\n);\n```\n\n`lc.charge` wraps the handler: preflight (reserve) → run → settle (confirm on success, refund on failure). Or route existing traffic through `https://lemoncake.xyz/g/<shortId>` — **no code changes required**.\n\n---\n\n## 🪪 Agent Identity\n\nGive each AI agent its own spend-capped identity — so a fleet can pay for APIs without a shared card or runaway cost. Built on top of Pay Tokens; **no balance pool, custody-free** (an agent's \"budget\" is just the Pay Tokens bound to it).\n\n- **Bind a Pay Token to an agent** when issuing it (`agentId`) → spend is attributed to that agent.\n- **Per-agent rollup** — budget, spend, calls, last-used in the dashboard.\n- **Kill switch** — `pause` / `resume` / `revoke` an agent; bound tokens are rejected at the gateway instantly (`AGENT_PAUSED` / `AGENT_REVOKED`), even with budget remaining.\n- **Server-authoritative** — price is set on the endpoint; agents never carry a card or a seller key.\n\n```bash\n# manage agents (owner-authenticated)\nPOST /api/agents            # create  → { agent_id, ... }\nPOST /api/agents/:id/pause  # kill switch (also /resume, /revoke)\nGET  /api/agents            # list + per-agent spend rollup\n```\n\n---\n\n## ✨ Features\n\n### For agents / buyers\n- ✅ **x402 native** — 402 challenge returns `accepts[]` with price + mintUrl\n- ✅ **Hard-capped** — per-mint / daily / monthly limits, server-enforced\n- ✅ **Off-session top-up** — agent self-funds via Buyer Key (`bk_...`), no prompts\n- ✅ **Demo Mode** — 8 free tools, try without any setup\n\n### For API providers / sellers\n- ✅ **5-min go-live** — `npx create-lemon-mcp`, or `lc.charge()` on any tool, or route through the gateway\n- ✅ **Custody-free** — Stripe Connect Direct Charge, 97% goes directly to seller\n- ✅ **Usage ledger** — every call recorded, revenue visible in dashboard\n- ✅ **Buy link** — share one URL, buyers self-serve\n\n### For agent fleets / operators\n- ✅ **Per-agent identity** — bind Pay Tokens to an agent, attribute spend\n- ✅ **Per-agent kill switch** — pause / resume / revoke, enforced at the gateway\n- ✅ **Spend rollup** — budget / spent / calls per agent\n- ✅ **No balance pool** — custody-free; budget = the agent's bound Pay Tokens\n\n### Infrastructure\n- 🔧 Stripe Connect Direct Charge (no custody)\n- 🔧 x402 gateway with `WWW-Authenticate: Lemoncake-Prepaid`\n- 🔧 EN / 日本語 / Español dashboard\n- 🔧 [JP FSA: registration not required](https://lemoncake.xyz/security) (confirmed 2026-06)\n\n---\n\n## 🏗 Architecture\n\n```\n┌─────────────────────────────────────────────────┐\n│  Buyer / Agent                                  │\n│   ↳ prepays via card OR Buyer Key (bk_...)      │\n│   ↳ receives Pay Token (signed JWT)             │\n└──────────────────────┬──────────────────────────┘\n                       │  Authorization: Bearer <jwt>\n                       ▼\n┌─────────────────────────────────────────────────┐\n│  LemonCake Gateway  /g/<shortId>                │\n│   ↳ verify JWT signature                        │\n│   ↳ check budget + calls + rate limit           │\n│   ↳ decrement spend, write to ledger            │\n└──────────────────────┬──────────────────────────┘\n                       │  HTTPS + upstream_auth (hidden)\n                       ▼\n┌─────────────────────────────────────────────────┐\n│  Your API / MCP server (unchanged)              │\n└─────────────────────────────────────────────────┘\n```\n\nLemonCake is the middle box. It never holds funds — money flows Stripe → seller via Direct Charge.\n\n---\n\n## 🌍 Compliance\n\nJapan FSA Fintech Support Desk (2026-06) confirmed: no registration required.\nCustody-free design (Stripe Connect Direct Charge, no pooled balance).\n\n| Jurisdiction | Basis |\n|---|---|\n| 🇯🇵 Japan | FSA — registration not required |\n| 🇺🇸 USA | FinCEN 2019 §4.5 — non-custodial software ≠ MSB |\n| 🇪🇺 EU | MiCA — non-CASP |\n| 🇬🇧 UK | FCA — Tech Service Provider |\n| 🇸🇬 Singapore | MAS — DPT non-applicable |\n| 🇨🇦 Canada | FINTRAC — non-custodial exemption |\n| 🇨🇭 Switzerland | FINMA — non-financial intermediary |\n\nSee [lemoncake.xyz/security](https://lemoncake.xyz/security)\n\n---\n\n## 🔌 Package family\n\n| Package | What it does |\n|---|---|\n| [`agent-payment-mcp`](https://www.npmjs.com/package/agent-payment-mcp) | Main entry — x402 gateway + agent payment rail |\n| [`@lemon-cake/mcp-sdk`](https://www.npmjs.com/package/@lemon-cake/mcp-sdk) | Seller SDK — `lc.charge()` / `lc.protect()`, fiat, no crypto |\n| [`create-lemon-mcp`](https://www.npmjs.com/package/create-lemon-mcp) | Scaffold a paid MCP server — sandbox→prod with one env var |\n| [`xstocks-mcp`](https://www.npmjs.com/package/xstocks-mcp) | Buy tokenized US stocks on Solana |\n| [`alpaca-guard-mcp`](https://www.npmjs.com/package/alpaca-guard-mcp) | Alpaca paper / live trading with hard daily cap |\n| [`tokenized-stock-mcp`](https://www.npmjs.com/package/tokenized-stock-mcp) | Dinari dShares |\n\n---\n\n## 🛡 Security\n\n- **Server-side hard caps** — per-mint / daily / monthly, cannot be exceeded\n- **Pay Token = signed JWT** — HS256, verified on every gateway call\n- **upstream_auth never exposed** — seller's real API key hidden from buyers\n- **RLS on all DB tables** — Supabase row-level security enabled\n- **Stripe Connect Direct Charge** — LemonCake never holds funds\n",
  "bytes": 11755,
  "sha": "80630546b995ac2ea4956b0606b0d3f4e8922066d5c1215937d97f85282d7756",
  "repo_slug": "evidai/agent-payment-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_evidai_polymarket_guard_bdf9ac3d/readme"
}