<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: LemonCake</title>
    <description>The latest articles on DEV Community by LemonCake (@lemoncake).</description>
    <link>https://dev.to/lemoncake</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3936371%2Fa5acc724-5c59-4f01-b119-18172e5b4509.png</url>
      <title>DEV Community: LemonCake</title>
      <link>https://dev.to/lemoncake</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lemoncake"/>
    <language>en</language>
    <item>
      <title>How to Monetize Your MCP Server with Pay-Per-Call USDC Payments</title>
      <dc:creator>LemonCake</dc:creator>
      <pubDate>Sun, 17 May 2026 13:58:52 +0000</pubDate>
      <link>https://dev.to/lemoncake/how-to-monetize-your-mcp-server-with-pay-per-call-usdc-payments-3mg9</link>
      <guid>https://dev.to/lemoncake/how-to-monetize-your-mcp-server-with-pay-per-call-usdc-payments-3mg9</guid>
      <description>&lt;h1&gt;
  
  
  How to Monetize Your MCP Server with Pay-Per-Call USDC Payments
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;If you've built an MCP server, you've probably wondered: how do I actually charge for this?&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Monetization Gap in the MCP Ecosystem
&lt;/h2&gt;

&lt;p&gt;The MCP ecosystem is exploding. Thousands of servers listed on registries, npm, Glama, Smithery. But look closely at the pricing model for almost all of them:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Free.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not "freemium." Just free. With a GitHub Sponsors link buried at the bottom that nobody clicks.&lt;/p&gt;

&lt;p&gt;This makes sense for early adoption — you want distribution. But it's not a business. And the obvious alternatives don't fit agentic workflows:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Monthly subscription&lt;/td&gt;
&lt;td&gt;AI agents don't have credit cards. Who signs up?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API key + quota&lt;/td&gt;
&lt;td&gt;Rate limits = agent blocking at 3am. Friction.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Per-seat SaaS&lt;/td&gt;
&lt;td&gt;Makes sense for humans, not for 100 parallel agents&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;There's a mismatch. MCP tools are called programmatically, at scale, in automated pipelines. The payment model should match.&lt;/p&gt;

&lt;p&gt;That's the gap I wanted to fill.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Pay Token Pattern
&lt;/h2&gt;

&lt;p&gt;Here's the insight: &lt;strong&gt;treat every tool call like an API call with a receipt&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;An agent that can call &lt;code&gt;search_markets()&lt;/code&gt; or &lt;code&gt;place_order()&lt;/code&gt; should be able to pay for those calls — automatically, with no human approval per call, within pre-set limits.&lt;/p&gt;

&lt;p&gt;The pattern looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User (human)                    MCP Client            MCP Server (your tool)
     │                               │                        │
     ├─ Top up $20 USDC once ───────&amp;gt;│                        │
     ├─ Set daily cap $5 ───────────&amp;gt;│                        │
     │                               │                        │
     │ (agent runs autonomously)     │                        │
     │                               ├─ call_tool(args) ─────&amp;gt;│
     │                               │   + LEMONCAKE_PAY_TOKEN │
     │                               │                        ├─ charge $0.01
     │                               │&amp;lt;─ result + receipt ────┤
     │                               │                        │
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key element is the &lt;strong&gt;Pay Token&lt;/strong&gt; — a short-lived, scoped JWT that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Carries a spend limit the agent cannot exceed&lt;/li&gt;
&lt;li&gt;Can be revoked instantly (kill switch)&lt;/li&gt;
&lt;li&gt;Doesn't expose your wallet or API key to the MCP server&lt;/li&gt;
&lt;li&gt;Produces a machine-readable receipt on every successful charge&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Safety Mechanic: Spend Caps the Agent Can't Override
&lt;/h2&gt;

&lt;p&gt;This is what took the most thought to get right.&lt;/p&gt;

&lt;p&gt;The obvious approach is trusting the agent to "spend responsibly." This doesn't work. An injected prompt, a hallucinated loop, or a misconfigured instruction can rack up charges before you notice.&lt;/p&gt;

&lt;p&gt;The safer design: &lt;strong&gt;the cap is enforced server-side, outside the agent's call graph&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// alpaca-guard-mcp: preflight before every order&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;guarded_place_order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PlaceOrderArgs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// 1. Resolve notional cost&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;notional&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;qty&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;limitPrice&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;get_latest_quote&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

  &lt;span class="c1"&gt;// 2. Preflight against cap.json — BEFORE any Alpaca call&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;readCap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// { dailyLimitUsd: 50, todayUsedUsd: 12.50 }&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;remaining&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dailyLimitUsd&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;todayUsedUsd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;notional&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;remaining&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;BUDGET_EXCEEDED&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;hint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`This order would cost ~$&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;notional&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; but only $&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;remaining&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; remains under today's $&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dailyLimitUsd&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; cap.`&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// 3. Only then: call Alpaca&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;alpaca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;placeOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// 4. Record the charge&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;recordCharge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;notional&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent sees the &lt;code&gt;BUDGET_EXCEEDED&lt;/code&gt; structured response and can explain it to the user. It cannot retry past the cap. There's no agent-side override.&lt;/p&gt;




&lt;h2&gt;
  
  
  Adding Billing to Your Own MCP Server
&lt;/h2&gt;

