scrapling-fetch-mcp
一个MCP服务器,帮助AI助手从实施了机器人检测的网站获取文本内容,优化用于低容量文档和参考资料的检索。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"Cyber-Chitta": {
"args": [
"scrapling-fetch-mcp"
],
"command": "uvx"
}
}
}
该服务需要配置环境变量:变量名1
可用工具 (2 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
s-fetch-page 5 个参数 需填 1 项
Fetches a complete web page with pagination support. Retrieves content from websites with bot-detection avoidance. For best performance, start with 'basic' mode (fastest), then only escalate to 'stealth' or 'max-stealth' modes if basic mode fails. Content is returned as 'METADATA: {json}\n\n[content]' where metadata includes length information and truncation status.
必填参数:url
s-fetch-pattern 6 个参数 需填 2 项
Extracts content matching regex patterns from web pages. Retrieves specific content from websites with bot-detection avoidance. For best performance, start with 'basic' mode (fastest), then only escalate to 'stealth' or 'max-stealth' modes if basic mode fails. Returns matched content as 'METADATA: {json}\n\n[content]' where metadata includes match statistics and truncation information. Each matched content chunk is delimited with '॥๛॥' and prefixed with '[Position: start-end]' indicating its byte position in the original document, allowing targeted follow-up requests with s-fetch-page using specific start_index values.
必填参数:url、search_pattern
服务介绍
Scrapling Fetch MCP
一个MCP服务器,帮助AI助手访问实施了机器人检测的网站上的文本内容,弥合了您在浏览器中看到的内容与AI可以访问的内容之间的差距。
预期用途
此工具针对从实施了机器人检测的网站上低量检索文档和参考材料(仅限文本/HTML)进行了优化。它并未设计或测试用于通用站点抓取或数据采集。
注意:此项目是在Claude Sonnet 3.7的合作下开发的,使用了LLM Context。
安装
-
要求:
- Python 3.10+
- uv 包管理器
-
安装依赖项和工具:
bash
uv tool install scrapling
scrapling install
uv tool install scrapling-fetch-mcp
与Claude配合设置
将以下配置添加到您的Claude客户端的MCP服务器配置中:
json
{
"mcpServers": {
"Cyber-Chitta": {
"command": "uvx",
"args": ["scrapling-fetch-mcp"]
}
}
}
可用工具
此包提供了两个不同的工具:
- s-fetch-page: 支持分页的完整网页检索
- s-fetch-pattern: 提取匹配正则表达式的带有上下文的内容
使用示例
检索完整页面
Human: 请获取并总结 https://example.com/docs 上的文档。
Claude: 我会帮您完成这个任务。让我来获取这些文档。
mcp:function_calls
<mcp:invoke name="s-fetch-page">
<mcp:parameter name="url">https://example.com/docs</mcp:parameter>
<mcp:parameter name="mode">basic</mcp:parameter>
</mcp:invoke>
</mcp:function_calls>
根据我获取的文档,以下是总结...
使用模式匹配提取特定内容
Human: 请在文档页面中找到所有提到“API keys”的地方。
Claude: 我会搜索这些具体信息。
mcp:function_calls
<mcp:invoke name="s-fetch-pattern">
<mcp:parameter name="url">https://example.com/docs</mcp:parameter>
<mcp:parameter name="mode">basic</mcp:parameter>
<mcp:parameter name="search_pattern">API\s+keys?</mcp:parameter>
<mcp:parameter name="context_chars">150</mcp:parameter>
</mcp:invoke>
</mcp:function_calls>
我在文档中找到了几处提到API密钥的地方:
...
功能选项
-
保护级别:
basic: 快速检索(1-2秒),但对高度保护的网站成功率较低stealth: 平衡保护(3-8秒),适用于大多数网站max-stealth: 最大保护(10秒以上),适用于高度保护的网站
-
内容定位选项:
- s-fetch-page: 支持分页的整个页面检索(使用
start_index和max_length) - s-fetch-pattern: 使用正则表达式提取特定内容(使用
search_pattern和context_chars)- 结果包括位置信息,以便后续使用
s-fetch-page进行查询
- 结果包括位置信息,以便后续使用
- s-fetch-page: 支持分页的整个页面检索(使用
获取最佳结果的小贴士
- 从
basic模式开始,只有在需要时才升级到更高的保护级别 - 对于大型文档,请使用分页参数与
s-fetch-page - 在大型页面上查找特定信息时使用
s-fetch-pattern - AI会根据网站的保护级别自动调整其方法
限制
- 仅设计用于文本内容:特别是文档、文章和参考资料
- 不适用于高容量抓取或数据采集
- 可能不适用于需要身份验证的网站
- 性能因网站复杂性而异
许可证
Apache 2