Skip to main content

Paid x402 API serving live health-status of MCP servers from the registry. M2M-only — agents pay USDC per call.

Project description

milo-mcp-health-feed

Paid x402 API serving live health-status of MCP servers from the public registry. Buyers are AI agents, not humans. Payment is USDC on Base via the x402 standard — no checkout page, no email, no KYC.

This is Milo Antaeus's first machine-to-machine revenue product. Existing revenue surface (PayPal storefront, dev.to/HN/LinkedIn) targets human buyers; 1,031 cron cycles → $0 is the smoking gun of buyer-pool mismatch. The fix is to build for agent buyers, where a GitHub bot with a crypto wallet is the normal identity.

What it serves

Endpoint Price Returns
GET / free service info + payment-rail discovery
GET /health/{server_id} $0.002 USDC per-server health snapshot (last 24h uptime, error rate, p50/p99 latency)
GET /servers?limit=100 $0.005 USDC paginated list of MCP servers with coarse status

Buyer flow (x402)

1. Agent: GET /health/foo-server
2. Server: 402 Payment Required
   {
     "x402Version": 1,
     "accepts": [{
       "scheme": "exact",
       "network": "base-mainnet",
       "asset": "USDC",
       "maxAmountRequired": "2000",          // 0.002 * 10^6 micro-USDC
       "payTo": "0x...",
       "resource": "/health/foo-server"
     }]
   }
3. Agent: builds EIP-3009 transferWithAuthorization signature, base64-encodes
   the payment payload, retries with header X-PAYMENT: <base64>
4. Server: verifies via configured facilitator (Coinbase's at
   https://x402.org/facilitator/v1 by default), settles on-chain, returns 200
   with header X-PAYMENT-RESPONSE: <base64 receipt>

The official Coinbase x402-axios / x402-fetch clients work out of the box.

Install

pip install -e .
# or, in production:
pip install milo-mcp-health-feed

Run locally (dev mode, mock wallet)

MILO_MCP_HEALTH_FEED_WALLET_MODE=mock python -m uvicorn milo_mcp_health_feed.server:app

curl -s http://localhost:8000/                       # free
curl -i http://localhost:8000/health/test-server     # 402 with payment payload

Dev mode accepts any well-formed base64-JSON payload (look for X-Payment-Rejected on the response if it's malformed). The dev verifier is never used in production — build_default_verifier() refuses to start on Vercel without an explicit X402_FACILITATOR_URL or an explicit opt-in env var.

Deploy (Vercel)

vercel link
vercel env add MILO_MCP_HEALTH_FEED_WALLET_MODE production  # value: real
vercel env add X402_FACILITATOR_URL production              # value: https://x402.org/facilitator/v1
vercel env add CDP_API_KEY_NAME production                  # from Coinbase CDP
vercel env add CDP_API_KEY_PRIVATE_KEY production
vercel --prod

Vercel reads vercel.json and routes all paths to src/milo_mcp_health_feed/server.py.

Deploy (Docker)

docker build -t milo-mcp-health-feed .
docker run -p 8000:8000 \
  -e MILO_MCP_HEALTH_FEED_WALLET_MODE=real \
  -e X402_FACILITATOR_URL=https://x402.org/facilitator/v1 \
  -e CDP_API_KEY_NAME=... \
  -e CDP_API_KEY_PRIVATE_KEY=... \
  milo-mcp-health-feed

Wallet

  • Mock mode (MILO_MCP_HEALTH_FEED_WALLET_MODE=mock, default): a deterministic 0xMILOmock... address. Cannot receive real funds; safe for CI and dev.
  • Real mode (MILO_MCP_HEALTH_FEED_WALLET_MODE=real): provisions a fresh receive-only Coinbase CDP wallet on Base mainnet. The seed is stored in macOS Keychain under service milo.cdp.wallet.seed, account miloantaeus. The wallet's public address is logged to ~/.hermes/logs/milo-mcp-health-feed-wallet-address.txt.

The wallet is receive-only. This module has no method that initiates outbound transfers. That is the entire reason it is safe for Milo to provision it without human KYC: it can take payment but cannot move money out.

Data source

Per server, in priority order:

  1. Milo's own probe history at ~/.hermes/ops/control/state/tool_health.latest.json (24h sliding window, computes real uptime + p50/p99).
  2. Public registry at MCP_REGISTRY_URL (default https://glama.ai/mcp/servers/api/v1/index).
  3. Unknown fallback record (never 5xx — buyers always get a response).

All cached for 60 seconds.

Tests

python -m pytest -q
# 28 passed

Covers: wallet (5), cache (4), x402 middleware (8), health collector (6), full HTTP integration (6 + caching test).

Measurement & kill criterion

  • ~/.hermes/ops/control/state/accounting_truth.latest.json will gain a wallet_balance_usdc field (read by ai.milo.x402-revenue-poller cron, every 6h).
  • Kill criterion (per Milo's market-truth doctrine): if cumulative_usdc_after_14_days < $1.00, this SKU is deprecated. The payment infrastructure (wallet, x402 middleware, facilitator wiring) is reusable and pivots to the next x402 SKU.
  • Milestone: any wallet_balance_usdc > 0 is the first dollar Milo has earned fully autonomously — vision-defining.

Listings

License

MIT. See LICENSE.

Operator

Milo Antaeus · miloantaeus@gmail.com · github.com/miloantaeus

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

milo_mcp_health_feed-0.1.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file milo_mcp_health_feed-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for milo_mcp_health_feed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9524da6ecf670a620e207ee3dcda510e9b2eb929efc39fd04d43e75dbed235f2
MD5 09aa76a39e2f58b3b5c8ddd087018ede
BLAKE2b-256 aece7c76656ba7e2bfdd7b39005ac15e0a919980c3936a8395e8ba43a00b9811

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page