A Model Context Protocol server that drives the KDE video editor Kdenlive by editing its native MLT XML project file. No GUI scraping. No window automation. Deterministic, headless, identical on Linux, macOS, Windows and WSL.
A .kdenlive project is an XML document. Upstream documents the
format in dev-docs/fileformat.md, and every fact about a project —
clips, tracks, effects, transitions, timing — is in that one file. So the MCP
reads and writes that file directly instead of pretending to be a human with a
mouse.
That single decision is what makes this work where the video-editor MCPs on the market do not. A GUI-scraping server needs a display, a specific window layout, and it loses races against the UI. This one needs nothing but Python. It works in CI, it works over SSH, it works while the editor is closed, and it produces the same bytes on every operating system.
Standard library only. melt and ffprobe are optional extras that unlock rendering and exact media timings.
Plus 53 transitions, generated from Kdenlive's own data/effects. The model never has to guess an mlt_service name.
Real H.264/AAC output at 1920×1080 / 25 fps from a project this server wrote, verified against MLT 7.41.
No
Zero configuration is the default. Every tool takes the project path as an
argument, so KDENLIVE_MCP_PROJECT is a convenience, not a
requirement. The variables exist for people who want to set a default
project or point at an unusual melt build — nothing breaks if
you never touch them.
The one thing you do configure once is the MCP client itself (Claude Desktop, OpenCode, Cursor). That is a five-line JSON block, and it is the same block on all three operating systems.
No
No linking step, no registration, no "open project" handshake. Point a tool
at a .kdenlive path and it works. The server can create one from
nothing with kdenlive_create_project, and it can list a
directory of them for you.
What does exist is the bin — Kdenlive's own media shelf. Clips you add land
there, and kdenlive_add_clip accepts a bin clip id instead of a
file path when you want to reuse the same media on the timeline twice.
No — and this matters
Kdenlive does not need to be running. Not for reading, not for editing, not
for rendering. Rendering shells out to MLT's melt directly, so
a headless box with Kdenlive installed is a fully functional video
production machine.
None of them — and that is deliberate. The whole design is that the project
file is the data. There is no sidecar HTML, no config schema, no
manifest to keep in sync with the timeline. A .kdenlive file is
self-describing: the profile, the sequences, the tracks, the clips and their
effects are all right there in it.
What you get instead is a validator. kdenlive_validate_project
reports dangling references, producers defined after the elements that use
them, stale cached durations and missing media. Run it after a batch of
edits and you get a factual report instead of a guess.
Pure Python, no framework between you and the XML. The layers are small and each one is useful on its own.
| Module | Job |
|---|---|
mltxml.py | The project model. Reads and writes MLT XML, resolves sequences, tracks, clips and the bin, performs frame-accurate playlist edits. |
schema.py | MLT's content models, transcribed from the upstream DTD. Catches ordering mistakes that silently break Kdenlive. |
validate.py | Structural validation: dangling and forward references, stale durations, missing media, effects without a service name. |
_catalog.py | 407 effects and 53 transitions with their real parameter names. Generated, never hand-edited. |
media.py | ffprobe wrapper for real durations, frame rates and stream layouts. |
render.py | Background rendering through melt, with progress parsing and cancellation. |
bridge.py | HTTP client for reaching a Kdenlive on another machine. |
binaries.py | Locates melt, ffprobe and ffmpeg across Linux, macOS, Windows and WSL. |
These are the details that separate a project Kdenlive opens cleanly from one it chokes on. Every one of them was read out of the upstream source and then confirmed by rendering with MLT 7.41 — not guessed.
| Rule | Why it matters |
|---|---|
Clip effects live inside the <entry> |
Not on the producer. The same media can sit on the timeline twice and each instance carries its own effects. |
Track effects live inside the track's <tractor> |
Not on the track's first playlist. Only Kdenlive's internally added audio-mixer filters go on the tractor as well. |
Master effects live inside the sequence's <tractor> |
The sequence tractor is the timeline; the project tractor at the end of the file is just the wrapper pointing at it. |
The sequence tractor's element id is its uuid |
Not a tractorN name. main_bin and the project tractor reference that uuid. |
| Producers are defined before the elements that use them | MLT resolves references in document order. A chain appended at the end of the file is a forward reference and it will not resolve. |
| Two timecode formats are in play | HH:MM:SS.mmm is a millisecond clock value for MLT's in/out. HH:MM:SS:FF is a frame count for Kdenlive's kdenlive:duration. Mixing them silently shifts your timeline by a frame. |
out is inclusive |
A clip's length is out - in + 1, not out - in. |
| Ids are unique across the whole tree | Filters and transitions are nested inside tractors, so an id generator that only scans root children will hand out duplicates. |
Thirty-two tools, grouped by what you are trying to do. The design rule: every tool returns facts about the file, never a guess. A tool that reports success without evidence is worse than no tool at all.
| Group | Tools |
|---|---|
| Inspect | kdenlive_status, kdenlive_project_info, kdenlive_sequences, kdenlive_tracks, kdenlive_clips, kdenlive_bin, kdenlive_effects_on, kdenlive_effects_catalog, kdenlive_validate_project |
| Build | kdenlive_create_project, kdenlive_add_track, kdenlive_remove_track, kdenlive_add_clip, kdenlive_remove_clip, kdenlive_move_clip, kdenlive_trim_clip, kdenlive_split_clip, kdenlive_set_clip_property, kdenlive_set_track_property |
| Effects | kdenlive_add_effect, kdenlive_remove_effect, kdenlive_add_transition, kdenlive_remove_transition |
| Media & output | kdenlive_probe_media, kdenlive_render, kdenlive_render_status, kdenlive_render_cancel |
| Bridge & paths | kdenlive_bridge_status, kdenlive_bridge_projects, kdenlive_bridge_open, kdenlive_bridge_render, kdenlive_path_translate |
"00:00:05.000" is accepted anywhere a frame count is, and
track, clip and sequence references accept an index, a name or an id. The model
should never have to convert between representations by hand.
One command on every platform. uv handles the interpreter, the
virtualenv and the entry point.
# anywhere -- macOS, Linux, Windows (PowerShell)
uv tool install git+https://github.com/Jemo69/kdenlive-mcp
# or from a checkout
uv sync
uv run kdenlive-mcp
PyPI is not published yet, so the GitHub install is the working one today.
The packaging is already PyPI-shaped — uv build produces a
clean wheel and sdist — so publishing it later is a credential away,
not a code change.
Claude Desktop, OpenCode and Cursor all take the same shape — a command, some args, and optionally an environment block:
{
"mcpServers": {
"kdenlive": {
"command": "uv",
"args": ["tool", "run", "--from", "kdenlive-mcp", "kdenlive-mcp"],
"env": { "KDENLIVE_MCP_PROJECT": "/home/me/Videos/myproject.kdenlive" }
}
}
}
melt ships with Kdenlive. Linux: apt install melt.
macOS: brew install mlt. Windows: install Kdenlive and it lands in
C:\Program Files\Kdenlive\bin\melt.exe. If it is somewhere odd,
point at it with KDENLIVE_MCP_MELT. Portable builds that need
MLT_REPOSITORY and friends get them through
KDENLIVE_MCP_MELT_ENV.
This is the configuration the thing was designed around, so it splits cleanly into two halves.
A project on the Windows drive is reachable from WSL through
/mnt/c. Since the MCP edits the file directly, there is no boundary
to cross. No bridge, no configuration, no Windows binary involved.
ls /mnt/c/Users/me/Videos/myproject.kdenlive # just works
Those need the machine that actually has Kdenlive on it. The bridge is a tiny stdlib-only HTTP server that runs on the Windows side and hands back a local render or launches the editor.
# on Windows
python bridge\kdenlive_bridge.py --token <a-long-random-string>
# Kdenlive bridge listening on http://127.0.0.1:8765
# auth: bearer token required
# inside WSL -- the Windows host address
export KDENLIVE_MCP_BRIDGE_URL=http://172.28.224.1:8765
export KDENLIVE_MCP_BRIDGE_TOKEN=<the same token>
The server probes 127.0.0.1 first, then the WSL gateway, so
Windows 11 mirrored networking needs no configuration at all. The same bridge
reaches a Kdenlive on a different machine over the network — nothing about it
is WSL-specific.
--token when you
start it and set KDENLIVE_MCP_BRIDGE_TOKEN on the MCP side; every
request then has to carry it. Leaving it off means no authentication at all,
which is fine for loopback and not fine for anything else.
Assertions without artifacts are marketing. Here is what ran, and what came back.
melt
invocations on Windows and macOS have not been run on this machine.
This was the clearest gap against the competition, and it is now closed. Every mutating tool records a revision, so a bad batch of edits is recoverable instead of catastrophic.
Undo systems usually store the inverse of each edit. For XML that is where they go wrong — the inverse of "insert an entry at frame 250" depends on what was already there, and getting that subtly wrong corrupts the project. Here the unit of undo is the file itself. A revision stores the bytes before and after the change, so undoing is "put the previous bytes back" and there is nothing to get wrong.
Before undoing, the current file is hashed and compared with the
revision that produced it. If somebody edited the file outside the MCP in
the meantime — which is exactly what happens when Kdenlive still has
the project open — the undo is refused rather than
silently discarding their work. force=True overrides it.
Outside the project folder, in the platform state directory. A
.kdenlive file usually lives in a folder that gets synced to
cloud storage or handed to a render farm; a directory of full file
snapshots next to it is exactly the kind of thing that should not be
there. KDENLIVE_MCP_STATE_DIR moves it if you want it
elsewhere.
| Tool | What it does |
|---|---|
kdenlive_history | The audit trail of every change the MCP made to the file, with timestamps and hashes. |
kdenlive_undo | Undo the last change. Refused if the file changed outside the MCP. |
kdenlive_redo | Re-apply the change that was undone. |
kdenlive_checkpoint | Name the current state so it can be restored later. |
kdenlive_restore_checkpoint | Restore a named checkpoint. |
An MCP server is driven by a model, so the paths it receives may be
hallucinated, mis-typed, or lifted from an untrusted document. Set
KDENLIVE_MCP_ALLOWED_ROOTS to the directories it may touch and
every project, media and output path is resolved — following
symlinks — and has to land inside one of them.
The check runs on the resolved path rather than on the
text that was typed, so a symlink pointing out of a root is rejected
exactly like a literal .. would be. Without the variable the
server stays unrestricted, which keeps the zero-configuration promise,
and kdenlive_status reports which mode you are in.
| Thing | Path |
|---|---|
| The open source repo | github.com/Jemo69/kdenlive-mcp — public, MIT |
| The MCP server | /home/jemo/projects/kdenlive-mcp |
| Kdenlive source (reference) | /tmp/opencode/kdenlive — clone of github.com/KDE/kdenlive on master |
| Bridge (Windows side) | bridge/kdenlive_bridge.py |
| Effect catalogue generator | tools/generate_catalog.py |
| Upstream test fixtures | tests/fixtures/ — unmodified, GPL-3.0 |