πŸ‹ LemonCake

June 10, 2026 Β· View on GitHub

πŸ‹ LemonCake

The billing, budget & identity layer for software for agents. Private Beta Β· Open core

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. First 3,000 calls free (lifetime). Then 3% only when your API earns.

License: MIT (SDK) Open core MCP Compatible x402 native npm: agent-payment-mcp FSA-confirmed Glama score

πŸš€ Get started Β· πŸ’² Pricing Β· πŸ“š Docs Β· 🌐 Live


An AI agent pays for paid API calls on its own β€” spend-capped, no crypto

☝️ 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. Β· demo source


πŸš€ Get started

Monetizing an MCP/API? Start here β€” one command:

npx create-lemon-mcp my-paid-mcp     # a paid MCP server, running in sandbox now
# then add a Seller Key in /app and set LEMONCAKE_SELLER_KEY β†’ it charges for real (no code change)

Pick your path:

I want to…Do this
Monetize my MCP/API (sellers)npx create-lemon-mcp β†’ add a Seller Key in /app to go live
Add billing to a server I already have@lemon-cake/mcp-sdk β€” wrap a tool with lc.charge(), or route through the gateway (no code)
Let an agent pay for paid APIs (buyers)npx -y agent-payment-mcp β€” 8 free demo tools, no signup
Buyer-side MCP β€” try in 30 seconds
npx -y agent-payment-mcp
{ "mcpServers": { "lemon": { "command": "npx", "args": ["-y", "agent-payment-mcp"] } } }

Ask your agent to run list_demos / call_demo. To call paid APIs, set LC_PAY_TOKEN (get one at lemoncake.xyz/app).


What is LemonCake?

LemonCake 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.

sequenceDiagram
    participant A as πŸ€– AI Agent
    participant G as πŸ‹ LemonCake Gateway
    participant API as Your API
    A->>G: POST /g/:id (no token)
    G-->>A: 402 + accepts[] (price, mintUrl)
    A->>G: mint Pay Token (off-session, capped)
    A->>G: Bearer :jwt
    G->>API: forward (upstream key hidden)
    API-->>A: 200 + result
    Note over A,G: budget exhausted β†’ 402 β†’ agent self-funds β†’ continues

Sellers register any HTTP API and set a price per call. Buyers / agents prepay with a card β†’ Pay Token issued automatically β†’ agent calls the API within budget. Budget exhausted β†’ 402 challenge β†’ agent self-funds β†’ continues. No humans.


🧱 Open core

LayerStatusWhere
Buyer-side MCP (agent-payment-mcp)βœ… MITnpm, src
Seller SDK (@lemon-cake/mcp-sdk)βœ… MITnpm, src
Starter templatesβœ… MITexamples/
Docs siteβœ… Publiclemoncake.xyz/docs
Gateway + billing engineπŸ”’ Hostedlemoncake.xyz
Dashboard (analytics, usage ledger)πŸ”’ Hostedlemoncake.xyz/app

πŸ’³ How payment works

For buyers (human or agent)

  1. Open a buy link (lemoncake.xyz/buy/<shortId>)
  2. Pay with a card β†’ Pay Token (JWT) issued automatically
  3. Pass Authorization: Bearer <token> to the gateway
  4. Gateway verifies, meters, forwards to the real API
  5. Budget exhausted β†’ 402 challenge returned with payment instructions

For agents (fully autonomous)

  1. Issue a Buyer Key (bk_...) at /app β†’ Pay Tokens pane
  2. Save a card once at /agent/fund
  3. Agent calls POST /api/lc/agent/tokens (Bearer bk_) β†’ off-session card charge β†’ JWT
  4. Agent uses JWT to call gateway β€” hard-capped, no human in the loop
// MCP config for agent with pre-issued Pay Token
{
  "mcpServers": {
    "lemon": {
      "command": "npx",
      "args": ["-y", "agent-payment-mcp"],
      "env": {
        "LC_PAY_TOKEN": "<jwt from Pay Token>"
      }
    }
  }
}

πŸ— Publish your API on LemonCake (sellers)

Monetize any HTTP API or MCP server:

  1. Sign in at lemoncake.xyz/app
  2. Add API β€” paste your URL, set price per call (e.g. $0.01)
  3. Share the buy link, or issue a Seller Key (sk_live_…) to charge from your own server
  4. You keep 97%. LemonCake takes 3% (Stripe Connect Direct Charge). Never holds funds.

Scaffold a paid MCP in one command β€” sandbox by default, production with one env var:

npx create-lemon-mcp my-paid-mcp     # demo runs with no key
# then: set LEMONCAKE_SELLER_KEY=sk_live_… β†’ it charges for real (no code change)

Add billing to any tool with the SDK (@lemon-cake/mcp-sdk v1, no crypto):

import { createLemonCakeSDK } from "@lemon-cake/mcp-sdk";

const lc = createLemonCakeSDK();   // reads LEMONCAKE_SELLER_KEY (demo without it)

