Getting a Cloudflare Worker to return HTTP 402 with a Base-USDC PAYMENT-REQUIRED header is the easy part. I covered that plumbing in my earlier notes on cf-x402-mcp v0.1.0.
What tripped me up next was a much more mundane question: once a paid MCP server is deployed, how does an agent or another developer actually find it, inspect what it returns without paying first, and verify that its manifests are not broken?
Between v0.1.0 and v0.3.0 of xgbtxy/cf-x402-mcp (51/51 Vitest tests passing in CI), most of my work shifted away from payment plumbing and toward discovery and verification surfaces — plus two small, browserless Pay-Per-Event (PPE) Apify Actor repos built around the same HTTP-first pattern. Here is what actually worked, where the seams are, and what I am still unsure about.
1. Three discovery surfaces, three different contracts
In v0.3.0, cf-x402-mcp exposes five paid tools (ci_log_sieve, repo_sec_triage, market_edge_feed, web_md_distill, and the newly added llm_cost_router at $0.01 USDC) across six OpenAPI 3.1 REST routes plus a stateless streamable-http MCP endpoint at POST /mcp.
To make the server discoverable without asking someone to read a README first, it now publishes to three distinct surfaces:
- Self-hosted machine-readable endpoints:
GET /llms.txt(HTTP 200,text/plain; charset=utf-8) — concise plain-text index of the MCP URL, discovery manifest, OpenAPI spec, and free preview route.GET /.well-known/x402(HTTP 200) — x402 v2 manifest declaringnetwork: eip155:8453, Base USDC asset, facilitator URL,mcpEndpoint: "/mcp", and per-tool atomic pricing.GET /openapi.json— OpenAPI 3.1 schema covering all six REST routes (/api/ci-log-sieve,/api/llm-cost-router,/api/market-edge-feed,/api/poly-signals,/api/repo-sec-triage,/api/web-md-distill).
- Official MCP Registry (
io.github.xgbtxy/cf-x402-mcp):- Published at
v0.3.0(status: active,isLatest: true) via GitHub OIDC, declaring astreamable-httpremote pointing tohttps://cf-x402-mcp.yan8925298.workers.dev/mcp. - One small detail that bit me at
v0.2.1:server.jsonenforces a tight description length (<= 100chars), so registry metadata cannot just be a copy-paste of your repo tagline.
- Published at
- Third-party directories:
- Glama:
https://glama.ai/mcp/servers/xgbtxy/cf-x402-mcp(HTTP 200). - x402scan:
https://www.x402scan.com/server/9b24c611-587b-49f1-940c-c8c93b4b8bec(6/6endpoints registered).
- Glama:
The catch is obvious once you maintain all three: none of them is a single source of truth. Each surface has its own schema, staleness window, and versioning rules. Updating a route in the Worker updates /llms.txt and /openapi.json immediately, whereas the Official MCP Registry only moves when you push a v* tag and run the OIDC publish workflow, and external directories refresh on their own schedule.
2. "sample": true as the practical trust primitive
Nobody — human or agent — wants to sign a USDC payment just to discover that a tool's JSON output shape does not match what their parser expects.
Every paid tool in cf-x402-mcp accepts "sample": true (or ?sample=true on REST routes) at $0, returning a deterministic built-in response without triggering the paywall. There is also a free GET /api/poly-signals/preview endpoint for a single-signal preview.
In practice, "sample": true has been more useful than prose documentation. You can test the exact response shape with a single curl:
curl -X POST "https://cf-x402-mcp.yan8925298.workers.dev/api/ci-log-sieve?sample=true"
The trade-off: sample responses can quietly drift from live paid outputs if they are not generated through the same core formatter. Right now unit tests cover both paths (test/core.test.ts, test/http.test.ts, test/poly-signals.test.ts), which helps, but there is no runtime schema assertion guaranteeing zero drift in production.
3. Two browserless Pay-Per-Event Apify Actors (and the honest seams)
Alongside the Cloudflare Worker, I built two companion MIT-licensed Apify Actor repositories using Pay-Per-Event (PPE) billing:
- xgbtxy/agent-docs-distiller-actor (
8/8Vitest tests passing in CI): pure HTTPfetch+cheerio+turndownin a 128–512 MB Node.js container (no Playwright/Chromium). It strips boilerplate, extracts HTML<table>elements into typed{ headers, rows }JSON, probes origins for/llms.txtand/openapi.json, and writes a Dataset,OUTPUTsummary, andLLMS_FULL.mdRAG bundle. PPE events:$0.002actor-start,$0.005page-distilled,$0.010spec-discovered(failed HTTP fetches are never billedpage-distilled). - xgbtxy/x402-endpoint-auditor-actor (
27/27Vitest tests passing in CI): pure HTTP compliance auditor for x402 v2 and MCP origins. It checks discovery (/.well-known/x402,/openapi.json,/llms.txt,/favicon.ico), runs optional MCP JSON-RPCinitialize+tools/list, probes paid routes for HTTP402+ Base64PAYMENT-REQUIREDheaders (x402Version, CAIP-2network, USDC asset,payTo), and outputs a0–100readinessScore, A–Fgrade, andAUDIT_REPORT.md. PPE events:$0.002actor-start,$0.005manifest-checked,$0.020endpoint-audited(SSRF-blocked or unreachable origins are never billed).
I want to be careful not to oversell the relationship between the Cloudflare Worker and these two Apify Actors. They do not share a runtime, a billing system, a registry, or an auth layer. One settles Base USDC on Cloudflare Workers via x402; the other bills USD per-event on Apify's platform.
What they do share is a narrow engineering preference: pure HTTP over headless browsers, explicit per-call/per-event pricing instead of opaque subscriptions, fail-closed CI tests, and treating llms.txt / OpenAPI / /.well-known/x402 as machine-verifiable contracts.
Two deliberate scope limits in x402-endpoint-auditor-actor are worth calling out explicitly:
- Strict SSRF guard: it rejects localhost, loopback, RFC1918, link-local, IPv6 loopback/ULA, DNS rebinding, and redirects to internal hosts before billing or probing.
- Zero payment is ever sent: the auditor only inspects unpaid
402challenges and discovery manifests. That means a100/Ascore on my own server is a shape check and a smoke test — not a proof that live facilitator settlement or on-chain finality will succeed under load.
Also, to be completely transparent about current status: both Apify Actor repositories are public and CI-green on GitHub, but Apify Store console publishing is still pending. They are runnable locally (npm test, npm run dry-run), not yet listed on the Apify Storefront.
4. Architectural trade-offs I actually felt
- Pure HTTP (
fetch+cheerio) vs. headless Chromium: startup is fast and memory stays in 128–512 MB, which makes$0.005/pageeconomics plausible. The obvious downside is that client-side-only SPAs that render documentation purely via JavaScript come back thin or empty. - Two billing rails (x402 Base USDC vs. Apify PPE): x402 gives permissionless per-call crypto settlement on Cloudflare Workers, while Apify PPE plugs into an existing developer billing platform (
mcp.apify.com). Supporting both means maintaining two completely separate operational surfaces instead of one clean stack. - Static shape audits vs. live paid end-to-end tests: refusing to hold private keys or send funds inside
x402-endpoint-auditor-actorkeeps the auditor safe to run on untrusted URLs, at the cost that settlement bugs still have to be caught separately.
5. What I am unsure about
- Whether registry presence drives real agent traffic or mostly human curiosity. Being active on the Official MCP Registry (
io.github.xgbtxy/cf-x402-mcp), Glama, and x402scan makes the server cleaner to inspect, but I have no evidence yet that autonomous agents are discovering and paying for third-party x402 tools in the wild at meaningful volume. - Whether micro-priced PPE events survive real-world unit economics.
$0.002foractor-startand$0.005forpage-distilledlooks friendly on paper, and pending Apify Store publication means I have zero live billing data yet to see how platform fees and noisy crawls behave in practice. - How much value a self-written auditor has beyond catching my own regressions. Using
x402-endpoint-auditor-actoragainstcf-x402-mcpis genuinely handy for catching missing headers or malformed manifests in CI, but an author auditing their own server is never an independent stamp of quality.
If you are publishing remote streamable-http MCP servers or experimenting with /llms.txt and /.well-known/x402 discovery, I would love to hear which discovery surfaces have actually sent you real traffic — and which ones turned out to be pure maintenance overhead.
Links
github.com/xgbtxy/cf-x402-mcp(MIT, v0.3.0, 51/51 Vitest tests)- Official MCP Registry ·
io.github.xgbtxy/cf-x402-mcp - Glama ·
xgbtxy/cf-x402-mcp - x402scan ·
cf-x402-mcp(6/6 endpoints) github.com/xgbtxy/agent-docs-distiller-actor(MIT, 8/8 Vitest tests)github.com/xgbtxy/x402-endpoint-auditor-actor(MIT, 27/27 Vitest tests)- Essay #10: Shipping a Pure-Rust MCP Server Across the Official Registry, Glama, Docker, and a Plugin Bundle
- Essay #8: Wiring HTTP 402 Paywalls Into MCP Servers on Cloudflare Workers (Base USDC + Solana USDC)
我觉得技术没有壁垒,在合适的时间做合适的事情就好,hhh