resolve-free-mcp
README.md
# resolve-free-mcp
Let Claude (or any MCP client) drive the **free** edition of DaVinci Resolve, Windows included. It also builds timelines from a clip list (FCPXML) and matches the look of your shot to a reference frame as a `.cube` LUT.
Tested end to end on **DaVinci Resolve 21.2.0.6 free, Windows 11**: status, project reading, FCPXML import, color match, LUT on a clip node, render.
## Why this exists
Since Resolve 21.1, external scripting and Python menu scripts are Studio-only. Lua menu scripts still run in the free edition, so most free-edition MCP servers run a Lua bridge inside Resolve that exchanges files with the server.
On 21.1.2+ (measured on 21.2, Windows) that stops working as well: the menu-script Lua has no `io`, no `loadfile`, and `SavePrefs` never reaches the disk. The bridge cannot read or write a single file.
What still works is Resolve's own timeline interchange:
- **Inbound:** the server writes the request as the note of a marker in a tiny OTIO timeline. The bridge imports it with `MediaPool:ImportTimelineFromFile`, reads the note and deletes the scratch timeline.
- **Outbound:** the bridge creates an empty scratch timeline, adds one marker whose note is the answer, runs `Timeline:Export(path, EXPORT_OTIO)` and deletes the scratch timeline.
One call takes about a second. The current timeline and Media Pool folder are restored after every exchange. If Lua does have `io` (older builds, other platforms), the bridge uses plain files instead (`file` channel).
## Tools
| Tool | What it does |
|---|---|
| `resolve_status` | Is the bridge running, which channel it uses, Resolve version, current page |
| `install_bridge` | Copies the Lua bridge into Workspace > Scripts |
| `run_lua` | Runs any Lua inside Resolve (`resolve`, `project()`, `mediapool()`, `timeline()`) and returns JSON plus `print` output |
| `api_docs` | Searches Blackmagic's shipped scripting reference |
| `project_info`, `list_timelines`, `timeline_items`, `media_pool` | Read the open project |
| `import_media`, `add_marker` | Basic changes |
| `build_timeline` | Clip list with in/out points → FCPXML 1.9 → imported as a timeline. Supports a main track with gaps, overlay video lanes and audio lanes (music, voice-over). Reads source timecode with ffprobe so in-points land exactly. Works without the bridge too: import the file via File > Import > Timeline |
| `color_match` | Matches a shot to a reference image or video and writes a 33³ `.cube` LUT, a before / after / reference preview PNG, and a distance score |
| `apply_lut` | Puts a LUT on a grading node of timeline clips |
| `render_start`, `render_status` | Queue and start a render, then poll it |
| `stop_bridge` | Stops the loop inside Resolve |
### Color match
All of it runs in Oklab:
1. **Lightness:** the shot's lightness distribution is mapped onto the reference's. The curve is smoothed and its slope is limited, so faces don't blow out and gradients don't band.
2. **Color:** pixels are split into lightness bands. In each band the tint moves toward the reference's and the color spread is scaled toward it (gain 0.5–1.6).
3. **Saturation ceiling:** a soft limit at the reference's own saturation, applied only to chroma the transform added.
4. **Skin protection:** skin tones keep most of their own color and brightness (`protect_skin`, default 0.7). Without it, a cold reference turns faces grey and beards orange.
The LUT is display-referred: it maps Rec.709 video as ffmpeg decodes it. For log footage, convert to Rec.709 first and match that.
## Setup
You need [Node.js](https://nodejs.org) 22.18 or newer (it runs the TypeScript directly, no build step), [ffmpeg](https://ffmpeg.org) on your PATH, and DaVinci Resolve 21.1 or newer, free or Studio.
```sh
git clone https://github.com/yusuf-budunoglu/resolve-free-mcp
cd resolve-free-mcp
npm install
node src/cli.ts install
```
Register it with your client. For Claude Code:
```sh
claude mcp add resolve-free -- node /absolute/path/to/resolve-free-mcp/src/cli.ts serve
```
Claude Desktop (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"resolve-free": {
"command": "node",
"args": ["C:/absolute/path/to/resolve-free-mcp/src/cli.ts", "serve"]
}
}
}
```
Then:
1. Restart Resolve once after the first install.
2. Open a project.
3. Click **Workspace > Scripts > resolve_free_mcp**. Do this each time you open Resolve. Clicking it again replaces the running loop.
4. Ask your client for `resolve_status`.
## Good to know
- **Studio-only features** (Magic Mask, some AI tools) open an upgrade dialog on the free edition. Any modal dialog blocks the bridge until you close it.
- **Scratch timelines:** every exchange briefly creates and deletes a timeline named `_mcp_<n>_<m>` in the Media Pool root. If Resolve crashes mid-call, one may be left behind; delete it.
- **Renders:** Resolve refuses timeline exports while it renders, so the bridge holds its answer until the render ends. A long render can outlast the tool timeout; the next call picks up the late answer.
- **LUT folder:** `Graph:SetLUT` only loads LUTs from Resolve's LUT folder. `color_match` and `apply_lut` copy into `<LUT folder>/ResolveFreeMCP/`. On Windows that is under `C:\ProgramData`, which may need write access.
- **Files:** the server and bridge talk through `~/.resolve-free-mcp` (override with `RESOLVE_MCP_STATE_DIR`). Nothing goes over the network.
## Development
```sh
npm test # unit tests (needs ffmpeg)
npm run typecheck
node scripts/call.mjs resolve_status # call one tool by hand
node scripts/call.mjs run_lua '{"code":"return project():GetName()"}'
```
## Credits
The idea of a Lua bridge inside free Resolve comes from earlier projects, which are worth a look: [saadk408/davinci-resolve-lua-mcp](https://github.com/saadk408/davinci-resolve-lua-mcp), [kingjamesch/davinci-resolve-mcp](https://github.com/kingjamesch/davinci-resolve-mcp) and [emircbngl/davinci-resolve-mcp-free](https://github.com/emircbngl/davinci-resolve-mcp-free). [wassermanproductions/unofficial-davinci-mcp](https://github.com/wassermanproductions/unofficial-davinci-mcp) showed that interchange files (FCPXML, LUTs) are a good fit for the free edition. The code here was written from scratch.
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues