@mthines/reaper-mcp 0.73.0-beta.83.2 → 0.73.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/README.md +42 -46
- package/bridge-ui/mcp_bridge.html +18 -18
- package/main.js +8 -87
- package/package.json +1 -1
- package/reaper/mcp_bridge.lua +3 -13
package/main.js
CHANGED
|
@@ -4453,71 +4453,6 @@ function ensureSnapshotActions(kb) {
|
|
|
4453
4453
|
const body = kb === "" || kb.endsWith("\n") ? kb : kb + eol;
|
|
4454
4454
|
return { kb: body + lines.join(eol) + eol, added };
|
|
4455
4455
|
}
|
|
4456
|
-
var AUTOSTART_MARKER = "reaper-mcp: start the bridge with REAPER";
|
|
4457
|
-
var AUTOSTART_BEGIN = `-- ${AUTOSTART_MARKER} (begin)`;
|
|
4458
|
-
var AUTOSTART_END = `-- ${AUTOSTART_MARKER} (end)`;
|
|
4459
|
-
var AUTOSTART_BLOCK = [
|
|
4460
|
-
AUTOSTART_BEGIN,
|
|
4461
|
-
"-- Written by `reaper-mcp setup`. Turn it off in the bridge window: Settings \u2192 Start with REAPER.",
|
|
4462
|
-
"do",
|
|
4463
|
-
' local bridge = reaper.GetResourcePath() .. "/Scripts/mcp_bridge.lua"',
|
|
4464
|
-
' if reaper.GetExtState("MCPBridge", "cfg_autostart") ~= "0" and reaper.file_exists(bridge) then',
|
|
4465
|
-
" local id = reaper.AddRemoveReaScript(true, 0, bridge, true)",
|
|
4466
|
-
" if id and id > 0 then reaper.Main_OnCommand(id, 0) end",
|
|
4467
|
-
" end",
|
|
4468
|
-
"end",
|
|
4469
|
-
AUTOSTART_END
|
|
4470
|
-
];
|
|
4471
|
-
function ensureBridgeAutostart(startup) {
|
|
4472
|
-
const eol = startup.includes("\r\n") ? "\r\n" : "\n";
|
|
4473
|
-
const block = AUTOSTART_BLOCK.join(eol);
|
|
4474
|
-
const lines = startup.split(/\r?\n/);
|
|
4475
|
-
const begin = lines.indexOf(AUTOSTART_BEGIN);
|
|
4476
|
-
const end = begin === -1 ? -1 : lines.indexOf(AUTOSTART_END, begin);
|
|
4477
|
-
let text7;
|
|
4478
|
-
if (begin !== -1 && end !== -1) {
|
|
4479
|
-
text7 = [...lines.slice(0, begin), ...AUTOSTART_BLOCK, ...lines.slice(end + 1)].join(eol);
|
|
4480
|
-
} else if (startup.trim() === "") {
|
|
4481
|
-
text7 = block + eol;
|
|
4482
|
-
} else {
|
|
4483
|
-
text7 = block + eol + eol + startup;
|
|
4484
|
-
}
|
|
4485
|
-
return { text: text7, changed: text7 !== startup };
|
|
4486
|
-
}
|
|
4487
|
-
function readExtState(ini, section, key) {
|
|
4488
|
-
let inSection = false;
|
|
4489
|
-
for (const line of ini.split(/\r?\n/)) {
|
|
4490
|
-
const header = /^\s*\[(.*)\]\s*$/.exec(line);
|
|
4491
|
-
if (header) {
|
|
4492
|
-
inSection = header[1] === section;
|
|
4493
|
-
} else if (inSection) {
|
|
4494
|
-
const eq = line.indexOf("=");
|
|
4495
|
-
if (eq !== -1 && line.slice(0, eq).trim() === key) return line.slice(eq + 1).trim();
|
|
4496
|
-
}
|
|
4497
|
-
}
|
|
4498
|
-
return void 0;
|
|
4499
|
-
}
|
|
4500
|
-
function autostartCheck(startup, extstate, reaperRunning) {
|
|
4501
|
-
const label = "Start with REAPER";
|
|
4502
|
-
if (startup === null || !startup.includes(AUTOSTART_MARKER)) {
|
|
4503
|
-
return {
|
|
4504
|
-
label,
|
|
4505
|
-
status: "warn",
|
|
4506
|
-
detail: "Not in REAPER's Scripts/__startup.lua: run mcp_bridge.lua by hand in each REAPER session",
|
|
4507
|
-
fix: "reaper-mcp setup"
|
|
4508
|
-
};
|
|
4509
|
-
}
|
|
4510
|
-
const saved = reaperRunning ? " (as REAPER last saved it)" : "";
|
|
4511
|
-
if (extstate !== null && readExtState(extstate, "MCPBridge", "cfg_autostart") === "0") {
|
|
4512
|
-
return {
|
|
4513
|
-
label,
|
|
4514
|
-
status: "info",
|
|
4515
|
-
detail: `Off in the bridge window${saved}: run mcp_bridge.lua by hand in each REAPER session`,
|
|
4516
|
-
fix: "turn it back on in the bridge window: Settings \u2192 Start with REAPER"
|
|
4517
|
-
};
|
|
4518
|
-
}
|
|
4519
|
-
return { label, status: "ok", detail: `On \xB7 REAPER's startup script runs the bridge at launch${saved}` };
|
|
4520
|
-
}
|
|
4521
4456
|
var MCP_TOOL_NAMES = [
|
|
4522
4457
|
// project
|
|
4523
4458
|
"get_project_info",
|
|
@@ -9280,15 +9215,15 @@ async function setup() {
|
|
|
9280
9215
|
} else {
|
|
9281
9216
|
console.log(` Not found: ${join12(wwwSrc, BRIDGE_UI_FILE)} (build bridge-ui first)`);
|
|
9282
9217
|
}
|
|
9283
|
-
installBridgeAutostart(scriptsDir);
|
|
9284
9218
|
const webPort = await enableWebInterface();
|
|
9285
9219
|
await registerSnapshotActions();
|
|
9286
9220
|
console.log("\nSetup complete!\n");
|
|
9287
9221
|
console.log("Next steps:");
|
|
9288
|
-
console.log(" 1.
|
|
9289
|
-
console.log("
|
|
9290
|
-
console.log(`
|
|
9291
|
-
console.log("
|
|
9222
|
+
console.log(" 1. Open REAPER");
|
|
9223
|
+
console.log(" 2. Actions > Show action list > Load ReaScript");
|
|
9224
|
+
console.log(` 3. Select: ${join12(scriptsDir, "mcp_bridge.lua")}`);
|
|
9225
|
+
console.log(" 4. Run the script (it will keep running in background via defer loop)");
|
|
9226
|
+
console.log(" 5. Add reaper-mcp to your Claude Code config (see: reaper-mcp doctor)");
|
|
9292
9227
|
if (webPort) {
|
|
9293
9228
|
console.log(`
|
|
9294
9229
|
The bridge opens its status window on start: http://localhost:${webPort}/${BRIDGE_UI_FILE}`);
|
|
@@ -9340,14 +9275,6 @@ async function enableWebInterface() {
|
|
|
9340
9275
|
console.log(` Enabled on port ${result.port} (override with REAPER_WEB_PORT)`);
|
|
9341
9276
|
return result.port;
|
|
9342
9277
|
}
|
|
9343
|
-
function installBridgeAutostart(scriptsDir) {
|
|
9344
|
-
console.log("\nStarting the bridge with REAPER...");
|
|
9345
|
-
const path = join12(scriptsDir, "__startup.lua");
|
|
9346
|
-
const { text: text7, changed } = ensureBridgeAutostart(existsSync7(path) ? readFileSync5(path, "utf-8") : "");
|
|
9347
|
-
if (changed) writeFileSync5(path, text7, "utf-8");
|
|
9348
|
-
console.log(changed ? " Added to Scripts/__startup.lua (REAPER runs it at launch)" : " Already in Scripts/__startup.lua");
|
|
9349
|
-
console.log(" Turn it off in the bridge window: Settings > Start with REAPER.");
|
|
9350
|
-
}
|
|
9351
9278
|
async function registerSnapshotActions() {
|
|
9352
9279
|
console.log("\nRegistering snapshot actions (quick save, next, previous)...");
|
|
9353
9280
|
const kbPath = join12(getReaperResourcePath(), "reaper-kb.ini");
|
|
@@ -9389,7 +9316,7 @@ async function init() {
|
|
|
9389
9316
|
console.log("\nIf you haven't yet, install the bridge:");
|
|
9390
9317
|
}
|
|
9391
9318
|
console.log(" reaper-mcp setup # Lua bridge + JSFX \u2192 REAPER");
|
|
9392
|
-
console.log("then
|
|
9319
|
+
console.log("then load mcp_bridge.lua in REAPER.");
|
|
9393
9320
|
if (!findCloneRoot(__dirname2)) console.log("\nWant it to remember plugins and your corrections? Connect LoreKit (free): https://lorekit.io. /learn-plugin will walk you through it.");
|
|
9394
9321
|
console.log('\nTry: /mixer "Please gain stage my tracks" \xB7 /critique "Roast my mix"');
|
|
9395
9322
|
}
|
|
@@ -9473,12 +9400,6 @@ async function doctor() {
|
|
|
9473
9400
|
core2.push(
|
|
9474
9401
|
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" }
|
|
9475
9402
|
);
|
|
9476
|
-
const readIfExists = (path) => existsSync7(path) ? readFileSync5(path, "utf-8") : null;
|
|
9477
|
-
core2.push(autostartCheck(
|
|
9478
|
-
readIfExists(join12(getReaperScriptsPath(), "__startup.lua")),
|
|
9479
|
-
readIfExists(join12(getReaperResourcePath(), "reaper-extstate.ini")),
|
|
9480
|
-
await isReaperRunning()
|
|
9481
|
-
));
|
|
9482
9403
|
const globalClaudeDir = join12(homedir8(), ".claude");
|
|
9483
9404
|
const localSkills = existsSync7(join12(process.cwd(), ".claude", "skills", "mixer", "SKILL.md"));
|
|
9484
9405
|
const globalSkills = existsSync7(join12(globalClaudeDir, "skills", "mixer", "SKILL.md"));
|
|
@@ -9730,11 +9651,11 @@ Usage:
|
|
|
9730
9651
|
Quick Start (from npm):
|
|
9731
9652
|
npm install -g @mthines/reaper-mcp
|
|
9732
9653
|
reaper-mcp setup && reaper-mcp init # bridge into REAPER, tools + skills into Claude Code
|
|
9733
|
-
# then
|
|
9654
|
+
# then load mcp_bridge.lua in REAPER (Actions > Load ReaScript > Run)
|
|
9734
9655
|
|
|
9735
9656
|
Quick Start (from your clone):
|
|
9736
9657
|
./scripts/install.sh # build, link CLI, bridge, symlink skills + knowledge, configure
|
|
9737
|
-
# then
|
|
9658
|
+
# then load mcp_bridge.lua in REAPER (Actions > Load ReaScript > Run)
|
|
9738
9659
|
|
|
9739
9660
|
Then in Claude Code:
|
|
9740
9661
|
/mixer "Please gain stage my tracks" \xB7 /critique "Roast my mix"
|
package/package.json
CHANGED
package/reaper/mcp_bridge.lua
CHANGED
|
@@ -4668,7 +4668,6 @@ end
|
|
|
4668
4668
|
|
|
4669
4669
|
-- Settings written by the status page through REAPER's web interface (/_/SET/EXTSTATE...).
|
|
4670
4670
|
-- cfg_paused is in-memory only (resets with REAPER); the others persist in reaper-extstate.ini.
|
|
4671
|
-
-- cfg_autostart is read at REAPER's launch by the startup block setup writes into Scripts/__startup.lua.
|
|
4672
4671
|
local function cfg(key)
|
|
4673
4672
|
return reaper.GetExtState(STATUS_SECTION, key) == "1"
|
|
4674
4673
|
end
|
|
@@ -4693,7 +4692,7 @@ local _, script_path, _, script_cmd_id = reaper.get_action_context()
|
|
|
4693
4692
|
local script_source = script_path and read_file(script_path)
|
|
4694
4693
|
local HEALTH_INTERVAL = 10
|
|
4695
4694
|
local last_health_check = -HEALTH_INTERVAL
|
|
4696
|
-
local health = { sws = false, jsfx = true, outdated = false
|
|
4695
|
+
local health = { sws = false, jsfx = true, outdated = false }
|
|
4697
4696
|
local JSFX_FILES = { "mcp_analyzer.jsfx", "mcp_lufs_meter.jsfx", "mcp_correlation_meter.jsfx", "mcp_crest_factor.jsfx", "mcp_midi_emitter.jsfx" }
|
|
4698
4697
|
|
|
4699
4698
|
local function check_health(now)
|
|
@@ -4711,13 +4710,8 @@ local function check_health(now)
|
|
|
4711
4710
|
missingJsfx = #missing > 0 and missing or nil,
|
|
4712
4711
|
-- The installed script changed under us (setup ran): this running copy is stale until restarted
|
|
4713
4712
|
outdated = script_source ~= nil and installed ~= nil and installed ~= script_source,
|
|
4714
|
-
-- REAPER's startup script holds the block `reaper-mcp setup` writes (AUTOSTART_BLOCK in cli.ts), which
|
|
4715
|
-
-- starts the bridge with REAPER unless the page's cfg_autostart is "0"
|
|
4716
|
-
autostart = ((read_file(reaper.GetResourcePath() .. "/Scripts/__startup.lua") or "")
|
|
4717
|
-
:find("reaper-mcp: start the bridge with REAPER", 1, true)) ~= nil,
|
|
4718
4713
|
}
|
|
4719
|
-
if next_health.sws ~= health.sws or next_health.jsfx ~= health.jsfx or next_health.outdated ~= health.outdated
|
|
4720
|
-
or next_health.autostart ~= health.autostart then
|
|
4714
|
+
if next_health.sws ~= health.sws or next_health.jsfx ~= health.jsfx or next_health.outdated ~= health.outdated then
|
|
4721
4715
|
status_dirty = true
|
|
4722
4716
|
end
|
|
4723
4717
|
health = next_health
|
|
@@ -5300,11 +5294,7 @@ local function publish_status(now, force)
|
|
|
5300
5294
|
deferMs = defer_n > 0 and math.floor(defer_sum / defer_n * 100000 + 0.5) / 100 or 0,
|
|
5301
5295
|
recent = status.recent,
|
|
5302
5296
|
sessions = session_list(),
|
|
5303
|
-
settings = {
|
|
5304
|
-
paused = cfg("cfg_paused"), readonly = cfg("cfg_readonly"), openOnStart = open_on_start(), dev = dev_mode(),
|
|
5305
|
-
-- Start with REAPER: on unless turned off ("0"); read by the startup block, not by this script
|
|
5306
|
-
autostart = reaper.GetExtState(STATUS_SECTION, "cfg_autostart") ~= "0",
|
|
5307
|
-
},
|
|
5297
|
+
settings = { paused = cfg("cfg_paused"), readonly = cfg("cfg_readonly"), openOnStart = open_on_start(), dev = dev_mode() },
|
|
5308
5298
|
health = health,
|
|
5309
5299
|
web = web_watch.status,
|
|
5310
5300
|
control = control_status(),
|