Back to MCP directory
publicPublicdnsLocal runtime

Fetch with Images

MCP Fetch是一个为Claude Desktop设计的网页内容抓取和图像处理服务工具,支持自动化提取网页内容、标题和优化图像处理。

article

README

🚀 MCP 抓取工具

Model Context Protocol 服务器可用于抓取网络内容并处理图像,这使得 Claude Desktop(或其他 MCP 客户端)能够抓取网页内容并对图像进行适当处理。

点击访问

🚀 快速开始

用户使用步骤

若要将此工具与 Claude Desktop 配合使用,请将以下内容添加到您的 Claude Desktop 配置文件(~/Library/Application Support/Claude/claude_desktop_config.json)中:

{
  "tools": {
    "fetch": {
      "command": "npx",
      "args": ["-y", "@kazuph/mcp-fetch"]
    }
  }
}

这样会自动下载并按需运行该工具的最新版本。

必要设置

  1. 启用 Claude 的辅助功能:
    • 打开系统设置。
    • 转到隐私与安全 > 辅助功能。
    • 点击“+”按钮。
    • 从应用程序文件夹中添加 Claude。
    • 启用 Claude 旁边的切换开关。

此辅助功能设置是自动执行剪贴板操作(Cmd + V)所必需的。

✨ 主要特性

  • 网页内容提取:可自动提取网页内容并将其格式化为 Markdown。
  • 文章标题提取:能够提取并显示文章标题。
  • 图像处理:可选择处理网络页面中的图像,具备优化功能(默认关闭,启用请设置 enableFetchImages: true)。
  • 分页支持:支持文本和图像的分页。
  • JPEG 优化:自动将图像转换为 JPEG 格式并控制质量。
  • GIF 支持:提取 animated GIFs 的第一帧。

🔧 技术细节

开发者先决条件

  • 需要 Node.js 18+ 版本。
  • 由于依赖 macOS 特定的剪贴板操作,需使用 macOS 系统。

安装步骤

按照以下命令进行安装:

npm install -g @kazuph/mcp-fetch

图像处理规范

图像处理采用 Sharp 库,以保障最佳性能和质量。当发现多张图像时,它们会按顺序垂直拼接,同时会考虑尺寸限制。

配置方法

~/.config/mcp-fetch.json 中添加以下配置:

{
  "proxy": "http://your-proxy-server:port",
  "timeout": 30000,
  "maxConcurrency": 5
}

可用参数说明

请求体参数

基本参数

| 参数名 | 类型 | 是否必填 | 描述 | | ---- | ---- | ---- | ---- | | url | string | 是 | 待抓取的网页地址 | | enableFetchImages | bool | 否 | 是否启用图像处理,默认为 false | | imageStartIndex | number | 否 | 图像起始索引,默认为 0 | | imageMaxCount | number | 否 | 最大抓取图像数量,默认为 1 |

高级参数

| 参数名 | 类型 | 是否必填 | 描述 | | ---- | ---- | ---- | ---- | | proxy | string | 否 | 设置代理服务器地址和端口 | | timeout | number | 否 | 设置请求超时时间,单位为毫秒,默认 30000 | | maxConcurrency | number | 否 | 设置并发请求数量,默认为 5 |

响应体参数

基本响应

| 参数名 | 类型 | 描述 | | ---- | ---- | ---- | | content | string | 抓取到的网页内容 | | title | string | 文章标题 | | images | array | 抓取到的图像列表 |

图像响应

| 参数名 | 类型 | 描述 | | ---- | ---- | ---- | | src | string | 图像源地址 | | width | number | 图像宽度 | | height | number | 图像高度 | | extractedFrame | bool | 是否为 GIF 的第一帧 |

💻 使用示例

基础用法

{
  "url": "https://example.com"
}

高级用法

启用图像抓取

{
  "url": "https://example.com",
  "enableFetchImages": true,
  "imageMaxCount": 3
}

分页抓取图像

{
  "url": "https://example.com",
  "enableFetchImages": true,
  "imageStartIndex": 3,
  "imageMaxCount": 3
}

📄 备注

  • ⚠️ 重要提示:此工具专为 macOS 设计,因为依赖 macOS 特定的剪贴板操作。
  • 💡 使用建议:图像处理使用 Sharp 库以确保高性能和高质量;当发现多张图像时,它们会按顺序垂直拼接,并考虑尺寸限制;animated GIFs 会自动处理为提取其第一帧。

📈 变更日志

v1.1.3

  • 修改默认行为:默认不抓取图像(enableFetchImages: false)。
  • 移除 disableImages 参数,转而使用 enableFetchImages 参数。

v1.1.0

  • 新增文章标题提取功能。
  • 改进响应格式以包含文章标题。
  • 修复 MCP 响应内容中的类型问题。

v1.0.0

  • 初始版本发布。
  • 提供网页内容抓取、图像处理和优化、分页支持等功能。
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