blazecrawl-mcp

v0.1.2
blazecrawl-mcp Checked 20 hours ago Published 2 months ago

MCP server for BlazeCrawl Core (scrape/map/crawl tools).

Security-first web extraction. Self-hosted by you. Turn public web pages into Markdown and page data for RAG pipelines, AI agents, and developer tools. Get started  ·  Choose an integration  ·  Build with us  ·  Explore the architecture Real output from a native local instance. No simulated results. Static view · Reproduce the demos

Summary extracted from the README.


One engine. Three jobs: scrape a page, map a site's URLs, or crawl a bounded set of pages. Run it locally without a cloud account or a third-party scraping service.

Why BlazeCrawl?

Web extraction is more than fetching HTML. BlazeCrawl brings the API, rendering, extraction, and outbound-request controls together so you can spend less time assembling infrastructure.

What you need What BlazeCrawl provides
Content for your retrieval pipeline Main-content extraction to Markdown, with optional HTML, text, links, and images.
A site's discoverable URLs Sitemap and link-graph discovery through /v1/map.
More than one page Same-origin crawl jobs with page/depth limits, robots.txt rules, polling, and cancellation.
JavaScript-rendered content Playwright rendering, plus a static path and automatic fallback for thin content.
Control over your deployment A local API and Docker image; no mandatory hosted platform or cloud credentials.
Defenses against hostile URLs Destination validation, private-address blocking, DNS-rebinding-resistant connections, and guarded browser egress.
A familiar integration HTTP, Python, Node.js, CLI, or MCP, backed by the same engine.

Best fit: self-hosted extraction for developer tools, research workflows, and downstream AI systems. Core does not bundle an LLM, a managed proxy fleet, or a promise to bypass every site's bot protection.

Quickstart

Release candidate: v0.2.0. This page describes the intended release, not a claim that it is already published. Use the pinned commands below only after the release confirms all five packages and the image passed public-registry checks. Until then, use source setup. v0.1.2 does not include the new 0.2.0 fields/features.

Recommended path: Docker running Linux containers, with a working internet connection. The image supports Linux x86_64 (amd64). On Apple Silicon, add --platform linux/amd64 to docker run to use Docker Desktop emulation (slower; not native ARM64 support). Bash examples use curl 7.71+ on Linux/macOS for bounded startup retries; the PowerShell equivalent follows. No cloud account is needed. Prefer Python? Use the no-Docker option.

1. Start the API

docker run -d --name blazecrawl \
  -p 127.0.0.1:8000:8000 \
  -v blazecrawl-data:/data/blazecrawl \
  ghcr.io/danish-sethi/blazecrawl:0.2.0

The API is published to loopback only. The volume keeps your generated key across container restarts.

2. Get your local key

docker logs -f blazecrawl

Wait for the first run line, copy the blz_local_... key, then press Ctrl+C to stop following the logs; the container keeps running. The key is shown only when first generated. Keep it private. If you reuse an existing volume, use your previously saved key instead.

3. Make your first request

export BLAZECRAWL_API_URL="http://127.0.0.1:8000"
export BLAZECRAWL_API_KEY="blz_local_REPLACE_WITH_YOUR_KEY"

# Wait for startup; connection refused means the server is not ready yet.
curl --retry 30 --retry-all-errors --retry-delay 1 --retry-max-time 90 --max-time 5 \
  -fsS "$BLAZECRAWL_API_URL/ready"

curl -fsS "$BLAZECRAWL_API_URL/v1/scrape" \
  -H "Authorization: Bearer $BLAZECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","formats":["markdown"],"render":"static","only_main_content":false}' \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["data"]["markdown"])'

The final line uses Python 3 to display data.markdown, including Example Domain. Without Python, remove the pipe to see the JSON response, which contains success and data. The SDKs unwrap data for you. Check browser.is_healthy in /ready before using browser rendering; static extraction can still work when the browser pool is unavailable.

Open interactive API docs on your running instance to explore the contract.

If the first request fails

Symptom Action
Container cannot bind port 8000 Use -p 127.0.0.1:8001:8000 and set the client URL to http://127.0.0.1:8001. If the name is already in use, inspect docker ps -a and start the existing container or choose another name.
Connection refused / startup still running Check docker ps -a and docker logs blazecrawl; retry /ready after startup. /health reports liveness/version, not working Chromium.
HTTP 401 / no new key printed An old volume reuses its saved key; use the same key, not a new placeholder. Recover your own persisted key locally with docker exec blazecrawl cat /data/blazecrawl/api_key; do not paste it into an issue. Do not delete the volume to troubleshoot.
HTTP 400 url_rejected for a private URL Expected SSRF protection. Use a public HTTP(S) page. Loopback, LAN, metadata and private DNS answers are intentionally rejected; do not disable the checks.
Browser unhealthy / Chromium missing Static extraction may still work. For native installs run playwright install chromium in the server's environment; on Linux use --with-deps. For Docker use the pinned official image and inspect startup logs.
SDK installed but no server responds SDKs and MCP are clients, not the extraction server. Start the API, then set the same API URL and key in the client terminal.
Image/package version not found 0.2.0 may still be a candidate, or the new org image may not yet be public. Check the release status; do not substitute an unverified latest tag.

Keep the key private; redact keys and proxy credentials from shared logs. Authentication stays enabled.

docker run -d --name blazecrawl -p 127.0.0.1:8000:8000 -v blazecrawl-data:/data/blazecrawl ghcr.io/danish-sethi/blazecrawl:0.2.0
docker logs -f blazecrawl

Copy the first-run key and press Ctrl+C, then:

$env:BLAZECRAWL_API_URL = "http://127.0.0.1:8000"
$env:BLAZECRAWL_API_KEY = "blz_local_REPLACE_WITH_YOUR_KEY"
$ready = $null
for ($i = 0; $i -lt 30; $i++) {
    try {
        $ready = Invoke-RestMethod "$env:BLAZECRAWL_API_URL/ready" -TimeoutSec 5
        break
    } catch [System.Net.WebException] {
        Start-Sleep -Seconds 2
    } catch [System.Net.Http.HttpRequestException] {
        Start-Sleep -Seconds 2
    }
}
if ($null -eq $ready) { throw "API not ready; inspect docker logs blazecrawl." }
$ready

$headers = @{ Authorization = "Bearer $env:BLAZECRAWL_API_KEY" }
$body = @{ url = "https://example.com"; formats = @("markdown"); render = "static"; only_main_content = $false } | ConvertTo-Json
$result = Invoke-RestMethod -Uri "$env:BLAZECRAWL_API_URL/v1/scrape" -Method Post -Headers $headers -ContentType "application/json" -Body $body
$result.data.markdown

For a source build/Compose and optional Redis, see contributor setup. Without Redis, crawl state is lost on restart unless CRAWL_CHECKPOINTS_ENABLED=true writes checkpoints to the API state volume. The generated API key persists independently of crawl settings.

Deployment note: set BLAZECRAWL_API_KEY yourself to use a key that is never printed or persisted. Keep authentication enabled. Publishing beyond loopback requires deliberate access controls and TLS. See the security model before exposing the API.

Local (no Docker)

Requires Python 3.11+. On Linux/macOS:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install blazecrawl-core==0.2.0
playwright install chromium
blazecrawl-server

On native Windows, set an explicit BLAZECRAWL_API_KEY before starting the server; generated-key storage expects POSIX file permissions. Use the same securely generated value in both server and client terminals:

py -3 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install blazecrawl-core==0.2.0
playwright install chromium
$env:BLAZECRAWL_API_KEY = python -c "import secrets; print('blz_local_' + secrets.token_urlsafe(32))"
blazecrawl-server

On Linux, playwright install --with-deps chromium also installs the browser's OS dependencies. The server defaults to http://127.0.0.1:8000. If you did not supply your own key, copy the first-run key; then make the same authenticated request from another terminal. The CLI is included in blazecrawl-core.

Crawl scheduling safeguards

All jobs in the API process share one CrawlManager governor. Each hostname (including requests using different schemes/ports) has one concurrency limit and token bucket. The strongest robots crawl-delay observed for that hostname is also enforced between page attempt start times; robots disallow rules and SSRF checks remain mandatory.

Environment variable Default Units / scope
CRAWL_MAX_CONCURRENCY 4 Active page-fetch attempts across all hosts/jobs
CRAWL_HOST_CONCURRENCY 2 Active page-fetch attempts per hostname, shared across jobs
CRAWL_HOST_RATE 1.0 Tokens refilled per second per hostname; one token per attempt
CRAWL_HOST_BURST 2 Maximum stored tokens; buckets start full
CRAWL_FETCH_BUDGET 10000 Total admitted page-fetch attempts per manager lifetime, across jobs
CRAWL_PAGE_ATTEMPTS 3 Maximum static/browser attempts for one page, including retries/fallback
CRAWL_PAGE_DEADLINE_SECONDS 120.0 Seconds after robots checks, including admission waits, fetches and retries
CRAWL_BACKOFF_SECONDS 1.0 Initial 429/5xx retry delay in seconds, doubled on consecutive retries
CRAWL_BACKOFF_MAX_SECONDS 30.0 Maximum exponential delay in seconds (not a cap on valid Retry-After)

These settings must be positive finite numbers (counts must be integers). Invalid configuration fails explicitly at startup. A page-fetch attempt means one static HTTP fetch or one browser navigation initiated by the crawler. A browser fallback is another attempt. HTTP redirects inside that fetch, robots.txt fetches, and browser subresources are not separate budgeted attempts; this is crawler admission governance, not a network-layer request quota. Direct scrape/map calls do not use this governor.

Rate/robots/backoff waits do not spend budget or hold fetch permits. An admitted attempt spends budget even if it fails or is cancelled; retries spend budget too. Exhaustion fails the job explicitly with status: "failed" and an error containing budget exhausted, rather than reporting success. The limit is process-wide through the API singleton, not shared between processes or replicas. After exhaustion, new jobs cannot fetch pages until the manager/process is restarted.

429 and 5xx responses defer all subsequent admissions to that hostname. Valid Retry-After integer seconds or HTTP dates are honored as a minimum delay; invalid headers use exponential backoff. If the delay cannot fit the page deadline, the page fails without an early retry. Retry/robots/bucket waits do not block unrelated hosts. Cancellation releases both waiting and active permits promptly. Exhausted page retries are terminal page failures (pages_failed), not successful pages; other frontier pages may still be processed.

Governor buckets, delays, attempt counters and per-page retry deadlines are in memory and reset when a manager restarts, including when restoring Redis/disk checkpoints. The current page stays in the persisted frontier throughout retries and is marked visited only after success or a terminal outcome. After a crash/shutdown, that in-flight page is retried with a fresh allowance; already checkpointed pages are not fetched again. Explicitly cancelled or budget-failed jobs stay terminal.

Integrations

All clients below connect to your running BlazeCrawl API. They do not start a server. Keep BLAZECRAWL_API_URL and BLAZECRAWL_API_KEY from the quickstart in your environment.

Surface Install Detailed guide
Server + CLI pip install blazecrawl-core==0.2.0 Quickstart
Python SDK pip install blazecrawl==0.2.0 Python SDK
Node.js SDK, Node 18+ npm install @blazecrawl/sdk@0.2.0 Node SDK
Python MCP server pip install blazecrawl-mcp==0.2.0 Python MCP
Node.js MCP server, Node 18+ npm install @blazecrawl/mcp@0.2.0 Node MCP

Python

from blazecrawl import BlazeCrawl

with BlazeCrawl() as client:  # Uses your environment variables.
    document = client.scrape("https://example.com", render="static")
    print(document["markdown"])

Node.js

Use an ES module, such as scrape.mjs:

import { BlazeCrawl } from "@blazecrawl/sdk";

const client = new BlazeCrawl(); // Uses your environment variables.
const document = await client.scrape("https://example.com", { render: "static" });
console.log(document.markdown);

CLI

blazecrawl scrape https://example.com --render static
blazecrawl map https://quotes.toscrape.com
blazecrawl crawl https://quotes.toscrape.com --max-pages 3 --max-depth 1 --wait
blazecrawl health

Add --json for the full response. See runnable examples for more.

New in 0.2.0: scrape --output page.md, scrape --formats screenshot --output page.png (add --full-page for the whole page), and doctor. These are not in the v0.1.2 CLI. --output writes UTF-8 and overwrites an existing file; its parent directory must exist. With --formats screenshot, --output writes the PNG bytes, and --json returns the full response with the base64 screenshot. doctor checks Chromium and, when configured, server/key access.

MCP

Give an MCP-compatible client scrape, map, and crawl tools over stdio while the extraction engine stays self-hosted. After installing blazecrawl-mcp, add:

{
  "mcpServers": {
    "blazecrawl": {
      "command": "blazecrawl-mcp",
      "env": {
        "BLAZECRAWL_API_URL": "http://127.0.0.1:8000",
        "BLAZECRAWL_API_KEY": "blz_local_REPLACE_WITH_YOUR_KEY"
      }
    }
  }
}

Replace the placeholder with your local key. Your client must be able to find the installed command. Prefer Node.js? See the equivalent npx configuration.

Static view. This is a protocol demonstration, not a simulated AI conversation.

API

Endpoint Purpose
GET /health Liveness, version, and runtime mode.
GET /ready Browser-pool, cache, and queue status.
GET /metrics Opt-in Prometheus browser-pool metrics (0.2.0; disabled by default).
POST /v1/scrape One page to Markdown, HTML, text, links, images, or a PNG screenshot.
POST /v1/map Discover URLs from sitemaps and the link graph.
POST /v1/crawl Start an asynchronous, same-origin crawl.
GET /v1/crawl/{job_id} Poll status and collected page data.
DELETE /v1/crawl/{job_id} Cancel a crawl.

All /v1/ endpoints require your bearer key by default. Scrape render accepts static, browser, or auto (static first, browser fallback for thin content). See table conversion limits when working with tabular pages. Version 0.2.0 supports user_agent per scrape or crawl; it selects robots.txt rules for crawls. Version 0.2.0 also supports a headers field on scrape for custom outbound HTTP headers (User-Agent, Accept-Language, Authorization, etc.). Both fields are not in the v0.1.2 schema. Your running instance's /docs is the authoritative version-specific contract.

Screenshots (0.2.0, not in the v0.1.2 schema): "formats": ["screenshot"] returns a base64-encoded PNG at data.screenshot. Screenshots always render in the browser, so render must be auto or browser; render: "static" is rejected with HTTP 422. Set "full_page": true to capture the whole scrollable page instead of the viewport (default false). A capture larger than SCREENSHOT_MAX_BYTES (default 5 MB of raw PNG bytes) is rejected with HTTP 413 and error: "screenshot_too_large"; no partial image is returned.

Custom header names are case-insensitive HTTP tokens; duplicate names ignoring case are rejected. Values must be printable ASCII (no CR/LF or control bytes). Limits: 32 headers, 128 characters per name, 4096 per value, and 8192 total wire bytes; User-Agent is limited to 200 characters. Transport-managed headers (Host, Content-Length, Transfer-Encoding, Connection, Keep-Alive, Proxy-Connection, Proxy-Authenticate, Proxy-Authorization, TE, Trailer, Upgrade, HTTP2-Settings, Expect) are rejected. A headers["User-Agent"] override wins over user_agent only on the initial origin (scheme, hostname and effective port). Static requests permanently drop supplied headers when a redirect changes origin; browser requests apply them only to initial-origin requests, including redirects and subresources. Other origins retain the baseline user_agent. SSRF checks remain enforced on every hop. Browser custom headers require the pool's Chromium interception support and fail closed if it cannot be installed. Cache keys ignore header ordering and name casing, isolate different values, and retain existing keys when no custom headers are supplied. See the custom-header examples for fake-credential demonstrations; never send real secrets to public echo services.

Optional pool metrics (0.2.0)

Install the [metrics] extra and set METRICS_ENABLED=true before starting the server:

pip install "blazecrawl-core[metrics]==0.2.0"
METRICS_ENABLED=true blazecrawl-server
curl -fsS http://127.0.0.1:8000/metrics

With uv, use uv sync --extra metrics and METRICS_ENABLED=true uv run --extra metrics blazecrawl-server. In PowerShell, set $env:METRICS_ENABLED = "true" before launching the server. The extra is not available in v0.1.2. An enabled exporter without the extra fails explicitly with installation instructions. With METRICS_ENABLED=false (the default), the optional dependency is not imported and /metrics returns 404.

Series Meaning
blazecrawl_browser_pool_size Actual existing contexts, idle plus active; zero before startup/after shutdown.
blazecrawl_browser_pool_active_contexts Currently acquired contexts, including release cleanup.
blazecrawl_browser_pool_errors_total Pool startup, acquisition, page setup, release, and recycling errors; intentional cancellation is excluded.
blazecrawl_browser_pool_page_creation_seconds Histogram of page creation/setup latency in seconds, including failed/cancelled attempts (_bucket, _count, _sum).

Counters and histograms survive browser-pool restarts and reset on process restart. Each process has its own registry; run one API worker for a single-node pool view. There are no URL, key, or exception labels and no default process collectors. The opt-in endpoint does not require the API bearer key: keep it on a trusted interface or restrict scraper access at your reverse proxy. It does not alter scrape authentication or egress.

curl -fsS "$BLAZECRAWL_API_URL/v1/map" \
  -H "Authorization: Bearer $BLAZECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://quotes.toscrape.com"}'

curl -fsS "$BLAZECRAWL_API_URL/v1/crawl" \
  -H "Authorization: Bearer $BLAZECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://quotes.toscrape.com","max_pages":3,"max_depth":1}'

# Replace JOB_ID with the job_id from the crawl response.
curl -fsS "$BLAZECRAWL_API_URL/v1/crawl/JOB_ID" \
  -H "Authorization: Bearer $BLAZECRAWL_API_KEY"

Starting a crawl returns HTTP 202 with job_id and status_url. Poll until status is completed, failed, or cancelled; inspect pages_failed as well.

Static view. Counts shown are from the recorded run, not a performance guarantee.

Security model

Optional upstream proxy (0.2.0)

Set EGRESS_UPSTREAM_PROXY=https://proxy.example:8443 to route both static fetches and browser traffic through an HTTP(S) CONNECT proxy; unset it for the default direct path. The endpoint must resolve exclusively to public addresses on every dial. Optional URL-encoded username:password@ credentials are sent only in CONNECT negotiation; prefer HTTPS endpoints to protect them in transit. Paths other than /, queries, fragments, malformed credentials/ports, and SOCKS are rejected without printing credentials. The upstream must support numeric CONNECT for both HTTP and HTTPS destinations. Targets and redirects remain SSRF-validated and IP-pinned, with original Host and TLS verification intact. This setting is not in the v0.1.2 release. See the upstream security contract.

User-supplied URLs are untrusted input. Static HTTP validates destinations and pins connections to approved addresses. Browser traffic passes through a validating loopback egress proxy, with request guards for redirects, subresources, and unsupported browser primitives.

Boundary Controls
Destinations Private, loopback, link-local, reserved, and cloud-metadata addresses are blocked.
DNS and redirects Validate the complete resolved address set, pin connections, revalidate redirect hops, and block HTTPS-to-HTTP downgrades.
Browser egress Govern HTTP/HTTPS socket destinations; block WebSockets, workers, and service workers.
Resource use Response-size caps, timeouts, and bounded crawl requests.
Local access Bearer authentication by default; loopback-only port publishing in the quickstart.

Static view. The demo shows actual responses, not packet-level telemetry.

Egress controls are not a substitute for workload isolation. Use appropriate containers/VMs for untrusted crawling, keep authentication enabled, and respect site policies and applicable law. Read the full threat model; report vulnerabilities through SECURITY.md.

Architecture

HTTP / Python / Node.js / CLI / MCP
                |
        FastAPI + local auth
                |
       Scrape / Map / Crawl
                |
    Validated egress + browser proxy
                |
         Public web content
                |
      Extraction -> Markdown / data

The default is a single-node Python service with an in-process crawl manager and memory cache. Set REDIS_URL to persist crawl job state in Redis (memory is used if Redis is unreachable at startup). Crawl jobs checkpoint their frontier and results after every page. Set REDIS_URL, or opt in with CRAWL_CHECKPOINTS_ENABLED=true for disk checkpoints, so unfinished crawls resume after a restart without re-fetching completed pages. There is no distributed crawl queue in this release. Explore the architecture and the roadmap before proposing extensions.

Contributing

Help make self-hosted web extraction easier to trust and easier to use. You do not need to start with networking internals: a reproducible bug report, a tricky extraction fixture, a useful example, or a clearer explanation can make a meaningful contribution.

Find a good first issue · Browse help wanted · Propose an improvement

  1. Choose an open issue or discuss a focused change before building something substantial.
  2. Follow CONTRIBUTING.md for setup, tests, and the first-PR workflow.
  3. Include a reproduction or relevant tests, and explain the user-facing difference in your PR.

The contribution backlog offers ideas and context; some items are already complete, so check the live tracker before claiming one. All user-controlled network access must stay within the existing egress controls, including the browser proxy.

Built with help from our contributors. Participation follows the Code of Conduct; project roles are described in Governance.

Project status and support

v0.2.0 candidate: an early release, not a large-scale production guarantee. The core surfaces are implemented; real-world feedback, compatibility reports, and regression tests are especially useful.

Core is the open-source engine, not a hosted SaaS. Managed anti-bot/proxy services, managed LLM execution, enterprise identity, billing, and multi-tenant metering are outside this repository's scope. See OSS vs. Cloud. Performance figures are limited to the documented baseline and its caveats, not competitor comparisons.

Need Go here
Bug report or feature request Issue templates
Setup question Support guide and a focused GitHub issue
Release notes Releases · Changelog
Planned work Roadmap
Security disclosure Security policy

GitHub Discussions is not enabled; GitHub issues are the current public support channel. If BlazeCrawl is useful to you, star the repository to help others discover it, and watch releases for updates.

License

Apache-2.0. Use it, self-host it, and build on it. See LICENSE and NOTICE.