Kdenlive MCP Server

io.github.Va1bhav512由 GitHub 账号 Va1bhav512 发布v0.1.3更新于 Oct 24, 2026

Kdenlive video editing MCP - 36 tools for project, timeline, filters and melt rendering

已验证STDIO仅桌面文件与存储媒体与设计

概览

AI 生成的概览

本地 MCP 服务器,让助手构建和编辑 Kdenlive 视频项目:素材箱、时间线、滤镜、转场、标记以及 melt 渲染。

可以做什么
  • 新建、打开、保存和查看 Kdenlive 项目,并列出可用的输出配置
  • 导入、列出、查看和删除项目素材箱中的媒体片段
  • 在时间线上增删轨道与片段,移动、裁剪、分割片段,并支持批量放置保留片段
  • 添加、删除和调整滤镜与转场,添加或列出时间线标记与章节
  • 导出 Kdenlive/MLT XML、列出渲染预设并通过 melt 渲染成视频
  • 撤销、重做并查看会话状态与历史;将横屏片段重构为 9:16 竖屏
适用场景
适合让助手以程序化方式搭建或修改 Kdenlive 项目,例如把长镜头切成多段、添加特效、插入章节,或制作竖屏短视频版本后再导出或渲染。它操作的是 Kdenlive 项目文件,而不是已打开的图形界面会话。
运行要求
以 stdio 方式在本机运行,PyPI 包 kdenlive-mcp-server,需要 Python 3.10+ 和 uv;README 还要求渲染时使用 melt 命令行,并从 GitHub 仓库获取 cli-anything-kdenlive 依赖。未声明认证、环境变量或请求头。仅支持桌面环境。
安装前请注意
工具会写入磁盘:每次修改后自动保存项目,导出和渲染会把 XML 或视频写到指定路径,因此应指向可写目录并备份已有项目。删除轨道会同时删除其上的片段,撤销历史最多 50 条。有一个依赖从 GitHub 源码安装而非正式发布版本。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Kdenlive MCP Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Kdenlive MCP Server

A Model Context Protocol (MCP) server wrapping cli-anything-kdenlive for LLM-driven video editing workflows via Kdenlive.

Overview

This FastMCP server enables AI models to perform complex video editing tasks on Kdenlive projects through a set of 75 tools. The server uses the Python API of cli-anything-kdenlive directly (not subprocess) to maintain a persistent session state, ensuring modifications are immediately available to subsequent tool calls.

Key Features

  • Persistent Session State: Uses CLI's in-memory session API, auto-saves after every mutation
  • Gen 5 XML Export: Kdenlive-compatible XML output with proper bin references and version metadata
  • Robust Error Handling: All exceptions caught and returned as structured JSON payloads
  • Auto-Project Tracking: Globally tracks project path; all tools automatically target the active project
  • 75 MCP Tools: Comprehensive coverage of Kdenlive operations

Installation

Prerequisites

bash
# Python 3.10+# Ensure uv is installed for dependency managementpip install uv

Install Dependencies

bash
cd kdenlive-mcp-serveruv sync

Usage

As an MCP Server

The server runs as a FastMCP server compatible with any LLM platform that supports MCP (e.g., Claude Code, Pi, OpenCode).

Command Line

bash
# Run the MCP serveruv run kdenlive-mcp
# Or directly via Pythonuv run python3 -m kdenlive_mcp_server.server

Python Integration

python
from kdenlive_mcp_server.server import (    project_new, bin_import_clip, timeline_add_clip, export_xml)
# Create projectresult = project_new(output_path="my_project.kdenlive-cli.json", profile="hd1080p30")
# Import mediaresult = bin_import_clip(clip_path="video.mp4", name="Interview", duration=120.0)
# Add to timelineresult = timeline_add_clip(clip_id="clip0", track=0, position=0.0)
# Export XMLresult = export_xml(output_path="output.kdenlive")

Project Structure

kdenlive-mcp-server/├── kdenlive_mcp_server/│   ├── __init__.py           # Empty package init│   └── server.py             # FastMCP server with 75 tools├── main.py                   # Entry point delegating to server module├── pyproject.toml            # Project configuration and dependencies├── uv.lock                   # Dependency lock file└── README.md                 # This file

Tools

Project (5 tools)

ToolDescription
project_new()Create a new Kdenlive project with optional profile override
project_open()Load an existing .kdenlive-cli.json project
project_save()Persist the current project state to disk
project_get_info()Get project metadata (resolution, FPS, track layout, clip counts)
project_list_profiles()List all available video output profiles (hd1080p30, 4k60, sd_pal, etc.)

Bin (4 tools)

ToolDescription
bin_import_clip()Ingest media files (video, audio, image) into the project bin
bin_remove_clip()Delete a clip from the bin by ID
bin_list_clips()List all assets in the project bin
bin_get_clip_details()Fetch detailed properties of a clip (duration, type, source)

