DEV Community

~K¹yle Million
~K¹yle Million

Posted on

How to add x402 pay-per-call data tools to your Claude Code agent — no API key needed

Most data APIs charge a monthly fee. Your agent might call the endpoint twice in a month, but you're still paying the full subscription. There's a better model.

x402 is an HTTP payment protocol built on the HTTP 402 status code — a code that's been in the spec since 1996 but never implemented at scale until now. Coinbase built the facilitator layer last year. The protocol is live on Base mainnet. AI agents can now pay exactly for what they use, in USDC, with no account or API key required.

I built The Stall around this protocol — a live MCP server with 32 data capabilities, each priced per call in USDC. Here's how to wire it into Claude Code in about 3 minutes, and what x402 actually looks like in the request cycle.


How x402 works

The flow is simple:

  1. Your agent sends a normal HTTP request to a capability endpoint
  2. The server responds with HTTP 402 + a payment challenge (a JSON blob describing amount, currency, facilitator, recipient address)
  3. Your x402-enabled client reads the challenge, constructs a signed USDC payment header, and resends the original request with X-Payment header attached
  4. The server verifies the payment with the Coinbase facilitator and returns the data
  5. The agent gets back structured JSON — and a receipt in the response headers

The x402 TypeScript SDK handles steps 2–4 automatically if you're building a coded agent. For Claude Code using MCP, the server manages this transparently through the MCP transport layer.


Claude Code setup

Add The Stall to your Claude Code MCP configuration:

{
  "mcpServers": {
    "the-stall": {
      "url": "https://the-stall.intuitek.ai/mcp",
      "transport": "streamable-http"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

That's the entire setup for most use cases. When Claude routes a tool call through The Stall, the MCP transport handles the x402 payment cycle — your agent doesn't need to implement anything.

For programmatic agents that call the REST endpoints directly, add the x402 SDK:

npm install x402
Enter fullscreen mode Exit fullscreen mode
import { wrapFetchWithPayment } from "x402/client";

// Fund this wallet with a few dollars of USDC on Base mainnet
const payingFetch = wrapFetchWithPayment(fetch, walletClient);

const response = await payingFetch(
  "https://the-stall.intuitek.ai/cap/us-stock-price?symbol=AAPL"
);
const data = await response.json();
// data: { symbol, price, change_percent, market_cap, ... }
Enter fullscreen mode Exit fullscreen mode

What's available

32 capabilities at the current catalog (https://the-stall.intuitek.ai/catalog). Pricing per call:

Capability Price What it returns
us-stock-price $0.030 Real-time US equity price + change %
equity-technicals $0.490 RSI, MACD, Bollinger Bands, support/resistance
market-intelligence $0.500 Which x402 endpoints have live on-chain volume
macro-indicators $0.008 GDP, CPI, Fed rate, unemployment, yield curve
commodity-futures $0.010 Gold, crude, nat gas, wheat — live front-month
crypto-top-movers $0.008 Top gainers/losers/mcap from CoinGecko top 100
company-intel $0.012 SEC EDGAR due diligence: name, SIC, filing history for any US public company by ticker
defi-yields $0.025 Top DeFi yield pools by APY
prediction-markets $0.050 Top Polymarket markets + crowd probabilities
concentration-risk-score $0.100 HHI-based wallet concentration risk
solana-token-risk $0.350 Rug-pull + scam detector for Solana SPL tokens
evm-token-security $0.007 Honeypot + rug detector for any EVM chain
funding-rates $0.020 Perp funding rates for 200+ assets
eth-block $0.002 Block header + transaction count
gas-prices $0.005 Current gas + EIP-1559 fee recommendations
forex-rates $0.005 170+ fiat exchange rates
dex-trending-pools $0.015 Trending DEX pools by buy pressure
stablecoin-watch $0.050 Depeg monitor for major stablecoins
wallet-screener $0.010 Risk profile for any EVM wallet
korean-market-movers $0.010 Top movers across 260+ KRW markets (Upbit)
github-repo-intel $0.010 Stars, forks, activity score for any GitHub repo
npm-lookup $0.007 Weekly downloads + metadata for any npm package
pypi-lookup $0.007 Downloads + metadata for any PyPI package
hn-search $0.010 Hacker News search with story + comment data
market-overview $0.100 Broad market snapshot (indices, crypto, sector)
market-sentiment $0.015 Fear & Greed Index + VIX + put/call ratio
generate-meme $0.005 AI-generated meme with context-appropriate caption
ping $0.001 Health check + connectivity test
weather $0.010 Weather for any location
tx-explainer $0.014 Human-readable explanation of any on-chain tx

Actual costs for typical agent patterns

The practical math for a data-heavy agent session:

  • Check stock price once: $0.03
  • Full technical analysis on 5 tickers: $2.45
  • Macro snapshot + commodity check on every run: $0.02
  • 30-day portfolio monitoring (1 check/day, 10 tickers): $9.00/month

Compare to Polygon.io starter ($29/month) or Alpha Vantage premium ($50/month) for similar data. If your agent doesn't run daily, pay-per-call wins the margin math.


The discovery angle — how agents find x402 services

The protocol is live, but agent-to-agent discovery is still early. Currently The Stall is listed in:

  • MCP Registry (official): ai.intuitek.the-stall/the-stall v3.1.0
  • Smithery.ai: The Stall — 32 tools enumerated
  • CDP x402 Bazaar — seeded, async indexing
  • 8+ awesome-mcp-servers / awesome-x402 catalog PRs pending merge

The emerging pattern for agent discovery is: MCP registry for schema discovery, x402 Bazaar for commercial discovery (services that accept payment), Smithery for Claude-native discovery. The Stall is live on all three.


Related reading

Source, catalog, and pricing: https://the-stall.intuitek.ai


~K¹ / IntuiTek¹ — built by Aegis

Top comments (0)