Skip to main content

Dhole

让 AI 代理访问互联网:抓取 · 爬取 · 搜索,内置反爬,$0 无密钥。

MIT · Python 3.11+

Dhole 是一个 MCP 服务器,为 AI 代理提供网页抓取、整站爬取和无密钥网页搜索。HTTP 被拦截时自动升级到反检测浏览器,可读取 PDF(含扫描件 OCR),全部本地运行、无需任何 API key。

功能特性

  • 智能抓取:HTTP 优先(~1 秒),被拦截或遇到 JS 空壳时自动升级 Patchright 隐身浏览器并求解 Cloudflare 验证;全部失败时回退 Wayback Machine 快照
  • 网页搜索:多引擎并行(bing / duckduckgo / brave / yahoo / yandex 等),本地 ONNX 神经重排序,跨引擎共识排名;fetch_content=true 直接抓回 top3 全文
  • 整站爬取:同域最佳优先遍历,内容自适应提取,sitemap 模式,页数 / 深度 / token 预算控制
  • PDF + OCR:结构化 Markdown 输出,扫描件与 CID 损坏自动 OCR
  • 结构化提取:CSS 选择器 / JSON-LD / 自动模式 schema,支持多 URL 批量并行
  • Agent 友好:每次调用返回 next_action 建议与来源分类;超长内容自动分页;SQLite 缓存加速重复抓取
  • 优雅降级:浏览器依赖缺失时自动切换纯 HTTP 模式(Termux / 精简容器可用)

安装

未发布到 PyPI,从源码安装。需要 Python 3.11+。

git clone https://github.com/ouli-1242/dhole-mcp.git
cd dhole-mcp
pip install .[all]              # 完整版;精简版(纯 HTTP + 搜索)用 pip install .
playwright install chromium     # 反检测浏览器引擎(~150MB,完整版需要)

卸载:

pip uninstall dhole-mcp
rm -rf ~/.dhole                 # 运行时缓存(Windows: rd /s /q %USERPROFILE%\.dhole)

使用

在 MCP 客户端(Claude Code / Cursor / OpenCode 等)配置中添加:

{ "mcpServers": { "dhole": { "command": "dhole" } } }

无需参数、无需密钥、无需环境变量。CLI 自带诊断命令:

dhole -v    # 查看版本 + 更新状态
dhole -u    # 自更新(本 fork 默认关闭)

工具

工具 功能
smart_fetch 抓取任意 URL:自动反爬升级、PDF/OCR、批量、聚焦提取、页面交互、结构化提取
smart_search 无密钥网页搜索:多引擎并行、神经重排序、可同时抓回全文
smart_crawl 同域最佳优先爬取,支持 sitemap 模式与关键词过滤
screenshot 页面截图(多模态代理专用)
parse 本地文件解析(.html/.docx/.xlsx/.csv → Markdown)
feed_fetch 批量抓取 RSS/Atom feed 最新条目
resolve_url 解析 URL 最终地址(跟随重定向,不下载页面体)
cache_clear 清除抓取缓存

配置

所有环境变量均可选,默认零配置可用:

变量 用途
DHOLE_SEARCH_PROXY 搜索引擎代理,逗号分隔可轮换(也自动读取 HTTPS_PROXY 等)
DHOLE_BROWSER_IDLE_TIMEOUT 浏览器空闲关闭秒数(默认 300,0 永不关闭)
DHOLE_SEARCH_DEADLINE 单次搜索整体截止秒数(默认 16)
DHOLE_BRIGHTDATA_API_KEY 启用 Bright Data SERP 付费后端(可选)
DHOLE_SSRF_DNS_RECHECK 1 开启 DNS 解析内网复查(默认关闭)
DHOLE_UPDATE_PACKAGE 自更新目标发行名(发布自己的发行版后设置以启用)

已知限制

  • 无法绕过 DataDome / Akamai / 交互式 Turnstile;需要登录的网站不在设计范围内
  • duckduckgo / brave / yahoo 需要 VPN 可达(bing / yandex 国内直连)
  • 搜索引擎限速时熔断器自动冷却 60 秒,重度使用建议配置代理
  • YouTube 仅能获取少量文本

贡献

欢迎 issue 与 PR,规范见 CONTRIBUTING.md

致谢

本项目是 dondai1234/master-fetch 的二创(衍生作品),上游以 MIT 协议发布,原始版权文本已完整保留于 LICENSEsrc/dhole_mcp/search_metasearch.py 派生自 ddgs,声明见 NOTICE.ddgs.txt

许可证

MIT

Release files for dhole-mcp 14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dhole-mcp 14.0
File Size Uploaded
dhole_mcp-14.0.tar.gz 2.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for dhole-mcp 14.0
File Interpreter ABI Platform
dhole_mcp-14.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / dhole_mcp-14.0.tar.gz

Download URL dhole_mcp-14.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
03a8a80a2cf80797ea6415faadeea762d1be35db9013adfa9cca21a29a9cc66b
BLAKE2b-256 checksum
How to use checksums
0e14bca4460a04e000167b5b29982f067a7239f7602f18e2b34dd5b82566c07a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / dhole_mcp-14.0-py3-none-any.whl

Download URL dhole_mcp-14.0-py3-none-any.whl
Size 214.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9149dd7a5f88094c158dd0e42cd10fec25218c83e78a7ca6a5d0f79c487f8800
BLAKE2b-256 checksum
How to use checksums
340f26cfbd66d74bd3a9506f99dfbf5cd4facdbc190bb7487f93ba66a877e184
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release history Release notifications | RSS feed

14.2.1

2 release files

14.2

2 release files

14.1

2 release files

This release

14.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page