🍋 LemonCake — Billing & budgets for AI agents
🍋 LemonCake — AI 智能体钱包与 USDC 按次付费 MCP 服务器
🎮 立即尝试 — 无需注册。 点击上方的 "Try in Browser" → 将 两个 环境变量字段留 空 → 点击 Start Inspector。演示模式将调用真实的 Wikipedia / httpbin / 实时外汇 API。无需账户、无需信用卡、无需 API 密钥。
📦 v0.5.0 重命名: npm 包现已更名为
pay-per-call-mcp(原名为lemon-cake-mcp)。旧名称仍可作为轻量包装器使用,但新配置应使用npx -y pay-per-call-mcp。
为你的 AI 智能体提供钱包。 通过 Claude Desktop、Cursor、Cline 或任何 MCP 客户端,直接为任意 HTTP API 进行 USDC 按次付费。无需人工干预,无需为每个 API 单独注册,无需管理繁琐的 API 密钥。
LemonCake 的 MCP 服务器使你能够从 Claude Desktop / Cursor / Cline 等 MCP 兼容客户端中,无需人工干预即可使用 USDC 调用付费 API。
English ↓ 快速入门 · 提供工具 · 使用场景 · 兼容性
🚀 3分钟快速入门
使用 MCP 服务器需要 LemonCake 账户和 USDC 余额。
创建免费账户 — 只需一个邮箱即可完成
充值余额 — 最低 $5 USDC 或 JPYC(账单页面)
复制 Buyer JWT — 从 仪表盘 → API Keys 获取
在下方的
claude_desktop_config.json中进行配置
📚 详情:快速入门文档
Related MCP server: @arispay/payagent-mcp
📦 安装
Claude Desktop
在 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS)或
%APPDATA%\Claude\claude_desktop_config.json(Windows)中添加:
{
"mcpServers": {
"pay-per-call": {
"command": "npx",
"args": ["-y", "pay-per-call-mcp"],
"env": {
"LEMON_CAKE_BUYER_JWT": "eyJhbGci..."
}
}
}
}重启 Claude Desktop 后,你将在 🔨 工具图标中看到 LemonCake 的工具。
Cursor / Cline / 其他 MCP 客户端
同样,请将服务器启动命令设置为 npx -y pay-per-call-mcp,并在环境变量中设置 LEMON_CAKE_BUYER_JWT。
Node.js 要求:v20 或更高版本
🛠️ 提供工具
工具名称 | 用途 | 主要参数 |
| 首次设置指南(返回账户创建和充值方法) | — |
| LemonCake 市场上可用的付费 API 列表 |
|
| 通过 Pay Token 对指定服务进行付费调用 |
|
| 获取当前 USDC 余额和 KYA 上限 | — |
| 通过国税厅 API 验证合格发票开具方编号 |
|
| 按服务统计使用情况和付费记录 | — |
所有参数架构均可通过 MCP Inspector 或 tools/list 获取。
🎮 演示模式(无需凭证即可尝试)
如果不设置任何 LEMON_CAKE_BUYER_JWT / LEMON_CAKE_PAY_TOKEN 直接启动,将自动进入 DEMO MODE。无需注册即可运行以下功能:
list_services→ 真实市场 +demo_search(Wikipedia) /demo_echo(httpbin) /demo_fx(open.er-api) 三个演示服务排在最前call_service→demo_*服务将 调用真实免费 API 并返回原始数据(无费用,无需认证)check_balance→ 返回$1.00的模拟余额(mode: "demo")check_tax/get_service_stats→ 正常运行(本身无需认证)
→ 在 Glama Inspector 或 npm 试用环境 中,无需任何设置即可确认实现行为。如果想调用正式的付费 API,请设置 LEMON_CAKE_PAY_TOKEN。
💡 尝试这些提示词(MCP Prompts)
本服务器支持 MCP 的 prompts capability。Glama Inspector / Claude Desktop / Cursor 的 "prompt picker" 中会出现以下预设,点击即可执行:
提示词名称 | 内容 | 认证 |
🎮 | 在演示模式下依次执行 setup → list_services → demo_search → demo_fx | 无需 |
🛍 | 列出真实市场的所有服务,并按用途推荐前 3 名 | 无需 |
🇯🇵 | 在国税厅验证合格发票开具方编号 + 判定预扣税 | 无需 |
💰 | 通过 check_balance → call_service → check_balance 演示预算管理 | demo 可用 / 真实服务需 PAY_TOKEN |
🔄 | 对比 demo_search 和真实 Serper 的相同查询结果 | demo 可用 / 对比需 PAY_TOKEN |
🏯 | 结合 gBizINFO + 国税厅 + e-Gov 的日本企业调研 | PAY_TOKEN(无需 demo 部分) |
→ 在 Glama / Claude Desktop 中启用 pay-per-call MCP(原 lemon-cake)后,上述内容会自动出现在候选列表中。
💡 使用示例
在 Claude Desktop 中:
“请使用 LemonCake 以 0.50 USDC 调用
demo_agent_search_api,搜索 'AI agent payments'”
Claude 将自动:
通过
setup确认设置状态(仅首次)执行
call_service(serviceId="demo_agent_search_api", limitUsdc="0.50", body={query:"AI agent payments"})总结结果并回复
🎯 使用场景
自主研究智能体 — 让你的智能体为高级搜索、抓取或数据 API 按次付费,无需提供你的信用卡。
多 API 工作流 — 一个 JWT,一个余额,数十个上游 API。无需为每个供应商注册或轮换密钥。
合规支出控制 — KYA (Know-Your-Agent) 上限限制了智能体在每次会话/每天的支出金额。
日本税务自动化 —
check_tax通过国税厅 API 验证合格发票编号,确保发票合规。幂等重试 —
idempotencyKey使call_service可以安全重试,不会重复扣费。
✅ 已测试客户端
客户端 | 状态 | 备注 |
Claude Desktop (macOS / Windows) | ✅ | 主要目标 |
Cursor | ✅ | stdio 传输 |
Cline (VS Code) | ✅ | stdio 传输 |
Claude Code CLI | ✅ | stdio 传输 |
Continue.dev | ✅ | v0.9 起支持 MCP |
自定义 MCP 客户端 | ✅ | 任何通过 stdio 使用 MCP 1.10+ 的客户端 |
🔐 环境变量
变量名 | 必须 | 说明 |
| ✅ | Buyer JWT(从仪表盘 Settings → API Keys 获取) |
| — | Pay Token JWT( |
| — | API 端点(默认: |
🏃 本地开发
git clone https://github.com/evidai/lemon-cake.git
cd lemon-cake/mcp-server
npm install
npm run build
npm startDocker
docker build -t pay-per-call-mcp .
docker run --rm -i -e LEMON_CAKE_BUYER_JWT=eyJhbGci... pay-per-call-mcp该镜像也用于 Glama Inspector 的浏览器内预览。
🔗 相关链接
📄 许可证
MIT © LemonCake
Available Tools
6 toolscall_serviceA
Invoke an upstream API service through LemonCake's pay-per-call proxy. Each successful call automatically debits USDC from your wallet via the permit you signed. LemonCake never holds your USDC — the transfer is direct wallet → provider on Base.
PRECONDITIONS:
• LEMON_CAKE_PERMIT env var must be set for real services. Get one in ~30 seconds at
https://lemoncake.xyz/start/v2 (sign in with Google, sign 1 EIP-712 permit, copy the blob).
If missing, the tool returns a structured PERMIT_MISSING error with how-to-fix steps.
• DEMO MODE: any serviceId starting with demo_ works WITHOUT a permit and hits real
free upstreams (Wikipedia / httpbin / Open-Meteo / Nominatim / MyMemory / dictionaryapi /
worldtimeapi / open.er-api). 8 demos cover search / echo / fx / translate / weather /
geocode / time / dictionary — useful for Glama Inspector or new-user trial. They are
marked with mode: "demo" and incur no charge.
• serviceId must come from list_services.
BEHAVIOR: • Returns the upstream response body verbatim (JSON or text), plus the X-Charge-Id and X-Amount-Usdc headers reported by the proxy. • HTTP 402 Payment Required is returned as a normal result (NOT thrown) so the agent can autonomously stop spending when the daily $25 permit cap is exhausted. • Pass the same idempotencyKey to retry safely without double-charging. • This tool spends real money and contacts an external service — it is non-idempotent by default and has external side effects.
x402-COMPATIBLE INTERFACE:
• Successful calls include an x402Receipt field with { scheme, chain, asset, amount,
recipient, paymentIntentId, settledAt }. Same shape as on-chain x402 receipts so the
agent's payment-handling logic is portable.
• If upstream returns an x402 challenge (WWW-Authenticate: x402, X-402-* headers, or
body.x402), it's parsed into x402Challenge for the agent to reason about.
• If upstream returns 202 + Retry-After + X-Payment-Status: pending, the result is
{ status: "PAYMENT_PENDING", paymentIntentId, retryAfterMs, retryContract }.
Re-call with the same idempotencyKey to resume — no double-charge.
Returns: { status, chargeId, amountUsdc, response, x402Receipt?, x402Challenge?, hint? }
Inputs: serviceId (required), body, path, method, +1 more.
check_balanceARead-onlyIdempotent
Check the current on-chain USDC balance of the wallet that owns the configured permit.
PRECONDITIONS: • DEMO MODE (no LEMON_CAKE_PERMIT): returns a canned $1.00 demo balance so trial users see something useful before signing. • LIVE: queries Base USDC.balanceOf(owner) directly + reports remaining daily permit cap. LemonCake's backend doesn't store the balance — it's read from the chain.
Use BEFORE call_service to confirm sufficient funds and remaining daily cap.
Returns: { balanceUsdc, dailyCap, remainingToday, ownerAddress, [mode], [note] }
Inputs: no named parameters.
check_taxARead-onlyIdempotent
Run a Japanese tax compliance check on a single transaction. No authentication required.
Performs three checks in one call:
Validates the qualified-invoice registration number (T-number) against the NTA registry.
Determines whether source-withholding (源泉徴収) applies based on the service description.
If withholding applies, computes the withholding amount and net payable.
Intended for Japanese corporations that pay AI / API services and need to file withholding correctly under the qualified-invoice (インボイス制度) regime.
Returns: { invoice: { valid, name, ... }, withholding: { required, rate, amount, net } } Errors: invalid registrationNumber returns invoice.valid = false (not an exception).
Inputs: grossAmountJpy (required), registrationNumber (required), serviceDescription (required).
get_service_statsARead-onlyIdempotent
Return public usage statistics for every approved service on the marketplace. No authentication required.
Use this AFTER list_services and BEFORE call_service to pick a service based on real-world traction (call counts, USDC revenue, last-used timestamp).
Returns: an array of { serviceId, callCount, totalRevenueUsdc, lastCalledAt }.
Inputs: no named parameters.
list_servicesARead-onlyIdempotent
List approved API services available on the LemonCake marketplace. No authentication required.
Use this BEFORE call_service to discover serviceId values and per-call USDC pricing.
When LEMON_CAKE_PERMIT is missing, 8 demo services are prepended: demo_search → Wikipedia opensearch demo_echo → httpbin.org/anything demo_fx → live FX rates (open.er-api) demo_translate → 80+ languages (MyMemory) demo_weather → current weather any lat/lon (Open-Meteo) demo_geocode → place name → lat/lon (OpenStreetMap Nominatim) demo_time → IANA timezone time + DST (worldtimeapi) demo_dictionary → English definitions / synonyms (dictionaryapi.dev) All real upstreams, no auth, free. Live users (permit set) see real marketplace entries; demo_* IDs remain callable directly.
Each item: { id, name, provider, type ('API' | 'MCP'), pricePerCall, [usage], [mode] }.
Errors: HTTP-level errors are returned as Error: API <status>: <body>.
Inputs: limit.
setupARead-onlyIdempotent
Show the LemonCake MCP first-run setup guide. No authentication required. Call this tool FIRST to learn what is missing and how to obtain a permit.
If LEMON_CAKE_PERMIT is not set, the server is in DEMO MODE: list_services returns 8 free demo services (search / echo / fx / translate / weather / geocode / time / dictionary) powered by real upstreams (Wikipedia, httpbin, Open-Meteo, Nominatim, etc.). call_service and check_balance respond with mock data so you can verify integration before signing.
Returns the current credential status (permit presence), demo-mode flag, and step-by-step instructions for getting a permit at /start/v2, including a sample MCP client config snippet ready to paste.
Returns: { version, apiUrl, mode, credentials, availableTools, setupSteps, permitUrl, docs } Errors: none — this tool always succeeds.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct role: setup guides onboarding, list_services discovers offerings, call_service executes paid calls, check_balance monitors funds, check_tax handles compliance, and get_service_stats provides marketplace analytics. There is no meaningful overlap or ambiguity between them.
Tool names follow a consistent snake_case verb_noun pattern: list_services, call_service, check_balance, check_tax, get_service_stats. Even 'setup' fits as a single-word imperative without breaking the overall stylistic consistency.
Six tools is a well-scoped count for a billing/proxy service: onboarding, discovery, execution, balance checking, tax compliance, and usage stats each earn their place. The server feels neither bloated nor thin.
The core lifecycle is well covered: discover services, call them, check balance, and verify tax obligations. Minor gaps exist, such as no explicit transaction-history or budget-configuration tool, but the daily cap and receipt fields mitigate these and the main workflows are complete.
Maintenance
Related MCP Connectors
Machine-payable API infrastructure for autonomous agents. Per-call x402 settlement in USDC.
30 pay-per-call APIs for AI agents: compliance, trade, safety, web, data. USDC on Base via x402.
Non-custodial stablecoin bill-pay rails on Celo & Base for AI agents, settled on-chain via MCP.
Pay-per-use MCP tools for AI agents. USDC on Base via x402. No API keys.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI agents to manage USDC wallets on Solana, allowing them to send payments, create invoices, and access paid APIs within human-defined spending limits. It uses threshold signatures to provide agents with financial autonomy while ensuring secure oversight and transaction approval.36248 npm4Apache 2.0

@arispay/payagent-mcpofficial
AlicenseAqualityBmaintenanceEnables AI agents to call paid APIs and settle HTTP 402 payment challenges with USDC on Base, without private keys ever being involved.7444 npmMIT- AlicenseAqualityDmaintenanceLets AI agents discover, pay for, and call any HTTP API per request using USDC, with gasless nanopayments and no API keys or accounts needed.561 npmMIT
- AlicenseAqualityBmaintenanceEnables AI agents to make non-custodial USDC payments on Base through an MCP endpoint, with server-enforced per-payment and daily caps, human approval bands, and recipient allowlists.739 npmMIT