WebFetch MCP服务器
   
A. 模型上下文协议 (MCP)服务器,获取网页,将HTML转换为markdown,并使用Claude回答有关内容的问题。从任何MCP客户端获取任何网页的人工智能摘要和分析。
安装
安装时使用 篮子:
mpak install @nimblebraininc/webfetch配置
从获取API密钥 Anthropic 控制台,然后配置:
mpak config set @nimblebraininc/webfetch anthropic_api_key YOUR_API_KEY克劳德代码
claude mcp add webfetch -- mpak run @nimblebraininc/webfetch克劳德桌面
添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"webfetch": {
"command": "mpak",
"args": ["run", "@nimblebraininc/webfetch"]
}
}
}看 mpak注册表页 获取完整安装选项。
工具
web_fetch
获取一个网页并回答有关其内容的问题。页面被提取,转换为markdown,并发送给Claude Haiku进行分析。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
url | string | 是 | 要获取的URL。HTTP URL会自动升级为HTTPS。 |
prompt | string | 是 | 关于页面内容的问题或说明。 |
示例调用:
{
"name": "web_fetch",
"arguments": {
"url": "https://example.com",
"prompt": "What is this page about? Summarize the main points."
}
}示例响应:
This page is the IANA example domain, reserved for use in documentation
and examples. It contains a simple heading and a paragraph explaining
that the domain is established for illustrative purposes.特征:
- 自动HTTP到HTTPS升级
- HTML被清理并转换为markdown(删除脚本、样式、导航、页眉、页脚)
- 15分钟内存缓存,用于重复获取同一URL
- 跨主机重定向检测(返回重定向URL供您遵循)
- 超大页面的内容截断
快速开始
本地开发
git clone https://github.com/NimbleBrainInc/mcp-webfetch.git
cd mcp-webfetch
# Install dependencies
uv sync
# Set API key
export ANTHROPIC_API_KEY=your-key-here
# Run the server (stdio mode)
uv run python -m mcp_webfetch.server服务器支持HTTP传输:
- 健康检查:
GET /health - MCP端点:
POST /mcp
发展
# Install with dev dependencies
uv sync --group dev
# Run all checks (format, lint, typecheck, unit tests)
make check
# Run unit tests
make test
# Run with coverage
make test-cov关于
许可证
麻省理工学院
