@mthines/reaper-mcp 0.103.0 → 0.104.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/main.js CHANGED
@@ -207,6 +207,9 @@ function resolveTelemetry(env = process.env, config = readTelemetryConfig(), des
207
207
  if (!forcedOn && config.telemetry === false) {
208
208
  return { mode: "off", reason: "turned off with `reaper-mcp telemetry off`" };
209
209
  }
210
+ if (env["REAPER_MCP_DISTRIBUTION"] === "plugin" && !forcedOn && config.telemetry !== true) {
211
+ return { mode: "off", reason: "the Claude plugin is opt-in: turn on its telemetry option to share anonymous usage" };
212
+ }
210
213
  if (!destination.token) return { mode: "off", reason: "this build has no built-in telemetry destination" };
211
214
  return {
212
215
  mode: "default",
@@ -9917,6 +9920,82 @@ function registerPluginBuildTools(server) {
9917
9920
  );
9918
9921
  }
9919
9922
 
9923
+ // apps/reaper-mcp-server/src/tool-annotations.ts
9924
+ var READ_PREFIXES = ["get_", "list_", "read_", "analyze_", "search_", "detect_", "measure_"];
9925
+ var READ_EXTRA = /* @__PURE__ */ new Set([
9926
+ "measure_masking",
9927
+ "measure_track_alignment",
9928
+ "verify_edit",
9929
+ "snapshot_list",
9930
+ // Category tools only change which tools are described, never the project
9931
+ "enable_tool_category",
9932
+ "disable_tool_category"
9933
+ ]);
9934
+ var DESTRUCTIVE_PREFIXES = ["delete_", "remove_"];
9935
+ var DESTRUCTIVE_EXTRA = /* @__PURE__ */ new Set([
9936
+ "clear_envelope",
9937
+ "undo_project",
9938
+ "redo_project",
9939
+ "run_action",
9940
+ "run_plan",
9941
+ "save_project",
9942
+ "render_project",
9943
+ "render_versions",
9944
+ "snapshot_restore",
9945
+ "snapshot_delete",
9946
+ "load_fx_chain",
9947
+ "process_items",
9948
+ "freeze_tracks",
9949
+ "unfreeze_tracks",
9950
+ "apply_fx_to_items",
9951
+ // replace a saved file (`overwrite`) or existing points / stretch markers wholesale
9952
+ "save_fx_chain",
9953
+ "save_track_template",
9954
+ "create_transient_automation",
9955
+ "quantize_audio",
9956
+ "align_audio_to_guide",
9957
+ "edit_stretch_markers"
9958
+ ]);
9959
+ var WORDS = {
9960
+ fx: "FX",
9961
+ midi: "MIDI",
9962
+ cc: "CC",
9963
+ pc: "PC",
9964
+ lufs: "LUFS",
9965
+ jsfx: "JSFX",
9966
+ rfx: "RfxChain",
9967
+ fxchain: "FX chain",
9968
+ pcm: "PCM",
9969
+ rpp: "RPP",
9970
+ hlx: "HLX"
9971
+ };
9972
+ function toolTitle(name) {
9973
+ const words = name.split("_").map((w) => WORDS[w] ?? w);
9974
+ const text9 = words.join(" ");
9975
+ return text9.charAt(0).toUpperCase() + text9.slice(1);
9976
+ }
9977
+ var OPEN_WORLD = /* @__PURE__ */ new Set(["list_builtin_knowledge", "get_builtin_knowledge"]);
9978
+ function toolKind(name) {
9979
+ const kind = baseKind(name);
9980
+ return OPEN_WORLD.has(name) ? { ...kind, openWorldHint: true } : kind;
9981
+ }
9982
+ function baseKind(name) {
9983
+ if (DESTRUCTIVE_EXTRA.has(name) || DESTRUCTIVE_PREFIXES.some((p) => name.startsWith(p))) {
9984
+ return { readOnlyHint: false, destructiveHint: true, openWorldHint: false };
9985
+ }
9986
+ if (READ_EXTRA.has(name) || READ_PREFIXES.some((p) => name.startsWith(p))) {
9987
+ return { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
9988
+ }
9989
+ return { readOnlyHint: false, destructiveHint: false, openWorldHint: false };
9990
+ }
9991
+ function annotateTools(server) {
9992
+ const tools = server._registeredTools;
9993
+ for (const [name, tool] of Object.entries(tools)) {
9994
+ tool.title ??= toolTitle(name);
9995
+ tool.annotations = { title: tool.title, ...toolKind(name), ...tool.annotations };
9996
+ }
9997
+ }
9998
+
9920
9999
  // apps/reaper-mcp-server/src/server.ts
9921
10000
  var MAX_STATUS_MESSAGE = 256;
9922
10001
  var TOOL_ERROR_MESSAGE = "reaper.tool.error.message";
@@ -10072,6 +10151,7 @@ function createServer(profile = resolveProfile()) {
10072
10151
  registerPluginResearchTools(server);
10073
10152
  registerJsfxTools(server);
10074
10153
  registerPluginBuildTools(server);
10154
+ annotateTools(server);
10075
10155
  return server;
10076
10156
  }
10077
10157
 
@@ -11041,7 +11121,7 @@ function flagsCommand(args, options = {}) {
11041
11121
 
11042
11122
  // apps/reaper-mcp-server/src/main.ts
11043
11123
  import { existsSync as existsSync13, mkdirSync as mkdirSync13, readFileSync as readFileSync15, realpathSync as realpathSync2, rmSync as rmSync4, writeFileSync as writeFileSync12 } from "node:fs";
11044
- import { join as join21, dirname as dirname12, resolve as resolve3 } from "node:path";
11124
+ import { join as join21, dirname as dirname13, resolve as resolve3 } from "node:path";
11045
11125
  import { fileURLToPath as fileURLToPath6 } from "node:url";
11046
11126
  import { homedir as homedir12, platform as platform6 } from "node:os";
11047
11127
  import { exec as execCb, spawn as spawn3 } from "node:child_process";
@@ -11569,7 +11649,7 @@ function renderDoctor(sections3, opts = {}) {
11569
11649
 
11570
11650
  // apps/reaper-mcp-server/src/bridge-repair.ts
11571
11651
  import { existsSync as existsSync12, mkdirSync as mkdirSync12, readFileSync as readFileSync12, rmSync as rmSync3, writeFileSync as writeFileSync11 } from "node:fs";
11572
- import { join as join19 } from "node:path";
11652
+ import { dirname as dirname12, join as join19 } from "node:path";
11573
11653
  var BRIDGE_VERSION_FILE = "mcp_bridge_version.txt";
11574
11654
  function readBridgeVersion(scriptsDir) {
11575
11655
  try {
@@ -11590,7 +11670,7 @@ function sameContent(a, b) {
11590
11670
  return false;
11591
11671
  }
11592
11672
  }
11593
- function installReaperFiles(paths) {
11673
+ function installReaperFiles(paths, withPage = true) {
11594
11674
  let luaChanged = false;
11595
11675
  for (const asset of REAPER_ASSETS) {
11596
11676
  const src = join19(paths.assetsDir, asset);
@@ -11603,7 +11683,7 @@ function installReaperFiles(paths) {
11603
11683
  installFile(src, dest);
11604
11684
  }
11605
11685
  for (const asset of RETIRED_ASSETS) rmSync3(join19(paths.scriptsDir, asset), { force: true });
11606
- if (existsSync12(join19(paths.wwwSrcDir, BRIDGE_UI_FILE))) copyDirSync(paths.wwwSrcDir, paths.wwwDir);
11686
+ if (withPage && existsSync12(join19(paths.wwwSrcDir, BRIDGE_UI_FILE))) copyDirSync(paths.wwwSrcDir, paths.wwwDir);
11607
11687
  return luaChanged;
11608
11688
  }
11609
11689
  function repairBridgeInstall(paths, version, opts) {
@@ -11611,19 +11691,26 @@ function repairBridgeInstall(paths, version, opts) {
11611
11691
  if (opts.inClone) return { skipped: "clone", ...none };
11612
11692
  const reapack = existsSync12(join19(paths.scriptsDir, "reaper-mcp", "MCP Bridge", "mcp_bridge.lua"));
11613
11693
  const ours = existsSync12(join19(paths.scriptsDir, "mcp_bridge.lua"));
11614
- if (!reapack && !ours) return { skipped: "not_installed", ...none };
11694
+ const first = !reapack && !ours && opts.firstInstall === true && existsSync12(dirname12(paths.scriptsDir));
11695
+ if (!reapack && !ours && !first) return { skipped: "not_installed", ...none };
11615
11696
  const from = readBridgeVersion(paths.scriptsDir);
11616
11697
  if (from && compareVersions(from, version) >= 0) return { skipped: "current", from, ...none };
11617
- const bridgeChanged = reapack ? false : installReaperFiles(paths);
11698
+ const withPage = !opts.firstInstall || existsSync12(join19(paths.wwwDir, BRIDGE_UI_FILE));
11699
+ const bridgeChanged = reapack ? false : installReaperFiles(paths, withPage);
11618
11700
  const startupPath = join19(paths.scriptsDir, "__startup.lua");
11619
11701
  const startup = existsSync12(startupPath) ? readFileSync12(startupPath, "utf-8") : "";
11620
- const { text: text9, changed } = ensureBridgeAutostart(startup);
11702
+ const keepOff = opts.firstInstall === true && !first && !startup.includes(AUTOSTART_MARKER);
11703
+ const { text: text9, changed } = keepOff ? { text: startup, changed: false } : ensureBridgeAutostart(startup);
11621
11704
  if (changed) writeFileSync11(startupPath, text9, "utf-8");
11622
11705
  writeBridgeVersion(paths.scriptsDir, version);
11623
- return { from, bridgeChanged, autostartAdded: !startup.includes(AUTOSTART_MARKER) };
11706
+ return { from, bridgeChanged, autostartAdded: !keepOff && !startup.includes(AUTOSTART_MARKER), ...first && { firstInstalled: true } };
11624
11707
  }
11625
11708
  function repairNotices(repair, version, bridgeRunning) {
11626
11709
  const notices = [];
11710
+ if (repair.firstInstalled) {
11711
+ notices.push(`reaper-mcp installed its bridge ${version} into REAPER (a script in Scripts/, the analyzers in Effects/reaper-mcp/ and a start-with-REAPER block in Scripts/__startup.lua). Restart REAPER and the bridge starts with it; to start it now, load Scripts/mcp_bridge.lua with Actions \u2192 Load ReaScript\u2026. To turn the autostart off, delete the block marked "reaper-mcp: start the bridge with REAPER" from Scripts/__startup.lua.`);
11712
+ return notices;
11713
+ }
11627
11714
  if (repair.bridgeChanged) {
11628
11715
  notices.push(bridgeRunning ? `reaper-mcp updated the REAPER bridge to ${version}, but REAPER is still running the old one: restart REAPER, or click Restart bridge in the bridge window, so it loads the new bridge.` : `reaper-mcp updated the REAPER bridge to ${version}; REAPER loads it the next time the bridge starts.`);
11629
11716
  }
@@ -11790,7 +11877,7 @@ function readInstallInfo(codeDir, current, env = process.env, paths = { statePat
11790
11877
  // apps/reaper-mcp-server/src/main.ts
11791
11878
  var execAsync = promisifyUtil(execCb);
11792
11879
  var ui = createUi();
11793
- var __dirname2 = dirname12(fileURLToPath6(import.meta.url));
11880
+ var __dirname2 = dirname13(fileURLToPath6(import.meta.url));
11794
11881
  async function setup() {
11795
11882
  const verbose = process.argv.includes("--verbose");
11796
11883
  const installedLine = (what, files) => {
@@ -12034,7 +12121,7 @@ async function init(chained = false) {
12034
12121
  const h = HARNESSES.find((x) => x.id === id);
12035
12122
  if (id === "claude") {
12036
12123
  const settingsPath = join21(homedir12(), ".claude", "settings.json");
12037
- mkdirSync13(dirname12(settingsPath), { recursive: true });
12124
+ mkdirSync13(dirname13(settingsPath), { recursive: true });
12038
12125
  console.log(`${ui.mark("ok")} Claude settings (${MCP_TOOL_NAMES.length} REAPER tools allow-listed): ${ensureClaudeSettings(settingsPath)} \u2192 ${ui.dim(settingsPath.replace(homedir12(), "~"))}`);
12039
12126
  if (inClone) {
12040
12127
  const mcpJsonPath = join21(process.cwd(), ".mcp.json");
@@ -12290,7 +12377,7 @@ function repairReaperSide(log) {
12290
12377
  wwwDir: getReaperWwwPath(),
12291
12378
  assetsDir: resolveAssetDir(__dirname2, "reaper"),
12292
12379
  wwwSrcDir: resolveAssetDir(__dirname2, "bridge-ui")
12293
- }, readServiceVersion(), { inClone: findCloneRoot(__dirname2) !== null });
12380
+ }, readServiceVersion(), { inClone: findCloneRoot(__dirname2) !== null, firstInstall: process.env["REAPER_MCP_DISTRIBUTION"] === "plugin" });
12294
12381
  } catch (err) {
12295
12382
  log(`Could not update REAPER's reaper-mcp files: ${err instanceof Error ? err.message : String(err)}`);
12296
12383
  return void 0;
@@ -12341,7 +12428,7 @@ async function serve() {
12341
12428
  const version = readServiceVersion();
12342
12429
  if (repair.bridgeChanged) startupSpan.setAttribute("reaper.bridge.files_updated", true);
12343
12430
  if (repair.autostartAdded) startupSpan.setAttribute("reaper.bridge.autostart_added", true);
12344
- log(`Updated REAPER's reaper-mcp files from ${repair.from ?? "an earlier release"} to ${version}`);
12431
+ log(repair.firstInstalled ? `Installed REAPER's reaper-mcp files (${version})` : `Updated REAPER's reaper-mcp files from ${repair.from ?? "an earlier release"} to ${version}`);
12345
12432
  for (const text9 of repairNotices(repair, version, bridge.state === "connected")) addNotice({ text: text9 });
12346
12433
  }
12347
12434
  const profile = resolveProfile();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mthines/reaper-mcp",
3
- "version": "0.103.0",
3
+ "version": "0.104.0",
4
4
  "type": "module",
5
5
  "description": "MCP server for controlling REAPER DAW — real-time mixing, FX control, and frequency analysis for AI agents",
6
6
  "license": "MIT",
@@ -5794,7 +5794,11 @@ local function open_status_window(url)
5794
5794
  end
5795
5795
 
5796
5796
  local web_port = find_web_port()
5797
- if not web_port then
5797
+ -- A build that never installed the status page (the Claude plugin) has nothing to open and no `reaper-mcp` command
5798
+ local page_installed = file_exists(reaper.GetResourcePath() .. "/reaper_www_root/mcp_bridge.html")
5799
+ if not page_installed then
5800
+ -- nothing to show
5801
+ elseif not web_port then
5798
5802
  reaper.ShowConsoleMsg("MCP Bridge: running. For the status window, quit REAPER and run `reaper-mcp setup` "
5799
5803
  .. "(or enable Preferences > Control/OSC/Web > Web browser interface).\n")
5800
5804
  elseif open_on_start() and not ui_recently_seen() then