本项目是一个基于 Python 的 MCP 协议(https://modelcontextprotocol.io/introduction)网络爬虫,可高效提取网站内容并保存,为网站内容处理提供便捷方案。
本爬虫是基于 Python 的 MCP 协议网络爬虫,用于提取并保存网站内容。
git clone https://github.com/yourusername/webcrawler.git
cd webcrawler
pip install -r requirements.txt
export OUTPUT_PATH=./output # 设置您首选的输出目录
爬取的内容将以 Markdown 格式保存到指定的输出目录中。
通过环境变量对服务器进行配置:
| 属性 | 详情 |
|---|---|
OUTPUT_PATH |
默认输出文件夹路径(默认值:./output) |
MAX_CONCURRENT_REQUESTS |
最大并行请求数(默认值:5) |
REQUEST_TIMEOUT |
请求超时时间(单位:秒, 默认值:30) |
通过 FastMCP 安装服务器:
fastmcp install server.py
或使用自定义设置直接运行:
{
"Crawl Server": {
"command": "fastmcp",
"args": [
"run",
"/Users/mm22/Dev_Projekte/servers-main/src/Webcrawler/server.py"
],
"env": {
"OUTPUT_PATH": "/Users/user/Webcrawl"
}
}
}
fastmcp dev server.py --with-editable .
建议使用 https://modelcontextprotocol.io/docs/tools/inspector 工具进行调试
mcp call extract_content --url "https://example.com" --output_path "example.md"
mcp call scan_linked_content --url "https://example.com" | \
mcp call create_index --content_map - --output_path "index.md"
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)本项目基于 MIT 协议开源。更多详细信息请参阅 LICENSE 文件。