网页内容抓取服务

MCP Fetch是一个用于通过自定义HTTP代理抓取网页内容的模型上下文协议服务器,适用于Claude Desktop等MCP客户端,支持内容提取和图像处理。

  • by kwp-lab
  • JavaScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 kwp-lab/mcp-fetch

使用说明

MCP提取

模型上下文协议服务器,用于使用自定义http代理获取web内容。这允许Claude Desktop(或任何MCP客户端)获取web内容并适当处理图像。

此存储库从 @史密斯/mcp取回 并替换 node-fetch 与库一起实现 节点获取本机.

服务器将使用 http_proxy 和 https_proxy 默认情况下,如果设置了环境变量,则通过代理服务器路由请求。 您还可以设置 MCP_HTTP_PROXY 环境变量以使用不同的代理服务器。

可用工具

  • fetch:从Internet检索URL并将其内容提取为markdown。如果找到图像,它们的URL将包含在响应中。

图像处理规范:

仅从文章内容中提取图像URL,并将其附加到工具结果中:

{
  "params": {
    "url": "https://www.example.com/articles/123"
  },
  "response": {
    "content": [
      {
        "type": "text",
        "text": "Contents of https://www.example.com/articles/123:\nHere is the article content\n\nImages found in article:\n- https://www.example.com/1.jpg.webp\n- https://www.example.com/2.jpg.webp\n- https://www.example.com/3.webp"
      }
    ]
  }
}

快速入门(适用于用户)

要在Claude Desktop中使用此工具,只需将以下内容添加到您的Claude Desktop配置中(~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "tools": {
    "fetch": {
      "command": "npx",
      "args": ["-y", "@kwp-lab/mcp-fetch"],
      "env": {
        "MCP_HTTP_PROXY": "https://example.com:10890" // Optional, remove if not needed
      }
    }
  }
}

这将在需要时自动下载并运行该工具的最新版本。

所需设置

  1. 为Claude启用可访问性:
    • 打开系统设置
    • 前往隐私与安全>辅助功能
    • 点击“+”按钮
    • 从“应用程序”文件夹中添加Claude
    • 打开克劳德的开关

对于开发者

以下部分适用于那些想要开发或修改该工具的人。

先决条件

  • Node.js 18+
  • Claude桌面(从安装https://claude.ai/desktop)
  • tsx(通过安装 npm install -g tsx)

安装

通过Smithery安装

通过以下方式自动安装MCP Fetch for Claude Desktop 史密瑟里:

npx -y @smithery/cli install @kwp-lab/mcp-fetch --client claude

手动安装

git clone https://github.com/kwp-lab/mcp-fetch.git
cd mcp-fetch
npm install
npm run build

配置

  1. 确保Claude Desktop已安装并正在运行。

  2. 如果您还没有全局安装tsx:

    npm install -g tsx
    # or
    pnpm add -g tsx
    
  3. 修改位于以下位置的Claude Desktop配置:

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

您可以通过Claude Desktop菜单轻松找到:

  1. 打开克劳德桌面
  2. 点击Mac菜单栏上的Claude
  3. 点击“设置”
  4. 点击“开发者”

将以下内容添加到MCP客户端的配置中:

{
  "tools": {
    "fetch": {
      "args": ["tsx", "/path/to/mcp-fetch/index.ts"]
    }
  }
}