简单下载MCP(注:MCP可能指多种含义,如“Microsoft Certification Program”(微软认证计划)或其他特定上下文中的缩写,具体需根据上下文确定)
一个功能丰富的文件下载器,支持多线程下载、进度追踪、下载历史管理以及MCP服务器支持
特点/特性
- ✅ 多线程并发下载
- ✅ 实时进度显示
- ✅ 下载历史管理
- ✅ 暂停/继续下载
- ✅ 错误重试机制
- ✅ 检查磁盘空间
- ✅ 自动解决文件名冲突
- ✅ 数据库记录与实际下载的文件一致
- ✅ 完善的命令行帮助系统
- ✅ MCP服务器支持
安装
pip install -r requirements.txt使用方法
基本下载
python3 main.py download https://example.com/file.zip指定输出路径
python3 main.py download https://example.com/file.zip --output /path/to/save/file.zip查看下载历史
# View all records
python3 main.py list
# View records with specific status
python3 main.py list --status completed管理下载任务
# Check download status
python3 main.py status
# Pause download
python3 main.py pause
# Resume download
python3 main.py resume
# Cancel download
python3 main.py cancel 查看活跃下载
python3 main.py active查看配置
python3 main.py config获取帮助
# View all commands
python3 main.py --help
# View specific command usage
python3 main.py download --help
python3 main.py list --help
python3 main.py status --help配置
配置文件 config.json 自动创建,并采用以下设置:
{
"download_dir": "downloads",
"max_concurrent_downloads": 3,
"timeout": 30,
"retry_count": 3,
"retry_delay": 5,
"chunk_size": 8192,
"enable_progress_bar": true
}MCP服务器集成
启动MCP服务器
python3 mcpserver.py服务器将在以下地址监听: http://127.0.0.1:8001/sse
MCP工具功能
启动MCP服务器后,您可以使用以下下载工具:
download_file- 单个文件下载batch_download_files- 下载多个文件get_download_status- 检查下载状态list_downloads- 列出所有下载记录pause_download/resume_download/cancel_download- 下载管理
健康检查
curl http://127.0.0.1:8001/health技术栈
核心下载功能
- HTTP 请求请求:
- 数据库SQLite + SQLAlchemy
- 并发性线程 + ThreadPoolExecutor(线程池执行器)
- 进度显示tqdm
- 命令行点击
- 文件操作pathlib
MCP集成
- MCP框架fastmcp
- 传输协议服务器发送事件 (SSE)
- API设计异步/同步混合架构
- 工具注册动态工具注册机制
系统功能
- 跨平台兼容Windows/Linux/macOS系统
- 简历支持范围请求支持
- 错误处理重试机制和详细的错误报告
- 配置管理JSON配置文件
- 记录日志内置日志系统
______________________________________________________________________
版本信息
版本V1.0.0 作者伊桑
许可证
这个项目采用以下许可证授权: 麻省理工学院许可证这是最宽松的开源许可证之一,允许:
- ✅ 商业用途 - 任何个人或企业均可将其用于商业用途
- ✅ 修改与分发 - 修改代码并分发修改版本的自由
- ✅ 私人使用 - 在私人项目中自由使用
- ✅ 翻译成中文是“正确”或“对”。 分许可 - 可以在专有软件中包含代码
- ✅ 不作任何保证 - 软件按“原样”提供,不附带任何保证
唯一的要求是 软件和文档中必须包含原始版权说明和MIT许可证文本。
MIT License
Copyright (c) 2025 Ethan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.