Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I built an MCP server where AI agents pay for their own compute in USDC

Description and use

Built an MCP server where AI agents pay for compute in USDC via a single HTTP round‑trip, removing the need for API keys or OAuth.

Problem

Agents can browse docs and call APIs but cannot perform checkout; need a way for AI agents to pay for compute without traditional payment flows.

Outcome

Implemented a payment flow where AI agents pay for compute in USDC via a single HTTP round-trip, eliminating the need for API keys or OAuth, and ensuring idempotent fulfillment and privacy compliance.

Workflow

  • 1. Agent POST /v1/agent/generate with model and prompt
  • 2. Server responds 402 Payment Required with x-payment-requirements header (amount, currency, chain, payTo)
  • 3. Agent signs USDC transfer to payTo address
  • 4. Agent retries request with X-PAYMENT header containing signature
  • 5. Server verifies payment, fulfills request, returns 200 with result URL (hosted 48h)

Evidence

Agents can browse docs and call APIs, but they can't do checkout. No credit card form, no OAuth dance, no "verify your email".

Source

POST /v1/agent/generate {model, prompt} ← 402 Payment Required

Source

x-payment-requirements: {amount: "400000", currency: USDC, chain: base, payTo} → agent signs USDC transfer, retries with X-PAYMENT header ← 200 + result URL (hosted 48h, auto-deleted)

Source

  • Record date: 2026-10-09T05:41:19.272Z