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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。