video-extract-mcp
Parses and downloads Bilibili videos, including b23.tv short links and regular video URLs; DASH audio/video streams are automatically merged with ffmpeg.
Parses and downloads Kuaishou short links and work URLs, with a built-in GraphQL fallback for extraction.
Parses and downloads TikTok videos from share links or share text, with optional proxy support.
Parses and downloads WeChat Channels (微信视频号) videos where possible, typically requiring a valid cookie due to platform restrictions.
Parses and downloads Xiaohongshu videos, including xhslink.com short links; some content requires cookies.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
video-extractor-mcp
面向 AI Agent 的短视频解析与下载工具:提供 MCP Server、标准化 CLI + Agent Skill、FastAPI HTTP 服务 与 WebUI,支持将抖音、TikTok、快手、小红书、哔哩哔哩、微信视频号的链接或分享口令解析为无水印视频直链并下载到本地。
Short-video parser & downloader built for AI Agents (MCP Server, JSON CLI, Agent Skill, FastAPI / OpenAPI, and Docker).
特性一览
多形态 AI 接入:
MCP Server (
video-extract-mcp):支持stdio(本地客户端直连)与streamable-http(远程/容器部署),适配 Claude Desktop、Cursor、Antigravity、Windsurf、Cline 等。标准 CLI +
SKILL.md(video-extract):stdout 纯 JSON 输出、错误走 stderr + 非零退出码,适合 Claude Code、Codex、Antigravity 等 Coding Agent 直接调用。FastAPI HTTP / OpenAPI (
video-extract-server):内置 Swagger 文档与 Coze 专用coze/openapi.json,开箱接入 Coze、Dify、n8n 与 Function Calling。
抖音免 Cookie 无水印优先:优先通过分享页 SSR 提取无水印源(
playwm → play),绕开yt-dlp常见风控;失败自动回退yt-dlp与 HTML 兜底。音视频分离自动合并:B 站等 DASH 流自动检测
need_merge: true,下载时调用ffmpeg无损合并为完整 MP4。公网部署友好:支持可选
API_KEY鉴权、下载目录 TTL 自动过期清理、单文件体积限制、流式代理白名单(防 SSRF)与预装ffmpeg的 Docker 镜像。结构化错误码:统一返回
INVALID_URL、COOKIE_REQUIRED、FILE_TOO_LARGE、FFMPEG_MISSING、NETWORK_ERROR等错误码,方便 AI 自动判断后续动作。
Related MCP server: Wanyi Watermark Remover
支持平台
平台 | 标识 | 说明 |
抖音 / TikTok |
| 支持分享口令与短链;自动尝试 |
快手 |
| 支持短链与作品链接,内置 GraphQL 兜底 |
小红书 |
| 支持 |
哔哩哔哩 |
| 支持 |
微信视频号 |
| 平台限制较多,通常需要有效 Cookie(尽力支持) |
快速安装
要求 Python >= 3.10;如需合并 B 站等音视频分离流,建议安装 ffmpeg(Docker 镜像已预装)。
git clone https://github.com/niannianmao/video-extractor-mcp.git
cd video-extractor-mcp
# 推荐使用虚拟环境安装(可编辑模式)
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
pip install -e .
# 可选:复制环境变量模板
cp .env.example .envAI 接入方式
1. MCP Server(Claude Desktop / Cursor / Antigravity / Cline)
在你的 MCP 客户端配置文件中加入以下条目(stdio 本地直连模式):
{
"mcpServers": {
"video-extractor": {
"command": "video-extract-mcp",
"args": [],
"env": {
"DOWNLOAD_DIR": "/path/to/downloads",
"COOKIEFILE": "/path/to/cookies.txt"
}
}
}
}如果使用 uv 直接从源码运行,无需全局安装:
{
"mcpServers": {
"video-extractor": {
"command": "uv",
"args": ["run", "--directory", "/path/to/video-extractor-mcp", "video-extract-mcp"]
}
}
}也可以以远程 Streamable HTTP 模式启动:
video-extract-mcp --transport streamable-http --host 0.0.0.0 --port 8001暴露的 MCP Tools:
parse_video(url):解析分享口令或链接,返回无水印直链与元信息(不落盘)。download_video(url, filename=None, output_dir=None):解析并下载到本地,自动合并音视频流。list_platforms():查询支持的平台列表与注意事项。
2. CLI + Agent Skill(Claude Code / Codex / Antigravity)
仓库根目录自带 SKILL.md,可复制到你的 Agent Skills 目录,让 Agent 自动学会调用 CLI:
# 仅解析(stdout 输出纯 JSON)
video-extract parse "7.86 复制打开抖音,看看【xxx】https://v.douyin.com/xxxxx/"
# 解析并下载到指定目录
video-extract download "https://www.bilibili.com/video/BV1GJ411x7h7" --output-dir ./downloads
# 查看支持的平台
video-extract platforms也兼容旧版脚本调用:
python cli.py "<url>" [--download]。
3. Docker 一键部署(推荐给 Coze / Dify / n8n)
镜像内置 ffmpeg,一条命令启动 HTTP 服务:
cp .env.example .env
# 公网部署请务必在 .env 中设置 API_KEY
docker compose up -d --build如需同时启动远程 MCP Server(端口 8001):
docker compose --profile mcp up -d --build4. HTTP API / Coze / Dify 接入
本地启动 HTTP 服务:
video-extract-server
# 或 python run.py启动后访问:
WebUI:
http://127.0.0.1:8000/Swagger 文档:
http://127.0.0.1:8000/docsOpenAPI JSON:
http://127.0.0.1:8000/openapi.json健康检查:
http://127.0.0.1:8000/api/v1/health
主要接口:
POST /api/v1/parse:仅解析视频直链与元信息POST /api/v1/download:解析并下载到服务端downloads/(自动合并 DASH)POST /api/v1/parse_and_download:一步解析并按需下载GET /api/v1/stream:不落盘流式转发(仅限已知媒体 CDN 域名)GET /api/v1/files/{filename}:获取已下载的视频文件GET /api/v1/platforms:获取支持的平台
鉴权说明:在 .env 设置 API_KEY 后,除 /api/v1/health 与 /api/v1/platforms 外,所有业务接口均需携带以下任一凭证:
Header
Authorization: Bearer <API_KEY>Header
X-API-Key: <API_KEY>Query
?api_key=<API_KEY>(适用于浏览器直接下载/api/v1/files/...)
Coze 接入:
HTTP 插件:将
coze/openapi.json中的servers[0].url改为你的公网 HTTPS 地址后导入 Coze。代码节点:参考
examples/coze_code_node.py。
结构化错误码
API、CLI 与 MCP 工具在失败时均会返回统一的 error_code,便于 AI Agent 自动处理:
| 含义 | AI 推荐处理策略 |
| 未提取到有效链接 | 提示用户提供完整的 http/https 链接或分享口令 |
| 平台风控或需登录 | 提示用户配置 Netscape 格式 |
| 平台暂不支持 | 调用 |
| 超过 | 提示用户调大限制或仅获取直链 |
| 缺少 | 提示安装 |
| 请求超时/连接失败 | 建议重试或配置 |
| API Key 无效或缺失 | 检查 |
环境变量配置
参考 .env.example:
变量 | 默认值 | 说明 |
|
| HTTP 服务监听地址与端口 |
| 空(不鉴权) | 开启 HTTP 接口鉴权(公网部署强烈建议设置) |
|
| 视频保存目录 |
|
| 下载文件过期自动清理时间(分钟), |
| 空 | Netscape |
|
| 网络请求超时(秒) |
|
| 单视频体积上限(MB), |
| 空 | 可选代理,例如 |
开发与测试
python -m unittest discover -s tests -v目录结构
app/
main.py FastAPI 入口(含 WebUI 与 TTL 清理任务)
mcp_server.py MCP Server(stdio / streamable-http / sse)
cli.py 标准化 JSON CLI
config.py 环境变量配置
errors.py 结构化错误码与分类器
models.py Pydantic 数据模型
api/routes.py HTTP 路由与 API Key 鉴权
core/parser.py 解析引擎(抖音 SSR + yt-dlp + 兜底)
core/downloader.py 下载器与 ffmpeg 合并
core/cleanup.py 下载目录 TTL 自动清理
core/share.py 分享口令提取与平台识别
platforms/ 平台元信息
web/index.html 单页 WebUI
assets/icon.png WebUI 图标
coze/openapi.json Coze OpenAPI 3.0 描述文件
examples/ Coze 代码节点示例
tests/ 单元测试
SKILL.md Agent Skill 使用说明
Dockerfile 预装 ffmpeg 的容器镜像
docker-compose.yml API + 远程 MCP 编排文件合规与免责声明
本项目仅供学习、研究与个人授权内容处理使用,请勿用于侵犯版权、绕过付费墙或违反目标平台服务条款的行为。
平台接口和反爬策略随时可能变化;如遇解析失败,可先尝试更新
yt-dlp:pip install -U yt-dlp。切勿将包含个人登录态的
.env或cookies/*.txt提交到公开仓库(.gitignore已默认忽略)。
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Parse short-video share links into watermark-free direct URLs via MCP for AI assistants.
Parse short-video share links into watermark-free direct URLs via MCP for AI assistants.
Instagram, TikTok, YouTube and other social media links to direct media download URLs.
660+ data tools for agents: TikTok, Douyin, Instagram, YouTube, X, weather, GitHub. Pay per call.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables downloading watermark-free videos from Douyin (TikTok China) share links, extracting audio, and converting speech to text using AI voice recognition APIs.1MIT
- AlicenseAqualityDmaintenanceExtracts watermark-free videos and images from Douyin (TikTok) and Xiaohongshu (RedNote) share links, with optional AI-powered video transcription support.447 PyPI27Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to download high-quality videos from platforms like YouTube, Bilibili, Douyin, TikTok, and Instagram, with tools for querying media info, downloading, batch processing, cookie management, and environment checks.1MIT
- AlicenseAqualityCmaintenanceTurns TikTok, Instagram, X/Twitter and Facebook post URLs into video download links plus metadata (title, author, duration, thumbnail), so AI agents can fetch social videos in one tool call.242 npmMIT