Timeline (8 tools)

ToolDescription
timeline_add_track()Append a video or audio track to the timeline
timeline_remove_track()Delete a track and all its clips
timeline_add_clip()Place a bin clip on a track at a specific position
timeline_remove_clip()Remove a clip from a track
timeline_move_clip()Reposition a clip on the same track
timeline_trim_clip()Adjust clip in/out crop handles
timeline_split_clip()Cut a clip into two pieces at a precise offset
timeline_list()List all tracks with clip counts and status

Filters (5 tools)

ToolDescription
filter_add()Attach a video/audio effect (blur, brightness, frei0r.opacity, volume)
filter_remove()Remove an effect from a clip
filter_set_param()Update a single filter parameter (radius, opacity, level)
filter_list()List all active filters on a clip
filter_list_available()Discover all available filters by category

Transitions (4 tools)

ToolDescription
transition_add()Create blend transitions (dissolve, wipe, slide, composite, affine)
transition_remove()Delete a transition by ID
transition_set()Update a transition parameter
transition_list()List all transitions on the timeline

Guides (3 tools)

ToolDescription
guide_add()Add timeline markers/chapters
guide_remove()Remove a guide by ID
guide_list()List all guide markers

Export (3 tools)

ToolDescription
export_xml()Generate Kdenlive/MLT XML for the project
export_list_presets()List available render presets
export_render()Render project to video via melt CLI

Session (4 tools)

ToolDescription
session_undo()Revert the most recent operation (up to 50 history entries)
session_redo()Redo the last undone operation
session_status()Inspect session state (project loaded, modified flag, history depth)
session_history()List all undo/redo history entries

Batch Editing & Vertical Video (new in 0.2.0)

ToolDescription
timeline_build_from_segments()Place many keep-segments of one bin clip back to back in a single, single-undo call
clip_reframe_vertical()Center-crop a 16:9 clip to fill a 9:16 frame, with a horizontal pan
timeline_build_from_segments(clip_id, segments, track=0, start=0.0, gap=0.0, include_audio=True, audio_track=None)

Cutting a long take with timeline_split_clip / timeline_remove_clip is fragile because every removal shifts the clip_index of the clips after it. Instead, compute the ranges you want to keep and place them all at once:

python
timeline_add_track()  # video track 0timeline_build_from_segments(    clip_id="clip0",    segments=[{"start": 0.5, "end": 1.5}, {"start": 3.0, "end": 4.5}, {"start": 6.0, "end": 8.0}],)# -> {"placed": 3, "timeline_duration": 4.5, "kept_seconds": 4.5, "track": 0, "audio_track": 1, ...}
  • segments is a list of {start, end} in source seconds, or a path to a JSON file containing {"segments": [...]}.
  • Segments are sorted, clamped to the clip's duration, merged where they overlap or touch, and dropped if shorter than 0.05 s. An empty result is an error.
  • Segments are laid out from start, separated by gap seconds.
  • Clips on a video track render without sound, so when the source has an audio stream the same segments are mirrored onto an audio track (the first existing one, or a new A1). Pass include_audio=False to skip this, or audio_track=<id> to choose the track.
  • The whole build, including any auto-created audio track, is one undo step: a single session_undo() reverts it.
clip_reframe_vertical(track_id, clip_index, x_offset=0.0)

For Shorts/Reels/TikTok, start the project with a vertical profile (vertical1080p30 or vertical1080p60, both 1080x1920), then reframe each landscape clip:

python
project_new("short.kdenlive-cli.json", profile="vertical1080p30")# ... import + timeline_build_from_segments ...clip_reframe_vertical(track_id=0, clip_index=0)                 # centerclip_reframe_vertical(track_id=0, clip_index=1, x_offset=-0.5)  # pan left

