← All work
Product · 2026 Flagship

On-Chain Web-Data Agent with x402 Micropayments

Overview

An autonomous on-chain agent that proxies web-scraping (Firecrawl) and search (SerpApi) behind a fixed, predictable per-operation price, settled via x402 micropayments on the MegaETH chain. It exposes these capabilities to other agents and apps through standard MCP and Agent-to-Agent (A2A) endpoints, with an on-chain identity registered via the ERC-8004 Identity Registry.

The Challenge

Autonomous agents need web data, search results, scraped pages, structured extractions, but upstream providers charge variable, credit-based prices that make budgeting impossible, offer no on-chain way to discover or trust a service, and force every consumer to custody their own API keys. The goal was to wrap these services in a fixed-price, on-chain-discoverable, key-free interface.

What We Built

A Cloudflare Workers service (Hono) organized into route handlers for Firecrawl, SerpApi, an A2A surface, an MCP server, and metadata/discovery endpoints, plus service wrappers and an agent store. An x402 payment middleware (@x402/hono, @x402/evm) enforces fixed per-operation fees in USDC before serving a request; pricing is centralized in a config module so callers know the exact cost up front. Agent records and usage persist to Cloudflare D1. The agent is registered on MegaETH via ERC-8004 so other agents can discover and reputationally trust it. Deployed behind a dedicated route on Cloudflare.

Technologies & Approach

TypeScript on Cloudflare Workers with Hono for the HTTP surface; the MCP SDK and an A2A endpoint so the service is callable by standard agent orchestrators; @mendable/firecrawl-js and serpapi as upstreams; the x402 protocol (core/evm/hono) for on-chain micropayments; D1 for state; ERC-8004 for on-chain identity. The architecture deliberately absorbs upstream pricing complexity and re-exposes it as flat, transparent fees.

Outcome / Impact

A deployed proof that variable-cost web-data APIs can be re-served as fixed-price, on-chain-payable, agent-discoverable tools, removing both budget unpredictability and API-key custody for autonomous consumers. A strong demonstration of combining web-data infrastructure, the MCP/A2A agent ecosystem, and crypto micropayments.

Capabilities Demonstrated

  • Building agent-facing tool services over MCP and A2A
  • Wrapping scraping/search providers behind predictable, fixed pricing
  • On-chain agent identity (ERC-8004) and x402 micropayments on MegaETH
  • Edge deployment on Cloudflare Workers with D1 persistence
More work See all →