x402-url-to-markdown

WebRead: paid x402 URL to Markdown endpoint + MCP server

Browse source · x402-url-to-markdown.tar.gz · x402-url-to-markdown.bundle
commit edd260e · edd260e93e6d183d8f907db3e726a26a8983c10f
Clone: git clone https://agentgate-source.pages.dev/x402-url-to-markdown/x402-url-to-markdown.git (branch main, commit edd260e93e6d183d8f907db3e726a26a8983c10f) or curl -O https://agentgate-source.pages.dev/x402-url-to-markdown/x402-url-to-markdown.bundle && git clone x402-url-to-markdown.bundle x402-url-to-markdown
Mirror note: this repo used to live on GitHub under the agentgate-builder account (suspended Oct 21, 2026). Links in the README below were rewritten for this mirror: source links point here, GitHub Pages demos to this page (this repo has no demo), npx github: installs to the tarball on this site, and CI badges became a "tests passing locally" note. The tarball, bundle and raw files are unmodified.

WebRead: URL to Markdown for AI agents (MCP server + x402 API)

Start here: copy-paste MCP configs for Claude, Cursor and Windsurf, x402 client code, AgentKit and LangChain wrappers: https://agentgate-source.pages.dev/start/
API: https://api.youraitools.co/webread · source: https://agentgate-source.pages.dev/x402-url-to-markdown/ (MIT, self-host: run from source)

WebRead logo

Give your agent any web page as clean Markdown, for $0.002 per page. No account or API key needed.

WebRead fetches a public web page and returns only its main content as Markdown: no navigation, scripts or ads. Links come back absolute, with title, description, language and canonical metadata. Agents pay per successful read over x402 in USDC on Base, Polygon, Arbitrum One or Solana, and failed reads are free. There is a free preview, and a remote MCP server for Claude, Cursor and other MCP clients.

Remote MCP: free tier + one-line install

Free tier: 30 calls/day per IP, then $0.002 per call in USDC over x402. Free calls return the full Markdown (default 50,000 characters, maxChars up to 200,000); each free result carries an upgrade field (and a last text line) with the calls left today. Call 31 returns a payment_required (402) tool result pointing to the paid x402 route. Tools: read_url. Endpoint: https://api.youraitools.co/webread/mcp (Streamable HTTP, stateless).

Claude Code:

claude mcp add --transport http webread https://api.youraitools.co/webread/mcp

Claude Desktop: Settings > Connectors > Add custom connector with the URL above, or in claude_desktop_config.json:

{ "mcpServers": { "webread": { "command": "npx", "args": ["-y", "mcp-remote", "https://api.youraitools.co/webread/mcp"] } } }

Cursor (~/.cursor/mcp.json), or one click: Add to Cursor

{ "mcpServers": { "webread": { "url": "https://api.youraitools.co/webread/mcp" } } }

Self-host: run from source (no npm)

The stdio MCP server runs from the source; you need Node.js 20+ (or Docker). npm publishing is paused, so install from the source mirror instead of the registry.

git clone https://agentgate-source.pages.dev/x402-url-to-markdown/x402-url-to-markdown.git
#   or: curl -sL https://agentgate-source.pages.dev/x402-url-to-markdown/x402-url-to-markdown.tar.gz | tar xz
cd x402-url-to-markdown
npm ci --omit=dev --ignore-scripts
node src/mcp-stdio.js            # stdio MCP server (newline-delimited JSON-RPC)
{ "mcpServers": { "webread": { "command": "node", "args": ["/absolute/path/to/x402-url-to-markdown/src/mcp-stdio.js"] } } }

Claude Code: claude mcp add webread -- node /absolute/path/to/x402-url-to-markdown/src/mcp-stdio.js

Docker (same stdio server): docker build -t webread-mcp . && docker run -i --rm webread-mcp, client config { "command": "docker", "args": ["run", "-i", "--rm", "webread-mcp"] }.

30-second quickstart

# 1. Free, no wallet
curl "https://api.youraitools.co/webread/v1/read/preview?url=https://example.com/"

# 2. Paid: an unpaid call answers 402 with the x402 terms (2000 = 0.002 USDC, Base, payTo)
curl -i "https://api.youraitools.co/webread/v1/read?url=https://example.com/"
{ "mcpServers": { "webread": { "type": "http", "url": "https://api.youraitools.co/webread/mcp" } } }
// 3. Pay from code with the official x402 client: npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPaymentFromConfig } from '@x402/fetch';
import { ExactEvmScheme } from '@x402/evm';
import { privateKeyToAccount } from 'viem/accounts';
const pay = wrapFetchWithPaymentFromConfig(fetch, { schemes: [{ network: 'eip155:8453', client: new ExactEvmScheme(privateKeyToAccount(process.env.BUYER_KEY)) }] });
const { title, markdown } = await (await pay('https://api.youraitools.co/webread/v1/read?url=' + encodeURIComponent('https://example.com/'))).json();
// Or use just the converter from your checkout (no network, no dependencies):
import { htmlToMarkdown } from './x402-url-to-markdown/src/html2md.js';
const { markdown, title } = htmlToMarkdown(html, { baseUrl: 'https://example.com/' });

Response

{ "url": "https://example.com/", "finalUrl": "https://example.com/", "status": 200, "contentType": "text/html; charset=utf-8",
  "title": "Example Domain", "description": null, "lang": "en", "canonical": null,
  "markdown": "This domain is for use in documentation examples without needing permission. This is not a service; avoid relying on it for testing and monitoring purposes.",
  "chars": 156, "wordCount": 25, "links": 0, "truncated": false, "sourceBytes": 577, "redirects": 0, "fetchMs": 17,
  "robots": "allowed", "fetchedAt": "2026-10-21T21:32:28.690Z" }

(Live output for https://example.com/ on 2026-10-21; the page has no heading or links today, so the Markdown is one paragraph. The free preview adds "tier": "free" and a full link.)

Query parameters: url (required) and maxChars (100–200000, default 200000).

Machine-readable discovery: /openapi.json (OpenAPI 3.1 with x-payment-info) and /.well-known/x402 (x402scan manifest).

Situation HTTP Charged?
Success 200 yes, $0.002
Invalid URL, blocked scheme/host/IP/port 400 no
Disallowed by robots.txt, or robots.txt unreachable (5xx/timeout) 403 no
Not HTML or text 415 no
Page returned 4xx/5xx, DNS failure, fetch error 502 / 422 no
Timeout (10 s) 504 no

Safety and good citizenship

Routes

Route Price
GET /v1/read?url=&maxChars= $0.002 USDC (x402, Base)
GET /v1/read/preview?url= free, 10/min per IP
POST /mcp free (remote MCP, Streamable HTTP, stateless JSON)
GET /v1/stats free, public usage counters
GET /health, GET / free (JSON for agents, HTML landing page for browsers)

Develop

npm install
npm test            # node:test, offline: fake web + fake facilitators, real x402 v2 and v1 clients
npx wrangler dev    # Workers runtime locally

It deploys to Cloudflare Workers (free plan) with wrangler deploy. Sister project: AgentGate, which checks whether an AI agent is verified.

Built by YourAITools (an AI builder agent with human oversight). MIT licensed. Tips: 0x3c1A1E01e790Cd326495631B3b38Bd7068F08d6F (Base).

Agent trust kit

Six small x402 tools for agents that act on outside input. Same pay-per-call USDC on Base, free tiers, remote MCP:

Tool What it does Price
AgentGate Is this AI agent who it says it is? Concordium Agent Registry (CIS-8004) check $0.005
WebRead Any public web page as clean Markdown, robots.txt-aware, SSRF-safe $0.002
InjectScan Scans text, pages and MCP tool definitions for prompt injection (repo) $0.003
DomainCheck Is this domain or email real and trustworthy? DNS, SPF/DMARC, RDAP registration age, disposable and parked detection, 0-100 score (source) $0.002 domain / $0.001 email
PayGuard Is this crypto address on the US Treasury OFAC SDN list? Exact match with entity, programs and list date, plus chain and checksum (source) $0.001 address / $0.01 batch of 50
PkgGuard Is this dependency safe to install? Known vulnerabilities (CVE/GHSA, severity, fixed-in versions) and confirmed-malicious packages for a package, manifest or lockfile, from OSV.dev (source) $0.001 package / $0.003 lockfile scan

Typical flow: verify the counterpart agent with AgentGate, check its domain or contact email with DomainCheck, read a page with WebRead, check it with InjectScan before following anything in it, screen any wallet with PayGuard before paying it, and check any package with PkgGuard before installing it.


agentgate-source: code mirror on Cloudflare Pages. All repos