一个强大的MCP服务器,可以轻松地将网页内容抓取并转换为各种格式(HTML、JSON、Markdown、纯文本)。
browser-automation
2.3w 查看 · 2026-07-07 更新
简介
一个强大的MCP服务器,可以轻松地将网页内容抓取并转换为各种格式(HTML、JSON、Markdown、纯文本)。
简介
一个强大的MCP服务器,可以轻松地将网页内容抓取并转换为各种格式(HTML、JSON、Markdown、纯文本)。
MCP NPX Fetch
🚀 特性
- 🌐 通用内容抓取: 支持HTML、JSON、纯文本和Markdown格式
- 🔒 自定义头部支持: 在请求中添加身份验证和自定义头部
- 🛠 内置转换: 自动在不同格式之间进行转换
- ⚡ 高性能: 使用现代JavaScript特性和优化以提高速度
- 🔌 MCP兼容: 无缝集成Claude Desktop和其他MCP客户端
- 🎯 类型安全: 用TypeScript编写,具有完整的类型定义
📦 安装
NPM 全局安装
npm install -g @tokenizin/mcp-npx-fetch
直接通过NPX使用
npx @tokenizin/mcp-npx-fetch
📚 文档
可用工具
fetch_html
从任何URL获取并返回原始HTML内容。
{ url: string; // Required: Target URL headers?: { // Optional: Custom request headers [key: string]: string; }; }
fetch_json
从任何URL获取并解析JSON数据。
{ url: string; // Required: Target URL headers?: { // Optional: Custom request headers [key: string]: string; }; }
fetch_txt
获取并返回干净的纯文本内容,移除HTML标签和脚本。
{ url: string; // Required: Target URL headers?: { // Optional: Custom request headers [key: string]: string; }; }
fetch_markdown
获取内容并将其转换为格式良好的Markdown。
{ url: string; // Required: Target URL headers?: { // Optional: Custom request headers [key: string]: string; }; }
🔧 使用
CLI 使用
直接启动MCP服务器:
mcp-npx-fetch
或者通过npx:
npx @tokenizin/mcp-npx-fetch
Claude Desktop 集成
-
找到你的Claude Desktop配置文件:
- 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对象中添加以下配置:
{ "mcpServers": { "fetch": { "command": "npx", "args": ["-y", "@tokenizin/mcp-npx-fetch"], "env": {} } } }
💻 本地开发
- 克隆仓库:
git clone https://github.com/tokenizin-agency/mcp-npx-fetch.git cd mcp-npx-fetch
- 安装依赖项:
npm install
- 启动开发模式:
npm run dev
- 运行测试:
npm test
🛠 技术栈
- Model Context Protocol SDK - 核心MCP功能
- JSDOM - HTML解析和操作
- Turndown - HTML到Markdown转换
- TypeScript - 类型安全和现代JavaScript特性
- Zod - 运行时类型验证
🤝 贡献
希望这符合您的要求!如果有任何需要进一步调整的地方,请告诉我。
欢迎贡献!请随时提交 Pull Request。对于重大更改,请先打开一个 issue 来讨论您想要进行的更改。
- 叉取仓库
- 创建您的功能分支 (
git checkout -b feature/AmazingFeature) - 提交您的更改 (
git commit -m 'Add some AmazingFeature') - 将更改推送到分支 (
git push origin feature/AmazingFeature) - 打开一个 Pull Request
📄 许可证
本项目根据 MIT 许可证授权 - 详情请参阅 LICENSE 文件。
由 PT Tokenizin Technology Agency 用 ❤️ 制作
工具列表
-
fetch_html: Fetch a website and return the content as HTML
-
fetch_markdown: Fetch a website and return the content as Markdown
-
fetch_txt: Fetch a website, return the content as plain text (no HTML)
-
fetch_json: Fetch a JSON file from a URL
服务配置
[{'mcpServers': {'fetch': {'args': ['-y', '@tokenizin/mcp-npx-fetch'], 'command': 'npx', 'env': {}}}}]
来源
- 来源:github
- 链接:https://github.com/tokenizin-agency/mcp-npx-fetch