&lt;p&gt;If you've built an MCP server and want to add pay-per-call billing, it's three lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @lemon-cake/mcp-sdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;McpServer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@modelcontextprotocol/sdk/server/mcp.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createLemonCakeSDK&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@lemon-cake/mcp-sdk&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;McpServer&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;my-server&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1.0.0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createLemonCakeSDK&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;sellerKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LEMONCAKE_SELLER_KEY&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;my_paid_tool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="c1"&gt;// Wrap your handler with lc.charge()&lt;/span&gt;
  &lt;span class="nx"&gt;lc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;charge&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt; &lt;span class="p"&gt;})(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;query&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;doExpensiveOperation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;query&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Demo Mode&lt;/strong&gt;: if &lt;code&gt;LEMONCAKE_SELLER_KEY&lt;/code&gt; is absent, &lt;code&gt;lc.charge()&lt;/code&gt; is a no-op. Your tool runs, charges are logged to stderr, no real billing. Safe for local dev.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Live Mode&lt;/strong&gt;: set &lt;code&gt;LEMONCAKE_SELLER_KEY&lt;/code&gt; in your server env. Every successful tool call deducts from the caller's Pay Token balance and returns a receipt.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Full Flow for a Paid Tool Call
&lt;/h2&gt;

&lt;p&gt;What actually happens when an agent calls a billed tool:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Agent calls tool&lt;/strong&gt; → MCP client injects &lt;code&gt;LEMONCAKE_PAY_TOKEN&lt;/code&gt; from its env&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SDK validates token&lt;/strong&gt; → checks signature, expiry, remaining balance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handler executes&lt;/strong&gt; → your actual logic runs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SDK charges token&lt;/strong&gt; → atomic debit from Pay Token balance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Receipt returned&lt;/strong&gt; → &lt;code&gt;x402Receipt&lt;/code&gt; appended to tool result&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent gets result + receipt&lt;/strong&gt; → can log, display, or ignore&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If the token is expired, exhausted, or revoked at step 2, the tool returns a structured error — the agent never calls your downstream API.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real MCPs Using This Pattern
&lt;/h2&gt;

&lt;p&gt;I've shipped several MCP servers using this model:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/agent-payment-mcp" rel="noopener noreferrer"&gt;agent-payment-mcp&lt;/a&gt;&lt;/strong&gt; — pays for calls to 10+ APIs (Serper, Hunter, Jina, Firecrawl, Slack). Free demo mode, no signup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/alpaca-guard-mcp" rel="noopener noreferrer"&gt;alpaca-guard-mcp&lt;/a&gt;&lt;/strong&gt; — wraps Alpaca trading API with a hard daily USD cap. Paper trading default.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/polymarket-guard-mcp" rel="noopener noreferrer"&gt;polymarket-guard-mcp&lt;/a&gt;&lt;/strong&gt; — Polymarket prediction markets with USDC billing. Read-only free.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/xstocks-mcp" rel="noopener noreferrer"&gt;xstocks-mcp&lt;/a&gt;&lt;/strong&gt; — tokenized US stocks on Solana via Jupiter DEX. $0.10/trade.&lt;/p&gt;

&lt;p&gt;All use the same pattern: free read tools, charged write tools, spend caps enforced before any destructive operation.&lt;/p&gt;




&lt;h2&gt;
  
  
  The x402 Connection
&lt;/h2&gt;

&lt;p&gt;If you've been following the &lt;a href="https://www.x402.org/" rel="noopener noreferrer"&gt;x402 protocol&lt;/a&gt; — HTTP-native machine payments — this is the same idea applied to MCP.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;agent-payment-mcp&lt;/code&gt; speaks x402: every successful charge returns an &lt;code&gt;x402Receipt&lt;/code&gt;, and upstream 402 challenges from APIs are parsed and handled automatically. Agent code written for on-chain x402 works unmodified.&lt;/p&gt;

&lt;p&gt;The eventual goal is for the cap ledger to live on a server-side API rather than a local file — same daily cap mechanic, but shared across MCP clients and auditable. That's the Phase B roadmap item.&lt;/p&gt;




&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;As a user&lt;/strong&gt; (call billed tools):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sign up at &lt;a href="https://lemoncake.xyz" rel="noopener noreferrer"&gt;lemoncake.xyz&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Top up $5+ USDC&lt;/li&gt;
&lt;li&gt;Copy your Buyer JWT&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;LEMON_CAKE_BUYER_JWT&lt;/code&gt; to any of the MCPs above&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;As a developer&lt;/strong&gt; (add billing to your MCP server):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;npm install @lemon-cake/mcp-sdk&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Wrap handlers with &lt;code&gt;lc.charge({ price: 0.01 })(handler)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Apply to &lt;a href="https://lemoncake.xyz" rel="noopener noreferrer"&gt;lemoncake.xyz&lt;/a&gt; to list in the marketplace&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Demo mode works immediately with no signup. You can ship a billed tool today and test the full flow before going live.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Questions? Drop them below or find me at &lt;a href="https://twitter.com/evidai" rel="noopener noreferrer"&gt;@evidai&lt;/a&gt;. The spec for the Pay Token format and x402 compatibility is in the &lt;a href="https://github.com/evidai/agent-payment-mcp" rel="noopener noreferrer"&gt;agent-payment-mcp README&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; mcp, ai, agents, payments, usdc, claude, typescript&lt;/p&gt;

</description>
      <category>ai</category>
      <category>cryptocurrency</category>
      <category>mcp</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
