lemon-cake-mcp
Pay-per-call USDC payment proxy for AI agents. Issue scoped Pay Tokens with hard spending caps and auto-journal every charge to freee / Money Forward / QuickBooks.
README
<div align="center">
๐ LemonCake
Give your AI agent a wallet โ with a kill switch.
JWT-based Pay Tokens + USDC balance management for autonomous Machine-to-Machine payments.
๐ Docs ยท ๐ Quickstart ยท ๐ง Contact
Public website, Discord, and Twitter are launching alongside public beta. For now, please reach out via email โ we reply within 1 business day.
<br />

<sub>โ An agent calling a paid API via a Pay Token. Balance drops in real time. Kill Switch stops it in one click.</sub>
</div>
โก๏ธ 60-second quickstart
# 1. Register at https://lemoncake.xyz, grab a BUYER_JWT
# 2. Issue a Pay Token (scoped, expiring, revocable)
curl -X POST https://lemoncake.xyz/api/tokens \
-H "Authorization: Bearer $BUYER_JWT" \
-H "Content-Type: application/json" \
-d '{"serviceId":"svc_xxx","limitUsdc":"2.00","sandbox":true}'
# โ { "jwt": "<pay_token>", ... }
# 3. Hand it to your agent. Done.
# Claude / Cursor:
npx lemon-cake-mcp
# Eliza v2:
npm install eliza-plugin-lemoncake
# Anything else:
curl -X POST https://lemoncake.xyz/api/proxy/svc_xxx/your/endpoint \
-H "Authorization: Bearer <pay_token>" \
-H "Idempotency-Key: $(uuidgen)"
Budget exhausted? 402. Token revoked? 422. No runaway agents. No stolen keys.
What is LemonCake?
LLM agents are getting powerful โ but they still can't pay for things autonomously.
LemonCake solves this with Pay Tokens: short-lived JWTs that give an agent a scoped spending limit. The agent calls paid APIs through our proxy, gets charged per call in USDC, and stops automatically when the budget runs out.
You Agent Paid API
โ โ โ
โโ issue Pay Token โโโถ โ โ
โ limit: $2.00 โ โ
โ โโ call /api/proxy โโโโโถ โ
โ โ Authorization: Bearer <pay_token>
โ โ โ
โ โ โโ response + charge โโค
โ โ X-Charge-Id: ch_... โ
โ โ X-Amount-Usdc: 0.001 โ
โ โ โ
โ โโ (budget exhausted) โ
โ โ 402 Payment Required โ
โ โ agent stops cleanly โ
๐ Integrations
MCP ใตใผใใผ โ lemon-cake-mcp
Claude DesktopใปCursor ใซ npx ไธ็บใงๆฅ็ถใงใใๅ
ฌๅผ MCP ใตใผใใผใ
npx lemon-cake-mcp
claude_desktop_config.json ใซ่ฟฝ่จใใใ ใ๏ผ
{
"mcpServers": {
"lemon-cake": {
"command": "npx",
"args": ["-y", "lemon-cake-mcp"],
"env": {
"LEMON_CAKE_PAY_TOKEN": "<Pay Token JWT>",
"LEMON_CAKE_BUYER_JWT": "<Buyer JWT>"
}
}
}
}
| ใใผใซ | ่ชฌๆ |
|---|---|
setup |
่ช่จผ็ถๆ ใฎ็ขบ่ชใจ่จญๅฎๆ้ ใฎใฌใคใ๏ผ่ช่จผไธ่ฆ๏ผ |
list_services |
ใใผใฑใใใใฌใคในใฎๆฟ่ชๆธใฟ API ไธ่ฆงใๅๅพ |
call_service |
Pay Token ใง่ชฒ้ API ใใใญใญใทๅผใณๅบใ |
check_balance |
USDC ๆฎ้ซใปKYC ใใฃใขใ็ขบ่ช |
Eliza v2 ใใฉใฐใคใณ โ eliza-plugin-lemoncake
@elizaos/core v2 ๅฏพๅฟใฎๅ
ฌๅผใใฉใฐใคใณใcharacter.plugins ใซ่ฟฝๅ ใใใ ใใง Eliza ใจใผใธใงใณใใ่ชๅพๆฑบๆธใๅฎ่กใงใใพใใ
npm install eliza-plugin-lemoncake
import { lemonCakePlugin } from "eliza-plugin-lemoncake";
const character = {
name: "MyAgent",
plugins: [lemonCakePlugin],
};
# ใฉใกใใไธๆนใ่จญๅฎ
LEMONCAKE_PAY_TOKEN=eyJhbGci... # ใฏใคใใฏในใฟใผใ๏ผไบๅ็บ่กใใผใฏใณ๏ผ
LEMONCAKE_BUYER_JWT=eyJhbGci... # ๆฌ็ช้็จ๏ผๅผใณๅบใใใจใซ้ฝๅบฆ็บ่ก๏ผ
่ช็ถ่จ่ชใงใใฎใพใพๅใ๏ผ
"LemonCake ใฎ demo_search_api ใ 0.50 USDC ใงๅผใณๅบใใฆ"
"serviceId: svc_invoice ใซ 0.10 USDC ๆฏๆใใๅฎ่กใใฆ"
| ใขใฏใทใงใณ | ่ชฌๆ |
|---|---|
EXECUTE_LEMONCAKE_PAYMENT |
ใกใคใณใขใฏใทใงใณใserviceId + limitUsdc ใๆๅฎใใฆ M2M ๆฑบๆธใๅฎ่ก |
PAY_WITH_LEMONCAKE / M2M_PAYMENT ใชใฉ |
่ช็ถ่จ่ชใใชใฌใผ็จใจใคใชใขใน๏ผsimiles๏ผ |
โ ่ฉณ็ดฐ: eliza-plugin-lemoncake/README.md
โจ Features
For AI Agents (Buyers)
- Pay Token (JWT) โ Scoped, expiring spend authorization. One token per task or session.
- 402-first design โ Agents receive structured
402 Payment Requirederrors with machine-readable codes when budget runs out. - Idempotency keys โ Prevent double charges on retries with
Idempotency-Keyheader (auto-assigned by plugins). - Real-time balance โ Check remaining USDC before committing to expensive calls.
For API Providers (Sellers)
- Service registry โ Register any REST API. Set price-per-call in USDC.
- Instant revenue โ Get paid per call with no invoicing, no net-30, no chargebacks.
- Usage analytics โ See call counts, revenue, and error rates per service.
Infrastructure
- JPYC on-chain deposit โ Charge balance with JPYC (Polygon ERC-20). Auto-verified via TX hash.
- Accounting sync โ Auto-post journal entries to freee, QuickBooks, Xero, or Zoho.
๐ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ lemoncake.xyz โ
โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ Dashboard โ โ Hono API โ โ Pay Proxy โ โ
โ โ (Next.js) โโโโโถโ + OpenAPI โโโโโ Middleware โ โ
โ โโโโโโโโโโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโผโโโโโโโโโโโโโ โ
โ โผ โผ โผ โ
โ PostgreSQL Redis Polygon โ
โ (Prisma) (Queue) USDC / JPYC โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โฒ โฒ
โ โ
MCP / Eliza Upstream APIs
(Claude, Cursor, Eliza...) (registered services)
Key design decisions:
- HMAC-SHA256 (HS256, RFC 7518) for JWT signing today; Ed25519 (EdDSA, RFC 8037) migration planned for v0.1.0 to enable asymmetric verification by external partners
- Optimistic locking on
usedUsdcโ prevents double charges under concurrent agent calls - Proxy-first โ upstream API keys never leave the server; agents only hold Pay Tokens
๐ Public API (selected endpoints)
Full OpenAPI spec available at
/api/docafter signing in.
Auth
POST /api/auth/register
{ "name": "string", "email": "string", "password": "string (min 8)" }
โ { "token": "<buyer_jwt>", "expiresIn": 2592000 }
POST /api/auth/buyer-login
{ "email": "string", "password": "string" }
โ { "token": "<buyer_jwt>" }
Tokens (Pay Token)
POST /api/tokens
Authorization: Bearer <buyer_jwt>
{
"serviceId": "<id>",
"limitUsdc": "5.00",
"buyerTag": "my-agent-session-42",
"expiresAt": "2026-05-01T00:00:00Z"
}
โ { "tokenId": "...", "jwt": "<pay_token>", "limitUsdc": "5.000000", "expiresAt": "..." }
Proxy (Pay-per-call)
ANY /api/proxy/<serviceId>/<upstream-path>
Authorization: Bearer <pay_token>
Idempotency-Key: <uuid>
โ upstream response
+ X-Charge-Id: ch_...
+ X-Amount-Usdc: 0.001000
Error responses:
{ "error": "Token limit exceeded", "used": "4.999", "limit": "5.000" } // 402
{ "error": "Insufficient balance: 1.23 USDC available" } // 402
{ "error": "Token expired" } // 401
Services
GET /api/services?reviewStatus=APPROVED&limit=50
โ [{ "id": "...", "name": "...", "pricePerCallUsdc": "0.001", ... }]
๐งโ๐ป Local Development
# 1. Clone
git clone https://github.com/evidai/lemon-cake.git
cd lemon-cake
# 2. API server
cd api
cp .env.example .env
npm install && npx prisma migrate dev
npm run dev # http://localhost:3000
# 3. Dashboard
cd ../dashboard
cp .env.example .env.local # NEXT_PUBLIC_API_URL=http://localhost:3000
npm install && npm run dev # http://localhost:3001
# 4. MCP server
cd ../mcp-server
npm install && npm run build
# 5. Eliza plugin
cd ../eliza-plugin-lemoncake
npm install && npm run build
Seed demo data
node api/seed_demo.js
# Creates demo provider, 4 approved services, and 9,000+ sample charge records
๐ก Security
- Brute-force protection โ 10 failed logins triggers a 15-minute lockout per email
- Pay Token scoping โ Each token is bound to a single
serviceId; cross-service reuse is rejected - No JWT storage โ Only the
jti(token ID) is stored in the DB; the signed JWT never persists - CSRF protection โ OAuth state parameter with 10-minute TTL and single-use consumption
- On-chain deposit verification โ JPYC transfers are verified against Polygon event logs before balance is credited
๐บ Roadmap
Shipped:
- [x] Kill Switch โ atomic one-click token revocation (race-condition-free)
- [x] KYA (Know Your Agent) โ tiered spending limits: 10 โ 1,000 โ 50,000 USDC/day
- [x] Sandbox mode โ full-flow dry-run without moving real USDC
- [x] MCP server + Eliza v2 plugin published to npm
- [x] JPYC on-chain deposit with Polygon event-log verification
Next:
- [ ] Panic button โ revoke all active tokens for a buyer in one click
- [ ] Smart contract escrow for trustless settlement
- [ ] Streaming / token-count billing for LLM APIs
- [ ] Multi-chain support (Ethereum, Solana, Base)
- [ ] Agent-to-agent sub-token delegation (parent caps child)
- [ ] Self-hostable edition
๐ License
Proprietary โ All rights reserved ยฉ 2026 LemonCake
MCP server and Eliza plugin source are available for review. Core API and payment engine are closed source.
Built for the agentic web. lemoncake.xyz
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.