Skip to main content
Glama
Prog-up

Web Scraper MCP

by Prog-up

Web Scraper MCP

一个自托管的 Model Context Protocol 服务器, 为 LLM 客户端(Claude Code、Cursor、ChatGPT)提供与付费抓取服务相同的工具面——scrape、crawl、map、search、extract、interact、deep_research——完全运行在您自己的硬件上。

无需付费代理/CAPTCHA 服务:反机器人是自托管的(无头 Chromium + playwright-stealth、robots.txt、礼貌的速率限制)。加固的网站仍可能阻止;请参阅 限制。

工具

工具

功能

scrape

一个 URL → 干净的 markdown(去除样板内容)。静态优先,JS 页面自动回退到浏览器。

crawl / check_crawl_status

后台 BFS 爬取任务(去重、深度/页面上限);轮询结果。

map

列出页面上的链接(可选同域)——决定要爬取什么。

search

网络搜索。可插拔后端:DuckDuckGo(默认)、SearXNG、Brave 或 Tavily。

extract

获取页面并提取与您的模式匹配的结构化 JSON,通过 LLM。

browser_navigate / browser_act / browser_close

使用 token 便宜的 ARIA 快照驱动持久浏览器会话(点击/填写/按键)。

deep_research

搜索 → 阅读顶级来源 → 返回带引用的综合报告。

extract 和 deep_research 需要 ANTHROPIC_API_KEY。

Related MCP server: Fetch MCP Server

快速开始

uv sync                      # install deps (uses the pinned uv.lock)
uv run playwright install chromium
export SCRAPER_AUTH_TOKEN=$(openssl rand -hex 32)
uv run web-scraper-mcp       # HTTP server on http://127.0.0.1:8000/mcp

Stdio(本地,用于桌面客户端):SCRAPER_TRANSPORT=stdio uv run web-scraper-mcp。

Docker

最快的入门方式是拉取 DockerHub 上的预构建镜像。

# Pull the latest image
docker pull PROG_UP_USERNAME/web-scraper-mcp:latest

# Run the container (with Anthropic / Claude)
docker run -p 8000:8000 \
  -e SCRAPER_AUTH_TOKEN=your_secure_token_here \
  -e ANTHROPIC_API_KEY=sk-ant-api03-... \
  PROG_UP_USERNAME/web-scraper-mcp:latest

# Or run the container over stdio (useful for local MCP clients)
docker run -i --rm \
  -e SCRAPER_TRANSPORT=stdio \
  -e SCRAPER_AUTH_TOKEN=your_secure_token_here \
  PROG_UP_USERNAME/web-scraper-mcp:latest

(确保将 PROG_UP_USERNAME 替换为您实际的 DockerHub 用户名)。

使用本地模型(Ollama)与上下文窗口

如果您希望使用本地模型而不是 Anthropic 的 API,服务器完全支持 Ollama 作为 extract 和 deep_research 工具的替代后端。

docker run -p 8000:8000 \
  -e SCRAPER_AUTH_TOKEN=your_secure_token_here \
  -e SCRAPER_OLLAMA_HOST=http://host.docker.internal:11434 \
  -e SCRAPER_EXTRACT_MODEL=qwen3.5:2b \
  -e SCRAPER_RESEARCH_MODEL=qwen3.5:2b \
  PROG_UP_USERNAME/web-scraper-mcp:latest

[!WARNING] 上下文窗口至关重要! 网络抓取会产生大量 Markdown。extract 可以向 LLM 发送多达 100,000 个字符,deep_research 可以发送多达 16,000 个字符。

默认情况下,Claude 原生处理大规模上下文。然而,Ollama 的默认上下文窗口(num_ctx)通常仅配置为 2,048 个 token。如果您将巨大的 Wikipedia 页面传递给本地模型,它会静默截断提示(丢弃您的指令)并返回空字符串!

我们自动在 API 负载中向 Ollama 传递 "num_ctx": 32768 以防止这种截断。使用 Ollama 时,请确保您的本地机器有足够的 RAM/VRAM 来支持 32K 上下文窗口!

在客户端中注册(mcp.json)

如果通过 HTTP 运行:

{
  "mcpServers": {
    "web-scraper": {
      "url": "http://127.0.0.1:8000/mcp",
      "headers": { "Authorization": "Bearer your_secure_token_here" }
    }
  }
}

如果通过 stdio(Docker)运行:

{
  "mcpServers": {
    "web-scraper": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "SCRAPER_TRANSPORT=stdio",
        "-e", "SCRAPER_OLLAMA_HOST=http://host.docker.internal:11434",
        "-e", "SCRAPER_EXTRACT_MODEL=qwen3.5:2b",
        "-e", "SCRAPER_RESEARCH_MODEL=qwen3.5:2b",
        "PROG_UP_USERNAME/web-scraper-mcp:latest"
      ]
    }
  }
}

