Skip to main content
Glama
evidai

pay-per-call-mcp — USDC · x402 · AI Agent Billing | LemonCake

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
LEMON_CAKE_BUYER_JWTNoBuyer JWT for production use, issues tokens on each call.
LEMON_CAKE_PAY_TOKENNoPay Token JWT for quickstart or pre-issued token.

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{}
logging
{}
prompts
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
setup

Show the LemonCake MCP first-run setup guide. No authentication required. Call this tool FIRST to learn what credentials are missing and how to obtain them.

If no auth env vars are set, the server is in DEMO MODE: list_services returns three demo services (demo_search / demo_echo / demo_fx) and call_service / check_balance respond with mock data so you can verify integration before signing up.

Returns the current credential status (Pay Token / Buyer JWT), demo-mode flag, and step-by-step instructions to obtain anything that is missing, including a sample MCP client config snippet ready to paste.

Returns: { version, apiUrl, mode, credentials, availableTools, setupSteps, register, dashboard, docs } Errors: none — this tool always succeeds.

list_services

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_PAY_TOKEN is missing, three demo services are prepended (demo_search → Wikipedia, demo_echo → httpbin, demo_fx → open.er-api) so you can try call_service without signing up. Live users (PAY_TOKEN set) see only 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>.

call_service

Invoke an upstream API service through LemonCake's pay-per-call proxy. Each successful call automatically charges USDC against your configured Pay Token.

PRECONDITIONS: • LEMON_CAKE_PAY_TOKEN env var must be set for real services. If missing, the tool returns a structured CREDENTIAL_MISSING error with how-to-fix steps. • DEMO MODE: serviceId values starting with demo_ (demo_search / demo_echo / demo_fx) work WITHOUT any auth and return canned responses — useful for Glama Inspector or new-user trial. They are clearly 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 Pay Token's limitUsdc 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 (since v0.5.1): • 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. On-chain auto-pay from Pay Token is gated (see issue #4); for now the agent should escalate. • 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? }

check_balance

Check the current USDC balance, KYC tier, and account info of the configured buyer.

PRECONDITIONS: • LEMON_CAKE_BUYER_JWT env var must be set. If missing AND no PAY_TOKEN is set, DEMO MODE returns a canned $1.00 demo balance with kycTier="DEMO" so trial users see something instead of an error. With PAY_TOKEN set but no BUYER_JWT, returns a structured CREDENTIAL_MISSING error.

Use BEFORE call_service to confirm sufficient funds, especially before a long batch.

Returns: { balanceUsdc, kycTier, email, name, [mode], [note] }

check_tax

Run a Japanese tax compliance check on a single transaction. No authentication required.

Performs three checks in one call:

  1. Validates the qualified-invoice registration number (T-number) against the NTA registry.

  2. Determines whether source-withholding (源泉徴収) applies based on the service description.

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

get_service_stats

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

Prompts

Interactive templates invoked by user choice

NameDescription
explore-demoWalk through demo_search → demo_fx → demo_echo with no auth required.
discover-marketplaceList approved services and pick one that matches a use case.
japan-tax-checkUse the check_tax tool to verify a 適格請求書発行事業者番号 against the NTA registry.
spend-with-budgetPattern: check_balance → call_service → check_balance again, demonstrating KYA/Pay-Token spending limits.
real-vs-demoHit the same logical query against demo_search (Wikipedia) and a real marketplace search service to see the difference.
japan-finance-bundleCombine gBizINFO 法人情報 + 国税庁 invoice check + e-Gov 法令 in one workflow.

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/evidai/lemon-cake'

If you have feedback or need assistance with the MCP directory API, please join our Discord server