The source is scaled so its height fills the frame, then shifted horizontally: x_offset -1 shows the left edge, 0 the center, 1 the right edge. It adds an affine filter (Kdenlive's Transform effect) with a transition.rect; calling it again on the same clip updates that filter instead of stacking another. Center crop only, no face tracking.

Example Workflows

Create a Simple Video Project

python
from kdenlive_mcp_server.server import (    project_new, bin_import_clip, timeline_add_track,    timeline_add_clip, export_xml, project_save)
# 1. Create projectresult = project_new(    output_path="intro_video.kdenlive-cli.json",    profile="hd1080p30",    name="Introduction")
# 2. Import mediaresult = bin_import_clip(    clip_path="interview.mp4",    name="Interview",    duration=120.0)
# 3. Add track and place clipresult = timeline_add_track(track_type="video", track_name="V1")result = timeline_add_clip(    clip_id="clip0",  # From bin_import_clip response    track=0,    position=0.0)
# 4. Exportresult = export_xml(output_path="intro.kdenlive")

Apply Effects to Clips

python
from kdenlive_mcp_server.server import (    project_new, bin_import_clip, timeline_add_track,    timeline_add_clip, filter_add, filter_set_param, filter_list)
# Setupresult = project_new(output_path="effects_demo.kdenlive-cli.json", profile="hd720p60")result = bin_import_clip(clip_path="movie.mp4", name="Movie", duration=300.0)result = timeline_add_track(track_type="video")result = timeline_add_clip(clip_id="clip0", track=0, position=0.0)
# Add brightness filterresult = filter_add(    track_id=0,    clip_index=0,    filter_type="brightness",    params=["level=0.8"])
# Update brightnessresult = filter_set_param(    track_id=0,    clip_index=0,    filter_index=0,    parameter="level",    value="1.2")
# List filtersresult = filter_list(track_id=0, clip_index=0)

Add Chapter Markers

python
from kdenlive_mcp_server.server import (    project_new, bin_import_clip, timeline_add_track,    timeline_add_clip, guide_add, guide_list, project_save)
# Setupresult = project_new(output_path="documentary.kdenlive-cli.json", profile="4k30")result = bin_import_clip(clip_path="documentary.mp4", name="Doc", duration=900.0)result = timeline_add_track(track_type="video")result = timeline_add_clip(clip_id="clip0", track=0, position=0.0)
# Add chapter markersresult = guide_add(position=60.0, label="Chapter 1: Introduction", guide_type="chapter")result = guide_add(position=180.0, label="Chapter 2: Main Content", guide_type="chapter")result = guide_add(position=300.0, label="Chapter 3: Conclusion", guide_type="chapter")
# List guidesresult = guide_list()
# Saveresult = project_save()

Error Handling

All tools return consistent response formats:

python
# Success{    "success": True,    "data": {...}}
# Error{    "success": False,    "error": "Error message describing the failure"}

Configuration

pyproject.toml

toml
[project]name = "kdenlive-mcp-server"version = "0.1.0"description = "MCP server for Kdenlive video editing via cli-anything-kdenlive"requires-python = ">=3.10"dependencies = [    "mcp>=1.28.0",    "cli-anything-kdenlive>=1.0.0",]
[project.scripts]kdenlive-mcp = "kdenlive_mcp_server.server:main"
[tool.uv.sources]cli-anything-kdenlive = { git = "https://github.com/HKUDS/CLI-Anything.git", subdirectory = "kdenlive/agent-harness" }

uv.lock

Auto-generated by uv sync. Contains locked dependency versions.

Dependencies

Troubleshooting

Kdenlive XML Compatibility Issues

If Kdenlive reports "Version of the project file cannot be read" or "Timeline clip without bin reference found":

  1. Cause: Using PyPI v1.0.0 (Gen 4 format) which lacks proper Kdenlive metadata
  2. Fix: The package now installs from GitHub HEAD with Gen 5 format that includes:
    • kdenlive:docproperties.version="1.1"
    • Chain-based clip structure with kdenlive:id linking to main_bin
    • Proper bin reference handling

Project Not Saving

The server auto-saves to disk after every mutation. If changes aren't persisting:

  1. Verify the project path is set via project_new() or project_open()
  2. Check that session_status() shows has_project: true
  3. Ensure the output directory is writable

FastMCP Server Not Starting

  1. Verify MCP version: uv run python3 -c "import mcp; print(mcp.__version__)"
  2. Check FastMCP: uv run python3 -c "from mcp.server.fastmcp import FastMCP; print('FastMCP OK')"
  3. Review logs for detailed error messages

Development

Testing

Run the test suite:

bash
# Run all integration testsuv run python3 test_integration.py
# Test with zero-duration edge caseuv run python3 test_edge_cases.py

Code Style

The project follows PEP 8 style guidelines. Use uv run ruff check . to lint.

Adding New Tools

To add a new MCP tool:

  1. Add the tool function to server.py decorated with @server.tool()
  2. Import the corresponding CLI API module if needed
  3. Include comprehensive docstrings with Args and Returns sections
  4. Implement error handling with try/except
  5. Call _save() after mutations to persist changes

Example:

python
@server.tool()def my_new_tool(param1: str, param2: int) -> dict[str, Any]:    """Brief description of what the tool does.
    Args:        param1: Description of param1.        param2: Description of param2.
    Returns:        Success response format.    """    err = _require_project()    if err:        return err
    try:        # Do something with the project        result = some_api_function(param1, param2)        _save()        return _ok(result)    except Exception as e:        return _err(str(e))

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass: uv run pytest
  5. Submit a pull request

References

来源:README.md,提交 f1ce009

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.3最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。