Package Exports
- agent-payment-mcp
- agent-payment-mcp/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (agent-payment-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
agent-payment-mcp — AI Agent Payment MCP Server by LemonCake
🎮 Try instantly — no signup needed. Click "Try in Browser" above → leave BOTH env var fields EMPTY → click Start Inspector. Demo Mode hits real Wikipedia / httpbin / live FX APIs. No account, no card, no API key.
📦 v0.6.0 rename: the npm package is now
agent-payment-mcp(waslemon-cake-mcp). The old name still works as a thin wrapper, but new configs should usenpx -y agent-payment-mcp.
Give your AI agent a wallet. Pay-per-call USDC payments for any HTTP API — straight from Claude Desktop, Cursor, Cline, or any MCP client. No human in the loop, no per-API signups, no API key juggling.
LemonCake の MCP サーバーで、Claude Desktop / Cursor / Cline などの MCP 互換クライアントから、人間の介在なしに USDC で有料 API を呼び出せるようになります。
English ↓ Quickstart · Tools · Use Cases · Compatibility
🚀 3分で始める
MCP サーバーの利用には LemonCake アカウントと USDC 残高が必要です。
- 無料アカウント作成 — メール1つで完了
- 残高チャージ — 最低 $5 USDC または JPYC(Billing)
- Buyer JWT をコピー — Dashboard → API Keys から
- 下記の
claude_desktop_config.jsonに設定
📚 詳細: クイックスタート ドキュメント
📦 インストール
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", "agent-payment-mcp"],
"env": {
"LEMON_CAKE_BUYER_JWT": "eyJhbGci..."
}
}
}
}Claude Desktop を再起動すれば、🔨 ツールアイコンに LemonCake のツールが表示されます。
Cursor / Cline / その他 MCP クライアント
同様に、サーバー起動コマンドを npx -y agent-payment-mcp / 環境変数に LEMON_CAKE_BUYER_JWT を設定してください。
Node.js 要件: v20 以上
🛠️ 提供ツール
| ツール名 | 用途 | 主なパラメータ |
|---|---|---|
setup |
初回セットアップガイド(アカウント作成・チャージ方法を返す) | — |
list_services |
LemonCake マーケットプレイスで利用可能な有料 API 一覧 | limit? (1–100) |
call_service |
指定サービスへ Pay Token 経由で課金付き呼び出し | serviceId, path?, method?, body?, idempotencyKey? |
check_balance |
現在の USDC 残高と KYA 上限を取得 | — |
check_tax |
国税庁 API で適格請求書発行事業者番号を検証 | registrationNumber (T+13桁), description?, amountJpy? |
get_service_stats |
サービス別の利用統計・課金履歴集計 | — |
すべての引数スキーマは MCP Inspector または tools/list で取得可能です。
🎮 Demo Mode(認証情報なしで試せる)
LEMON_CAKE_BUYER_JWT / LEMON_CAKE_PAY_TOKEN を何も設定せずに起動すると、自動で DEMO MODE になります。サインアップなしで以下が動きます:
list_services→ 実マーケット +demo_search(Wikipedia) /demo_echo(httpbin) /demo_fx(open.er-api) の 3 デモが先頭にcall_service→demo_*サービスは実フリー API を叩いて生データを返却(課金なし、認証なし)check_balance→$1.00のモック残高を返却(mode: "demo")check_tax/get_service_stats→ 通常通り(元から認証不要)
→ Glama Inspector や npm の試用環境 でも、何も設定せず実装挙動を確認できます。本番の有料 API を叩きたくなったら LEMON_CAKE_PAY_TOKEN を設定してください。
💡 Try these prompts(MCP プロンプト)
このサーバーは MCP の prompts capability に対応しています。Glama Inspector / Claude Desktop / Cursor の "prompt picker" に下記のプリセットが表示され、ワンクリックで実行できます:
| Prompt 名 | 内容 | 認証 |
|---|---|---|
🎮 explore-demo |
デモモードで setup → list_services → demo_search → demo_fx を一気通貫 | 不要 |
🛍 discover-marketplace |
実マーケットの全サービスを listing して、用途別に top 3 を推薦 | 不要 |
🇯🇵 japan-tax-check |
適格請求書発行事業者番号を国税庁で検証+源泉徴収判定 | 不要 |
💰 spend-with-budget |
check_balance → call_service → check_balance のパターンで予算管理を実演 | demo OK / 実 service には PAY_TOKEN |
🔄 real-vs-demo |
同じクエリを demo_search と実 Serper で叩いて比較 | demo OK / 比較に PAY_TOKEN |
🏯 japan-finance-bundle |
gBizINFO + 国税庁 + e-Gov を組み合わせた日本企業リサーチ | PAY_TOKEN(demo 部分は不要) |
→ Glama / Claude Desktop で pay-per-call MCP(旧 lemon-cake)を有効にすると、上記が自動で候補に出ます。
💡 使い方の例
Claude Desktop で:
「LemonCake で
demo_agent_search_apiを 0.50 USDC で呼び出して、"AI agent payments" を検索して」
Claude は自動で:
setupでセットアップ状況を確認(初回のみ)call_service(serviceId="demo_agent_search_api", limitUsdc="0.50", body={query:"AI agent payments"})- 結果を要約して返答
🎯 Use Cases
- Autonomous research agents — Let your agent pay-per-call for premium search, scraping, or data APIs without giving it your credit card.
- Multi-API workflows — One JWT, one balance, dozens of upstream APIs. No per-vendor signup or rotating keys.
- Compliance-aware spending — KYA (Know-Your-Agent) limits cap how much an agent can spend per session/day.
- Japanese tax automation —
check_taxvalidates 適格請求書 numbers against 国税庁 API for invoice compliance. - Idempotent retries —
idempotencyKeymakes call_service safe to retry without double-charging.
🪙 x402-compatible interface (since v0.5.1)
This server speaks the x402 idiom even though settlement happens off-chain via a Pay Token. The same agent code that handles on-chain x402 receipts works against agent-payment-mcp unmodified.
Successful calls return an x402Receipt
{
"status": 200,
"chargeId": "ch_abc123",
"amountUsdc": "0.005",
"response": { "...": "upstream payload" },
"x402Receipt": {
"scheme": "lemoncake-pay-token-v1",
"x402Compatible": true,
"chain": "off-chain (LemonCake Pay Token)",
"asset": "USDC",
"amount": "0.005",
"recipient": "serper",
"paymentIntentId": "ch_abc123",
"settledAt": "2026-05-09T14:50:11.019Z"
}
}Upstream 402 challenges are parsed
If a service returns an x402 challenge, call_service surfaces it as x402Challenge for your agent to reason about. Three challenge sources are recognised:
| Source | Example |
|---|---|
WWW-Authenticate header |
WWW-Authenticate: x402 chain="base" asset=USDC amount=0.01 recipient=0xabc |
X-402-* headers |
X-402-Chain: polygon, X-402-Asset: USDC, ... |
Body x402 field |
{ "x402": { "chain": "ethereum", ... } } |
⚠️ On-chain auto-pay of detected challenges (debiting the upstream's address from the Pay Token's USDC balance) is gated on the LemonCake
HOT_WALLETrollout — see issue #4. For now, the agent should escalate or pick another service.
PAYMENT_PENDING semantics for async settlement
If upstream returns 202 + Retry-After + X-Payment-Status: pending, call_service returns:
{
"status": "PAYMENT_PENDING",
"paymentIntentId": "pi_xyz",
"retryAfterMs": 5000,
"retryContract": "Call call_service again with the SAME idempotencyKey after 5000ms. The original request will resume; no double-charge."
}Agents should sleep retryAfterMs and retry with the same idempotencyKey. Demo Mode shows the same shape so you can write the handler against demo_search and ship it unchanged.
✅ Tested Clients
| Client | Status | Notes |
|---|---|---|
| Claude Desktop (macOS / Windows) | ✅ | Primary target |
| Cursor | ✅ | stdio transport |
| Cline (VS Code) | ✅ | stdio transport |
| Claude Code CLI | ✅ | stdio transport |
| Continue.dev | ✅ | MCP support since v0.9 |
| Custom MCP clients | ✅ | Any client speaking MCP 1.10+ over stdio |
🔐 環境変数
| 変数名 | 必須 | 説明 |
|---|---|---|
LEMON_CAKE_BUYER_JWT |
✅ | Buyer JWT(ダッシュボードの Settings → API Keys から取得) |
LEMON_CAKE_PAY_TOKEN |
— | Pay Token JWT(call_service で必要、未設定なら demo_* サービスのみ呼べる) |
LEMON_CAKE_API_URL |
— | API エンドポイント(デフォルト: https://api.lemoncake.xyz) |
🏃 ローカル開発
git clone https://github.com/evidai/lemon-cake.git
cd lemon-cake/mcp-server
npm install
npm run build
npm startDocker
docker build -t agent-payment-mcp .
docker run --rm -i -e LEMON_CAKE_BUYER_JWT=eyJhbGci... agent-payment-mcpイメージは Glama Inspector のブラウザ内プレビューにも利用されます。
🔗 関連リンク
- LemonCake ダッシュボード
- API ドキュメント
- Glama MCP listing
- Model Context Protocol
- GitHub
- Security Policy · Contributing · Code of Conduct
📄 ライセンス
MIT © LemonCake