配置

所有设置都是环境变量(前缀 SCRAPER_)或 .env 文件 — 请参阅 .env.example。

变量

默认值

说明

SCRAPER_AUTH_TOKEN

(未设置)

HTTP 端点的 Bearer token。任何网络部署必需;未设置 = 未认证(警告)。

SCRAPER_HOST / SCRAPER_PORT

127.0.0.1 / 8000

绑定地址。Docker 镜像设置主机为 0.0.0.0。

SCRAPER_MAX_CONCURRENT_PAGES

8

无头页面并发上限(受 RAM/CPU 限制)。

SCRAPER_MAX_CRAWL_PAGES / _DEPTH

100 / 3

爬取作业的硬性上限。

SCRAPER_PER_DOMAIN_DELAY_S

1.0

每个域名的礼貌速率限制。

SCRAPER_RESPECT_ROBOTS

true

遵守 robots.txt。

SCRAPER_ALLOW_PRIVATE_NETWORKS

false

保持 false — 如果为 true 则禁用 SSRF 防护。

ANTHROPIC_API_KEY

(未设置)

启用 extract / deep_research。

SCRAPER_SEARXNG_URL, BRAVE_API_KEY, TAVILY_API_KEY

(未设置)

可选搜索后端(先设置者优先,否则使用 DuckDuckGo)。

安全

  • SSRF 防护 — 每个获取的 URL(以及每个重定向跳转)都会进行 DNS 解析,如果指向私有/回环/链路本地/云元数据地址则被拒绝。浏览器还会中止对私有 IP 的子资源请求。

  • 认证 — HTTP 传输上的 Bearer token;默认绑定 localhost。

  • 资源上限 — 响应大小、超时、页面并发、爬取页面/深度限制以保护主机。

  • robots.txt + 速率限制 默认开启。

  • 容器 — 以非 root 用户运行;仅通过环境变量传递机密。

供应链 — 验证镜像

CI 使用 cosign(Sigstore)通过 GitLab 的 OIDC 身份对镜像进行无密钥签名,并附加 SPDX SBOM 证明。运行前请验证:

cosign verify \
  --certificate-oidc-issuer https://gitlab.cri.epita.fr \
  --certificate-identity-regexp 'https://gitlab.cri.epita.fr/enzo.juhel/web-scraper//.*' \
  registry.gitlab.cri.epita.fr/enzo.juhel/web-scraper@sha256:...

基准测试

benchmarks/run.py 对我们的 scrape/extract 与公共数据集和 Crawl4AI 基线进行评分,输出记分卡(按页面类型的 F1/准确率 + 限制部分)。在本地运行或通过手动 CI benchmark 作业运行:

uv run python benchmarks/run.py --output scorecard.md

限制

  • 无付费代理/CAPTCHA:防御严密的网站(LinkedIn、Amazon、Cloudflare 挑战)有时会阻止我们。基准测试记分卡量化了具体位置。

  • 主内容提取在文章上表现良好,在论坛/产品/列表页面上较弱(所有提取器的已知特性)。

  • 内存中的爬取/会话状态 — 设计为单进程、单用户。

开发

uv run pre-commit install        # local lint/secret hooks
uv run ruff check . && uv run ruff format --check .
uv run mypy src
uv run pytest -q

Available Tools

4 tools
deep_researchA

Search the web, read the top sources, and return a cited synthesis report.

NameRequiredDescriptionDefault
queryYesThe research question.
max_sourcesNoHow many top results to read.

Output Schema

NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It discloses the general workflow (searching the web, reading top sources, producing a cited report) but does not mention read-only behavior, potential latency, rate limits, or any limitations. The description is truthful and somewhat informative, but leaves important operational behavior unaddressed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence with a clear chronological structure, no filler, and immediate front-loading of the core action ('Search the web'). Every phrase earns its place: 'read the top sources' and 'cited synthesis report' are distinct and necessary components. This is appropriately concise for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the two fully documented parameters and the presence of an output schema (likely covering the report structure), the description covers the essential process and outcome well. What is missing is more explicit context about when to use the tool versus siblings and a few behavioral notes, but the combination of description and schema is largely sufficient for an agent to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%: both 'query' and 'max_sources' have descriptions in the schema. The tool description's phrasing ('research question', 'top results') mirrors the schema descriptions without adding new meaning about formats, constraints, or interpretation. This meets the baseline of 3 but does not exceed what structured data already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb sequence ('Search', 'read', 'return') with a clear deliverable ('a cited synthesis report'). It unambiguously identifies the tool's function and naturally distinguishes deep_research from siblings like search (just web results) or scrape/extract (page-level content gathering). The multi-step process is explicit and not a tautology.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for comprehensive research with cited synthesis, but it never explicitly states when to prefer this over search, scrape, or extract, nor does it give any 'instead of' guidance. Context makes the intended use reasonably clear, yet there are no exclusions or alternative routing as seen in higher-quality definitions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

