webfetch

webfetch

A local MCP server that fetches any http/https webpage, extracts main content, and converts it to Markdown, serving as a drop-in replacement for the built-in WebFetch tool.

Category
访问服务器

README

Yet Another WebFetch MCP Alternative

English | 中文


English

A local MCP server that fetches any http/https webpage, extracts the main content, and converts it to Markdown. Designed as a drop-in replacement for Claude Code's built-in WebFetch tool, which may fail under certain network / proxy environments (e.g., "Unable to verify if domain is safe").

Features

  • Content extraction — Mozilla Readability for article pages; falls back to full-page conversion for non-article content.
  • HTML → Markdown — powered by turndown; preserves headings and code blocks.
  • Auto proxy detection — picks up Windows / macOS / Linux system proxy automatically (env vars also supported).
  • Truncation — defaults to 50,000 characters to prevent context overflow.
  • 20s timeout, redirect-follow, browser User-Agent.
  • SSRF protection — http/https only; blocks localhost and private IP ranges (IPv4 & IPv6).

Installation

Requires Node.js ≥ 20.

git clone <repo-url> Yet-Another-WebFetch-MCP-Alternative
cd Yet-Another-WebFetch-MCP-Alternative
npm install

Setup with Claude Code

Add the following to ~/.claude.json under mcpServers (user-level) or to a project-local .mcp.json:

{
  "mcpServers": {
    "webfetch": {
      "type": "stdio",
      "command": "node",
      "args": ["<path-to-repo>\\index.js"]
    }
  }
}

Note: On Windows, avoid using npx as the command — it silently fails in non-TTY environments.

Reload the window (Ctrl+Shift+P → Developer: Reload Window), then type /mcp in a conversation to verify the connection.

Usage

The tool is registered as fetch_web.

Parameter Required Description
url Yes Full URL, http or https
maxChars No Max characters returned, default 50000
timeout No Timeout in milliseconds, default 20000

Claude will invoke the tool automatically when it needs to fetch a webpage — no manual prompting required.

Proxy

The server auto-detects the system proxy on all three platforms:

Platform Detection method
Windows Registry Internet Settings\ProxyServer
macOS scutil --proxy
Linux GNOME gsettings

To override manually, set the HTTPS_PROXY or HTTP_PROXY environment variable in the MCP config:

{
  "webfetch": {
    "type": "stdio",
    "command": "node",
    "args": ["<path-to-repo>\\index.js"],
    "env": {
      "HTTPS_PROXY": "http://127.0.0.1:7890"
    }
  }
}

Testing

npm test          # Handshake & tool list test (no network required)
LIVE=1 npm test   # End-to-end fetch against docs.tavily.com

Known Limitations

  • No JavaScript rendering — dynamic pages only return the initial HTML (same as most scraping tools).
  • Non-UTF-8 pages may produce garbled output in edge cases.
  • Sites with strict anti-bot measures may return error pages or block requests.
  • Domains unreachable from the local network (e.g., DNS-blocked in certain regions) cannot be fetched.

License

MIT


中文

一款本地 MCP 服务器:抓取任意 http/https 网页,提取正文并转换为 Markdown。作为 Claude Code 内置 WebFetch 工具的替代——内置 WebFetch 在部分网络 / 代理环境下会报 "Unable to verify if domain is safe" 而不可用。

特性

  • 正文提取 — 基于 Mozilla Readability,非文章页面自动回退全文转换。
  • HTML → Markdown — 基于 turndown,保留标题与代码块。
  • 自动代理检测 — 自动读取 Windows / macOS / Linux 系统代理,也支持环境变量覆盖。
  • 截断 — 默认 50000 字符,防止上下文溢出。
  • 20s 超时、重定向跟随、浏览器 UA。
  • SSRF 防护 — 仅 http/https,拒绝本机与内网地址(含 IPv6)。

安装

需要 Node.js ≥ 20。

git clone <仓库地址> Yet-Another-WebFetch-MCP-Alternative
cd Yet-Another-WebFetch-MCP-Alternative
npm install

接入 Claude Code

在 ~/.claude.json 的 mcpServers(用户全局)或项目根目录 .mcp.json 中加入:

{
  "mcpServers": {
    "webfetch": {
      "type": "stdio",
      "command": "node",
      "args": ["<仓库路径>\\index.js"]
    }
  }
}

注意: Windows 下不要用 npx 作为 command(无 TTY 环境下会静默失败)。

保存后重载窗口(Ctrl+Shift+P → Developer: Reload Window),在对话中输入 /mcp 确认连接状态。

使用

工具名为 fetch_web。

参数 必填 说明
url 是 完整 URL,http 或 https
maxChars 否 返回内容最大字符数,默认 50000
timeout 否 超时毫秒数,默认 20000

Claude 会在需要抓取网页时自动调用,无需手动引导。

代理

服务器自动检测三平台系统代理:

平台 检测方式
Windows 注册表 Internet Settings\ProxyServer
macOS scutil --proxy
Linux GNOME gsettings

如需手动覆盖,在 MCP 配置中设置 HTTPS_PROXY 或 HTTP_PROXY 环境变量:

{
  "webfetch": {
    "type": "stdio",
    "command": "node",
    "args": ["<仓库路径>\\index.js"],
    "env": {
      "HTTPS_PROXY": "http://127.0.0.1:7890"
    }
  }
}

测试

npm test          # 握手与工具清单测试(不依赖网络)
LIVE=1 npm test   # 额外做一次端到端抓取(docs.tavily.com)

已知限制

  • 不渲染 JavaScript — 动态页面只能拿到初始 HTML(与多数抓取工具一致)。
  • 非 UTF-8 编码页面在极端情况下可能乱码。
  • 严格反爬站点可能被拦截或返回错误页。
  • 本机网络 DNS 不可达的域名无法抓取。

许可证

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选