Fetch MCP Server
一个灵活的HTTP抓取模型上下文协议服务器。
MCP Fetch 服务器让你能够以多种格式(HTML、JSON、纯文本、Markdown)获取网络内容。
主要功能
- fetch_html: 获取原始 HTML 内容
- fetch_json: 获取并解析 JSON 内容
- fetch_txt: 获取纯文本内容(去除 HTML 标签)
- fetch_markdown: 获取转换为 Markdown 的内容
快速开始
# 1. 克隆仓库
# 2. 安装依赖
npm install
# 3. 构建服务器
npm run build
# 4. 启动服务器
npm start
与桌面应用集成
将以下配置添加到应用的服务器配置中:
{
"mcpServers": {
"fetch": {
"command": "node",
"args": [
"/absolute/path/to/dist/index.js"
]
}
}
}
使用示例
每个功能接受相同的基本参数:
// 必需的 URL 参数
const url = "https://example.com";
// 可选的头部参数
const headers = {
"User-Agent": "Custom User Agent",
"Authorization": "Bearer token123"
};
// 调用示例
fetch_html(url, headers);
fetch_json(url, headers);
fetch_txt(url, headers);
fetch_markdown(url, headers);
开发
# 监视模式下启动 TypeScript 编译器
npm run dev
# 运行测试
npm test
该项目采用 MIT 许可证发布。