extractB

Extract structured data (JSON matching json_schema) or a text answer from a page.

NameRequiredDescriptionDefault
urlYesURL to extract from.
promptNoNatural-language extraction instruction.
renderNoForce a browser render.
json_schemaNoJSON Schema describing the fields to extract (recommended).

Output Schema

NameRequiredDescription

No output parameters

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must carry the behavioral burden. It does disclose the two operating modes (structured JSON versus text answer), which is meaningful. However, it does not mention rendering defaults, page-fetch behavior, rate limits, or side effects. The render parameter is defined in the schema, so some of that context is available, but the description itself stays minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no wasted words. It could be slightly better structured by explicitly separating the two modes, but as written it is efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema exists, so return-value details are covered elsewhere, and the input schema is fully documented. The main gaps are the lack of choice guidance between prompt and json_schema, and no indication of when to use extract instead of scrape. These gaps make the description adequate but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already defines url, prompt, render, and json_schema. The description adds a high-level mapping by linking json_schema to structured JSON and implying the text answer comes from the prompt, but it does not add much beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('extract'), the target resource ('a page'), and the two possible outputs: JSON matching json_schema or a text answer. It does not explicitly distinguish itself from sibling tools like scrape or search, though the verb and output specification make the core purpose clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives no guidance on when to use extract versus scrape, search, or deep_research, and no exclusions or conditions. The only context is 'from a page,' which is too thin to help an agent choose between this and its siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

scrapeA

Scrape a single URL into clean markdown (boilerplate/ads stripped).

Tries a fast static fetch first and falls back to a stealth headless browser automatically when the page looks JS-gated.

NameRequiredDescriptionDefault
urlYesThe URL to scrape (http/https).
renderNoForce a headless browser render (for JS-heavy pages).
include_linksNoAlso return all links found on the page.
include_raw_htmlNoAlso return the raw HTML (large).

Output Schema

NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of behavioral disclosure. It clearly reveals the two-phase fetch strategy, the automatic fallback to headless browsing, and the output transformation to clean markdown. It does not discuss rate limits, authentication, or failure behavior, but the core operational traits are transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with no fluff, front-loading the primary purpose before the fallback behavior. Every sentence contributes useful information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The presence of an output schema means return values do not need to be explained in the description. Combined with fully documented parameters and a clear explanation of the scraping strategy, the definition is largely complete, though it omits failure semantics and any rate-limit or authentication caveats.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all four parameters are already documented in the input schema. The tool description adds no additional parameter-level meaning, which matches the baseline for fully-covered schemas.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Scrape a single URL') and a concrete outcome ('into clean markdown'), making the tool's purpose immediately clear. The boilerplate/ads-stripping detail further distinguishes it from general fetch or research siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explains that a fast static fetch is attempted first and that a stealth headless browser is used automatically for JS-gated pages, giving clear context on when the tool adapts. It does not explicitly name alternatives or say when to prefer sibling tools, so it stops short of full exclusion guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observeddeep_research
    • First observedextract
    • First observedscrape
    • First observedsearch

TDQS

A3.8/5.0

Scored across 4 tools

Disambiguation4/5

scrape and extract both operate on a page but are clearly distinguished by output type: markdown document vs structured JSON/answer. search and deep_research are also distinct, though deep_research could be seen as a superset of search.

Naming Consistency5/5

All tools use lowercase snake_case imperative verbs: scrape, extract, search, deep_research. The naming pattern is consistent and predictable.

Tool Count5/5

Four tools is well-scoped for a web scraper/research server: one for raw page content, one for structured extraction, one for search, and one for synthesis. Each tool has a clear purpose with no redundant bloat.

Completeness4/5

The core web research workflow is covered: search, fetch, extract, and synthesize. A minor gap is the lack of batch crawling or link-following features, but most common agent tasks can be completed with these tools.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables web scraping and crawling capabilities for LLM clients, supporting single-page scraping, multi-page website crawling, and web search with multiple engines (Playwright, Cheerio, Puppeteer) and flexible output formats including markdown, HTML, text, and screenshots.
    19 npm
    6
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables LLMs to fetch and extract web content using browser automation, OCR, and multiple extraction methods, handling JavaScript rendering and anti-scraping techniques.
    17
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    Enables privacy-first web scraping and structured data extraction using a local headless browser and your own LLM key. Supports tools for scraping, batch scraping, data extraction with prompts or schemas, and screenshots.
    5
    6 npm
    3
    MIT