网页转Markdown工具

Skrape MCP Server是一款将网页转换为干净、适合LLM处理的Markdown格式的工具,支持JavaScript渲染和动态内容处理。

  • by skrapeai
  • JavaScript
  • 本地部署
  • 12 星标
  • 更新于
在 GitHub 查看 skrapeai/skrape-mcp

使用说明

Skrape MCP服务器

使用将网页转换为干净、LLM就绪的Markdown skrape.ai一个MCP服务器,将网络抓取与Claude Desktop和其他MCP兼容应用程序无缝集成。

主要特点

  • 清洁输出:删除广告、导航和无关内容
  • JavaScript支持:处理动态内容渲染
  • LLM优化:结构化Markdown非常适合人工智能消费
  • 一致格式:无论来源如何,结构统一

特性

工具

  • get_markdown -将任何网页转换为LLM就绪的Markdown
    • 接受任何输入URL和可选参数
    • 返回针对LLM消费优化的干净、结构化的Markdown
    • 支持动态内容的JavaScript渲染
    • 用于高级集成的可选JSON响应格式

安装

通过Smithery安装

通过以下方式自动安装适用于Claude Desktop的Skrape MCP服务器 史密瑟里:

npx -y @smithery/cli install @skrapeai/skrape-mcp --client claude

手动安装

  1. 从获取API密钥 skrape.ai

  2. 安装依赖项:

npm install
  1. 构建服务器:
npm run build
  1. 将服务器配置添加到Claude Desktop:

在MacOS上:

nano ~/Library/Application\ Support/Claude/claude_desktop_config.json

在Windows上:

notepad %APPDATA%/Claude/claude_desktop_config.json

添加此配置(使用您的值替换路径和API密钥):

{
  "mcpServers": {
    "skrape": {
      "command": "node",
      "args": ["path/to/skrape-mcp/build/index.js"],
      "env": {
        "SKRAPE_API_KEY": "your-key-here"
      }
    }
  }
}

与LLM一起使用

以下是如何将服务器与Claude或其他LLM模型一起使用:

  1. 首先,确保在LLM应用程序中正确配置了服务器
  2. 然后,您可以要求ALLMI获取和处理任何网页:
Convert this webpage to markdown: https://example.com

Claude will use the MCP tool like this:
<use_mcp_tool>
<server_name>skrape</server_name>
<tool_name>get_markdown</tool_name>
<arguments>
{
  "url": "https://example.com",
  "options": {
    "renderJs": true
  }
}
</arguments>
</use_mcp_tool>

由此产生的Markdown将是干净的、结构化的,并准备好进行LLM处理。

高级选项

这 get_markdown 工具接受以下参数:

  • url (必填):要转换的任何网页URL
  • returnJson (可选):设置为 true 获取完整的JSON响应,而不仅仅是markdown
  • options (可选):其他刮擦选项
    • renderJs:是否在抓取之前渲染JavaScript(默认值:true)

所有选项示例:

<use_mcp_tool>
<server_name>skrape</server_name>
<tool_name>get_markdown</tool_name>
<arguments>
{
  "url": "https://example.com",
  "returnJson": true,
  "options": {
    "renderJs": false
  }
}
</arguments>
</use_mcp_tool>

发展

对于自动重建的开发:

npm run watch

调试

由于MCP服务器通过stdio进行通信,调试可能具有挑战性。我们建议使用 MCP检查员:

npm run inspector

检查器将提供一个URL,用于访问浏览器中的调试工具。