davinci-resolve-mcp 4.1.3 → 4.2.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 +57 -0
- package/README.md +1 -1
- package/README.zh-CN.md +2 -2
- package/install.py +1 -1
- package/package.json +1 -1
- package/resolve-advanced/vendor/drp-format/__tests__/inject-grades.test.js +36 -0
- package/resolve-advanced/vendor/drp-format/inject-grades.js +24 -3
- package/src/granular/common.py +1 -1
- package/src/server.py +19 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,63 @@
|
|
|
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.2.0 — the raw grade-copy asks before it overwrites, and an injected grade shows as graded
|
|
6
|
+
|
|
7
|
+
Contributed by [@Rohitkanithi](https://github.com/Rohitkanithi) in
|
|
8
|
+
[#231](https://github.com/samuelgursky/davinci-resolve-mcp/pull/231), plus a
|
|
9
|
+
fix to the offline `.drp` grade-injection tier.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **`timeline_item_color copy_grades` now takes a `confirm_token` and requires
|
|
14
|
+
one before it calls `TimelineItem.CopyGrades`.** The raw action reaches an API
|
|
15
|
+
that replaces the target's entire node graph with the source's, with no
|
|
16
|
+
recovery version — reconfirmed on Studio 21.1.0.14 in
|
|
17
|
+
[#207](https://github.com/samuelgursky/davinci-resolve-mcp/issues/207), where
|
|
18
|
+
the target's exported grade became byte-identical to the source and the
|
|
19
|
+
version list stayed `['Version 1']` throughout. Until now the trap
|
|
20
|
+
acknowledgement was the only barrier, and acknowledging a trap is a statement
|
|
21
|
+
about understanding the API, not about the clips in front of you.
|
|
22
|
+
|
|
23
|
+
The first call now returns `confirmation_required` with a preview built from
|
|
24
|
+
the targets it actually resolved — how many, which IDs, and which IDs were not
|
|
25
|
+
found on any video track — and a one-time token bound to the action and a
|
|
26
|
+
fingerprint of the params. Change `target_ids` after receiving the token and
|
|
27
|
+
the token no longer matches. The trap gate still runs first, so the sequence is
|
|
28
|
+
acknowledge, inspect the resolved targets, then commit. The safe siblings
|
|
29
|
+
(`safe_copy_grade`, `bulk_match_to_hero`) already gated their own writes; this
|
|
30
|
+
closes the raw path that bypassed them.
|
|
31
|
+
|
|
32
|
+
A side effect of routing target resolution through the existing
|
|
33
|
+
`_timeline_items_for_grade_copy` helper: IDs that resolve to nothing are now
|
|
34
|
+
**reported** rather than silently dropped, which is the "No target existence
|
|
35
|
+
check" the action's own docstring had been warning about.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **An injected grade rendered correctly but the Color page listed the clip as
|
|
40
|
+
ungraded.** Resolve decides "graded" from the per-version `<HasCorrection>`
|
|
41
|
+
element beside the `Body`, not from the body bytes. `injectGrades` replaced the
|
|
42
|
+
`Body` and left the flag as it found it, so on a 352-clip balance pass the
|
|
43
|
+
grades were live while the page showed them missing. The version element lists
|
|
44
|
+
`HasCorrection` before `Body`, so the last `HasCorrection` preceding the
|
|
45
|
+
replaced `Body` is the owner's; it is now flipped to true and untouched clips
|
|
46
|
+
keep their flag. The test builds an ungraded two-clip DRP, injects one, and
|
|
47
|
+
asserts the target reads true while the sibling still reads false, with an
|
|
48
|
+
already-corrected fixture as the null control.
|
|
49
|
+
|
|
50
|
+
### Validation
|
|
51
|
+
|
|
52
|
+
- Full offline suite on the merged result: **3,620 passed, 1 skipped,
|
|
53
|
+
1,257 subtests passed, zero failures.** The `drp-format` Node tests pass
|
|
54
|
+
(8 passed, 1 skipped), including the new `HasCorrection` case.
|
|
55
|
+
- All release drift guards green, including `test_write_enforcement_ratchet`,
|
|
56
|
+
`test_doc_tool_counts`, `test_action_list_drift` and
|
|
57
|
+
`test_release_surface_drift`.
|
|
58
|
+
- No Resolve live run: the confirm-token gate is server-side control flow, and
|
|
59
|
+
the `.drp` change is offline file authoring covered by its own round-trip test.
|
|
60
|
+
Neither alters what Resolve is asked to do once a call is allowed through.
|
|
61
|
+
|
|
5
62
|
## What's New in v4.1.3 — every live harness could no longer start, and a probe that could never pass
|
|
6
63
|
|
|
7
64
|
Reported and measured by [@legionsound](https://github.com/legionsound) in
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
[](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
|
|
6
6
|
[](https://www.npmjs.com/package/davinci-resolve-mcp)
|
|
7
7
|
[](docs/reference/api-coverage.md)
|
|
8
8
|
[-blue.svg)](#server-modes)
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
[](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
|
|
6
6
|
[](https://www.npmjs.com/package/davinci-resolve-mcp)
|
|
7
7
|
[](docs/reference/api-coverage.md)
|
|
8
8
|
[-blue.svg)](#服务器模式)
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](https://www.python.org/downloads/)
|
|
13
13
|
[](https://opensource.org/licenses/MIT)
|
|
14
14
|
|
|
15
|
-
> 本翻译对应 v4.
|
|
15
|
+
> 本翻译对应 v4.2.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.
|
|
40
|
+
VERSION = "4.2.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
|
@@ -244,3 +244,39 @@ test('injectGrades: internals — extractDrxBodyHex throws on missing Body', ()
|
|
|
244
244
|
test.skip('injectGrades: rendered frame matches direct DRX apply '
|
|
245
245
|
+ '(covered by tests/live_drp_roundtrip_verification.py — grade-render compare still TODO)',
|
|
246
246
|
() => {});
|
|
247
|
+
|
|
248
|
+
test('injectGrades: flips the owning version\'s HasCorrection to true (Resolve reads the flag, not the body)', async () => {
|
|
249
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'inject-hc-'));
|
|
250
|
+
const src = path.join(dir, 'src.drp');
|
|
251
|
+
const out = path.join(dir, 'out.drp');
|
|
252
|
+
const buf = await drpFormat.buildDRP({
|
|
253
|
+
projectName: 'inject-hc-test',
|
|
254
|
+
timelines: [{
|
|
255
|
+
name: 'T1', frameRate: 24, startTimecode: '01:00:00:00', resolution: '1920x1080',
|
|
256
|
+
videoTracks: [{ clips: [
|
|
257
|
+
{ start: 0, duration: 24, in: 0, mediaFilePath: '/synthetic/a.mov', grade: { body: BASELINE_BODY, hasCorrection: false, versionName: 'V1' } },
|
|
258
|
+
{ start: 24, duration: 24, in: 0, mediaFilePath: '/synthetic/b.mov', grade: { body: ORIGINAL_BODY_CLIP_2, hasCorrection: false, versionName: 'V1' } },
|
|
259
|
+
] }],
|
|
260
|
+
audioTracks: [],
|
|
261
|
+
}],
|
|
262
|
+
});
|
|
263
|
+
await fs.writeFile(src, buf);
|
|
264
|
+
const before = await readSeqContainer(src);
|
|
265
|
+
assert.equal((before.match(/<HasCorrection>true<\/HasCorrection>/g) || []).length, 0, 'fixture starts ungraded');
|
|
266
|
+
const ids = [...before.matchAll(/<(?:Sm2TiVideoClip|Sm2VideoClip)[^>]*?DbId="([^"]+)"/g)].map((m) => m[1]);
|
|
267
|
+
assert.equal(ids.length, 2);
|
|
268
|
+
await drpFormat.injectGrades(src, [{ clipId: ids[0], drxContent: makeSyntheticDrx(INJECTED_BODY) }], { outputPath: out });
|
|
269
|
+
const after = await readSeqContainer(out);
|
|
270
|
+
const clipBlock = (xml, id) => {
|
|
271
|
+
const i = xml.indexOf(`DbId="${id}"`);
|
|
272
|
+
const j = xml.indexOf('</Sm2TiVideoClip>', i);
|
|
273
|
+
return xml.slice(i, j);
|
|
274
|
+
};
|
|
275
|
+
assert.match(clipBlock(after, ids[0]), /<HasCorrection>true<\/HasCorrection>/, 'targeted clip is now marked corrected');
|
|
276
|
+
assert.match(clipBlock(after, ids[0]), new RegExp(`<Body>${INJECTED_BODY}</Body>`));
|
|
277
|
+
assert.match(clipBlock(after, ids[1]), /<HasCorrection>false<\/HasCorrection>/, 'untouched clip keeps its flag');
|
|
278
|
+
assert.doesNotMatch(clipBlock(after, ids[1]), /<HasCorrection>true/);
|
|
279
|
+
// Null control: injecting into an already-corrected version changes nothing but the body.
|
|
280
|
+
const already = await readSeqContainer(src);
|
|
281
|
+
assert.equal((already.match(/<HasCorrection>/g) || []).length, 2);
|
|
282
|
+
});
|
|
@@ -56,7 +56,8 @@ function extractDrxBodyHex(drxContent) {
|
|
|
56
56
|
*
|
|
57
57
|
* Scoping: the regex anchors on `<Sm2TiVideoClip ... DbId="<id>"` and
|
|
58
58
|
* runs forward to the matching `</Sm2TiVideoClip>`. Inside that range we
|
|
59
|
-
* replace exactly one <Body>HEX</Body
|
|
59
|
+
* replace exactly one <Body>HEX</Body> and flip the owning version's
|
|
60
|
+
* <HasCorrection> to true. If a clip has no Body yet (a
|
|
60
61
|
* brand-new clip with no grade) we don't synthesize the surrounding
|
|
61
62
|
* LmVersionTable scaffolding — that's a builder responsibility, not an
|
|
62
63
|
* injector one. Callers wanting to add grades to clean clips should
|
|
@@ -100,12 +101,32 @@ function replaceBodyForClip(seqXml, targetDbId, newBodyHex) {
|
|
|
100
101
|
// 3. Within the clip's range, replace exactly one <Body>...</Body>.
|
|
101
102
|
const clipRange = seqXml.slice(openStart, clipEnd);
|
|
102
103
|
const bodyRe = /<Body>([\s\S]*?)<\/Body>/;
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
const bodyAt = clipRange.search(bodyRe);
|
|
105
|
+
if (bodyAt < 0) return null;
|
|
106
|
+
let newClipRange = clipRange.replace(
|
|
105
107
|
bodyRe,
|
|
106
108
|
`<Body>${newBodyHex}</Body>`,
|
|
107
109
|
);
|
|
108
110
|
|
|
111
|
+
// 4. Mark the owning version as corrected. Resolve keeps a per-version
|
|
112
|
+
// <HasCorrection> flag beside the Body and its UI reads THAT (clip strip
|
|
113
|
+
// "graded"/"ungraded", clip filters), not the body bytes — a body
|
|
114
|
+
// injected into a version left at false renders the grade but shows the
|
|
115
|
+
// clip as ungraded (JREG2, 2026-09-13). The version element lists
|
|
116
|
+
// HasCorrection before Body, so the last HasCorrection preceding the
|
|
117
|
+
// replaced Body is the owner's.
|
|
118
|
+
const head = newClipRange.slice(0, bodyAt);
|
|
119
|
+
const hcAt = head.lastIndexOf('<HasCorrection>');
|
|
120
|
+
if (hcAt >= 0) {
|
|
121
|
+
const hcEnd = head.indexOf('</HasCorrection>', hcAt);
|
|
122
|
+
if (hcEnd > hcAt) {
|
|
123
|
+
newClipRange =
|
|
124
|
+
head.slice(0, hcAt) +
|
|
125
|
+
'<HasCorrection>true</HasCorrection>' +
|
|
126
|
+
newClipRange.slice(hcEnd + '</HasCorrection>'.length);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
109
130
|
return seqXml.slice(0, openStart) + newClipRange + seqXml.slice(clipEnd);
|
|
110
131
|
}
|
|
111
132
|
|
package/src/granular/common.py
CHANGED
|
@@ -87,7 +87,7 @@ if not logging.getLogger().handlers:
|
|
|
87
87
|
handlers=[logging.StreamHandler()],
|
|
88
88
|
)
|
|
89
89
|
|
|
90
|
-
VERSION = "4.
|
|
90
|
+
VERSION = "4.2.0"
|
|
91
91
|
logger = logging.getLogger("davinci-resolve-mcp")
|
|
92
92
|
logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION}")
|
|
93
93
|
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.
|
|
14
|
+
VERSION = "4.2.0"
|
|
15
15
|
|
|
16
16
|
import base64
|
|
17
17
|
import os
|
|
@@ -28657,8 +28657,8 @@ def timeline_item_color(action: str, params: Optional[Dict[str, Any]] = None) ->
|
|
|
28657
28657
|
Raw mutators (UNSAFE direct mutation — prefer the safe_* sibling):
|
|
28658
28658
|
set_cdl(cdl, ...) -> {success}
|
|
28659
28659
|
UNSAFE. No validation; no dry_run. Prefer safe_set_cdl.
|
|
28660
|
-
copy_grades(target_ids, ...) -> {success}
|
|
28661
|
-
UNSAFE.
|
|
28660
|
+
copy_grades(target_ids, confirm_token?, ...) -> {success}
|
|
28661
|
+
UNSAFE. Replaces target grades and is confirm-token gated. Prefer safe_copy_grade.
|
|
28662
28662
|
export_lut(type, path, ...) -> {success}
|
|
28663
28663
|
UNSAFE. No path sandboxing. Prefer safe_export_lut.
|
|
28664
28664
|
reset_all_node_colors(...) -> {success}
|
|
@@ -28738,14 +28738,23 @@ def timeline_item_color(action: str, params: Optional[Dict[str, Any]] = None) ->
|
|
|
28738
28738
|
elif action == "copy_grades":
|
|
28739
28739
|
# Find target items by IDs
|
|
28740
28740
|
_, tl, _ = _get_tl()
|
|
28741
|
-
|
|
28742
|
-
target_ids = set(p["target_ids"])
|
|
28741
|
+
target_ids = p["target_ids"]
|
|
28743
28742
|
if tl:
|
|
28744
|
-
|
|
28745
|
-
|
|
28746
|
-
|
|
28747
|
-
|
|
28748
|
-
|
|
28743
|
+
targets, missing = _timeline_items_for_grade_copy(tl, target_ids)
|
|
28744
|
+
else:
|
|
28745
|
+
targets, missing = [], sorted(set(target_ids or []))
|
|
28746
|
+
if "confirm_token" not in p and "confirmToken" not in p and _confirm_token_required():
|
|
28747
|
+
preview = {
|
|
28748
|
+
"operation": "timeline_item_color.copy_grades",
|
|
28749
|
+
"warning": "Replaces the entire node graph on every successfully resolved target item.",
|
|
28750
|
+
"target_count": len(targets),
|
|
28751
|
+
"target_ids": [target.GetUniqueId() for target in targets],
|
|
28752
|
+
"missing": missing,
|
|
28753
|
+
}
|
|
28754
|
+
return _issue_confirm_token(action="timeline_item_color.copy_grades", params=p, preview=preview)
|
|
28755
|
+
blocked = _consume_confirm_token(action="timeline_item_color.copy_grades", params=p)
|
|
28756
|
+
if blocked:
|
|
28757
|
+
return blocked
|
|
28749
28758
|
return {"success": bool(item.CopyGrades(targets))}
|
|
28750
28759
|
elif action == "add_version":
|
|
28751
28760
|
return {"success": bool(item.AddVersion(p["name"], p.get("type", 0)))}
|