davinci-resolve-mcp 4.16.0 → 4.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  Release history for the DaVinci Resolve MCP Server. The latest release is summarized in the root README; older entries live here to keep the README focused.
4
4
 
5
+ ## What's New in v4.17.0 — Power windows for Resolve 21
6
+
7
+ ### Added
8
+
9
+ - **`drx generate` takes `resolveVersion`** (#328, thanks @hpaul). A major
10
+ number (`21`) or a version string (`"21.0.4"`). From 21 on, circle and
11
+ linear power windows are written the way Resolve 21 exports them: corrector
12
+ type 0x10004 (65540) with the full parameter set, `REF_WIDTH` 288 and an
13
+ identity transform matrix, and 0x10004 added to the node's corrector-type
14
+ list. Resolve 21 loads the older corrector-type-4 form into the Window
15
+ palette but renders an empty mask, which also hides the node's grade.
16
+ The default is unchanged, so output for Resolve 19/20 is byte-for-byte
17
+ what it was. Gradient and polygon/curve windows are not rewritten. The
18
+ format follows justhung69/resolve-mcp (MIT), pixel-verified there on free
19
+ 21.0.4.5.
20
+ - The node's corrector-type list is now varint encoded, because 65540 does
21
+ not fit in one byte. Every type id below 128 encodes to the same byte as
22
+ before.
23
+
24
+ ### Validation
25
+
26
+ - Advanced Node suite on Node 20 with a fresh `npm ci`, PR merged on
27
+ `main`: 1,214 tests, 1,153 passed, 0 failed, 61 skipped (8 new for the
28
+ Resolve 21 window layout). PR CI green on Python 3.10/3.11 and Node 20/22.
29
+ - Not live-validated on Resolve 21: the maintainer's box runs Studio
30
+ 19.1.3.7. The window layout is checked against Resolve 21 fixtures only.
31
+
5
32
  ## What's New in v4.16.0 — Calls name their timeline, and failures say so
6
33
 
7
34
  Eight reports from a Studio 21.1 / Windows deployment (#320–#327) and the
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  English | [简体中文](README.zh-CN.md)
4
4
 
5
- [![Version](https://img.shields.io/badge/version-4.16.0-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-4.17.0-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
6
6
  [![npm](https://img.shields.io/npm/v/davinci-resolve-mcp.svg?label=npm&color=CB3837)](https://www.npmjs.com/package/davinci-resolve-mcp)
7
7
  [![API Coverage](https://img.shields.io/badge/API%20Coverage-100%25-brightgreen.svg)](docs/reference/api-coverage.md)
8
8
  [![Tools](https://img.shields.io/badge/MCP%20Tools-37%20(390%20full)-blue.svg)](#server-modes)
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.md) | 简体中文
4
4
 
5
- [![Version](https://img.shields.io/badge/version-4.16.0-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-4.17.0-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
6
6
  [![npm](https://img.shields.io/npm/v/davinci-resolve-mcp.svg?label=npm&color=CB3837)](https://www.npmjs.com/package/davinci-resolve-mcp)
7
7
  [![API Coverage](https://img.shields.io/badge/API%20Coverage-100%25-brightgreen.svg)](docs/reference/api-coverage.md)
8
8
  [![Tools](https://img.shields.io/badge/MCP%20Tools-37%20(390%20full)-blue.svg)](#服务器模式)
@@ -12,7 +12,7 @@
12
12
  [![Python](https://img.shields.io/badge/python-3.10+-green.svg)](https://www.python.org/downloads/)
13
13
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
14
14
 
15
- > 本翻译对应 v4.16.0 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
15
+ > 本翻译对应 v4.17.0 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
16
16
 
17
17
  一个 Model Context Protocol (MCP) 服务器,让 AI 助手通过官方脚本 API 控制 DaVinci Resolve Studio(达芬奇)。它提供完整的 API 覆盖,外加带护栏的工作流助手,涵盖剪辑、媒体池整理、渲染设置、审阅标记、调色、Fusion、Fairlight、项目生命周期任务、扩展开发,以及不碰源媒体的媒体分析。
18
18
 
package/install.py CHANGED
@@ -37,7 +37,7 @@ from src.utils.update_check import (
37
37
 
38
38
  # ─── Version ──────────────────────────────────────────────────────────────────
39
39
 
40
- VERSION = "4.16.0"
40
+ VERSION = "4.17.0"
41
41
  # Only hard floor: mcp[cli] requires Python 3.10+. There is no upper bound —
42
42
  # Resolve's scripting bridge loads into newer interpreters on recent builds
43
43
  # (Python 3.14 verified against Resolve Studio 20.3.2). Older Resolve builds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "davinci-resolve-mcp",
3
- "version": "4.16.0",
3
+ "version": "4.17.0",
4
4
  "description": "NPM bootstrapper for the DaVinci Resolve MCP Server.",
5
5
  "license": "MIT",
6
6
  "author": "Samuel Gursky <samgursky@gmail.com>",
@@ -258,6 +258,15 @@ const generateSchema = z.object({
258
258
  "(<pTrackVer>), for graph.apply_grade_from_drx with source='timeline'; a clip-target file applied to " +
259
259
  'the timeline is refused (DRX_NO_TIMELINE_GRADE).'
260
260
  ),
261
+ resolveVersion: z
262
+ .union([z.number().int().min(1), z.string()])
263
+ .optional()
264
+ .describe(
265
+ "Resolve version the file is for, as a major number (21) or a version string ('21.0.4'). From 21 on, " +
266
+ 'circle and linear power windows are written in the Resolve 21 form (corrector type 0x10004, full parameter ' +
267
+ 'set), which renders on Resolve 21; the older form loads there but renders an empty mask. Default: the ' +
268
+ 'Resolve 19 form. Not live-verified here; the format comes from justhung69/resolve-mcp.'
269
+ ),
261
270
  outputPath: z.string().optional().describe('If set, write the .drx here'),
262
271
  });
263
272
 
@@ -692,7 +701,11 @@ export const drxTool = {
692
701
  if (action === 'generate') {
693
702
  const p = generateSchema.parse(args);
694
703
  const warnings = [];
695
- const metadata = { ...(p.metadata || {}), ...(p.target ? { target: p.target } : {}) };
704
+ const metadata = {
705
+ ...(p.metadata || {}),
706
+ ...(p.target ? { target: p.target } : {}),
707
+ ...(p.resolveVersion !== undefined ? { resolveVersion: p.resolveVersion } : {}),
708
+ };
696
709
  const out = await drxGenerator().generateDRX(normalizeGradeParams(p.gradeParams, warnings), metadata);
697
710
  const content = typeof out === 'string' ? out : out?.content || out?.drxContent;
698
711
  const warn = warnings.length ? { warnings } : {};
@@ -222,6 +222,7 @@ const PARAM_IDS = {
222
222
  * Corrector Type IDs from shared library
223
223
  */
224
224
  const CORRECTOR_TYPES = drxParams.CORRECTOR_TYPES;
225
+ const POWER_WINDOW_IDS = drxParams.POWER_WINDOWS;
225
226
 
226
227
  /**
227
228
  * Presence marker IDs from shared library
@@ -547,7 +548,7 @@ function buildHSLCurveParams(colorParams) {
547
548
  * @param {Object} options - Additional options (label, enabled, correctorTypes)
548
549
  */
549
550
  function createNode(nodeId, xPos, yPos, colorParams = null, options = {}) {
550
- const { label = '', enabled = true, nodeIndex = nodeId } = options;
551
+ const { label = '', enabled = true, nodeIndex = nodeId, resolveVersion } = options;
551
552
 
552
553
  // Build node header with fields in order: F1, F2, F4, F5, F6, F7?, F8
553
554
  // Native Resolve analysis shows: id(F1), index(F2), pos(F4,F5), label?(F6), F8=44
@@ -749,9 +750,11 @@ function createNode(nodeId, xPos, yPos, colorParams = null, options = {}) {
749
750
  }
750
751
  }
751
752
  if (colorParams) {
752
- const win = buildWindowParams(colorParams.window);
753
+ const win = buildWindowParams(colorParams.window, { resolveVersion });
753
754
  if (win.transform.length > 0) {
754
- correctorBlocks.push(buildCorrectorBlock(CORRECTOR_TYPES.POWER_WINDOW, win.transform));
755
+ correctorBlocks.push(buildCorrectorBlock(win.transformType, win.transform));
756
+ // Resolve 21 also lists its window type in the node's corrector-type list.
757
+ if (win.transformType !== CORRECTOR_TYPES.POWER_WINDOW && presenceTypes.length > 0) presenceTypes.push(win.transformType);
755
758
  }
756
759
  if (win.softMask.length > 0) {
757
760
  // Linear-window softness mask (0x0870xxxx) lives under corrector type 3 in live data.
@@ -881,7 +884,7 @@ function createNode(nodeId, xPos, yPos, colorParams = null, options = {}) {
881
884
 
882
885
  // Add compact presence list as F2 (raw byte array of type IDs)
883
886
  if (presenceTypes.length > 0) {
884
- const presenceBytes = Buffer.from(presenceTypes);
887
+ const presenceBytes = Buffer.concat(presenceTypes.map(encodeVarint)); // varints: the R21 window type is > 127
885
888
  f9Parts.push(protoBytes(2, presenceBytes));
886
889
  debugLog('[DRX] Added F2 presence list:', presenceTypes);
887
890
  }
@@ -1636,6 +1639,7 @@ function generateProtobuf(gradeParams, options = {}) {
1636
1639
  width = 1920,
1637
1640
  height = 1080,
1638
1641
  label = '',
1642
+ resolveVersion,
1639
1643
  } = options;
1640
1644
 
1641
1645
  const timestamp = generateTimestamp();
@@ -1667,6 +1671,7 @@ function generateProtobuf(gradeParams, options = {}) {
1667
1671
  const node = createNode(nodeId, xPos, yPos, nodeConfig.params, {
1668
1672
  label: nodeConfig.label || `Node ${nodeId}`,
1669
1673
  enabled: nodeConfig.enabled !== false,
1674
+ resolveVersion,
1670
1675
  });
1671
1676
  containerParts.push(node);
1672
1677
  });
@@ -1686,6 +1691,7 @@ function generateProtobuf(gradeParams, options = {}) {
1686
1691
  }
1687
1692
  const node = createNode(1, 500, 300, gradeParams, {
1688
1693
  label: label,
1694
+ resolveVersion,
1689
1695
  });
1690
1696
  containerParts.push(node);
1691
1697
  // firstNodeId and lastNodeId both stay 1
@@ -1752,6 +1758,7 @@ async function generateMultiNodeDRX(nodes, connections, metadata = {}) {
1752
1758
  baseNodeId: passedBaseNodeId,
1753
1759
  firstNodeId: passedFirstNodeId,
1754
1760
  lastNodeId: passedLastNodeId,
1761
+ resolveVersion,
1755
1762
  } = metadata;
1756
1763
 
1757
1764
  const timestamp = generateTimestamp();
@@ -1806,6 +1813,7 @@ async function generateMultiNodeDRX(nodes, connections, metadata = {}) {
1806
1813
  enabled: nodeConfig.enabled !== false,
1807
1814
  nodeIndex: nodeIndex, // Pass separate index for F2 field
1808
1815
  clipVersionId,
1816
+ resolveVersion,
1809
1817
  }
1810
1818
  );
1811
1819
  containerParts.push(node);
@@ -1975,13 +1983,14 @@ async function generateDRX(gradeParams, metadata = {}) {
1975
1983
  sourceTC = '00:00:00:00',
1976
1984
  recordTC = '01:00:00:00',
1977
1985
  target = 'clip',
1986
+ resolveVersion,
1978
1987
  } = metadata;
1979
1988
  if (target !== 'clip' && target !== 'timeline') {
1980
1989
  throw new Error(`target must be 'clip' or 'timeline', got ${JSON.stringify(target)}`);
1981
1990
  }
1982
1991
 
1983
1992
  // Generate the body (pass label for single-node mode)
1984
- const body = await generateDRXBody(gradeParams, { width, height, label });
1993
+ const body = await generateDRXBody(gradeParams, { width, height, label, resolveVersion });
1985
1994
  const bodyHex = body.toString('hex');
1986
1995
 
1987
1996
  // Generate UUIDs
@@ -2803,8 +2812,8 @@ function buildLumaQualifierParams(lumaParams) {
2803
2812
  * @param {number} [windowParams.soft4=0] - Softness 4 (linear only)
2804
2813
  * @returns {Array} - Parameter entries for window corrector
2805
2814
  */
2806
- function buildWindowParams(windowParams) {
2807
- const groups = { transform: [], softMask: [], gradient: [], shape: [] };
2815
+ function buildWindowParams(windowParams, { resolveVersion } = {}) {
2816
+ const groups = { transform: [], transformType: CORRECTOR_TYPES.POWER_WINDOW, softMask: [], gradient: [], shape: [] };
2808
2817
  const paramEntries = groups.transform;
2809
2818
  const { POWER_WINDOWS } = drxParams;
2810
2819
 
@@ -2940,12 +2949,78 @@ function buildWindowParams(windowParams) {
2940
2949
  paramEntries.push(createParameterEntry(POWER_WINDOWS.SOFT_REF, w.soft1 * 16));
2941
2950
  }
2942
2951
 
2952
+ if (isResolve21(resolveVersion) && !isVertexShape && paramEntries.length > 0) {
2953
+ groups.transform = toResolve21WindowTransform(paramEntries);
2954
+ groups.transformType = CORRECTOR_TYPE_WINDOW_R21;
2955
+ }
2956
+
2943
2957
  if (paramEntries.length > 0 || groups.softMask.length > 0) {
2944
2958
  debugLog('[DRX] Window params built:', paramEntries.length, '+', groups.softMask.length, isLinear ? '(linear: ct4 + ct3 mask)' : '(circle: ct4)');
2945
2959
  }
2946
2960
  return groups;
2947
2961
  }
2948
2962
 
2963
+ // Resolve 21 stores a circle/linear window transform as corrector type 0x10004 with the full
2964
+ // parameter set, not as corrector type 4 holding only the non-neutral parameters. The type 4
2965
+ // form loads into the Window palette on Resolve 21 but renders an empty mask, which also hides
2966
+ // the grade of the node. Order and neutral values follow what Resolve 21.0.4 exports for a
2967
+ // fresh circle window, as measured and pixel-verified by justhung69 in
2968
+ // https://github.com/justhung69/resolve-mcp (server/drx_r21.py, MIT, (c) 2026 Bùi Xuân Hưng).
2969
+ const CORRECTOR_TYPE_WINDOW_R21 = 0x10004;
2970
+ const R21_WINDOW_ORDER = [
2971
+ [POWER_WINDOW_IDS.ROTATE, 0],
2972
+ [POWER_WINDOW_IDS.ASPECT, 0],
2973
+ [POWER_WINDOW_IDS.SOFT_REF, 0],
2974
+ [POWER_WINDOW_IDS.SIZE, 1],
2975
+ [POWER_WINDOW_IDS.PAN, 0],
2976
+ [POWER_WINDOW_IDS.TILT, 0],
2977
+ ];
2978
+
2979
+ /** True when `resolveVersion` (a major number such as 21, or a string such as "21.0.4") is Resolve 21 or later. */
2980
+ function isResolve21(resolveVersion) {
2981
+ return Number.parseInt(resolveVersion, 10) >= 21;
2982
+ }
2983
+
2984
+ /** Read the parameter id out of an F3 parameter entry built by createParameterEntry. */
2985
+ function parameterEntryId(entry) {
2986
+ let i = 1; // skip the F3 tag
2987
+ while (entry[i++] & 0x80); // skip the entry length
2988
+ i++; // skip the F1 tag
2989
+ let id = 0;
2990
+ let shift = 0;
2991
+ let byte;
2992
+ do {
2993
+ byte = entry[i++];
2994
+ id += (byte & 0x7f) * 2 ** shift;
2995
+ shift += 7;
2996
+ } while (byte & 0x80);
2997
+ return id;
2998
+ }
2999
+
3000
+ function toResolve21WindowTransform(entries) {
3001
+ const byId = new Map(entries.map((entry) => [parameterEntryId(entry), entry]));
3002
+ const take = (id) => {
3003
+ const entry = byId.get(id);
3004
+ byId.delete(id);
3005
+ return entry;
3006
+ };
3007
+ const out = R21_WINDOW_ORDER.map(([id, neutral]) => take(id) || createParameterEntry(id, neutral));
3008
+ take(POWER_WINDOW_IDS.WINDOW_TYPE);
3009
+ const identity = [1, 0, 0, 0, 1, 0, 0, 0, 1];
3010
+ const matrix = protoBytes(3, Buffer.concat([
3011
+ protoVarint(1, POWER_WINDOW_IDS.TRACKING_BLOB),
3012
+ protoBytes(2, protoBytes(10, Buffer.concat(identity.map((v, i) => protoFloat32(i + 1, v))))),
3013
+ ]));
3014
+ out.push(
3015
+ createVarintParameterEntry(POWER_WINDOW_IDS.WINDOW_TYPE, 2),
3016
+ createParameterEntry(POWER_WINDOW_IDS.REF_WIDTH, 288),
3017
+ createParameterEntry(POWER_WINDOW_IDS.UNK_0E, 0),
3018
+ createParameterEntry(POWER_WINDOW_IDS.UNK_0F, 0),
3019
+ take(POWER_WINDOW_IDS.TRACKING_BLOB) || matrix,
3020
+ );
3021
+ return out.concat([...byId.values()]); // e.g. opacity, kept after the measured set
3022
+ }
3023
+
2949
3024
  /**
2950
3025
  * Check if any secondary correction tools are used (qualifier, window, HDR wheels)
2951
3026
  * Used to determine if we need to add those corrector blocks
@@ -92,7 +92,7 @@ if not logging.getLogger().handlers:
92
92
  handlers=[logging.StreamHandler()],
93
93
  )
94
94
 
95
- VERSION = "4.16.0"
95
+ VERSION = "4.17.0"
96
96
  logger = logging.getLogger("davinci-resolve-mcp")
97
97
  logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION}")
98
98
  logger.info(f"Detected platform: {get_platform()}")
package/src/server.py CHANGED
@@ -11,7 +11,7 @@ Usage:
11
11
  python src/server.py --full # Start the 377-tool granular server instead
12
12
  """
13
13
 
14
- VERSION = "4.16.0"
14
+ VERSION = "4.17.0"
15
15
 
16
16
  import base64
17
17
  import os