DEV Community

~K¹yle Million
~K¹yle Million

Posted on

I Built a Pay-Per-Call MCP Server on Base Mainnet — 26 Live Capabilities, No API Key, USDC Micropayments

The standard pattern for AI agent data access is: get an API key, pay a monthly fee, hope you don't blow your rate limit. I wanted something different — pay exactly for what you use, in USDC, with no account required.

So I built The Stall — a live x402 capability chassis with 26 data services, deployed on Railway, accepting USDC micropayments on Base mainnet. It's also published on the official MCP registry. No signup. No API key. Your agent pays in USDC and gets back data.

Here's how it works and what I learned building it.


What is x402?

x402 is a payment protocol that revived the abandoned HTTP 402 Payment Required status code. The flow:

  1. Agent hits a protected endpoint without payment
  2. Server returns HTTP 402 with a payment challenge (network, asset, amount, recipient)
  3. Agent pays USDC on Base via the x402 facilitator
  4. Agent retries with an X-PAYMENT header
  5. Server verifies on-chain, returns the payload

The x402 Foundation published the spec in early 2025. Coinbase built the facilitator. The practical result: AI agents can pay for API calls the same way they'd execute any other on-chain action — programmatically, with no OAuth, no billing portal, no monthly commitment.

Here's what a raw call looks like:

# Step 1: hit the endpoint — you get 402 back
curl https://the-stall.intuitek.ai/cap/us-stock-price?ticker=AAPL
# → HTTP 402
# {"x402Version":"1","accepts":[{"network":"base","asset":"USDC","maxAmountRequired":"30000",...}]}

# Step 2: pay via x402 facilitator (TypeScript SDK handles this automatically)
# Step 3: retry with X-PAYMENT header — server verifies on-chain, returns data
Enter fullscreen mode Exit fullscreen mode

With the x402 TypeScript SDK:

import { withPaymentInterceptor } from "x402-fetch";
import { createWalletClient } from "viem";

const client = withPaymentInterceptor(fetch, walletClient);

// This automatically handles the 402 → pay → retry cycle
const response = await client("https://the-stall.intuitek.ai/cap/us-stock-price?ticker=AAPL");
const data = await response.json();
// { ticker: "AAPL", price: 213.45, change_pct: -0.34, volume: 42881200, ... }
Enter fullscreen mode Exit fullscreen mode

The payment is $0.03 USDC. It settles on Base mainnet. No middleman holds the money.


The architecture: STALL + PROSPECTOR

I split the system into two components with different change rates:

The Stall is infrastructure — a domain-agnostic x402 chassis. It handles:

  • Payment verification (on-chain Base mainnet validation)
  • Capability routing (each capability is a standalone module in /capabilities/)
  • Schema validation and error normalization
  • MCP protocol wrapper (Streamable HTTP, spec 2025-11-25)
  • A2A agent card at /.well-known/agent.json

The chassis almost never changes. A new capability is one new file.

PROSPECTOR is the intelligence layer — a flow observer that monitors Base mainnet settlement data to decide what to build next.

Why settlement data instead of catalog scanning

The obvious approach is: scan the x402 Bazaar catalog, find categories with many listings, build one. I tried that. At 2,000 catalog entries, almost every bucket had 10+ competitors, and the catalog had grown to 40,000+ endpoints. Catalog scanning bottomed out.

The insight: the signal that matters isn't what's listed — it's what's actually getting paid. An endpoint that's collecting real organic settlements from multiple distinct wallets has proven demand. One with zero settlements is speculation.

PROSPECTOR v0.4 runs five data streams into a SQLite archive:

Stream Auth needed What it gives
bazaar none every Bazaar endpoint with first-seen/last-seen
base_rpc none live x402 settlements from public Base mainnet RPC
cloudflare CF_API_TOKEN AI-bot traffic share by user-agent
dune DUNE_API_KEY SQL aggregation over on-chain data (optional)
x402scan pending settlement feed from x402scan (placeholder)

The base_rpc stream is the key one. Public Base RPC + the USDC contract's AuthorizationUsed events cover every x402 settlement on Base — zero credentials required.

First run result: 1,222 real settlements in 2.6 seconds. Four concentration signals emitted, including one 100%-strength dependency (106 settlements from 2 distinct wallets on a single endpoint). That endpoint is now on my build list.


The 26 capabilities (with prices)

The catalog lives at /catalog. Current as of today:

Capability Price What it returns
us-stock-price $0.030 Price, change %, volume, day high/low, 52-week range for any NYSE/NASDAQ ticker
equity-technicals $0.490 Full technical analysis: RSI(14), MACD, Bollinger Bands, SMA/EMA, support/resistance
market-overview $0.100 SPY, QQQ, IWM, DIA + major crypto prices, 10Y yield, VIX — single-call snapshot
market-intelligence $0.500 Settlement-verified x402 endpoint intelligence from on-chain Base data
concentration-risk-score $0.100 HHI-based concentration risk for any x402 wallet (unique payers, top-payer share, risk tier)
market-sentiment $0.015 Crypto Fear & Greed Index + social volume data
solana-token-risk $0.350 Rug-pull scanner for Solana SPL tokens — mint address in, risk score + flags out
evm-token-security $0.007 Honeypot, rug-pull, and scam detection for any EVM token (0–100 risk score)
wallet-screener $0.010 Risk screening for EVM wallet addresses (0–100 score, OFAC check, mixer flags)
defi-yields $0.025 Top DeFi yield pools ranked by APY from DeFiLlama (16,000+ pools)
dex-trending-pools $0.015 Trending DEX liquidity pools with buy/sell pressure across timeframes
funding-rates $0.020 Perpetual funding rates for 200+ assets on Hyperliquid DEX
stablecoin-watch $0.050 Real-time depeg monitor for USDT, USDC, DAI, USDS, and others
prediction-markets $0.050 Top active Polymarket markets sorted by trading volume + crowd probabilities
tx-explainer $0.014 Decoded breakdown of any EVM transaction: sender, recipient, value, decoded input
eth-block $0.002 Ethereum block header + transaction hashes by block number or hash
gas-prices $0.005 Current gas prices and EIP-1559 fee recommendations for 6 major EVM chains
forex-rates $0.005 Real-time fiat FX rates, base USD, returns up to 170 currency pairs
github-repo-intel $0.010 Repository stats: stars, forks, open issues, language, recent commits
hn-search $0.010 Hacker News search via Algolia — stories and comments with scores
npm-lookup $0.007 npm package metadata: latest version, weekly downloads, dependencies
pypi-lookup $0.007 PyPI package metadata: version, author, classifiers, project URLs
korean-market-movers $0.010 Real-time KRX movers and volume-spike leaders across KRW markets
weather $0.010 Current conditions + 7-day daily forecast for any location worldwide
generate-meme $0.005 Meme image from 211 templates — returns a direct PNG URL
ping $0.001 Liveness probe — verifies the x402 rail end-to-end

Total range: $0.001 to $0.500 per call.


Using it as an MCP server

The Stall is published on the official MCP registry at ai.intuitek.the-stall/the-stall (v2.5.0). Add it to Claude Desktop or any MCP client:

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

All 26 capabilities show up as tools. When you invoke one, the x402 payment happens automatically via your configured wallet.

Or call any capability directly via the MCP tools/call interface:

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "id": 1,
  "params": {
    "name": "equity_technicals",
    "arguments": { "ticker": "NVDA" }
  }
}
Enter fullscreen mode Exit fullscreen mode

The pricing model (what I learned)

The x402 model has an interesting pricing constraint: payment happens before delivery. At selection time, the agent sees the capability description, schema, and price — nothing else. No reputation signal exists yet.

My pricing doctrine:

  1. Compete only in premium tiers ($0.10+). Commodity pricing ($0.001–$0.01) is a race to zero against incumbents with no marginal cost. Real per-call value requires a real per-call price.

  2. Undercut the comparable market rate by 10–20%. If the leading equity analytics endpoint charges $0.55, I price at $0.49 (equity-technicals). The agent picks the cheaper equivalent.

  3. Differentiate in what's visible before payment — richer output schemas, more complete descriptions, more fields returned. The agent's selection heuristic should see more value per dollar before it pays.

  4. Build reputation toward price increases. On-chain settled-call count is a public signal. As calls accrue, I'll reprice upward.


What's live and where to find it

The x402 SDK is at github.com/coinbase/x402. The spec is at x402.org.


Built by ~K¹ (William Kyle Million) · IntuiTek¹

Top comments (0)