DEV Community

Nathaniel Cruz
Nathaniel Cruz

Posted on

Agents now buy live data with MPP — here's a working example

Agents now buy live data with MPP — here's a working example

MPP (Machine Payments Protocol) launched March 18 with Stripe, Visa, Cloudflare, and 100+ ecosystem partners. The idea: agents discover services via OpenAPI specs and pay for them autonomously — no checkout flow, no OAuth dance, no human in the loop.

Here's what that looks like in practice, with a real endpoint that supports both MPP and x402.


Step 1: Discover the endpoint

Any MPP-enabled agent can auto-discover clawmerchants.com via its OpenAPI spec:

curl https://clawmerchants.com/openapi.json
Enter fullscreen mode Exit fullscreen mode

The spec is MPP-compatible (registered on mppscan.com) and lists 45 routes — DeFi yields, funding rates, onchain flows, security intel, and more.


Step 2: Request data, get a 402

curl https://clawmerchants.com/v1/data/defi-yields-live
Enter fullscreen mode Exit fullscreen mode

Response (HTTP 402):

{
  "error": "payment_required",
  "status": 402,
  "protocols_supported": ["x402", "mpp"],
  "asset_id": "defi-yields-live",
  "price_usdc": 0.001,
  "asset": {
    "name": "DeFi Yield Intelligence",
    "description": "Real-time DeFi yield intelligence for agents managing positions across protocols. Returns top 50 risk-ranked pools from Ethereum, Base, Arbitrum, Optimism, and Polygon — each with protocol name, APY, chain, TVL, risk tier, and risk-adjusted yield score. Updated every 5 minutes from DeFiLlama."
  }
}
Enter fullscreen mode Exit fullscreen mode

The response headers include:

WWW-Authenticate: Payment id="...", realm="clawmerchants.com",
  method="tempo", intent="charge", request="eyJ...", expires="..."
X-Asset-Preview-URL: https://clawmerchants.com/v1/preview/defi-yields-live
Enter fullscreen mode Exit fullscreen mode

Step 3a: Pay with MPP

MPP agents fulfill the WWW-Authenticate: Payment challenge via a Tempo/Stripe session, then retry with:

curl https://clawmerchants.com/v1/data/defi-yields-live \
  -H "Authorization: Payment <mpp-session-token>"
Enter fullscreen mode Exit fullscreen mode

The endpoint verifies the payment on-chain and returns data.


Step 3b: Pay with x402

x402 agents send USDC on Base (already in their wallet) and include the payment proof:

curl https://clawmerchants.com/v1/data/defi-yields-live \
  -H "X-PAYMENT: <base64({txHash, buyerWallet})>"
Enter fullscreen mode Exit fullscreen mode

Same endpoint, same data, different payment rail. Both protocols are verified server-side.


Step 4: Get data

After payment, the endpoint returns the full feed:

{
  "pools": [
    {
      "protocol": "morpho-v1",
      "chain": "Ethereum",
      "symbol": "ALPHAUSDCENHANCEDV2",
      "apy": 19.99,
      "tvlUsd": 934828,
      "riskTier": "low"
    },
    {
      "protocol": "maxapy",
      "chain": "Base",
      "symbol": "USDC",
      "apy": 19.76,
      "tvlUsd": 403129,
      "riskTier": "low"
    }
  ],
  "total_pools": 50,
  "updatedAt": "2026-03-24T07:00:00Z"
}
Enter fullscreen mode Exit fullscreen mode

50 risk-ranked pools across Ethereum, Base, Arbitrum, Optimism, and Polygon. $0.001 per call.


Free preview (no payment)

The endpoint exposes a free preview returning the top 3 pools:

curl https://clawmerchants.com/v1/preview/defi-yields-live
Enter fullscreen mode Exit fullscreen mode

Useful for agents that need to evaluate data quality before committing.


Why this matters for agent developers

The 402 → pay → retry loop is what MPP standardizes. You don't negotiate with a human or set up a subscription — your agent hits an endpoint, sees a 402, fulfills the payment challenge, and retries. The entire flow is automatable.

ClawMerchants went live with MPP support on March 18 (same day as the launch). The spec is listed on mppscan.com — any MPP-compatible agent that scans for payable endpoints will find it automatically.

The full catalog: clawmerchants.com/openapi.json

Top comments (0)