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
  }'
FieldTypeWhat it does
urlstringRequired. The page to fetch. Must be public http(s).
formatsstring[]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.
onlyMainContentbooleanDefaults to true: narrows html and markdown to the main content. Set false for the whole DOM.
waitForSelectorstringWait for this CSS selector before capturing.
persistbooleanStore the capture and return a link that renders it from our origin. Off by default.
rotationsnumberHow many exits to try on a wall. Default 3, clamped 0-5.
parallelProbesnumberHow many exits to try concurrently. Default 3, clamped 1-5.
timeoutnumberOverall budget for the request. Default 120000, clamped 5000-300000.
sessionobjectReplay a cleared session: the session.cookies (and egressPort) from a previous response.
attributes{selector,attribute}[]For the attributes format. Up to 20.
summaryPromptstringInstruction 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.

ToolWhat it does
fetchThe 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_coveragePreflight. Says whether a URL is public and http(s) before you spend a fetch on it. Makes no request and costs nothing.
session_openOpen 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_listSee open session count, account limit and pricing.
session_executeRun Playwright-style JavaScript against persistent page/context state. Each run has a 30-second limit.
session_closeClose 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.

FormatReturnsWhat it is
markdownstringThe page as markdown. The default when no format is given.
htmlstringCleaned HTML. Narrowed by onlyMainContent, which defaults to true.
rawHtmlstringThe document exactly as received, never narrowed.
rawBase64stringThe document bytes as base64. UTF-8 safe.
textstringVisible text only, no markup.
screenshotstringBase64 PNG of the rendered page.
linksstring[]Absolute URLs found on the page.
images{src,alt,...}[]Absolute image URLs with alt text and dimensions when present.
metadataobjectThe page's head tags: title, description, og:*, canonical, language.
brandingobjectColours, fonts and logo, extracted deterministically.
attributesobjectNamed attributes per CSS selector. Send `attributes: [{selector, attribute}]`.
summarystringA short abstract, generated by a model.
jsonobjectStructured extraction. Send `jsonOptions: { schema }`.
ai_overviewobjectThe 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.

CodeHTTPMeaning
invalid_request400The body did not validate — a missing url, an unknown format, a bad selector shape.
target_not_allowed400The URL is private, internal, or not a public http(s) address.
egress_unavailable400You asked for an egress tier this deployment has not configured. Refunded in full.
insufficient_balance402Your balance cannot cover one fetch. Nothing ran, nothing was charged.
blocked200The site returned a wall instead of content. `success: false`, nothing charged.
timeout504The request exceeded its `timeout` budget. Nothing charged.
fleet_unavailable503Our 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_....