@mthines/reaper-mcp 0.93.0 → 0.93.1
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/README.md +45 -45
- package/bridge-ui/mcp_bridge.html +44 -44
- package/main.js +63 -23
- package/package.json +1 -1
- package/reaper/mcp_bridge.lua +2 -0
package/main.js
CHANGED
|
@@ -10352,7 +10352,7 @@ Try it: reaper-mcp extension link ${basename4(r.dir)}`);
|
|
|
10352
10352
|
}
|
|
10353
10353
|
|
|
10354
10354
|
// apps/reaper-mcp-server/src/main.ts
|
|
10355
|
-
import { existsSync as existsSync13, mkdirSync as mkdirSync12, readFileSync as
|
|
10355
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync12, readFileSync as readFileSync13, realpathSync, rmSync as rmSync3, writeFileSync as writeFileSync11 } from "node:fs";
|
|
10356
10356
|
import { join as join20, dirname as dirname12, resolve as resolve3 } from "node:path";
|
|
10357
10357
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
10358
10358
|
import { homedir as homedir11, platform as platform6 } from "node:os";
|
|
@@ -10362,7 +10362,7 @@ import { promisify as promisifyUtil } from "node:util";
|
|
|
10362
10362
|
// apps/reaper-mcp-server/src/update.ts
|
|
10363
10363
|
import { spawn as spawn2 } from "node:child_process";
|
|
10364
10364
|
import { dirname as dirname10, join as join15 } from "node:path";
|
|
10365
|
-
import { existsSync as existsSync9 } from "node:fs";
|
|
10365
|
+
import { existsSync as existsSync9, readFileSync as readFileSync8 } from "node:fs";
|
|
10366
10366
|
|
|
10367
10367
|
// apps/reaper-mcp-server/src/version.ts
|
|
10368
10368
|
function compareVersions(a, b) {
|
|
@@ -10586,6 +10586,14 @@ async function runUpdate(deps) {
|
|
|
10586
10586
|
const { current, log } = deps;
|
|
10587
10587
|
log("==> Checking for a new version");
|
|
10588
10588
|
const latest = await deps.latest();
|
|
10589
|
+
const released = await deps.released?.();
|
|
10590
|
+
const npmHasNewer = latest !== void 0 && compareVersions(latest, current) > 0;
|
|
10591
|
+
if (latest !== void 0 && released && compareVersions(released, current) > 0 && !npmHasNewer && !deps.force) {
|
|
10592
|
+
log(`\u2717 v${released} is released, but npm only offers v${latest} from this computer, so it cannot be installed.`);
|
|
10593
|
+
log(" The release may still be reaching npm (try again in a few minutes), or a security tool or proxy between this computer and npm is hiding new versions (Aikido Device Protection does).");
|
|
10594
|
+
log(` To check: npm install -g ${NPM_PACKAGE}@${released}`);
|
|
10595
|
+
return 1;
|
|
10596
|
+
}
|
|
10589
10597
|
if (!latest) {
|
|
10590
10598
|
log("\u2717 Could not find a version npm can install. Either npm is unreachable (check your internet connection), or the newest release is not published there yet. Try again later.");
|
|
10591
10599
|
return 1;
|
|
@@ -10601,6 +10609,12 @@ async function runUpdate(deps) {
|
|
|
10601
10609
|
log(` npm install -g ${NPM_PACKAGE}@latest`);
|
|
10602
10610
|
return 1;
|
|
10603
10611
|
}
|
|
10612
|
+
const onDisk = deps.installed?.();
|
|
10613
|
+
if (onDisk !== void 0 && compareVersions(onDisk, latest) !== 0) {
|
|
10614
|
+
log(`\u2717 npm finished, but v${onDisk} is still the installed version, not v${latest}. Nothing was changed in REAPER.`);
|
|
10615
|
+
log(` Run this in a terminal to see what npm says: npm install -g ${NPM_PACKAGE}@${latest}`);
|
|
10616
|
+
return 1;
|
|
10617
|
+
}
|
|
10604
10618
|
log("==> Installing into REAPER");
|
|
10605
10619
|
if (await deps.run(deps.node, [deps.cli, "setup", "--yes"]) !== 0) {
|
|
10606
10620
|
log("\u2717 The new version downloaded, but installing it into REAPER failed. Run this in a terminal to see why:");
|
|
@@ -10608,8 +10622,25 @@ async function runUpdate(deps) {
|
|
|
10608
10622
|
return 2;
|
|
10609
10623
|
}
|
|
10610
10624
|
log(`\u2713 Updated to v${latest}`);
|
|
10625
|
+
if (released && compareVersions(released, latest) > 0) {
|
|
10626
|
+
log(` v${released} is released too, but npm does not offer it from this computer yet (it may still be reaching npm, or a security tool is hiding it). Run the update again later.`);
|
|
10627
|
+
}
|
|
10611
10628
|
return 0;
|
|
10612
10629
|
}
|
|
10630
|
+
async function fetchLatestRelease(fetchImpl = fetch, timeoutMs = 3e3) {
|
|
10631
|
+
try {
|
|
10632
|
+
const res = await fetchImpl("https://api.github.com/repos/mthines/reaper-mcp/releases/latest", {
|
|
10633
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
10634
|
+
headers: { accept: "application/vnd.github+json" }
|
|
10635
|
+
});
|
|
10636
|
+
if (!res.ok) return void 0;
|
|
10637
|
+
const tag = (await res.json()).tag_name;
|
|
10638
|
+
const version = typeof tag === "string" ? tag.replace(/^v/, "") : "";
|
|
10639
|
+
return /^\d+\.\d+\.\d+$/.test(version) ? version : void 0;
|
|
10640
|
+
} catch {
|
|
10641
|
+
return void 0;
|
|
10642
|
+
}
|
|
10643
|
+
}
|
|
10613
10644
|
function realUpdateDeps(current, cli, force = false, bridge = false) {
|
|
10614
10645
|
const nodeDir = dirname10(process.execPath);
|
|
10615
10646
|
const npmBeside = join15(nodeDir, process.platform === "win32" ? "npm.cmd" : "npm");
|
|
@@ -10627,6 +10658,15 @@ function realUpdateDeps(current, cli, force = false, bridge = false) {
|
|
|
10627
10658
|
child.on("error", () => resolve4(1));
|
|
10628
10659
|
child.on("close", (code) => resolve4(code ?? 1));
|
|
10629
10660
|
}),
|
|
10661
|
+
released: () => fetchLatestRelease(fetch, 1e4),
|
|
10662
|
+
installed: () => {
|
|
10663
|
+
try {
|
|
10664
|
+
const version = JSON.parse(readFileSync8(join15(dirname10(cli), "package.json"), "utf-8")).version;
|
|
10665
|
+
return typeof version === "string" ? version : void 0;
|
|
10666
|
+
} catch {
|
|
10667
|
+
return void 0;
|
|
10668
|
+
}
|
|
10669
|
+
},
|
|
10630
10670
|
npm: existsSync9(npmBeside) ? npmBeside : "npm",
|
|
10631
10671
|
node: process.execPath,
|
|
10632
10672
|
cli,
|
|
@@ -10638,7 +10678,7 @@ function realUpdateDeps(current, cli, force = false, bridge = false) {
|
|
|
10638
10678
|
|
|
10639
10679
|
// apps/reaper-mcp-server/src/claude-assets.ts
|
|
10640
10680
|
import { createHash as createHash2 } from "node:crypto";
|
|
10641
|
-
import { existsSync as existsSync10, lstatSync, mkdirSync as mkdirSync9, readFileSync as
|
|
10681
|
+
import { existsSync as existsSync10, lstatSync, mkdirSync as mkdirSync9, readFileSync as readFileSync9, readdirSync as readdirSync2, writeFileSync as writeFileSync8 } from "node:fs";
|
|
10642
10682
|
import { dirname as dirname11, join as join16, relative } from "node:path";
|
|
10643
10683
|
var CLAUDE_MANIFEST = ".reaper-mcp-installed.json";
|
|
10644
10684
|
var sha = (buf) => createHash2("sha256").update(buf).digest("hex");
|
|
@@ -10660,7 +10700,7 @@ function isSymlink(path) {
|
|
|
10660
10700
|
}
|
|
10661
10701
|
function readManifest2(path) {
|
|
10662
10702
|
try {
|
|
10663
|
-
const m = JSON.parse(
|
|
10703
|
+
const m = JSON.parse(readFileSync9(path, "utf-8"));
|
|
10664
10704
|
if (m && m.version === 1 && m.files && typeof m.files === "object") return m;
|
|
10665
10705
|
} catch {
|
|
10666
10706
|
}
|
|
@@ -10703,7 +10743,7 @@ function installClaudeAssets(packageClaudeDir, claudeDir, opts = {}) {
|
|
|
10703
10743
|
continue;
|
|
10704
10744
|
}
|
|
10705
10745
|
const key = relative(claudeDir, dest);
|
|
10706
|
-
const content =
|
|
10746
|
+
const content = readFileSync9(src);
|
|
10707
10747
|
const hash = sha(content);
|
|
10708
10748
|
if (!existsSync10(dest)) {
|
|
10709
10749
|
if (!opts.dryRun) {
|
|
@@ -10714,7 +10754,7 @@ function installClaudeAssets(packageClaudeDir, claudeDir, opts = {}) {
|
|
|
10714
10754
|
result.installed.push(key);
|
|
10715
10755
|
continue;
|
|
10716
10756
|
}
|
|
10717
|
-
const current = sha(
|
|
10757
|
+
const current = sha(readFileSync9(dest));
|
|
10718
10758
|
if (current === hash) {
|
|
10719
10759
|
if (!opts.dryRun) manifest.files[key] = hash;
|
|
10720
10760
|
result.unchanged++;
|
|
@@ -10737,7 +10777,7 @@ function installClaudeAssets(packageClaudeDir, claudeDir, opts = {}) {
|
|
|
10737
10777
|
|
|
10738
10778
|
// apps/reaper-mcp-server/src/jsfx/examples.ts
|
|
10739
10779
|
import { createHash as createHash3 } from "node:crypto";
|
|
10740
|
-
import { existsSync as existsSync11, mkdirSync as mkdirSync10, readFileSync as
|
|
10780
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync10, readFileSync as readFileSync10, readdirSync as readdirSync3, writeFileSync as writeFileSync9 } from "node:fs";
|
|
10741
10781
|
import { join as join17 } from "node:path";
|
|
10742
10782
|
var MANIFEST = ".installed.json";
|
|
10743
10783
|
var sha2 = (text8) => createHash3("sha256").update(text8).digest("hex");
|
|
@@ -10748,13 +10788,13 @@ function installExamplePlugins(examplesDir, outDir, toolkit, presetsDir2) {
|
|
|
10748
10788
|
const manifestPath = join17(outDir, MANIFEST);
|
|
10749
10789
|
let manifest = {};
|
|
10750
10790
|
try {
|
|
10751
|
-
manifest = JSON.parse(
|
|
10791
|
+
manifest = JSON.parse(readFileSync10(manifestPath, "utf8"));
|
|
10752
10792
|
} catch {
|
|
10753
10793
|
}
|
|
10754
10794
|
for (const file of readdirSync3(examplesDir).filter((f) => f.endsWith(".jsfx")).sort()) {
|
|
10755
10795
|
const dest = join17(outDir, file);
|
|
10756
|
-
const next = inlineToolkit(
|
|
10757
|
-
const current = existsSync11(dest) ?
|
|
10796
|
+
const next = inlineToolkit(readFileSync10(join17(examplesDir, file), "utf8"), { toolkit, version: 1, request: "a plugin that ships with reaper-mcp", slug: file.replace(/\.jsfx$/, ""), example: true });
|
|
10797
|
+
const current = existsSync11(dest) ? readFileSync10(dest, "utf8") : void 0;
|
|
10758
10798
|
if (current !== void 0 && current !== next && sha2(current) !== manifest[file]) {
|
|
10759
10799
|
result.kept.push(file);
|
|
10760
10800
|
continue;
|
|
@@ -10768,8 +10808,8 @@ function installExamplePlugins(examplesDir, outDir, toolkit, presetsDir2) {
|
|
|
10768
10808
|
for (const file of readdirSync3(examplesDir).filter((f) => f.endsWith(".jsfx")).sort()) {
|
|
10769
10809
|
const presetsPath = join17(examplesDir, file.replace(/\.jsfx$/, ".presets.json"));
|
|
10770
10810
|
if (!existsSync11(presetsPath)) continue;
|
|
10771
|
-
const input = JSON.parse(
|
|
10772
|
-
const { values, errors } = resolvePresets(input, parseSliders(
|
|
10811
|
+
const input = JSON.parse(readFileSync10(presetsPath, "utf8"));
|
|
10812
|
+
const { values, errors } = resolvePresets(input, parseSliders(readFileSync10(join17(examplesDir, file), "utf8")).sliders);
|
|
10773
10813
|
if (errors.length) {
|
|
10774
10814
|
result.presetErrors.push(`${file}: ${errors.join(" ")}`);
|
|
10775
10815
|
continue;
|
|
@@ -10809,12 +10849,12 @@ function renderDoctor(sections3, opts = {}) {
|
|
|
10809
10849
|
}
|
|
10810
10850
|
|
|
10811
10851
|
// apps/reaper-mcp-server/src/bridge-repair.ts
|
|
10812
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync11, readFileSync as
|
|
10852
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync11, readFileSync as readFileSync11, rmSync as rmSync2, writeFileSync as writeFileSync10 } from "node:fs";
|
|
10813
10853
|
import { join as join18 } from "node:path";
|
|
10814
10854
|
var BRIDGE_VERSION_FILE = "mcp_bridge_version.txt";
|
|
10815
10855
|
function readBridgeVersion(scriptsDir) {
|
|
10816
10856
|
try {
|
|
10817
|
-
const v =
|
|
10857
|
+
const v = readFileSync11(join18(scriptsDir, BRIDGE_VERSION_FILE), "utf-8").trim();
|
|
10818
10858
|
return /^\d+\.\d+\.\d+/.test(v) ? v : void 0;
|
|
10819
10859
|
} catch {
|
|
10820
10860
|
return void 0;
|
|
@@ -10826,7 +10866,7 @@ function writeBridgeVersion(scriptsDir, version) {
|
|
|
10826
10866
|
}
|
|
10827
10867
|
function sameContent(a, b) {
|
|
10828
10868
|
try {
|
|
10829
|
-
return
|
|
10869
|
+
return readFileSync11(a).equals(readFileSync11(b));
|
|
10830
10870
|
} catch {
|
|
10831
10871
|
return false;
|
|
10832
10872
|
}
|
|
@@ -10857,7 +10897,7 @@ function repairBridgeInstall(paths, version, opts) {
|
|
|
10857
10897
|
if (from && compareVersions(from, version) >= 0) return { skipped: "current", from, ...none };
|
|
10858
10898
|
const bridgeChanged = reapack ? false : installReaperFiles(paths);
|
|
10859
10899
|
const startupPath = join18(paths.scriptsDir, "__startup.lua");
|
|
10860
|
-
const startup = existsSync12(startupPath) ?
|
|
10900
|
+
const startup = existsSync12(startupPath) ? readFileSync11(startupPath, "utf-8") : "";
|
|
10861
10901
|
const { text: text8, changed } = ensureBridgeAutostart(startup);
|
|
10862
10902
|
if (changed) writeFileSync10(startupPath, text8, "utf-8");
|
|
10863
10903
|
writeBridgeVersion(paths.scriptsDir, version);
|
|
@@ -10908,7 +10948,7 @@ ${SIDECAR_OFFER_TEXT}
|
|
|
10908
10948
|
|
|
10909
10949
|
// apps/reaper-mcp-server/src/setup-health.ts
|
|
10910
10950
|
import { execFile as execFile2 } from "node:child_process";
|
|
10911
|
-
import { readFileSync as
|
|
10951
|
+
import { readFileSync as readFileSync12 } from "node:fs";
|
|
10912
10952
|
import { join as join19 } from "node:path";
|
|
10913
10953
|
import { platform as platform5 } from "node:os";
|
|
10914
10954
|
function heartbeatAgeBucket(ms) {
|
|
@@ -10932,7 +10972,7 @@ function isReaperProcessRunning(timeoutMs = 2e3) {
|
|
|
10932
10972
|
}
|
|
10933
10973
|
function autostartInstalled(scriptsDir) {
|
|
10934
10974
|
try {
|
|
10935
|
-
return
|
|
10975
|
+
return readFileSync12(join19(scriptsDir, "__startup.lua"), "utf-8").includes(AUTOSTART_MARKER);
|
|
10936
10976
|
} catch {
|
|
10937
10977
|
return false;
|
|
10938
10978
|
}
|
|
@@ -11122,7 +11162,7 @@ async function enableWebInterface() {
|
|
|
11122
11162
|
return null;
|
|
11123
11163
|
}
|
|
11124
11164
|
const requested = Number(process.env["REAPER_WEB_PORT"]) || DEFAULT_WEB_PORT;
|
|
11125
|
-
const result = ensureWebInterface(
|
|
11165
|
+
const result = ensureWebInterface(readFileSync13(iniPath, "utf-8"), requested);
|
|
11126
11166
|
if (!result.changed) {
|
|
11127
11167
|
console.log(ui.item("ok", `Already enabled on port ${result.port}`));
|
|
11128
11168
|
return result.port;
|
|
@@ -11137,14 +11177,14 @@ async function enableWebInterface() {
|
|
|
11137
11177
|
console.log(" Quit REAPER to finish (Ctrl+C to skip)...");
|
|
11138
11178
|
while (await isReaperRunning()) await new Promise((r) => setTimeout(r, 1e3));
|
|
11139
11179
|
}
|
|
11140
|
-
writeFileSync11(iniPath, ensureWebInterface(
|
|
11180
|
+
writeFileSync11(iniPath, ensureWebInterface(readFileSync13(iniPath, "utf-8"), requested).ini, "utf-8");
|
|
11141
11181
|
console.log(ui.item("ok", `Enabled on port ${result.port} (override with REAPER_WEB_PORT)`));
|
|
11142
11182
|
return result.port;
|
|
11143
11183
|
}
|
|
11144
11184
|
function installBridgeAutostart(scriptsDir) {
|
|
11145
11185
|
console.log(ui.section("Starting the bridge with REAPER..."));
|
|
11146
11186
|
const path = join20(scriptsDir, "__startup.lua");
|
|
11147
|
-
const { text: text8, changed } = ensureBridgeAutostart(existsSync13(path) ?
|
|
11187
|
+
const { text: text8, changed } = ensureBridgeAutostart(existsSync13(path) ? readFileSync13(path, "utf-8") : "");
|
|
11148
11188
|
if (changed) writeFileSync11(path, text8, "utf-8");
|
|
11149
11189
|
console.log(ui.item("ok", changed ? "Added to Scripts/__startup.lua (REAPER runs it at launch)" : "Already in Scripts/__startup.lua"));
|
|
11150
11190
|
console.log(ui.dim(" Turn it off in the bridge window: Settings > Start with REAPER."));
|
|
@@ -11152,7 +11192,7 @@ function installBridgeAutostart(scriptsDir) {
|
|
|
11152
11192
|
async function registerSnapshotActions() {
|
|
11153
11193
|
console.log(ui.section("Registering snapshot actions (quick save, next, previous)..."));
|
|
11154
11194
|
const kbPath = join20(getReaperResourcePath(), "reaper-kb.ini");
|
|
11155
|
-
const kb = existsSync13(kbPath) ?
|
|
11195
|
+
const kb = existsSync13(kbPath) ? readFileSync13(kbPath, "utf-8") : "";
|
|
11156
11196
|
const { added } = ensureSnapshotActions(kb);
|
|
11157
11197
|
if (!added.length) {
|
|
11158
11198
|
console.log(ui.item("ok", "Already in the Action List"));
|
|
@@ -11307,7 +11347,7 @@ async function doctor() {
|
|
|
11307
11347
|
core2.push(
|
|
11308
11348
|
bridgeRunning ? { label: "Lua bridge", status: "ok", detail: "Connected" } : { label: "Lua bridge", status: "fail", detail: "Not detected", fix: "reaper-mcp setup, then run mcp_bridge.lua in REAPER" }
|
|
11309
11349
|
);
|
|
11310
|
-
const readIfExists = (path) => existsSync13(path) ?
|
|
11350
|
+
const readIfExists = (path) => existsSync13(path) ? readFileSync13(path, "utf-8") : null;
|
|
11311
11351
|
core2.push(autostartCheck(
|
|
11312
11352
|
readIfExists(join20(getReaperScriptsPath(), "__startup.lua")),
|
|
11313
11353
|
readIfExists(join20(getReaperResourcePath(), "reaper-extstate.ini")),
|
package/package.json
CHANGED
package/reaper/mcp_bridge.lua
CHANGED
|
@@ -4901,6 +4901,8 @@ local function control_status()
|
|
|
4901
4901
|
canUpdate = can_update,
|
|
4902
4902
|
-- Where releases come from: "npm" (an npm install updates itself) or "clone" (git pull)
|
|
4903
4903
|
updateSource = update_source,
|
|
4904
|
+
-- This running copy is ReaPack's (Scripts/reaper-mcp/MCP Bridge/): ReaPack, not npm or git, updates the REAPER side
|
|
4905
|
+
reapack = script_path ~= nil and (script_path:gsub("\\", "/")):find("/Scripts/reaper-mcp/MCP Bridge/", 1, true) ~= nil,
|
|
4904
4906
|
-- Developer mode: source changed since the last install, so Rebuild & reload has something to do
|
|
4905
4907
|
changed = source_changed,
|
|
4906
4908
|
update = update,
|