webfetch.run
Hosted MCP server and API: fetch any public URL as markdown, HTML, text, or a screenshot. JS is rendered in a real browser, proxies are included, and a failed fetch costs nothing.
Hosted MCP Server
npx add-mcp 'https://mcp.webfetch.run/mcp'Installs into Claude Code, Codex, Cursor and more
Documentation
Scrape and interactive sessions
Fetch a URL as formatted content, or open a persistent browser and control it with JavaScript through the API or MCP.
The request
curl https://api.webfetch.run/v1/scrape \
-H "X-API-Key: $SCRAPE_API_KEYGet key →" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.allbirds.com/products/mens-wool-runners",
"formats": ["markdown"],
"egress": "residential",
"location": {"country": "ES", "languages": ["es-ES", "es"]},
"persist": true
}'
| Field | Type | What it does |
|---|---|---|
| url | string | Required. The page to fetch. Must be public http(s). |
| formats | string[] | Defaults to ["markdown"]. Names are case-insensitive; an unknown name is a 400 that lists the valid ones. |
| egress | "direct" | "datacenter" | "residential" | Where the request leaves from. Defaults to direct. A different egress reaches sites that refuse others; the price per fetch is the same either way. |
| location | {country, languages?} | Target the exit IP country and browser language, for example {"country":"ES","languages":["es-ES","es"]}. Uses direct egress when the fleet already exits in that country, otherwise country-targeted residential egress at the normal pay-as-you-go fetch price. |
| onlyMainContent | boolean | Defaults to true: narrows html and markdown to the main content. Set false for the whole DOM. |
| waitForSelector | string | Wait for this CSS selector before capturing. |
| persist | boolean | Store the capture and return a link that renders it from our origin. Off by default. |
| rotations | number | How many exits to try on a wall. Default 3, clamped 0-5. |
| parallelProbes | number | How many exits to try concurrently. Default 3, clamped 1-5. |
| timeout | number | Overall budget for the request. Default 120000, clamped 5000-300000. |
| session | object | Replay a cleared session: the session.cookies (and egressPort) from a previous response. |
| attributes | {selector,attribute}[] | For the attributes format. Up to 20. |
| summaryPrompt | string | Instruction for the summary format. |
| jsonOptions | {schema} | JSON Schema for the json format. |
MCP
If your client speaks MCP, you do not need any of the above. Point it at the server and the same fetch arrives as a tool, with the arguments typed and every failure explained in words rather than an HTTP status you have to interpret.
claude mcp add --transport http webfetch \
https://mcp.webfetch.run/mcp \
--header "X-API-Key: $SCRAPE_API_KEYGet key →"
Any MCP client works the same way: add https://mcp.webfetch.run/mcp as a streamable-HTTP server and send your key as the X-API-Key header. The server stores no key of its own — it forwards yours — so nothing it holds can spend your balance.
| Tool | What it does |
|---|---|
| fetch | The product. Same formats, same egress, same $0.022 per successful fetch. A page that does not come back costs nothing and the reply says why. |
| check_coverage | Preflight. Says whether a URL is public and http(s) before you spend a fetch on it. Makes no request and costs nothing. |
| session_open | Open an interactive browser. One session per account; five-minute maximum, 60-second idle close. $0.044 per browser minute, one-minute minimum, up to $0.22 reserved. |
| session_list | See open session count, account limit and pricing. |
| session_execute | Run Playwright-style JavaScript against persistent page/context state. Each run has a 30-second limit. |
| session_close | Close a session and refund the unused portion of its reserve. |
Interactive browser sessions
Use this when a single scrape is not enough: open a real browser, keep its page and context between calls, and run Playwright-style JavaScript as the page changes. The account can hold one session at a time. It expires after five minutes or 60 seconds without activity; each code execution is capped at 30 seconds. Billing is $0.044 per browser minute with a one-minute minimum. Opening reserves at most $0.22, and the unused time is returned when the session closes.
# Open a browser from Spain (country-targeted residential egress)
curl https://api.webfetch.run/v1/sessions \
-H "X-API-Key: $SCRAPE_API_KEYGet key →" -H "Content-Type: application/json" \
-d '{"url":"https://example.com","location":{"country":"ES","languages":["es-ES","es"]}}'
# Run JavaScript in the same page/context
curl https://api.webfetch.run/v1/sessions/$SESSION_ID/execute \
-H "X-API-Key: $SCRAPE_API_KEYGet key →" -H "Content-Type: application/json" \
-d '{"code":"await page.title()"}'
# Close early and settle the charge
curl -X DELETE https://api.webfetch.run/v1/sessions/$SESSION_ID \
-H "X-API-Key: $SCRAPE_API_KEYGet key →"
REPL code has access to page and context, including page-side evaluate. Callback functions are limited to page-context evaluation so code cannot execute in the shared fleet process.
Formats
Ask for any combination. You get back only what you asked for.
| Format | Returns | What it is |
|---|---|---|
| markdown | string | The page as markdown. The default when no format is given. |
| html | string | Cleaned HTML. Narrowed by onlyMainContent, which defaults to true. |
| rawHtml | string | The document exactly as received, never narrowed. |
| rawBase64 | string | The document bytes as base64. UTF-8 safe. |
| text | string | Visible text only, no markup. |
| screenshot | string | Base64 PNG of the rendered page. |
| links | string[] | Absolute URLs found on the page. |
| images | {src,alt,...}[] | Absolute image URLs with alt text and dimensions when present. |
| metadata | object | The page's head tags: title, description, og:*, canonical, language. |
| branding | object | Colours, fonts and logo, extracted deterministically. |
| attributes | object | Named attributes per CSS selector. Send `attributes: [{selector, attribute}]`. |
| summary | string | A short abstract, generated by a model. |
| json | object | Structured extraction. Send `jsonOptions: { schema }`. |
| ai_overview | object | The generated-answer card, expanded: markdown plus a PNG of that card. present is false when the page has none, including every non-Google URL. |
The response
{
"success": true,
"data": {
"markdown": "# Men's Wool Runner\n\nA true original, combining soft...",
"metadata": {
"url": "https://www.allbirds.com/products/mens-wool-runners",
"finalUrl": "https://www.allbirds.com/products/mens-wool-runners",
"title": "Men's Wool Runner - Natural Grey",
"status": 200,
"verdict": "ok",
"attempts": 2,
"bytes": 284710,
"session": { "cookies": ["..."], "egressPort": 10006 }
}
},
"balance": { "chargedMicros": 22000, "remainingMicros": 24978000 }
}
Keep metadata.session and send it back as session on the next request. A cleared session is bound to the exit that earned it, and reusing it turned repeat queries from 38 s into 6-8 s.
Errors
A failure is always success: false with a machine-readable code, and always costs nothing.
| Code | HTTP | Meaning |
|---|---|---|
| invalid_request | 400 | The body did not validate — a missing url, an unknown format, a bad selector shape. |
| target_not_allowed | 400 | The URL is private, internal, or not a public http(s) address. |
| egress_unavailable | 400 | You asked for an egress tier this deployment has not configured. Refunded in full. |
| insufficient_balance | 402 | Your balance cannot cover one fetch. Nothing ran, nothing was charged. |
| blocked | 200 | The site returned a wall instead of content. `success: false`, nothing charged. |
| timeout | 504 | The request exceeded its `timeout` budget. Nothing charged. |
| fleet_unavailable | 503 | Our own renderer could not be reached. Our fault, refunded in full. |
Keys
Create a key in the console. The plaintext is shown once; we store only a SHA-256 hash. Send it as X-API-Key: sk_live_....