Back to MCP directory
publicPublicdnsLocal runtime

scrapling-fetch-mcp

一个帮助AI助手绕过网站反爬机制获取文本内容的MCP服务器工具

article

README

🚀 网页抓取 MCP 服务

本项目是一个 MCP 服务器,旨在助力 AI 助手访问实施反机器人检测的网站上的文本内容,弥合您在浏览器中可见内容与 AI 可访问内容之间的差距。

🚀 快速开始

此工具针对低体积检索文档和参考资料(仅限 text/HTML)进行了优化,这些文档和参考资料来自实施反机器人检测的网站。它尚未为通用网站抓取或数据收集而设计。

⚠️ 重要提示

该项目是在与 Claude Sonnet 3.7 合作开发的,使用了 LLM Context

📦 安装指南

  1. 先决条件

    • Python 3.10+
    • uv 包管理器
  2. 安装依赖项和工具

uv tool install scrapling
scrapling install
uv tool install scrapling-fetch-mcp

💻 使用示例

🔨 使用 Claude 进行设置

将以下配置添加到您的 Claude 客户端的 MCP 服务器配置中:

{
  "mcpServers": {
    "Cyber-Chitta": {
      "command": "uvx",
      "args": ["scrapling-fetch-mcp"]
    }
  }
}

🔍 可用工具

此包提供两个不同的工具:

  1. s-fetch-page:带分页支持的完整网页检索
  2. 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 密钥”的提及。

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_indexmax_length 支持分页检索整个页面
    • s-fetch-pattern:使用正则表达式提取特定内容(使用 search_patterncontext_chars
      • 结果包括位置信息,用于后续查询时的 s-fetch-page

最佳实践提示

  • basic 模式开始,仅在需要时升级到更高保护级别
  • 处理大型文档时,请使用 s-fetch-page 的分页参数
  • 需要查找特定信息时,请使用 s-fetch-pattern
  • AI 会自动根据网站的保护级别调整其方法

局限性

  • 仅设计用于文本内容:专门针对文档、文章和参考资料
  • 不适用于高体积抓取或数据收集
  • 可能无法处理需要身份验证的网站
  • 性能因网站复杂性而异

📄 许可证

Apache 2.0 许可证,详情请见 License

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client