server.tool("my_premium_tool", "desc", { q: z.string() },
  lc.charge({ price: 0.01 })(async ({ q }) => {
    return { content: [{ type: "text", text: "result" }] };
  }),
);

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.


πŸͺͺ Agent Identity

Give 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).

  • Bind a Pay Token to an agent when issuing it (agentId) β†’ spend is attributed to that agent.
  • Per-agent rollup β€” budget, spend, calls, last-used in the dashboard.
  • Kill switch β€” pause / resume / revoke an agent; bound tokens are rejected at the gateway instantly (AGENT_PAUSED / AGENT_REVOKED), even with budget remaining.
  • Server-authoritative β€” price is set on the endpoint; agents never carry a card or a seller key.
# manage agents (owner-authenticated)
POST /api/agents            # create  β†’ { agent_id, ... }
POST /api/agents/:id/pause  # kill switch (also /resume, /revoke)
GET  /api/agents            # list + per-agent spend rollup

✨ Features

For agents / buyers

  • βœ… x402 native β€” 402 challenge returns accepts[] with price + mintUrl
  • βœ… Hard-capped β€” per-mint / daily / monthly limits, server-enforced
  • βœ… Off-session top-up β€” agent self-funds via Buyer Key (bk_...), no prompts
  • βœ… Demo Mode β€” 8 free tools, try without any setup

For API providers / sellers

  • βœ… 5-min go-live β€” npx create-lemon-mcp, or lc.charge() on any tool, or route through the gateway
  • βœ… Custody-free β€” Stripe Connect Direct Charge, 97% goes directly to seller
  • βœ… Usage ledger β€” every call recorded, revenue visible in dashboard
  • βœ… Buy link β€” share one URL, buyers self-serve

For agent fleets / operators

  • βœ… Per-agent identity β€” bind Pay Tokens to an agent, attribute spend
  • βœ… Per-agent kill switch β€” pause / resume / revoke, enforced at the gateway
  • βœ… Spend rollup β€” budget / spent / calls per agent
  • βœ… No balance pool β€” custody-free; budget = the agent's bound Pay Tokens

Infrastructure

  • πŸ”§ Stripe Connect Direct Charge (no custody)
  • πŸ”§ x402 gateway with WWW-Authenticate: Lemoncake-Prepaid
  • πŸ”§ EN / ζ—₯本θͺž / EspaΓ±ol dashboard
  • πŸ”§ JP FSA: registration not required (confirmed 2026-06)

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Buyer / Agent                                  β”‚
β”‚   ↳ prepays via card OR Buyer Key (bk_...)      β”‚
β”‚   ↳ receives Pay Token (signed JWT)             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚  Authorization: Bearer <jwt>
                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LemonCake Gateway  /g/<shortId>                β”‚
β”‚   ↳ verify JWT signature                        β”‚
β”‚   ↳ check budget + calls + rate limit           β”‚
β”‚   ↳ decrement spend, write to ledger            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚  HTTPS + upstream_auth (hidden)
                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Your API / MCP server (unchanged)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

LemonCake is the middle box. It never holds funds β€” money flows Stripe β†’ seller via Direct Charge.


🌍 Compliance

Japan FSA Fintech Support Desk (2026-06) confirmed: no registration required. Custody-free design (Stripe Connect Direct Charge, no pooled balance).

JurisdictionBasis
πŸ‡―πŸ‡΅ JapanFSA β€” registration not required
πŸ‡ΊπŸ‡Έ USAFinCEN 2019 Β§4.5 β€” non-custodial software β‰  MSB
πŸ‡ͺπŸ‡Ί EUMiCA β€” non-CASP
πŸ‡¬πŸ‡§ UKFCA β€” Tech Service Provider
πŸ‡ΈπŸ‡¬ SingaporeMAS β€” DPT non-applicable
πŸ‡¨πŸ‡¦ CanadaFINTRAC β€” non-custodial exemption
πŸ‡¨πŸ‡­ SwitzerlandFINMA β€” non-financial intermediary

See lemoncake.xyz/security


πŸ”Œ Package family

PackageWhat it does
agent-payment-mcpMain entry β€” x402 gateway + agent payment rail
@lemon-cake/mcp-sdkSeller SDK β€” lc.charge() / lc.protect(), fiat, no crypto
create-lemon-mcpScaffold a paid MCP server — sandbox→prod with one env var
xstocks-mcpBuy tokenized US stocks on Solana
alpaca-guard-mcpAlpaca paper / live trading with hard daily cap
tokenized-stock-mcpDinari dShares

πŸ›‘ Security

  • Server-side hard caps β€” per-mint / daily / monthly, cannot be exceeded
  • Pay Token = signed JWT β€” HS256, verified on every gateway call
  • upstream_auth never exposed β€” seller's real API key hidden from buyers
  • RLS on all DB tables β€” Supabase row-level security enabled
  • Stripe Connect Direct Charge β€” LemonCake never holds funds