DEV Community

Rob Lambert
Rob Lambert

Posted on

Nano Empire – Open-source MCP gateway with x402 micropayments and A2A routing

We built Nano Empire to solve the monetization bottleneck for AI agent tools. Most MCP servers either burn developer API credits for free or hide behind $20/month SaaS tiers that autonomous agents can't subscribe to.

We wrapped FastMCP with the x402 micropayment standard over Solana USDC and added Cerberus—a sub-millisecond UCB1 Multi-Armed Bandit router with a Bloom filter replay guard.

What it does:

  1. Tool Gateway: 12 live tools (security scanning, semantic embeddings, crypto price oracles, headless DOM extract).
  2. Pay-per-call: Tools cost $0.01 to $0.50 USDC per call. No API keys, no monthly subscription. Agents attach an x-402-receipt header.
  3. Agent-to-Agent (A2A) Delegation: Any agent can POST to /a2a/delegate to subcontract heavy compute to our local GPU cluster or fallback frontier models.
  4. Dogfood Proof: Our agent just ran a full 8-phase self-demonstration—discovering the tools, hitting the paywall, settling on-chain, and capturing an arbitrage task in 1,022ms (p99 latency 0.02ms for 100 concurrent requests).

The gateway is live in production:

Would love your feedback on the latency model and x402 payment flow.

Top comments (1)

Collapse
 
tercelyi profile image
tercel •

The 1,022ms end‑to‑end run you quote is the most interesting number here. It directly implies the payment + routing + tool call + arbitrage logic all fit inside a single “human‑acceptable” second, which is basically the bar where per‑call monetization can work for interactive agents.

A few things I’d be curious about when you say p99 latency 0.02ms for 100 concurrent requests:

  • Is that p99 for Cerberus’ routing decision only, or for the full HTTP round trip through the MCP gateway (excluding downstream tools)?
  • What does p50 / p95 look like side by side with the 1,022ms end‑to‑end number? That would show how much of the budget is spent on x402 settlement vs pure compute.
  • Are you measuring with or without on‑chain confirmation in the hot path? If agents optimistically proceed on receipt validation alone, it changes the risk profile but keeps the UX snappy.

On the x402 flow itself, a few checks I’d want to run:

  • How big is the per‑call receipt verification overhead in CPU and latency?
  • What happens when an agent fans out to, say, 20 tools in a single “plan”? Does receipt creation/validation become the dominant cost?
  • Any replay‑attack edge cases the Bloom filter doesn’t catch, e.g., across restarts or horizontal scale?

Overall, your numbers suggest “payments are not the bottleneck yet,” which is exactly what you want for a pay‑per‑call model. Sharing a simple trace diagram (timestamps at each phase) would make the story even clearer.