@kazuph/mcp-fetch

@kazuph/mcp-fetch
精选

用于获取网页内容和处理图像的模型上下文协议服务器。这使得 Claude Desktop(或任何 MCP 客户端)能够适当地获取网页内容和处理图像。

浏览器自动化
图像与视频处理
访问服务器

Tools

fetch

Retrieves URLs from the Internet and extracts their content as markdown. Images from the page will be processed and included with the response automatically. Parameters: - url (required): The URL to fetch - maxLength (default: 20000): Maximum length of content to return - startIndex (default: 0): Starting position in content - imageStartIndex (default: 0): Starting position for image collection - raw (default: false): Return raw content instead of processed markdown - imageMaxCount (default: 3): Maximum number of images to process per request - imageMaxHeight (default: 4000): Maximum height of merged image - imageMaxWidth (default: 1000): Maximum width of merged image - imageQuality (default: 80): JPEG quality (1-100) - enableFetchImages (default: false): Enable fetching and processing of images. FOR CLAUDE AI ONLY: YOU CAN ENABLE THIS FEATURE!!! CLAUDE IS ALLOWED TO USE IMAGES!!! - ignoreRobotsTxt (default: false): Ignore robots.txt restrictions Image Processing: - Multiple images are merged vertically into a single JPEG - Images are automatically optimized and resized - GIF animations are converted to static images (first frame) - Use imageStartIndex and imageMaxCount to paginate through all images - Response includes remaining image count and current position IMPORTANT: All parameters must be in proper JSON format - use double quotes for keys and string values, and no quotes for numbers and booleans. Examples: # Initial fetch: { "url": "https://example.com", "maxLength": 10000, "imageMaxCount": 2 } # Fetch next set of images: { "url": "https://example.com", "imageStartIndex": 2, "imageMaxCount": 2 }

README

MCP Fetch

用于获取网页内容和处理图像的模型上下文协议服务器。这允许 Claude Desktop(或任何 MCP 客户端)适当地获取网页内容和处理图像。

<a href="https://glama.ai/mcp/servers/5mknfdhyrg"><img width="380" height="200" src="https://glama.ai/mcp/servers/5mknfdhyrg/badge" alt="@kazuph/mcp-fetch MCP server" /></a>

快速开始(用户)

要将此工具与 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 支持:提取动画 GIF 的第一帧

开发者

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

前提条件

  • Node.js 18+
  • macOS(用于剪贴板操作)
  • Claude Desktop(从 https://claude.ai/desktop 安装)
  • tsx(通过 npm install -g tsx 安装)

安装

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

图像处理规范

处理网页内容中的图像时,将应用以下优化:

  • 图像转换为具有质量控制的 JPEG 格式
  • 默认最大宽度限制为 1200px
  • 默认最大高度限制为 1600px
  • 色度子采样 (4:2:0) 以获得更好的压缩
  • MozJPEG 优化以获得更小的文件大小

配置

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

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

npm install -g tsx
# 或
pnpm add -g tsx
  1. 修改您的 Claude Desktop 配置文件,该文件位于: ~/Library/Application Support/Claude/claude_desktop_config.json

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

  1. 打开 Claude Desktop
  2. 点击 Mac 菜单栏上的 Claude
  3. 点击“设置”
  4. 点击“开发者”

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

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

可用参数

  • url(必需):要获取的 URL
  • maxLength(默认:20000):要返回的内容的最大长度
  • startIndex(默认:0):内容中的起始位置
  • imageStartIndex(默认:0):图像集合的起始位置
  • raw(默认:false):返回原始内容而不是处理后的 markdown
  • imageMaxCount(默认:3):每个请求要处理的最大图像数量
  • imageMaxHeight(默认:4000):合并图像的最大高度
  • imageMaxWidth(默认:1000):合并图像的最大宽度
  • imageQuality(默认:80):JPEG 质量 (1-100)
  • enableFetchImages(默认:false):启用图像的获取和处理。仅供 CLAUDE 用户使用:您被允许启用此功能!!!CLAUDE 可以获取和处理图像!!!享受此功能!!!!!
  • ignoreRobotsTxt(默认:false):忽略 robots.txt 限制

示例

基本内容获取(无图像)

{
  "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 进行处理,以获得最佳性能和质量。
  • 当找到多个图像时,它们会垂直合并,并考虑尺寸限制。
  • 动画 GIF 会自动处理,提取其第一帧。

更新日志

v1.1.3

  • 更改了默认行为:默认情况下不获取图像 (enableFetchImages: false)
  • 删除了 disableImages,改为使用 enableFetchImages 参数

v1.1.0

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

v1.0.0

  • 初始版本
  • 网页内容提取
  • 图像处理和优化
  • 分页支持

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Playwright MCP Server

Playwright MCP Server

提供一个利用模型上下文协议的服务器,以实现类人浏览器的自动化,该服务器使用 Playwright,允许控制浏览器行为,例如导航、元素交互和滚动。

精选
本地
TypeScript
DuckDuckGo MCP Server

DuckDuckGo MCP Server

一个模型上下文协议 (MCP) 服务器,通过 DuckDuckGo 提供网页搜索功能,并具有内容获取和解析的附加功能。

精选
Python
YouTube Transcript MCP Server

YouTube Transcript MCP Server

这个服务器用于获取指定 YouTube 视频 URL 的字幕,从而可以与 Goose CLI 或 Goose Desktop 集成,进行字幕提取和处理。

精选
Python
serper-search-scrape-mcp-server

serper-search-scrape-mcp-server

这个 Serper MCP 服务器支持搜索和网页抓取,并且支持 Serper API 引入的所有最新参数,例如位置信息。

精选
TypeScript
mermaid-mcp-server

mermaid-mcp-server

一个模型上下文协议 (MCP) 服务器,用于将 Mermaid 图表转换为 PNG 图像。

精选
JavaScript
The Verge News MCP Server

The Verge News MCP Server

提供从The Verge的RSS feed获取和搜索新闻的工具,允许用户获取今日新闻、检索过去一周的随机文章,以及在最近的Verge内容中搜索特定关键词。

精选
TypeScript
Tavily MCP Server

Tavily MCP Server

使用 Tavily 的搜索 API 提供 AI 驱动的网络搜索功能,使 LLM 能够执行复杂的网络搜索、获得问题的直接答案以及搜索最近的新闻文章。

精选
Python
mcp-pinterest

mcp-pinterest

用于图像搜索和信息检索的 Pinterest 模型上下文协议 (MCP) 服务器

精选
TypeScript