davinci-resolve-mcp 5.0.2 → 5.0.4

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.4 — Media analysis finds FFmpeg installed through WinGet on Windows
6
+
7
+ Fixes #346, from #349 by @jsdhwfmax.
8
+
9
+ ### Fixed
10
+
11
+ - **FFmpeg installed through WinGet could be invisible on Windows.** A GUI client (OpenCode in the report) may start the server with a PATH that lacks WinGet's FFmpeg links, so `media_analysis` reported `ffmpeg` and `ffprobe` as unavailable while both worked in a terminal. On Windows the server now looks for the per-user `Gyan.FFmpeg` package under `%LOCALAPPDATA%\Microsoft\WinGet\Packages` and appends its `bin` folder to its own PATH when both executables are there. It is appended last, so a tool already on PATH keeps priority, and a folder already present under another spelling is not added twice.
12
+
13
+ ### Not changed
14
+
15
+ - macOS and Linux are untouched; the lookup only runs on Windows. Validated by the contributor's Windows run and by @0x-70da on Windows 10 with a real WinGet FFmpeg 9.0.2 install with the WinGet entry removed from PATH; @CaptRauti confirmed the directory layout on a current install. The offline suite passed here on macOS. No Resolve behavior changed, so no live Resolve run.
16
+
17
+ ## What's New in v5.0.3 — The control panel no longer builds AppleScript from a folder name
18
+
19
+ ### Security
20
+
21
+ - **The panel's folder picker passed its start folder into AppleScript source.** On macOS, the picker put the request's `initial` folder inside a string literal in the script it ran with `osascript`, checked only for being an existing directory. A folder whose name contained `"` could close the literal and run AppleScript of its own, such as `do shell script`. The script is now fixed text that reads the folder as a run-handler argument, and the folder is made absolute first. The endpoint sits behind the panel's token and Host/Origin gate and answers loopback clients only, so a caller needed a valid panel session on the same machine and a folder with that name to exist.
22
+ - **The panel's Claude Code terminal launcher, same shape.** It put its `cd <repo> && <claude>` command inside an AppleScript string. The iTerm branch did no escaping, and the Terminal branch escaped by hand. Neither value comes from the request, but both branches now pass the command as an argument the same way.
23
+
24
+ ### Not changed
25
+
26
+ - Covered by unit tests with a mutation check: restoring the old code fails all five new tests. One live measurement on macOS: `osascript -e 'on run argv' … -- <path>` delivers the path as the only argument, with quotes, backslashes and a leading `-` intact. The picker and the launcher themselves were not opened.
27
+
5
28
  ## What's New in v5.0.2 — A caller path that starts with "-" is no longer handed to a program as an option
6
29
 
7
30
  Closes the gap the v5.0.0 notes left open under **Not changed**, reported with a reachability check in #350.
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.2-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-5.0.4-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.2-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-5.0.4-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.2 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
15
+ > 本翻译对应 v5.0.4 版 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.2"
40
+ VERSION = "5.0.4"
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.2",
3
+ "version": "5.0.4",
4
4
  "description": "NPM bootstrapper for the DaVinci Resolve MCP Server.",
5
5
  "license": "MIT",
6
6
  "author": "Samuel Gursky <samgursky@gmail.com>",
@@ -14745,24 +14745,34 @@ def _launch_claude_code_terminal() -> Dict[str, Any]:
14745
14745
  iterm_running = (check.stdout or "").strip().lower() == "true"
14746
14746
  except Exception:
14747
14747
  iterm_running = False
14748
+ # The command (repo path + claude binary) reaches the script as a run
14749
+ # handler argument, never as interpolated AppleScript source, so a `"` or
14750
+ # backslash in either path cannot break out of a string literal.
14748
14751
  if iterm_running:
14749
- script = (
14750
- 'tell application "iTerm"\n'
14751
- ' activate\n'
14752
- f' create window with default profile command "{cmd}"\n'
14753
- 'end tell'
14754
- )
14752
+ script_lines = [
14753
+ "on run argv",
14754
+ 'tell application "iTerm"',
14755
+ "activate",
14756
+ "create window with default profile command (item 1 of argv)",
14757
+ "end tell",
14758
+ "end run",
14759
+ ]
14755
14760
  else:
14756
- escaped = cmd.replace("\\", "\\\\").replace('"', '\\"')
14757
- script = (
14758
- 'tell application "Terminal"\n'
14759
- ' activate\n'
14760
- f' do script "{escaped}"\n'
14761
- 'end tell'
14762
- )
14761
+ script_lines = [
14762
+ "on run argv",
14763
+ 'tell application "Terminal"',
14764
+ "activate",
14765
+ "do script (item 1 of argv)",
14766
+ "end tell",
14767
+ "end run",
14768
+ ]
14769
+ argv = ["osascript"]
14770
+ for line in script_lines:
14771
+ argv += ["-e", line]
14772
+ argv += ["--", cmd]
14763
14773
  try:
14764
14774
  proc = subprocess.run(
14765
- ["osascript", "-e", script],
14775
+ argv,
14766
14776
  stdin=subprocess.DEVNULL,
14767
14777
  capture_output=True, text=True, encoding="utf-8", errors="replace",
14768
14778
  timeout=15,
@@ -14785,17 +14795,30 @@ def _native_directory_picker(initial: Optional[str] = None) -> Dict[str, Any]:
14785
14795
  to expose a filesystem path.
14786
14796
  """
14787
14797
  initial_dir = initial if initial and os.path.isdir(initial) else os.path.expanduser("~")
14798
+ # Absolute so a caller-supplied relative name can never start with "-".
14799
+ initial_dir = os.path.abspath(initial_dir)
14788
14800
  if sys.platform == "darwin":
14789
14801
  # AppleScript picker — works without a Python Tk binding installed.
14790
- script = (
14791
- 'tell application "System Events" to activate\n'
14792
- f'set chosenFolder to choose folder with prompt "Select a folder" default location POSIX file "{initial_dir}"\n'
14793
- 'POSIX path of chosenFolder'
14794
- )
14802
+ # The start directory comes from the HTTP request, so it is passed to
14803
+ # the script's run handler as argv and never spliced into the script
14804
+ # source: a directory name containing `"` would otherwise close the
14805
+ # string literal and inject AppleScript (e.g. `do shell script`).
14806
+ script_lines = [
14807
+ "on run argv",
14808
+ 'tell application "System Events" to activate',
14809
+ 'set chosenFolder to choose folder with prompt "Select a folder" '
14810
+ "default location (POSIX file (item 1 of argv))",
14811
+ "return POSIX path of chosenFolder",
14812
+ "end run",
14813
+ ]
14814
+ argv = ["osascript"]
14815
+ for line in script_lines:
14816
+ argv += ["-e", line]
14817
+ argv += ["--", initial_dir]
14795
14818
  try:
14796
14819
  import subprocess
14797
14820
  proc = subprocess.run(
14798
- ["osascript", "-e", script],
14821
+ argv,
14799
14822
  stdin=subprocess.DEVNULL,
14800
14823
  capture_output=True, text=True, encoding="utf-8", errors="replace",
14801
14824
  timeout=120,
@@ -93,7 +93,7 @@ if not logging.getLogger().handlers:
93
93
  handlers=[logging.StreamHandler()],
94
94
  )
95
95
 
96
- VERSION = "5.0.2"
96
+ VERSION = "5.0.4"
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.2"
14
+ VERSION = "5.0.4"
15
15
 
16
16
  import base64
17
17
  import os
@@ -407,6 +407,25 @@ from src.utils.sync_detection import detect_sync_event_capabilities
407
407
  from src.utils import analysis_memory
408
408
 
409
409
 
410
+ def _winget_ffmpeg_bin() -> str | None:
411
+ """Find a complete Gyan.FFmpeg archive in WinGet's per-user package directory."""
412
+ local_appdata = os.environ.get("LOCALAPPDATA")
413
+ if not local_appdata or not Path(local_appdata).is_absolute():
414
+ return None
415
+ packages = Path(local_appdata) / "Microsoft" / "WinGet" / "Packages"
416
+ try:
417
+ candidates = sorted(packages.glob("Gyan.FFmpeg_Microsoft.Winget.Source_*/ffmpeg-*/bin"))
418
+ except OSError:
419
+ return None
420
+ for candidate in candidates:
421
+ try:
422
+ if (candidate / "ffmpeg.exe").is_file() and (candidate / "ffprobe.exe").is_file():
423
+ return str(candidate)
424
+ except OSError:
425
+ continue
426
+ return None
427
+
428
+
410
429
  def _ensure_path_includes_standard_tool_dirs() -> None:
411
430
  """Augment os.environ['PATH'] with common tool install dirs.
412
431
 
@@ -425,6 +444,9 @@ def _ensure_path_includes_standard_tool_dirs() -> None:
425
444
  So the tool was installed, working, and invisible, and `capabilities`
426
445
  reported `whisper_cli.available: false` with no hint as to why (#153, where
427
446
  the workaround that appeared to fix it was a shim placed on PATH by hand).
447
+
448
+ On Windows, a GUI client may also omit WinGet's FFmpeg links from PATH.
449
+ Append the complete package's bin directory so existing tools keep priority.
428
450
  """
429
451
  candidates = [
430
452
  # The venv this server is running from, first: a tool installed
@@ -449,6 +471,12 @@ def _ensure_path_includes_standard_tool_dirs() -> None:
449
471
  script_dir = candidates[0]
450
472
  front = [script_dir] if (script_dir in existing or script_dir in additions) else []
451
473
  ordered = front + [d for d in additions if d != script_dir] + [p for p in parts if p != script_dir]
474
+ if sys.platform == "win32":
475
+ winget_bin = _winget_ffmpeg_bin()
476
+ if winget_bin:
477
+ normalized = os.path.normcase(os.path.normpath(winget_bin))
478
+ if all(os.path.normcase(os.path.normpath(d)) != normalized for d in ordered):
479
+ ordered.append(winget_bin)
452
480
  if ordered != parts:
453
481
  os.environ["PATH"] = os.pathsep.join(ordered)
454
482