基于 MCP 协议的多平台视频下载服务端,支持 1000+ 视频平台,可通过双模式运行,提供实时进度跟踪等功能。
在你的 MCP 客户端配置文件中添加:
{
"mcpServers": {
"video-fetch": {
"command": "npx",
"args": ["@pickstar-2002/video-fetch-mcp@latest"]
}
}
}
# 启动 REST API 服务器
npx @pickstar-2002/video-fetch-mcp@latest api
# 或者使用已安装的版本
video-fetch-mcp api
# 使用 @latest 标签获取最新版本(推荐)
npx @pickstar-2002/video-fetch-mcp@latest
npm install -g @pickstar-2002/video-fetch-mcp@latest
npm install @pickstar-2002/video-fetch-mcp@latest
服务器提供以下 MCP 工具:
get_video_info
:获取视频详细信息{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
download_video
:下载视频文件{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"outputPath": "./downloads",
"quality": "best",
"extractAudio": false,
"downloadSubtitles": true
}
get_task_status
:查询下载任务状态{
"taskId": "uuid-task-id"
}
cancel_task
:取消下载任务{
"taskId": "uuid-task-id"
}
curl -X POST http://localhost:8080/api/v1/video/info \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'
curl -X POST http://localhost:8080/api/v1/video/download \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"outputPath": "./downloads",
"quality": "best"
}'
curl http://localhost:8080/api/v1/task/{taskId}
# 服务端口(默认:8080)
PORT=8080
# 日志级别(默认:info)
LOG_LEVEL=info
# yt-dlp 超时时间(默认:300000ms)
YTDLP_TIMEOUT=300000
quality
:视频质量 (best
, worst
, bestvideo
, bestaudio
)outputTemplate
:文件名模板 (默认: %(title)s.%(ext)s
)extractAudio
:是否提取音频audioFormat
:音频格式 (mp3
, aac
, wav
, flac
)downloadSubtitles
:是否下载字幕subtitleLangs
:字幕语言列表npx
缓存问题导致的。请按以下顺序尝试解决:
npx @pickstar-2002/video-fetch-mcp@latest
- **2. 锁定到特定版本(备用方案)**
npx @pickstar-2002/video-fetch-mcp@1.0.0
- **3. 清理 npx 缓存(终极方案)**
# 清理 npx 缓存
npx clear-npx-cache
# 或者手动清理
rm -rf ~/.npm/_npx
# Windows 用户使用:rmdir /s %USERPROFILE%\.npm\_npx
# 然后重新运行
npx @pickstar-2002/video-fetch-mcp@latest
# 安装 yt-dlp
pip install yt-dlp
# 或使用 conda
conda install -c conda-forge yt-dlp
PORT=8081 npx @pickstar-2002/video-fetch-mcp@latest api
mkdir -p ./downloads
chmod 755 ./downloads
启用详细日志:
LOG_LEVEL=debug npx @pickstar-2002/video-fetch-mcp@latest
# 克隆仓库
git clone https://github.com/pickstar-2002/video-fetch-mcp.git
cd video-fetch-mcp
# 安装依赖
npm install
# 开发模式
npm run dev
# 构建
npm run build
# 启动
npm start
video-fetch-mcp/
├── src/
│ ├── services/
│ │ ├── mcp-server-fixed.ts # MCP 服务器实现
│ │ ├── rest-api-server.ts # REST API 服务器
│ │ └── ytdlp-service.ts # yt-dlp 核心服务
│ ├── utils/
│ │ └── logger.ts # 日志工具
│ ├── types.ts # 类型定义
│ ├── config.ts # 配置文件
│ └── index.ts # 入口文件
├── dist/ # 编译输出
└── downloads/ # 默认下载目录
方法 | 端点 | 描述 |
---|---|---|
GET | /api/v1/health |
健康检查 |
POST | /api/v1/video/info |
获取视频信息 |
POST | /api/v1/video/download |
开始下载 |
GET | /api/v1/task/:taskId |
查看任务状态 |
DELETE | /api/v1/task/:taskId |
取消任务 |
GET | /api/v1/tasks |
列出所有任务 |
GET | /api/v1/platforms |
获取支持的平台 |
工具名 | 描述 | 参数 |
---|---|---|
get_video_info |
获取视频信息 | url |
download_video |
下载视频 | url , outputPath , quality , etc. |
get_task_status |
查看任务状态 | taskId |
cancel_task |
取消任务 | taskId |
list_tasks |
列出所有任务 | - |
欢迎贡献代码!请遵循以下步骤:
git checkout -b feature/amazing-feature
)。git commit -m 'Add some amazing feature'
)。git push origin feature/amazing-feature
)。本项目采用 MIT 许可证。
如有问题或建议,欢迎联系: 微信: pickstar_loveXX
⭐ 如果这个项目对你有帮助,请给个 Star!