davinci-resolve-mcp 2.214.1 → 2.214.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,43 @@
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.214.2 — a running Resolve is counted by its executable path, not only by its argument vector
6
+
7
+ ### Fixed
8
+
9
+ - **`resolve_control runtime_mode` could report `running: false, instances: 0`
10
+ while Resolve was up and answering scripting calls.** Seen on 2026-09-08
11
+ against Studio 19.1.3.7 at the stock macOS path, in the same minute
12
+ `get_version` connected. The scan read only `ps`'s argument-vector column
13
+ and required the line to *end* in the executable after flag stripping, so
14
+ it had a single point of failure that the exact trigger did not need to be
15
+ known to remove: the kernel withholds argv for some processes (`ps` prints
16
+ `(Resolve)`), a launch argument after the path — a project file — is not a
17
+ flag and defeated the suffix test, and `ps` was not asked for wide output.
18
+ The scan now reads two columns keyed by pid: the executable path (`comm`,
19
+ the full path on macOS, readable whenever the process is) decides whether an
20
+ instance exists; the argument vector decides its mode. An instance whose
21
+ argv cannot be read is counted with `headless: null` — never `false`, since
22
+ a wrong "it has a UI" is what makes an agent wait for a dialog that never
23
+ opens, and the tool's callers consult it before every project switch for
24
+ exactly that reason. `ps` is run with `-ww`. The "a shell line that merely
25
+ names the binary is not an instance" rule is kept and extended to the
26
+ unquoted `sh -c /opt/resolve/bin/resolve -nogui` shape.
27
+ - **The exact 2026-09-08 condition was not reproduced.** The same install,
28
+ restarted, matched the old scan. The fix is a removal of the scan's
29
+ dependence on argv parsing, verified against a fake process table built
30
+ from the real `ps` rows of that machine (pid 39560 at the stock path, its
31
+ IOXPC helper beside it), plus the unreadable-argv, positional-argument,
32
+ wide-output and one-column-failing cases.
33
+
34
+ ### Validation
35
+
36
+ - Seven new tests in `tests/test_headless_runtime.py` pin those cases; the
37
+ existing 29 pass unchanged against the new scan (their bare-command-line
38
+ fake tables are read as both columns of one process). Live on this machine:
39
+ `running: true, instances: 1, headless: false` at the stock path. Full
40
+ offline suite, drift guards and the advanced Node suite green.
41
+
5
42
  ## What's New in v2.214.1 — grade calls fail silently off the Color page; apply_trace_plan switches for you
6
43
 
