PC 

一个基于crawl4ai构建的最小MCP服务器,用于LLM友好的网页提取
概览
两个工具:用Playwright + Crawl4AI抓取真实页面,或者用自动备份在7个搜索引擎中搜索。 - 检查 Python 版本:python3 --version(必须是 3.10-3.13)- 升级 pip: python3 -m pip 安装 --upgrade pip - 使用镜像(中国):导出 PLAYWRIGHT_DOWNLOAD_HOST=https://npmmirror.com/mirrors/playwright/ - 然后:python3 -m 剧作家安装铬 大多数通用的“网页抓取”工具要么在JS重度页面上失败,要么返回过多样板代码。本项目聚焦于四个方面: - :即使模型配置为零也能使用——:对代理更简单,维护更简单——代理/Cookie/持久配置文件一流——完整的Markdown输出可以逐页保存和检查 - 使用llm_instruction时,提示符偏向保留原始行。- 没有llm_instruction,模型执行更通用的“干净可读标记”处理。- 如果LLM调用因任何原因失败,工具返回原始非LLM提取结果加上llm_used=false和llm_error。
概述(AI 翻译)
一个最小的MCP服务器,用于代理友好的网页提取和搜索。
两个工具:用Playwright + Crawl4AI抓取真实页面,或者用自动备份在7个搜索引擎中搜索。
快速进入
| 观众 | 阅读此文 |
|---|---|
| 人类开发者 | README.zh-CN.md / README.md |
| 生活在人工智能时代,把剩下的理智交给一个特工 | README_AGENT.md |
一览
| 项目 | 本仓库中的现实 |
|---|---|
| MCP工具 | 2个工具:fetch_urls + search_web |
| 单页取物 | urls: ["https://example.com"] |
| 网络搜索 | search_web(query="...", engine="auto") — 7台发动机,自动备份 |
| 搜索引擎 | 鸭鸭Go ·必应 ·谷歌 ·杨德克斯 ·索沟 ·360搜索 ·百度 |
| 输出 | title + content + links + blocked + llm_used/llm_error |
| 非LLM模式 | 一流,默认,无需任何模型即可使用 |
| LLM模式 | 默认关闭。仅在use_llm=true+可选llm_instruction时启用 |
| 备选 | 缺失/失败的LLM调用会自动退回到非LLM结果 |
| 反机器人现实主义 | 代理 / Cookie / 持久配置文件 / 随机浏览器行为 |
| 许可证 | AGPL-3.0或更高版本 |
它是如何运作的
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
crawl4ai-mcp
Quick entry
| Audience | Read this |
|---|---|
| Human developer | README.zh-CN.md / README.md |
| Living in the AI era, delegating your remaining sanity to an agent | README_AGENT.md |
At a glance
| Item | Reality in this repo |
|---|---|
| MCP tools | 2 tools: fetch_urls + search_web |
| Single-page fetch | urls: ["https://example.com"] |
| Web search | search_web(query="...", engine="auto") — 7 engines, auto fallback |
| Search engines | DuckDuckGo · Bing · Google · Yandex · Sogou · 360Search · Baidu |
| Output | title + content + links + blocked + llm_used/llm_error |
| Non-LLM mode | First-class, default, usable without any model |
| LLM mode | Off by default. Enabled only with use_llm=true + optional llm_instruction |
| Fallback | Missing/failed LLM call automatically falls back to non-LLM result |
| Anti-bot realism | proxy / cookies / persistent profile / randomized browser behavior |
| License | AGPL-3.0-or-later |
How it works
Fetch flow:
---
config:
theme: base
themeVariables:
primaryColor: "#FAF9F5"
primaryTextColor: "#1A1A1A"
primaryBorderColor: "#D97757"
lineColor: "#8B5E3C"
secondaryColor: "#F5F1E8"
tertiaryColor: "#FAF9F5"
fontFamily: "ui-sans-serif, system-ui, -apple-system, sans-serif"
fontSize: "14px"
---
flowchart LR
A[URL list] --> B[Playwright + Crawl4AI]
B --> C{Fast path enough?}
C -- Yes --> D[Markdown / HTML]
C -- No --> E[Stronger fallback]
E --> D
D --> F{use_llm?}
F -- No --> G[Return result]
F -- Yes --> H[OpenAI-compatible cleanup]
H --> I{LLM success?}
I -- Yes --> J[Return enhanced result]
I -- No --> G
Search flow:
---
config:
theme: base
themeVariables:
primaryColor: "#FAF9F5"
primaryTextColor: "#1A1A1A"
primaryBorderColor: "#D97757"
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"crawl4ai": {
"command": "crawl4ai-mcp",
"env": {
"CRAWL4AI_MCP_HEADLESS": "true",
"CRAWL4AI_MCP_PROXY": "127.0.0.1:7890",
"CRAWL4AI_MCP_NAVIGATION_TIMEOUT_MS": "30000",
"CRAWL4AI_MCP_WAIT_UNTIL": "load",
"OPENAI_BASE_URL": "https://your-openai-compatible-host",
"OPENAI_API_KEY": "your-api-key",
"OPENAI_MODEL": "your-model-name"
}
}
}
}