MCP NPX Fetch
一个强大的MCP Server,可以轻松地抓取并转换网页内容为多种格式(HTML、JSON、Markdown、纯文本)。
MCP NPX Fetch 是一个强大的 MCP 服务器,可以轻松抓取网页内容并转换为多种格式(HTML、JSON、Markdown、纯文本)。
安装
全局安装:
npm install -g @tokenizin/mcp-npx-fetch
或直接通过 npx 使用:
npx @tokenizin/mcp-npx-fetch
主要功能
- 支持多种格式:HTML、JSON、纯文本和 Markdown
- 支持自定义请求头(包括身份验证)
- 自动格式转换
- 与 Claude 桌面版和其他 MCP 客户端无缝集成
可用工具
工具 | 描述 |
---|---|
fetch_html | 获取原始 HTML 内容 |
fetch_json | 获取并解析 JSON 数据 |
fetch_txt | 获取干净的纯文本内容 |
fetch_markdown | 获取并转换为 Markdown 格式 |
每个工具都接受相同的参数格式:
{
"url": "https://example.com", // 必填:目标 URL
"headers": { // 可选:自定义请求头
"Authorization": "Bearer token"
}
}
Claude 桌面版集成
-
找到 Claude 桌面配置文件:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%/Claude/claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
添加以下配置:
{
"mcpServers": {
"fetch": {
"command": "npx",
"args": ["-y", "@tokenizin/mcp-npx-fetch"],
"env": {}
}
}
}
示例用法
在 Claude 中,可以这样使用:
使用 fetch_html 工具,请获取以下网页的 HTML 内容:
{ "url": "https://example.com" }
使用 fetch_markdown 工具,请获取以下网页的 Markdown 内容:
{ "url": "https://example.com" }
更多信息
完整文档和源代码:GitHub 仓库
许可证:MIT