7
44
  ### Fixed
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-2.214.1-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-2.214.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-36%20(353%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-2.214.1-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-2.214.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-36%20(353%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
- > 本翻译对应 v2.214.1 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
15
+ > 本翻译对应 v2.214.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 = "2.214.1"
40
+ VERSION = "2.214.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": "2.214.1",
3
+ "version": "2.214.2",
4
4
  "description": "NPM bootstrapper for the DaVinci Resolve MCP Server.",
5
5
  "license": "MIT",
6
6
  "author": "Samuel Gursky <samgursky@gmail.com>",
@@ -87,7 +87,7 @@ if not logging.getLogger().handlers:
87
87
  handlers=[logging.StreamHandler()],
88
88
  )
89
89
 
90
- VERSION = "2.214.1"
90
+ VERSION = "2.214.2"
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.214.1"
14
+ VERSION = "2.214.2"
15
15
 
16
16
  import base64
17
17
  import os
@@ -29,6 +29,7 @@ from __future__ import annotations
29
29
 
30
30
  import os
31
31
  import platform
32
+ import re
32
33
  import subprocess
33
34
  from typing import Any, Dict, List, Optional
34
35
 
@@ -57,40 +58,103 @@ MACOS_RESOLVE_APPS = (
57
58
  )
58
59
 
59
60
 
60
- def _process_lines() -> Optional[List[str]]:
61
- """Every running command line, or None when that cannot be determined.
61
+ _PID_PREFIX = re.compile(r"^\s*(\d+)\s+(.*)$")
62
+
62
63
 
63
- None rather than an empty list on failure: an unanswerable question must not
64
- become "nothing is running", which is the answer that leads to launching a
65
- second instance on top of a live one.
64
+ def _run_ps(columns: str) -> Optional[List[str]]:
65
+ """`ps -Awwo <columns>` as lines, or None when it cannot be run.
66
+
67
+ `-ww` on purpose: without it BSD ps may cut long command lines to the
68
+ terminal width, and a cut line no longer ends in the executable. Not
69
+ reproduced here (the Resolve path is 70 characters), but the second-
70
+ instance guard should not depend on where a launch argument happens to
71
+ fall relative to a column limit.
66
72
  """
67
73
  try:
68
- if platform.system().lower() == "windows":
69
- # `tasklist` prints no command line, so the flag is invisible there.
70
- # WMIC does print it and is what makes headless detection possible.
71
- #
72
- # Decoded explicitly: `text=True` alone decodes with the locale
73
- # codepage, which raises UnicodeDecodeError on a byte cp1252 has no
74
- # mapping for and this read is the input to the second-instance
75
- # guard, so it must fail to "cannot tell", never to an exception.
76
- # ASCII is byte-identical under both codecs, so the matching this
77
- # feeds is unchanged; what WMIC emits for a non-ASCII install path
78
- # on a non-English Windows is not something we can verify here.
74
+ out = subprocess.run(
75
+ ["ps", "-Awwo", columns], capture_output=True, text=True,
76
+ encoding="utf-8", errors="replace", timeout=10, check=False,
77
+ )
78
+ except Exception: # pragma: no cover - defensive; an unknown answer is None
79
+ return None
80
+ if out.returncode != 0 and not out.stdout:
81
+ return None
82
+ return (out.stdout or "").splitlines()
83
+
84
+
85
+ def _split_pid(line: str, index: int):
86
+ """(pid, field) for a `pid=,<col>=` row; a row with no pid gets a synthetic one.
87
+
88
+ The synthetic pid is the row index, so two column listings of the same
89
+ length join row-by-row. That is what keeps a fake process table written as
90
+ bare command lines (the shape every existing test uses) meaningful: it is
91
+ read as both the executable column and the argv column of one process.
92
+ """
93
+ match = _PID_PREFIX.match(line)
94
+ if match:
95
+ return int(match.group(1)), match.group(2)
96
+ return -(index + 1), line
97
+
98
+
99
+ def _process_table() -> Optional[List[Dict[str, Optional[str]]]]:
100
+ """One row per process: `{pid, comm, args}`, or None when undeterminable.
101
+
102
+ Two columns because they fail independently. `args` is the argument
103
+ vector, the only place `-nogui` is visible — but the kernel refuses to
104
+ expose it for some processes (ps prints `(Resolve)` in parentheses) and a
105
+ launch argument after the path breaks a suffix match on it. `comm` is the
106
+ executable path as the kernel knows it — on macOS the full path — and it
107
+ is readable whenever the process is. An instance is counted on EITHER;
108
+ the mode is read from argv when argv is readable.
109
+
110
+ None rather than an empty list on failure: an unanswerable question must
111
+ not become "nothing is running", which is the answer that leads to
112
+ launching a second instance on top of a live one.
113
+ """
114
+ if platform.system().lower() == "windows":
115
+ # `tasklist` prints no command line, so the flag is invisible there.
116
+ # WMIC does print it and is what makes headless detection possible.
117
+ #
118
+ # Decoded explicitly: `text=True` alone decodes with the locale
119
+ # codepage, which raises UnicodeDecodeError on a byte cp1252 has no
120
+ # mapping for — and this read is the input to the second-instance
121
+ # guard, so it must fail to "cannot tell", never to an exception.
122
+ # ASCII is byte-identical under both codecs, so the matching this
123
+ # feeds is unchanged; what WMIC emits for a non-ASCII install path
124
+ # on a non-English Windows is not something we can verify here.
125
+ try:
79
126
  out = subprocess.run(
80
127
  ["wmic", "process", "where", "name='Resolve.exe'", "get", "CommandLine"],
81
128
  capture_output=True, text=True, encoding="utf-8", errors="replace",
82
129
  timeout=10, check=False,
83
130
  )
84
- else:
85
- out = subprocess.run(
86
- ["ps", "-Ao", "command="], capture_output=True, text=True,
87
- encoding="utf-8", errors="replace", timeout=10, check=False,
88
- )
131
+ except Exception: # pragma: no cover - defensive; an unknown answer is None
132
+ return None
89
133
  if out.returncode != 0 and not out.stdout:
90
134
  return None
91
- return (out.stdout or "").splitlines()
92
- except Exception: # pragma: no cover - defensive; an unknown answer is None
135
+ return [{"pid": -(i + 1), "comm": None, "args": line}
136
+ for i, line in enumerate((out.stdout or "").splitlines())]
137
+
138
+ comm_lines = _run_ps("pid=,comm=")
139
+ args_lines = _run_ps("pid=,args=")
140
+ if comm_lines is None and args_lines is None:
93
141
  return None
142
+ rows: Dict[int, Dict[str, Optional[str]]] = {}
143
+ for index, line in enumerate(comm_lines or []):
144
+ pid, comm = _split_pid(line, index)
145
+ rows.setdefault(pid, {"pid": pid, "comm": None, "args": None})["comm"] = comm
146
+ for index, line in enumerate(args_lines or []):
147
+ pid, args = _split_pid(line, index)
148
+ rows.setdefault(pid, {"pid": pid, "comm": None, "args": None})["args"] = args
149
+ return list(rows.values())
150
+
151
+
152
+ def _process_lines() -> Optional[List[str]]:
153
+ """Argument vectors of every process, kept for callers that read only argv."""
154
+ table = _process_table()
155
+ if table is None:
156
+ return None
157
+ return [row["args"] for row in table if row["args"] is not None]
94
158
 
95
159
 
96
160
  def _matches_pattern(executable: str) -> bool:
@@ -137,6 +201,22 @@ def _executable_from_line(line: str) -> str:
137
201
  close = text.find('"', 1)
138
202
  if close > 1:
139
203
  return text[1:close]
204
+ # A launch ARGUMENT after the path — a project file, most likely — is not a
205
+ # flag, so the flag-stripping loop below leaves it attached and the suffix
206
+ # test fails. If the line STARTS with a path that ends in a Resolve pattern
207
+ # at a token boundary, that path is the executable, whatever follows it.
208
+ # The prefix must contain no quote (a launcher quoting the path) and no
209
+ # flag token (`/bin/sh -c /opt/resolve/bin/resolve` names Resolve without
210
+ # being it), which keeps the "mere mention" cases out.
211
+ for pattern in RESOLVE_PROCESS_PATTERNS:
212
+ cut = text.find(pattern)
213
+ while cut != -1:
214
+ end = cut + len(pattern)
215
+ prefix = text[:end]
216
+ at_boundary = end == len(text) or text[end].isspace()
217
+ if at_boundary and '"' not in prefix and " -" not in prefix:
218
+ return prefix
219
+ cut = text.find(pattern, cut + 1)
140
220
  while True:
141
221
  stripped = text.rstrip()
142
222
  cut = stripped.rfind(" -")
@@ -151,12 +231,42 @@ def _executable_from_line(line: str) -> str:
151
231
  return text
152
232
 
153
233
 
234
+ def _argv_unreadable(args: Optional[str]) -> bool:
235
+ """ps prints `(name)` when the kernel will not hand over the argument vector."""
236
+ if args is None:
237
+ return True
238
+ text = args.strip()
239
+ return text.startswith("(") and text.endswith(")")
240
+
241
+
242
+ def _resolve_rows() -> Optional[List[Dict[str, Optional[str]]]]:
243
+ """Process-table rows that are a running Resolve application."""
244
+ table = _process_table()
245
+ if table is None:
246
+ return None
247
+ matched = []
248
+ for row in table:
249
+ args = row.get("args")
250
+ comm = row.get("comm")
251
+ by_args = args is not None and not _argv_unreadable(args) and _is_resolve_command(args)
252
+ by_comm = comm is not None and _matches_pattern(comm.strip())
253
+ if by_args or by_comm:
254
+ matched.append(row)
255
+ return matched
256
+
257
+
154
258
  def resolve_processes() -> Optional[List[str]]:
155
- """Command lines of running Resolve applications, or None if undeterminable."""
156
- lines = _process_lines()
157
- if lines is None:
259
+ """Command lines of running Resolve applications, or None if undeterminable.
260
+
261
+ A row whose argv is unreadable reports its executable path instead, so a
262
+ caller still sees WHICH Resolve is up even when it cannot see how it was
263
+ started.
264
+ """
265
+ rows = _resolve_rows()
266
+ if rows is None:
158
267
  return None
159
- return [line for line in lines if _is_resolve_command(line)]
268
+ return [row["args"] if not _argv_unreadable(row.get("args")) else (row.get("comm") or "")
269
+ for row in rows]
160
270
 
161
271
 
162
272
  #: Where the scripting library sits relative to the Resolve executable. The
@@ -212,8 +322,8 @@ def runtime_mode() -> Dict[str, Any]:
212
322
  the process list unavailable. Callers must not read None as False; a wrong
213
323
  "it has a UI" is what makes an agent wait for a dialog that will never open.
214
324
  """
215
- processes = resolve_processes()
216
- if processes is None:
325
+ rows = _resolve_rows()
326
+ if rows is None:
217
327
  return {
218
328
  "determinable": False,
219
329
  "running": None,
@@ -221,7 +331,7 @@ def runtime_mode() -> Dict[str, Any]:
221
331
  "instances": None,
222
332
  "command_lines": [],
223
333
  }
224
- if not processes:
334
+ if not rows:
225
335
  return {
226
336
  "determinable": True,
227
337
  "running": False,
@@ -229,15 +339,23 @@ def runtime_mode() -> Dict[str, Any]:
229
339
  "instances": 0,
230
340
  "command_lines": [],
231
341
  }
342
+ readable = [row["args"] for row in rows if not _argv_unreadable(row.get("args"))]
343
+ # Any headless instance makes the reachable one headless: only one Resolve
344
+ # can hold the singleton, so a second is a conflict to report rather than
345
+ # a mode to average. An instance counted on its executable path alone has
346
+ # an argv this process cannot read, so unless another instance shows the
347
+ # flag the mode is UNKNOWN — None, never False: a wrong "it has a UI" is
348
+ # what makes an agent wait for a dialog that will never open.
349
+ headless: Optional[bool] = any(HEADLESS_FLAG in line for line in readable)
350
+ if not headless and len(readable) < len(rows):
351
+ headless = None
232
352
  return {
233
353
  "determinable": True,
234
354
  "running": True,
235
- # Any headless instance makes the reachable one headless: only one
236
- # Resolve can hold the singleton, so a second is a conflict to report
237
- # rather than a mode to average.
238
- "headless": any(HEADLESS_FLAG in line for line in processes),
239
- "instances": len(processes),
240
- "command_lines": processes,
355
+ "headless": headless,
356
+ "instances": len(rows),
357
+ "command_lines": [row["args"] if not _argv_unreadable(row.get("args"))
358
+ else (row.get("comm") or "") for row in rows],
241
359
  }
242
360
 
243
361