Skip to main content
Glama
README.md
# shortvideo-toolkit-mcp

<p align="center">
  <strong>All-in-One Short-Video Agent Skill & Zero-SDK Stdio MCP Server</strong><br>
  <strong>短视频三合一开源 Agent 技能 & 零依赖 MCP 工具包:无水印下载质检 · 杂乱素材自动清洗分仓 · 单视频 AI 抠图换背景裂变</strong>
</p>

<p align="center">
  <a href="#english">English</a> · <a href="#简体中文">简体中文</a>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT">
  <img src="https://img.shields.io/badge/Python-3.9%2B-green.svg" alt="Python 3.9+">
  <img src="https://img.shields.io/badge/MCP-Stdio_JSON--RPC_2.0-purple.svg" alt="MCP">
  <img src="https://img.shields.io/badge/Agent_Skill-One--Click_Install-orange.svg" alt="Agent Skill">
</p>

---

<a id="english"></a>

## English

### What It Does

`shortvideo-toolkit-mcp` packages three practical, standalone short-video production tools into a single **Agent Skill + Stdio MCP Server + Unified CLI** with zero external MCP SDK dependencies:

| # | MCP Tool / CLI Command | Capability | Minimum Requirements |
|---|---|---|---|
| 1 | `tiktok_download` / `download` | **Watermark-Free TikTok Batch Downloader & Validator** — Login-free `tikwm` HD API primary + `yt-dlp` fallback + mandatory `ffprobe` validation (guarantees positive width, height, duration, and rejects audio-only stubs). | Python 3.9+ (`ffprobe` recommended, `yt-dlp` optional) |
| 2 | `clip_wash` / `wash` | **Raw Clip Auto-Washer & Visual Bucketing** — Concurrently probes a folder of messy footage, filters out corrupt/wrong-orientation/low-res/too-short clips into clean buckets, generates JSON/CSV reports & 4×4 review contact sheets. Optional Gemini Vision mode packs 16 clips per sheet for semantic subject & overlay filtering. | Python 3.9+ & `ffprobe` (`Pillow` optional; `GEMINI_API_KEY` only for AI sorting) |
| 3 | `video_matting` / `matting` | **Single-Video AI Alpha Matting & Multi-Background Fission** — AI foreground segmentation (`rembg` with CUDA / DirectML / CPU auto-detection) + 3-frame temporal edge smoothing + optional floor contact-shadow preservation. Exports transparent VP9 `.webm` / ProRes 4444 `.mov` and batch-composites onto 1..N replacement backgrounds while keeping original audio. | `ffmpeg`, `rembg`, `opencv-python-headless`, `onnxruntime`, `pillow`, `numpy` |
| 0 | `check_environment` / `doctor` | **Runtime Doctor** — Checks binaries, Python packages, and GPU providers in one call. | Python 3.9+ (zero dependencies) |

### One-Click Install for AI Agents

Works out of the box with **Antigravity, Claude Code, Cursor, Windsurf, Cline**, and any MCP-compatible Agent:

```bash
git clone https://github.com/XuLi289/shortvideo-toolkit-mcp.git
cd shortvideo-toolkit-mcp

# Install Agent Skill + run MCP handshake smoke test + print ready-to-paste MCP config
python install.py

# Optional: also install Pillow / yt-dlp / full AI video matting dependencies
python install.py --with-pillow --with-ytdlp
python install.py --with-matting

# Optional: install Skill to another agent (e.g. Claude Code) & auto-register MCP JSON
python install.py --target ~/.claude/skills --mcp-config ~/.cursor/mcp.json
```

> **Zero-manual tip:** Hand this repo URL or cloned folder directly to your AI Agent and ask it to follow [`INSTALL_AND_RUN_FOR_AI.md`](./INSTALL_AND_RUN_FOR_AI.md).

### MCP Client Configuration Example

```json
{
  "mcpServers": {
    "shortvideo-toolkit": {
      "command": "python",
      "args": ["/absolute/path/to/shortvideo-toolkit-mcp/mcp_server.py"]
    }
  }
}
```

### Quick CLI Examples

```bash
# 1. Check local runtime & GPU readiness
python cli.py doctor

# 2. Download watermark-free TikTok clips & validate with ffprobe
python cli.py download \
  --url "https://www.tiktok.com/@creator/video/1234567890" \
  --out-dir "./downloads"

# 3. Wash a raw video folder into clean vertical buckets (zero API keys needed)
python cli.py wash \
  --src-dir "./raw_clips" \
  --out-dir "./washed_pool" \
  --orientation vertical --min-width 720 --min-duration 3 --action copy

# 4. Optional: AI visual washing with custom target & roles (set GEMINI_API_KEY)
python cli.py wash \
  --src-dir "./raw_clips" \
  --out-dir "./washed_ai" \
  --ai-target "Clean product hands-on demo without burned-in subtitles" \
  --ai-roles "closeup,demo,unboxing,lifestyle"

# 5. Cut out a foreground video & composite onto multiple replacement backgrounds
python cli.py matting \
  --src "./foreground_clip.mp4" \
  --bg-dir "./backgrounds" \
  --out-dir "./fission_out"
```

### Environment Variables (All Optional)

- `HTTP_PROXY` / `HTTPS_PROXY` / `SVT_PROXY` — Proxy URL for downloads or Gemini API calls.
- `GEMINI_API_KEY` — Only required if using `--ai-target` visual classification in `clip_wash`.
- `SVT_FFMPEG_PATH` / `SVT_FFPROBE_PATH` / `SVT_YT_DLP_PATH` — Override binary locations if not on `PATH`.

---

<a id="简体中文"></a>

## 简体中文

### 项目简介

`shortvideo-toolkit-mcp` 把短视频运营与素材处理中最常用的三个独立小工具,打包成一套**零重型框架依赖的一体化 Agent Skill + 标准 Stdio MCP Server + 命令行工具**,脱离任何私有生产环境,开箱即用:

| 序号 | MCP 工具 / CLI 命令 | 核心功能 | 最低依赖 |
|---|---|---|---|
| 1 | `tiktok_download` / `download` | **TikTok 无水印高清批量下载与质检**:免登录、免 Cookie,`tikwm` 高清 API 主通道 + `yt-dlp` 自动兜底,每条强制 `ffprobe` 校验分辨率与时长,杜绝只下出纯音频残片。 | Python 3.9+(推荐装 `ffprobe`,`yt-dlp` 可选) |
| 2 | `clip_wash` / `wash` | **杂乱视频素材自动清洗与分仓**:并发 `ffprobe` 扫全目录,按横竖屏/分辨率/时长/音轨规则一键筛片并自动分仓,输出 JSON/CSV 台账与 4×4 抽帧审片拼图;可选开启 Gemini 视觉分类(16 条拼 1 图极省额度,支持自定义目标商品与分仓角色)。 | Python 3.9+ 与 `ffprobe`(`Pillow` 可选;仅 AI 分类需 `GEMINI_API_KEY`) |
| 3 | `video_matting` / `matting` | **单视频 AI 抠图透明导出与多背景换景裂变**:`rembg` 前景抠像(自动优选 CUDA / DirectML / CPU)+ 3 帧时序边缘平滑去闪烁 + 可选地面接触阴影保留;支持输出透明通道 WebM / ProRes 4444 MOV,并批量合成到任意多张新背景图(自动保留原音轨)。 | `ffmpeg`、`rembg`、`opencv-python-headless`、`onnxruntime`、`pillow`、`numpy` |
| 0 | `check_environment` / `doctor` | **一键环境体检**:秒查本机 `ffmpeg`/`ffprobe`/`yt-dlp`/Python 包和 GPU 加速就绪状态,缺什么给出一行安装命令。 | Python 3.9+(零依赖) |

### 让 AI Agent 一键安装使用

完美适配 **Antigravity、Claude Code、Cursor、Windsurf、Cline** 等所有支持 Skill 或 MCP 的主流 Agent:

```bash
git clone https://github.com/XuLi289/shortvideo-toolkit-mcp.git
cd shortvideo-toolkit-mcp

# 默认安装:装好 Agent Skill + 自动跑 MCP 协议握手自检 + 输出可直接粘贴的 MCP 配置
python install.py

# 按需安装可选依赖(拼图 / yt-dlp 兜底 / 完整 AI 视频抠图裂变)
python install.py --with-pillow --with-ytdlp
python install.py --with-matting

# 安装到指定 Agent 目录并自动注册进 MCP 配置文件
python install.py --target ~/.claude/skills --mcp-config ~/.cursor/mcp.json
```

> **偷懒用法**:直接把本仓库链接或目录丢给你的 AI Agent,让它按 [`INSTALL_AND_RUN_FOR_AI.md`](./INSTALL_AND_RUN_FOR_AI.md) 全自动安装并直接开工即可。

### 目录结构

```text
shortvideo-toolkit-mcp/
├── README.md                  # 中英双语项目说明
├── LICENSE                    # MIT 开源协议
├── install.py                 # 一键安装器(装 Skill + 装可选依赖 + MCP 自检与注册)
├── INSTALL_AND_RUN_FOR_AI.md  # 给 AI Agent 的自动安装与执行指引
├── mcp_server.py              # 零第三方 SDK 依赖的 Stdio MCP Server
├── cli.py                     # 统一命令行入口
├── shortvideo-toolkit/
│   └── SKILL.md               # 标准 Agent Skill 说明书
└── toolkit/
    ├── common.py              # 跨平台环境探测与媒体信息读取
    ├── tiktok_downloader.py   # 工具 1:无水印下载与质检
    ├── clip_washer.py         # 工具 2:素材规则清洗与可选 AI 视觉分仓
    └── video_matting.py       # 工具 3:AI 视频透明抠图与多背景裂变
```

### 免责声明

本工具仅用于合法的个人素材整理、公开样本研究与自创内容后期处理,请遵守目标平台服务条款与版权法规。

TDQS

A3.7/5.0

Scored across 4 tools

Disambiguation5/5

Four tools each target a clearly distinct phase: environment/dependency inspection, video acquisition (download), foreground matting, and local clip filtering/organizing. An agent can easily pick the right tool without overlap.

Naming Consistency3/5

All names use snake_case and are readable, but the verb/noun ordering is inconsistent: check_environment (verb_noun), tiktok_download and clip_wash (noun_verb), video_matting (noun_noun). The pattern is not a predictable single convention.

Tool Count4/5

Four tools map cleanly to four distinct toolkit capabilities (setup check, download, matting, clip washing), each substantial. It is on the lean side but well-scoped for a focused toolkit.

Completeness4/5

The acquisition→processing→organizing lifecycle is covered (download, matting, clip filtering) plus a readiness check. Minor gaps exist around general transcoding/trimming or merging clips, but core short-video workflows are addressed.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues