davinci-resolve-mcp 5.0.1 → 5.0.2

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,29 @@
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 v5.0.2 — A caller path that starts with "-" is no longer handed to a program as an option
6
+
7
+ Closes the gap the v5.0.0 notes left open under **Not changed**, reported with a reachability check in #350.
8
+
9
+ ### Security
10
+
11
+ - **Option-like paths are refused before a program is spawned (#350).** A caller path that is the bare operand of ffprobe, ffmpeg or whisper and starts with `-` was read as an option: ffprobe given a file named `-report` writes a log into its working folder before it notices there is no input. The Python server now refuses it with `OPTION_LIKE_PATH_REFUSED`, the same code the advanced server's `assertNotOption` returns. An absolute path, or one prefixed with `./`, still works. Guarded sites:
12
+ - the proxy compatibility check, on its own or in `link_proxy` (`_probe_media_file`), and the render and quick-export readbacks (`_ffprobe_media_summary`)
13
+ - `media_pool_item extract_frames`, for its `output_dir`
14
+ - media analysis's ffprobe pass, and the whisper CLI's input path
15
+ - `mix_plan`'s stem probes and its premix `output_path`
16
+ - `assess_grade` / `grade_loop`'s colour-transfer probe, which reports the transfer as unknown instead of spawning
17
+
18
+ The four sites named in v5.0.0 were joined by four more, found by sweeping every spawn under `src/` for a caller path in a positional slot.
19
+
20
+ ### Fixed
21
+
22
+ - **`edit_engine sound_density_audit` with `duration_seconds`.** The duration limit was inserted between `-i` and the media path, so `-t` became ffmpeg's input and the caller's path a bare output filename. Every call that set `duration_seconds` failed. The limit now goes before `-i`.
23
+
24
+ ### Not changed
25
+
26
+ - Covered by unit tests with mutation checks: each guard, reverted, fails its own test. Nothing was run against a live ffprobe, ffmpeg, whisper or Resolve.
27
+
5
28
  ## What's New in v5.0.1 — Three more Resolve calls reported as broken in #336 are withdrawn
6
29
 
7
30
  A ledger correction. No tool behavior changed.
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-5.0.1-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-5.0.2-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-5.0.1-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-5.0.2-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
- > 本翻译对应 v5.0.1 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
15
+ > 本翻译对应 v5.0.2 版 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 = "5.0.1"
40
+ VERSION = "5.0.2"
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": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "NPM bootstrapper for the DaVinci Resolve MCP Server.",
5
5
  "license": "MIT",
6
6
  "author": "Samuel Gursky <samgursky@gmail.com>",
@@ -93,7 +93,7 @@ if not logging.getLogger().handlers:
93
93
  handlers=[logging.StreamHandler()],
94
94
  )
95
95
 
96
- VERSION = "5.0.1"
96
+ VERSION = "5.0.2"
97
97
  logger = logging.getLogger("davinci-resolve-mcp")
98
98
  logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION}")
99
99
  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 = "5.0.1"
14
+ VERSION = "5.0.2"
15
15
 
16
16
  import base64
17
17
  import os
@@ -83,7 +83,7 @@ from src.utils.page_lock import (
83
83
  restoring_page as _restoring_page,
84
84
  page_lock as _page_lock,
85
85
  )
86
- from src.utils.proc import safe_run, windows_pid_alive
86
+ from src.utils.proc import OPTION_LIKE_PATH_REFUSED, option_like_path_error, safe_run, windows_pid_alive
87
87
  from src.utils.readback import verify_by_readback, verification_stats as _verification_stats
88
88
  from src.utils import operation_result as _operation_result
89
89
  from src.utils import operation_log as _operation_log
@@ -10382,6 +10382,11 @@ def _extract_clip_frames(clip, p: Dict[str, Any]) -> Dict[str, Any]:
10382
10382
  if not shutil.which("ffmpeg"):
10383
10383
  return _err("ffmpeg not found on PATH")
10384
10384
  out_dir = p.get("output_dir") or tempfile.mkdtemp(prefix="mcp_frames_")
10385
+ # Each frame path is ffmpeg's bare output operand, so a directory starting
10386
+ # with "-" would make it an option (#350).
10387
+ refused = option_like_path_error(out_dir, "output_dir")
10388
+ if refused:
10389
+ return _err(refused, code=OPTION_LIKE_PATH_REFUSED, category="invalid_input", retryable=False)
10385
10390
  try:
10386
10391
  os.makedirs(out_dir, exist_ok=True)
10387
10392
  except OSError as exc:
@@ -15343,6 +15348,9 @@ def _ffprobe_media_summary(path: str) -> Optional[Dict[str, Any]]:
15343
15348
  ffprobe = shutil.which("ffprobe")
15344
15349
  if not ffprobe:
15345
15350
  return None
15351
+ refused = option_like_path_error(path)
15352
+ if refused:
15353
+ return {"error": refused, "code": OPTION_LIKE_PATH_REFUSED}
15346
15354
  try:
15347
15355
  proc = subprocess.run(
15348
15356
  [ffprobe, "-v", "error", "-show_entries",
@@ -15383,6 +15391,9 @@ def _probe_media_file(path: str):
15383
15391
  "error": "ffprobe is not installed or not on PATH",
15384
15392
  "path": path,
15385
15393
  }
15394
+ refused = option_like_path_error(path)
15395
+ if refused:
15396
+ return {"success": False, "code": OPTION_LIKE_PATH_REFUSED, "error": refused, "path": path}
15386
15397
  try:
15387
15398
  proc = subprocess.run(
15388
15399
  [
@@ -53,6 +53,7 @@ except ImportError: # pragma: no cover - exercised on minimal installs
53
53
  _np = None
54
54
 
55
55
  from src.utils import colorimetry as _cm
56
+ from src.utils.proc import option_like_path_error
56
57
 
57
58
  #: Every public entry point calls `_require()` before touching numpy, so the
58
59
  #: internals below treat `_np` as present. Declared machine-readably rather
@@ -184,6 +185,10 @@ def _decode_frame(
184
185
  def _probe_color_transfer(path: str) -> Optional[str]:
185
186
  if not shutil.which("ffprobe"):
186
187
  return None
188
+ if option_like_path_error(path):
189
+ # Not spawned: ffprobe would read it as an option (#350). The transfer
190
+ # is then unknown, the same answer as ffprobe being absent.
191
+ return None
187
192
  args = [
188
193
  "ffprobe", "-v", "error", "-select_streams", "v:0",
189
194
  "-show_entries", "stream=color_transfer", "-of", "default=nw=1:nk=1", path,
@@ -31,6 +31,7 @@ from pathlib import Path
31
31
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
32
32
 
33
33
  from src.utils import analysis_caps as _analysis_caps
34
+ from src.utils.proc import OPTION_LIKE_PATH_REFUSED, option_like_path_error
34
35
 
35
36
  # Caps preference reader — server.py registers a provider that reads the
36
37
  # media-analysis prefs file. Until then, the default preset is used.
@@ -2690,6 +2691,9 @@ def _parse_float(value: Any) -> Optional[float]:
2690
2691
 
2691
2692
 
2692
2693
  def _ffprobe(path: str) -> Dict[str, Any]:
2694
+ refused = option_like_path_error(path)
2695
+ if refused:
2696
+ return {"success": False, "code": OPTION_LIKE_PATH_REFUSED, "error": refused}
2693
2697
  code, stdout, stderr = _run_command([
2694
2698
  "ffprobe",
2695
2699
  "-v",
@@ -4277,6 +4281,11 @@ def _transcribe_with_whisper_cli(path: str, artifacts: Dict[str, Any], transcrip
4277
4281
  whisper = shutil.which("whisper")
4278
4282
  if not whisper:
4279
4283
  return {"success": False, "status": "skipped", "backend": "whisper_cli", "reason": "whisper CLI not found"}
4284
+ refused = option_like_path_error(path)
4285
+ if refused:
4286
+ # The path is whisper's bare first operand, so argparse would read it
4287
+ # as an option (#350).
4288
+ return {"success": False, "backend": "whisper_cli", "code": OPTION_LIKE_PATH_REFUSED, "error": refused}
4280
4289
  work_dir = os.path.join(os.path.dirname(artifacts.get("transcript_json") or artifacts["analysis_json"]), "transcript-work")
4281
4290
  os.makedirs(work_dir, exist_ok=True)
4282
4291
  # Default to capturing per-word timestamps so editor / word-snap features
@@ -57,6 +57,7 @@ import tempfile
57
57
  from typing import Any, Dict, List, Optional, Sequence, Tuple
58
58
 
59
59
  from . import delivery_targets, loudness_parse
60
+ from .proc import option_like_path_error
60
61
 
61
62
  try:
62
63
  import numpy as _np
@@ -179,6 +180,9 @@ def probe_duration(path: str) -> float:
179
180
  """Duration in seconds via ffprobe, or 0.0 when it cannot be read."""
180
181
  if not shutil.which("ffprobe"):
181
182
  raise MixPlanError("ffprobe is required to read stem durations")
183
+ refused = option_like_path_error(path, "stem path")
184
+ if refused:
185
+ raise MixPlanError(refused)
182
186
  code, stdout, _ = _run(
183
187
  ["ffprobe", "-v", "error", "-show_entries", "format=duration",
184
188
  "-of", "default=nw=1:nk=1", path]
@@ -382,6 +386,9 @@ def duck_envelope(
382
386
 
383
387
 
384
388
  def _write_wav(path: str, mix: "Any") -> str:
389
+ refused = option_like_path_error(path, "output_path")
390
+ if refused:
391
+ raise MixPlanError(refused)
385
392
  directory = os.path.dirname(os.path.abspath(path))
386
393
  if directory:
387
394
  os.makedirs(directory, exist_ok=True)
package/src/utils/proc.py CHANGED
@@ -8,10 +8,34 @@ than re-applied at every call site.
8
8
 
9
9
  ``windows_pid_alive`` lives here too: the Windows replacement for the
10
10
  ``os.kill(pid, 0)`` liveness probe, which on Windows terminates the process.
11
+
12
+ ``option_like_path_error`` is the Python twin of ``assertNotOption`` in
13
+ ``resolve-advanced/server/spawn-guard.mjs``. A caller path that lands in a
14
+ positional argv slot and starts with ``-`` is read by the child as an option:
15
+ ffprobe given ``-report`` writes a log into its working directory (#350).
16
+ Check it wherever a caller path is the bare operand of a spawned program.
11
17
  """
12
18
  import subprocess
13
19
  from typing import Any, Optional
14
20
 
21
+ #: Error code shared with the advanced server's ``assertNotOption``.
22
+ OPTION_LIKE_PATH_REFUSED = "OPTION_LIKE_PATH_REFUSED"
23
+
24
+
25
+ def option_like_path_error(value: Any, label: str = "path") -> Optional[str]:
26
+ """Why ``value`` cannot be a positional argv operand, or None when it can.
27
+
28
+ A string starting with ``-`` is refused, not rewritten to ``./-...``, so a
29
+ path gets the same answer from this server and the advanced one. An
30
+ absolute path or a ``./`` prefix passes.
31
+ """
32
+ if isinstance(value, str) and value.startswith("-"):
33
+ return (
34
+ f"{label} '{value}' starts with '-', so the program would read it as "
35
+ "an option. Pass it as an absolute path or prefix it with ./"
36
+ )
37
+ return None
38
+
15
39
 
16
40
  def safe_run(*args: Any, **kwargs: Any) -> "subprocess.CompletedProcess":
17
41
  """subprocess.run with stdin defaulted to DEVNULL (override by passing stdin).
@@ -219,7 +219,10 @@ def measure_track_levels(
219
219
  cmd = ["ffmpeg", "-v", "error", "-i", path, "-vn", "-ac", "1",
220
220
  "-ar", str(rate), "-f", "f32le", "-"]
221
221
  if duration_seconds:
222
- cmd[4:4] = ["-t", str(duration_seconds)]
222
+ # Before "-i", so it limits the input read. Index 4 is the path:
223
+ # inserting there left "-i -t <dur> <path>", which made "-t" the
224
+ # input and the caller's path a bare output filename (#350).
225
+ cmd[3:3] = ["-t", str(duration_seconds)]
223
226
  try:
224
227
  proc = subprocess.run(cmd, stdin=subprocess.DEVNULL, capture_output=True, timeout=120)
225
228
  except (subprocess.SubprocessError, OSError) as exc: