r/mcp • • 5d ago

showcase A serverless headless browser MCP for extracting JSON from React sites (Zero Puppeteer)

Hey r/mcp,

I got tired of standard fetch tools failing on client-side rendered apps, and running heavy Playwright/Puppeteer setups locally just for simple extractions is a pain (plus the official Puppeteer MCP was recently archived). So I built a lightweight, serverless alternative.

x402-cluster is an MCP server powered by Cloudflare Workers and Browser Run. You pass it a URL and a target JSON schema, it spins up a headless browser at the edge, waits for the JS to render, and returns perfectly typed data.

How it works: Instead of writing fragile DOM selectors, you just define the shape of the data you want back:

JSON

{
  "url": "https://modern-react-site.com",
  "schema": {
    "title": "string",
    "pricing_tiers": ["string"]
  }
}

**Two ways to pay for runs:**

  1. **Standard API Key:** Prepaid Bearer auth (easiest for Claude Desktop and local scripts).
  2. **Autonomous Micropayments:** Built for actual AI agents. Supports EIP-3009 off-chain signatures to settle $0.01–$0.05 per call directly on Base L2 USDC without requiring a prepaid balance.

*(There's also a free `preview_extract` tool built in if you want to test the endpoint without a key.)*

Would love to hear what sites or workflows you're trying to scrape right now. Happy to answer any questions about the Cloudflare Browser Run architecture too!

1 Upvotes

6 comments sorted by

2

u/Garitalabs6 5d ago

Neat approach running this on Workers instead of a local Puppeteer setup. Curious how you're handling the URL input on the server side — since it's fetching arbitrary URLs and rendering JS at the edge, is there any validation against internal/private IP ranges, or is that left entirely to whoever deploys it? That's usually the first thing that bites serverless fetch-and-render tools like this.

1

u/TheMainBrainMan 5d ago

Great question—that’s actually one of the main reasons I went with Workers + Browser Run instead of self-hosting Puppeteer on a VPS or EC2 box.

At the infrastructure layer, Cloudflare’s edge gives a much smaller blast radius than a traditional container: there’s no `169.254.169.254` instance metadata endpoint to leak IAM credentials, no local VPC/LAN interface attached by default, and Workers egress doesn't route to RFC1918 private space unless you explicitly attach a Tunnel or VPC binding.

On the application side, the Worker parses and validates incoming URLs before dispatching, though right now it leans mostly on `new URL()` validation + Cloudflare's isolated egress rather than a full DoH A/AAAA + redirect-hop IP filter. Adding an explicit pre-flight blocklist for non-`http(s)` schemes, `localhost`, and private/link-local CIDR literals (plus checking redirect targets) is high on my list—mostly so bad inputs fail fast in <1ms before spinning up a Browser Run session.

If you're self-hosting the repo and binding it to a Cloudflare Tunnel/private network, you'd definitely want that CIDR guard enabled first.

1

u/TheMainBrainMan 5d ago

Quick update for the folks asking about how billing works for failed scrapes vs. missing data:

I just updated the docs in the repo to clarify the policy: You only pay if the browser successfully loads and the LLM completes its pass. If the infrastructure crashes (Worker 500s, browser timeouts, etc.), you aren't charged. If the page loads but the data isn't in the DOM (login walls, CAPTCHAs), it still counts as a run since the compute was fully spent.

Highly recommend using the free `preview_extract` tool to verify a site's DOM visibility before wiring it into a paid agent loop!

2

u/FurryCyclone 5d ago

So you just give it the URL and the fields you want and it figures out where to get them?