VIDCraft-MCP
by KienPC1234
README.md
<img src="assets/logo.svg" alt="VIDCraft logo" width="96">
# VIDCraft-MCP
AI-native video editing engine. MCP-first, local-first, open source (AGPL-3.0).
VIDCraft lets an AI agent assemble finished videos from raw footage, photos, audio, and titles. The agent edits a validated timeline, previews cheap storyboards, and exports broadcast-ready files. It never touches raw ffmpeg commands. The backend owns every filter graph.
Master design document: `VIDCraft-MCP_MASTER_PLAN_v3.3_Effect_Packs.md`.
## Features
* Atomic timeline editing with revisions, dry-run, branches, and one-click revert
* Frame-accurate timing on integer frames, including 30000/1001 NTSC rates
* Image and video tracks with gaps, PiP overlays, and Unicode burned-in titles (Vietnamese fully supported)
* Per-clip transform (fit/fill, pan, zoom, rotate, flip), constant speed, fades, user LUTs, monochrome
* Non-destructive photo edit stacks shared by the video path and a Pillow exporter, plus reference look matching without ML
* Audio bed mixing with per-clip gain, fades, pitch-safe speed, and a peak limiter; classical silence/black/freeze scan for suggestions
* Manual captions plus SRT import with skip reporting; no speech recognition in the core
* Real crossfade and dip transitions with handle validation; honest cut fallback with reasons
* Storyboard and low-res preview in seconds, full export on demand
* Workspace model: source code stays in the repo, projects live in a user folder with a portable manifest, copy or link ingest modes, relink, packaging, and cache cleanup
* Settings GUI (Tkinter, separate process) plus a secrets store backed by the OS credential locker, with a restricted file fallback
* Agent-safe MCP surface: status booleans only, keys never cross the process boundary
## Requirements
* `uv` 0.5 or newer
* FFmpeg 7 with libass (`ffmpeg -version` should list libass)
* Windows: `winget install Gyan.FFmpeg`
* macOS: `brew install ffmpeg`
* Ubuntu: `apt install ffmpeg`
* Python 3.11 or newer (uv manages this automatically)
## Quickstart
```powershell
$env:VIDCRAFT_WORKSPACE = "D:\Videos\VIDCraft"
uv sync --extra dev
uv run vidcraft-doctor
uv run vidcraft demo
uv run pytest -q
```
Without `VIDCRAFT_WORKSPACE`, a `VIDCraft` folder in your home directory is used, so footage never lands in the source repo. The `demo` command builds a small slideshow and prints the project id and output path.
## MCP client setup
Run the server over stdio:
```powershell
uv run python -m vidcraft.mcp.server
```
Claude Desktop example:
```json
{
"mcpServers": {
"vidcraft": {
"command": "uv",
"args": ["run", "python", "-m", "vidcraft.mcp.server"],
"cwd": "D:/Dev/VIDCraft-MCP"
}
}
}
```
## How it works
An agent request flows through four stages: typed timeline operations, an atomic transaction, a compiled render plan, and a verified export. Each patch is validated before anything is written, and every revision is snapshotted, so experiments are cheap and reversible.
A workspace holds independent portable projects:
```text
<workspace>/
projects.sqlite index only, the manifest is the source of truth
cache/ shared, deletable, always rebuildable
<project_id>/
.vidcraft/ project.json, timeline.json, history, asset manifest
source/ copy-mode originals (self contained)
renders/ previews, storyboards, segment cache (rebuildable)
exports/ final deliverables (kept, packaged)
```
Copy mode keeps a project self contained for easy transfer. Link mode references footage in place and records a hash, so moved files can be found again with `project_maintain(relink)`.
## MCP tools
Project management: `project_create`, `project_list`, `project_open`, `project_maintain` (relink, package, cleanup, health, retarget, export_images, collage, transcript_attach, font_attach), `asset_ingest` (video/audio/image/font/LUT), `asset_inspect` (optional kind filter).
Timeline: `timeline_get` (summary now includes per-track clip ids + spans, transitions, markers — most ops need no full dump), `timeline_patch` (atomic, validated, dry-run capable, ≤200 ops per patch with op_index on errors, SRT import, image-stack handling, ripple/slip/slide/roll, `jcut` for J/L cuts, `mount_sequence` for nested projects, `multicam_group`/`multicam_cut`, `mask_track_add`/`mask_track_clear`, `set_caption_font` for per-project/ system faces, video motion pan/fades, `transform.tonemap` for HDR-to-SDR delivery, `transform.hdr=passthrough` for uniform 10-bit HDR delivery (PQ/HLG tags preserved, no grading), `set_speed_curve` variable ramps (V1/overlay/nested, motion/masks compose), motion `gain` envelopes on audio, edge/marker snapping, motion keyframes, karaoke words, text move/fade/scale via motion (`\move \fad \t\fs`), `set_audio_space` SFX sends (echo/reverb/room/damping, all-zero = bypass)), `timeline_history` (list, branch, revert).
Effects: `effect_catalog` (only lists effects the backend really renders), `effect_inspect`.
Render: `render_storyboard` (instant from cached preview), `render_preview` and `render_export` (queue on a one-worker background queue and return immediately with a time estimate; identical requests coalesce), `job_get` (poll no faster than `poll_interval_ms`), `job_cancel` (kills the running ffmpeg).
Media analysis: `media_scan` (silence, black, freeze, loudness suggestions; suggestions only, never auto-cut).
QA: `qa_inspect` (static preflight plus optional post-export verification of black frames, frozen ranges, and audio clipping).
Visual footage: `footage_analyze` (shots, sharpness, exposure, motion, duplicates — cached technical report), `footage_storyboard` (adaptive contact sheet the agent looks at), `footage_inspect` (dense frame strip over a range), `footage_select` (rule-based candidate cuts, always requires_review), `footage_search` (keyword over transcripts/filenames/markers/captions, or mode=semantic over CLIP-indexed assets with the optional vision extra — CPU by default (CUDA/MPS when seen), `device` selects cpu|cuda), `footage_track` (classical camera/box tracking: Farneback global motion, SQDIFF template — no models; returns keyframes + scores for motion_add/mask_track_add, never auto-applies), `transcript_transcribe` (local Whisper STT: `engine` faster-whisper — CPU int8 everywhere, CUDA float16 when seen — or whisper.cpp user binary incl. Vulkan-capable builds; `device` auto|cpu|cuda; never downloads weights — explicit opt-in fetch is `vidcraft models fetch --stt tiny|--clip`). Classical CV only; the agent's own vision does the understanding.
Languages: no hardcoded locale. Error `message` is English-canonical with optional `locale` map; transcripts/captions carry BCP-47 `lang` tags; search and renderers are script-agnostic (any Unicode script passes through).
Settings: `settings_open` (launches the GUI), `settings_status`, `settings_provider_test`, `settings_capabilities` (ffmpeg filters/encoders incl. tonemap/zscale/frei0r/ocio, configured providers, optional-AI readiness incl. CUDA). These return configured flags and status codes only.
Custom resources live in the project, not the repo: ingest `.ttf`/`.otf` fonts (`font_attach` declares the family, fc-scan-verified when available; captions pick them per clip with `set_caption_font`, staged to ASS `fontsdir` at render) and `.cube` LUTs (referenced as `asset:<id>` in `look.lut`, staged portably — package/relocate safe). Executable plugins (frei0r `.so`/shaders) are system-level only by design, never per-project.
## Settings and secrets
Prefer the GUI for configuration:
```powershell
uv run vidcraft settings
uv run vidcraft settings-status
uv run vidcraft diagnostics
```
API keys go to the OS credential store (`uv sync --extra settings` enables keyring support for Windows Credential Locker, macOS Keychain, and Secret Service). Without keyring, keys fall back to a file with owner-only permissions, and the active backend is always reported so there is no silent downgrade. The GUI runs as its own process with a fixed argument list, and it refuses to start on headless machines with a pointer to the CLI instead.
## Repository layout
```text
src/vidcraft/
settings.py workspace, ffmpeg discovery, approved roots
domain/ timebase, timeline models, typed operations, errors
timeline/ atomic transactions
storage/ manifests, revision store, sqlite index, jobs
media/ probing, proxies, thumbnails
render/ IR compiler, ffmpeg-python backend, OpenCV sampling, QA
effects/ versioned registry plus backend adapters
config/ user config, secrets, diagnostics, provider checks
gui/ Tkinter settings app (separate process)
mcp/server.py typed MCP tools
cli.py human friendly command line
presets/ output profiles and the effect catalog
tests/ unit, golden render, and workspace tests
assets/ project logo
```
## What M1 does not do yet
This list is deliberate, not a backlog accident. Each item has a milestone owner in the master plan.
* No transcribe, caption generation, or beat sync (M2)
* No stock providers, semantic search, or remote fetch (M3)
* No GPU shader transitions, speed ramps, or tracking (post M1)
* No multi-overlay compositing or animated motion graphics (M4)
* No claim about loudness targets or viral performance without measurement
## License
AGPL-3.0-only. See `LICENSE`.
This program is free software: you can redistribute it and modify it under the GNU Affero General Public License v3. Network use of a modified version over MCP HTTP triggers the source offer duty in section 13. FFmpeg is invoked as a separate process (Gyan build, GPL); nothing is statically linked.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues