davinci-resolve-mcp 2.97.6 → 2.97.7
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 +49 -0
- package/README.md +1 -1
- package/README.zh-CN.md +2 -2
- package/docs/SKILL.md +5 -0
- package/install.py +1 -1
- package/package.json +1 -1
- package/src/granular/common.py +1 -1
- package/src/server.py +106 -21
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,55 @@
|
|
|
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 v2.97.7
|
|
6
|
+
|
|
7
|
+
**`grab_and_export` deleted files it never created.** Reported in
|
|
8
|
+
[#151](https://github.com/samuelgursky/davinci-resolve-mcp/issues/151).
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **The cleanup step removed a directory diff, not the export.** It listed the
|
|
13
|
+
caller's folder before the export and again after, and treated the difference
|
|
14
|
+
as "what this call produced" — so anything that appeared in that window was
|
|
15
|
+
attributed to the call, inlined into the response, and deleted: a background
|
|
16
|
+
render, a file copy, a cloud sync, or a second `grab_and_export`. It then
|
|
17
|
+
finished with `os.rmdir(folder_path)`, removing a directory the caller had
|
|
18
|
+
chosen and this server had not created.
|
|
19
|
+
|
|
20
|
+
`_resolve_safe_dir` made the overlap concrete rather than theoretical. Every
|
|
21
|
+
sandbox/temp path is redirected to one shared `~/Documents/resolve-stills`,
|
|
22
|
+
which is also the folder the documented `/tmp/...` examples land in, so two
|
|
23
|
+
calls aimed at different temp folders arrived in the same place and each swept
|
|
24
|
+
up the other's output.
|
|
25
|
+
|
|
26
|
+
The export now goes to a private staging directory created inside
|
|
27
|
+
`folder_path` for that one call, so what it produced is known by construction
|
|
28
|
+
instead of inferred. Cleanup removes that directory and nothing else;
|
|
29
|
+
`folder_path` is removed only when this call created it and left it empty. A
|
|
30
|
+
folder the caller already had is theirs, empty or not. With `cleanup: false`
|
|
31
|
+
the files move up into `folder_path` under a non-colliding name rather than
|
|
32
|
+
overwriting a still already sitting there — Resolve numbers stills per export,
|
|
33
|
+
so a second call collides with the first by default.
|
|
34
|
+
|
|
35
|
+
Deletion is now confined to one helper that refuses any path it did not name,
|
|
36
|
+
which is the property that was missing: the old code path could be handed the
|
|
37
|
+
caller's folder and delete its contents.
|
|
38
|
+
|
|
39
|
+
The inlining half matters too. A file that was never ours was read into the
|
|
40
|
+
response, so an unrelated document sitting in the export folder could reach an
|
|
41
|
+
assistant's context. Only staged files are read now.
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
- `tests.test_gallery_still_export_cleanup` runs the action against a real temp
|
|
46
|
+
filesystem with a fake album that writes the way Resolve does, because the
|
|
47
|
+
defect was in what the filesystem looked like afterwards, not in any return
|
|
48
|
+
value: a bystander file written *during* the export must survive and must not
|
|
49
|
+
appear inlined; a pre-existing folder must not be removed; a folder the call
|
|
50
|
+
created must still be cleaned up; `cleanup: false` must not overwrite; and no
|
|
51
|
+
staging directory may survive any exit path, including the two early error
|
|
52
|
+
returns. All fail on 2.97.6.
|
|
53
|
+
|
|
5
54
|
## What's New in v2.97.6
|
|
6
55
|
|
|
7
56
|
**On Windows the server could not see the Resolve it was driving.** Reported 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
|
-
> 本翻译对应 v2.97.
|
|
15
|
+
> 本翻译对应 v2.97.7 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
|
|
16
16
|
|
|
17
17
|
一个 Model Context Protocol (MCP) 服务器,让 AI 助手通过官方脚本 API 控制 DaVinci Resolve Studio(达芬奇)。它提供完整的 API 覆盖,外加带护栏的工作流助手,涵盖剪辑、媒体池整理、渲染设置、审阅标记、调色、Fusion、Fairlight、项目生命周期任务、扩展开发,以及不碰源媒体的媒体分析。
|
|
18
18
|
|
package/docs/SKILL.md
CHANGED
|
@@ -1637,6 +1637,11 @@ Key actions:
|
|
|
1637
1637
|
Returns `{files, format, folder, cleaned_up}` where each file entry includes
|
|
1638
1638
|
`data_base64` for image files and `data` (text) for `.drx` grade files.
|
|
1639
1639
|
`cleanup` defaults to `true` — files are deleted from disk after being inlined.
|
|
1640
|
+
Only files this call produced are removed: the export goes to a private
|
|
1641
|
+
staging directory inside `folder_path`, so anything else written there
|
|
1642
|
+
meanwhile is untouched, and `folder_path` itself is removed only if the call
|
|
1643
|
+
created it and left it empty. With `cleanup: false` the files are moved up
|
|
1644
|
+
into `folder_path` without overwriting anything already there.
|
|
1640
1645
|
Requires Color page with Gallery panel visible.
|
|
1641
1646
|
- `delete_stills(still_indices)`
|
|
1642
1647
|
|
package/install.py
CHANGED
|
@@ -37,7 +37,7 @@ from src.utils.update_check import (
|
|
|
37
37
|
|
|
38
38
|
# ─── Version ──────────────────────────────────────────────────────────────────
|
|
39
39
|
|
|
40
|
-
VERSION = "2.97.
|
|
40
|
+
VERSION = "2.97.7"
|
|
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
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 = "2.97.
|
|
90
|
+
VERSION = "2.97.7"
|
|
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 353-tool granular server instead
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
VERSION = "2.97.
|
|
14
|
+
VERSION = "2.97.7"
|
|
15
15
|
|
|
16
16
|
import base64
|
|
17
17
|
import os
|
|
@@ -1289,6 +1289,50 @@ def _resolve_safe_dir(path):
|
|
|
1289
1289
|
return os.path.join(os.path.expanduser("~"), "Documents", "resolve-stills")
|
|
1290
1290
|
return path
|
|
1291
1291
|
|
|
1292
|
+
#: Prefix of the private per-call directory `gallery_stills(grab_and_export)`
|
|
1293
|
+
#: exports into. Named so that the only thing this server ever deletes is a
|
|
1294
|
+
#: directory it created itself, in this call, for this purpose. Deliberately not
|
|
1295
|
+
#: a dot-directory: Resolve's still exporter is particular about where it will
|
|
1296
|
+
#: write (see `_resolve_safe_dir`, which exists because it fails silently into
|
|
1297
|
+
#: sandbox paths), and an ordinary subdirectory is the least exotic thing to
|
|
1298
|
+
#: hand it.
|
|
1299
|
+
STILL_STAGING_PREFIX = "resolve-mcp-still-"
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
def _discard_still_staging(staging: str) -> None:
|
|
1303
|
+
"""Remove a still-export staging directory, and refuse anything else.
|
|
1304
|
+
|
|
1305
|
+
The name check is not ceremony. The step it replaces removed whatever the
|
|
1306
|
+
before/after diff of the caller's folder happened to show, and then removed
|
|
1307
|
+
the folder itself — so this helper is the one place a delete can happen, and
|
|
1308
|
+
it declines any path that is not a directory this server named. See #151.
|
|
1309
|
+
"""
|
|
1310
|
+
if not staging or not os.path.basename(staging).startswith(STILL_STAGING_PREFIX):
|
|
1311
|
+
return
|
|
1312
|
+
if not os.path.isdir(staging):
|
|
1313
|
+
return
|
|
1314
|
+
shutil.rmtree(staging, ignore_errors=True)
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
def _unused_path(path: str) -> str:
|
|
1318
|
+
"""`path`, or the first `name_1.ext`, `name_2.ext`… that does not exist yet.
|
|
1319
|
+
|
|
1320
|
+
Used when moving exported stills into the caller's folder: a still named
|
|
1321
|
+
like one already sitting there is a collision to step around, not a file to
|
|
1322
|
+
overwrite.
|
|
1323
|
+
"""
|
|
1324
|
+
import uuid
|
|
1325
|
+
|
|
1326
|
+
if not os.path.exists(path):
|
|
1327
|
+
return path
|
|
1328
|
+
stem, ext = os.path.splitext(path)
|
|
1329
|
+
for n in range(1, 1000):
|
|
1330
|
+
candidate = f"{stem}_{n}{ext}"
|
|
1331
|
+
if not os.path.exists(candidate):
|
|
1332
|
+
return candidate
|
|
1333
|
+
return f"{stem}_{uuid.uuid4().hex}{ext}"
|
|
1334
|
+
|
|
1335
|
+
|
|
1292
1336
|
# Error envelope categories (agentic-flow improvements A1/D1) — see the retryable
|
|
1293
1337
|
# default policy. Lock these names; downstream agents and tests route on them.
|
|
1294
1338
|
ERROR_CATEGORIES = (
|
|
@@ -25253,7 +25297,12 @@ def gallery_stills(action: str, params: Optional[Dict[str, Any]] = None) -> Dict
|
|
|
25253
25297
|
keeping the live GalleryStill reference (more reliable than separate grab + export).
|
|
25254
25298
|
Requires Color page. Automatically produces a companion .drx grade file.
|
|
25255
25299
|
File data is inlined in the response (DRX as text, images as base64).
|
|
25256
|
-
cleanup (default true) deletes exported files
|
|
25300
|
+
cleanup (default true) deletes the exported files after inlining. Only files
|
|
25301
|
+
this call produced are ever removed: the export goes to a private staging
|
|
25302
|
+
directory inside folder_path, so anything else written there meanwhile is
|
|
25303
|
+
untouched, and folder_path itself is removed only if this call created it
|
|
25304
|
+
and left it empty. With cleanup false the files are moved up into
|
|
25305
|
+
folder_path without overwriting anything already there.
|
|
25257
25306
|
"""
|
|
25258
25307
|
p = _params(params)
|
|
25259
25308
|
_, proj, err = _check()
|
|
@@ -25302,31 +25351,53 @@ def gallery_stills(action: str, params: Optional[Dict[str, Any]] = None) -> Dict
|
|
|
25302
25351
|
return _err("No stills to export")
|
|
25303
25352
|
return {"success": bool(album.ExportStills(stills, p["folder_path"], p.get("prefix", "still"), p.get("format", "dpx")))}
|
|
25304
25353
|
elif action == "grab_and_export":
|
|
25305
|
-
import time, os
|
|
25354
|
+
import time, os, shutil, uuid
|
|
25306
25355
|
folder_path = p.get("folder_path")
|
|
25307
25356
|
if not folder_path:
|
|
25308
25357
|
return _err("folder_path is required")
|
|
25309
25358
|
prefix = p.get("prefix", "still")
|
|
25310
25359
|
fmt = p.get("format", "dpx")
|
|
25311
25360
|
delete_after = p.get("delete_after", True)
|
|
25361
|
+
cleanup = p.get("cleanup", True)
|
|
25312
25362
|
# Redirect sandbox/temp paths that Resolve can't access
|
|
25313
25363
|
folder_path = _resolve_safe_dir(folder_path)
|
|
25364
|
+
folder_pre_existed = os.path.isdir(folder_path)
|
|
25314
25365
|
os.makedirs(folder_path, exist_ok=True)
|
|
25315
|
-
#
|
|
25316
|
-
|
|
25366
|
+
# Export into a private staging directory instead of straight into
|
|
25367
|
+
# folder_path, so "what this call produced" is known by construction.
|
|
25368
|
+
#
|
|
25369
|
+
# It used to be a before/after diff of folder_path, which is not the
|
|
25370
|
+
# same question: anything that appeared in that folder during the export
|
|
25371
|
+
# window — a background render, a copy, a cloud sync, a second
|
|
25372
|
+
# grab_and_export — was attributed to this call, inlined into the
|
|
25373
|
+
# response, and then deleted by the cleanup step. `_resolve_safe_dir`
|
|
25374
|
+
# makes that concrete rather than theoretical: every sandbox/temp path
|
|
25375
|
+
# is redirected to the one shared ~/Documents/resolve-stills folder, so
|
|
25376
|
+
# two overlapping calls each swept up the other's output. The old
|
|
25377
|
+
# cleanup also finished with `os.rmdir(folder_path)`, removing a
|
|
25378
|
+
# directory the caller had chosen and this server did not create.
|
|
25379
|
+
# Reported in #151.
|
|
25380
|
+
#
|
|
25381
|
+
# A staging directory is inside folder_path on purpose: same volume and
|
|
25382
|
+
# same permissions, so if Resolve can export to folder_path it can
|
|
25383
|
+
# export here, and the finished files move up with a rename.
|
|
25384
|
+
staging = os.path.join(folder_path, f"{STILL_STAGING_PREFIX}{uuid.uuid4().hex}")
|
|
25385
|
+
os.makedirs(staging)
|
|
25317
25386
|
# Grab still — requires Color page with a clip under the playhead
|
|
25318
25387
|
_, tl, err2 = _get_tl()
|
|
25319
25388
|
if err2:
|
|
25389
|
+
_discard_still_staging(staging)
|
|
25320
25390
|
return err2
|
|
25321
25391
|
still = tl.GrabStill()
|
|
25322
25392
|
if not still:
|
|
25393
|
+
_discard_still_staging(staging)
|
|
25323
25394
|
return _err("GrabStill failed — ensure Color page is active with a clip under the playhead")
|
|
25324
25395
|
time.sleep(0.5)
|
|
25325
25396
|
# Export using the live still reference with format fallback chain
|
|
25326
25397
|
export_ok = False
|
|
25327
25398
|
used_format = fmt
|
|
25328
25399
|
for try_fmt in [fmt, "tif", "dpx"]:
|
|
25329
|
-
result = album.ExportStills([still],
|
|
25400
|
+
result = album.ExportStills([still], staging, prefix, try_fmt)
|
|
25330
25401
|
if result:
|
|
25331
25402
|
export_ok = True
|
|
25332
25403
|
used_format = try_fmt
|
|
@@ -25336,15 +25407,19 @@ def gallery_stills(action: str, params: Optional[Dict[str, Any]] = None) -> Dict
|
|
|
25336
25407
|
if delete_after:
|
|
25337
25408
|
album.DeleteStills([still])
|
|
25338
25409
|
if not export_ok:
|
|
25410
|
+
_discard_still_staging(staging)
|
|
25339
25411
|
return _err("ExportStills failed — ensure the Gallery panel is open on the Color page (Workspace > Gallery)")
|
|
25340
25412
|
# Wait for filesystem
|
|
25341
25413
|
time.sleep(0.3)
|
|
25342
|
-
|
|
25343
|
-
|
|
25344
|
-
|
|
25414
|
+
try:
|
|
25415
|
+
exported = sorted(os.listdir(staging))
|
|
25416
|
+
except OSError:
|
|
25417
|
+
exported = []
|
|
25345
25418
|
file_details = []
|
|
25346
|
-
for f in
|
|
25347
|
-
fpath = os.path.join(
|
|
25419
|
+
for f in exported:
|
|
25420
|
+
fpath = os.path.join(staging, f)
|
|
25421
|
+
if not os.path.isfile(fpath):
|
|
25422
|
+
continue
|
|
25348
25423
|
entry = {"name": f, "path": fpath, "size": os.path.getsize(fpath)}
|
|
25349
25424
|
# Inline file data so cleanup can safely remove files
|
|
25350
25425
|
try:
|
|
@@ -25361,20 +25436,30 @@ def gallery_stills(action: str, params: Optional[Dict[str, Any]] = None) -> Dict
|
|
|
25361
25436
|
except OSError:
|
|
25362
25437
|
pass
|
|
25363
25438
|
file_details.append(entry)
|
|
25364
|
-
# Cleanup: remove exported files now that data is inlined (default: True)
|
|
25365
|
-
cleanup = p.get("cleanup", True)
|
|
25366
25439
|
if cleanup:
|
|
25367
|
-
|
|
25440
|
+
# Only the staging directory is removed, and only ever the files
|
|
25441
|
+
# this call put in it. folder_path is left alone unless this call
|
|
25442
|
+
# created it and it is still empty — a folder the caller already had
|
|
25443
|
+
# is theirs, empty or not.
|
|
25444
|
+
_discard_still_staging(staging)
|
|
25445
|
+
if not folder_pre_existed:
|
|
25368
25446
|
try:
|
|
25369
|
-
os.
|
|
25447
|
+
if os.path.isdir(folder_path) and not os.listdir(folder_path):
|
|
25448
|
+
os.rmdir(folder_path)
|
|
25370
25449
|
except OSError:
|
|
25371
25450
|
pass
|
|
25372
|
-
|
|
25373
|
-
|
|
25374
|
-
|
|
25375
|
-
|
|
25376
|
-
|
|
25377
|
-
|
|
25451
|
+
else:
|
|
25452
|
+
# Keeping the files: move them up into the folder the caller asked
|
|
25453
|
+
# for, never overwriting something already there.
|
|
25454
|
+
for entry in file_details:
|
|
25455
|
+
dest = _unused_path(os.path.join(folder_path, entry["name"]))
|
|
25456
|
+
try:
|
|
25457
|
+
shutil.move(entry["path"], dest)
|
|
25458
|
+
except OSError:
|
|
25459
|
+
continue
|
|
25460
|
+
entry["name"] = os.path.basename(dest)
|
|
25461
|
+
entry["path"] = dest
|
|
25462
|
+
_discard_still_staging(staging)
|
|
25378
25463
|
return {"files": file_details, "format": used_format, "folder": folder_path, "cleaned_up": cleanup}
|
|
25379
25464
|
elif action == "delete_stills":
|
|
25380
25465
|
stills = album.GetStills() or []
|