@mthines/reaper-mcp 0.82.1-beta.113.1 → 0.82.1-beta.113.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/README.md +44 -44
- package/main.js +357 -72
- package/package.json +1 -1
- package/sidecar/server.py +14 -4
- package/sidecar/tests/test_chords.py +15 -0
- package/sidecar/tests/test_server.py +13 -0
- package/sidecar/tests/test_voice_render.py +1 -1
- package/sidecar/voice_render.py +4 -2
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
3
|
<picture>
|
|
4
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
5
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/logo-dark.svg">
|
|
5
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/logo.svg" alt="reaper-mcp" width="360">
|
|
6
6
|
</picture>
|
|
7
7
|
|
|
8
8
|
<br><br>
|
|
9
9
|
|
|
10
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
10
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/hero.svg" alt="reaper-mcp — Mix by asking. Type what you hear and an AI mix engineer inside your REAPER session does it." width="100%">
|
|
11
11
|
|
|
12
12
|
<br>
|
|
13
13
|
|
|
@@ -21,7 +21,7 @@ You chat in plain English in Claude Code, by keyboard (or dictation, if you like
|
|
|
21
21
|
[](https://claude.com/claude-code)
|
|
22
22
|
[](https://lorekit.io)
|
|
23
23
|
[](#-install-in-3-steps)
|
|
24
|
-
[](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
24
|
+
[](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/LICENSE)
|
|
25
25
|
|
|
26
26
|
[**Install in 3 steps**](#-install-in-3-steps) · [See it work](#-just-type-what-you-hear) · [What you get](#-why-producers-use-it) · [Watch it work](#-see-what-your-agent-is-doing) · [Extensions](#-extensions-teach-it-your-plugin) · [Clients & models](#-clients-and-models) · [FAQ](#-faq)
|
|
27
27
|
|
|
@@ -48,7 +48,7 @@ with your OS if you prefer, it's the same thing to the agent):
|
|
|
48
48
|
|
|
49
49
|
Here's what happens next:
|
|
50
50
|
|
|
51
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
51
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/session-demo.svg" alt="Illustrative session: the mixer saves a snapshot, measures, cuts the guitars where they mask the vocal, compresses the vocal, re-measures and saves an after snapshot." width="100%">
|
|
52
52
|
|
|
53
53
|
It isn't a preset and it isn't a guess. Before it touches anything it **measures your
|
|
54
54
|
actual tracks** (loudness, spectrum, stereo width, dynamics). It makes the change with
|
|
@@ -96,7 +96,7 @@ handling and dynamics to the style. Just tell it what you're making.
|
|
|
96
96
|
With **[LoreKit](#-lorekit-the-knowledge-core)** as its memory, it keeps what it learns
|
|
97
97
|
about your plugins and your taste, so a correction sticks. It also draws on a shared
|
|
98
98
|
plugin library that grows every time someone
|
|
99
|
-
**[contributes](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
99
|
+
**[contributes](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/knowledge/contributions/README.md)**, you included.
|
|
100
100
|
|
|
101
101
|
</td>
|
|
102
102
|
<td valign="top">
|
|
@@ -113,7 +113,7 @@ or upload anything, and you hear each change as it happens.
|
|
|
113
113
|
|
|
114
114
|
## 🔍 How it works
|
|
115
115
|
|
|
116
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
116
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/how-it-works.svg" alt="You describe what you hear, Claude measures and decides, REAPER changes live. Every change: snapshot, measure, decide, change, re-measure." width="100%">
|
|
117
117
|
|
|
118
118
|
**You stay in charge.** Ask it to explain before it acts, undo anything, or use
|
|
119
119
|
`/critique` for advice without a single change to your project.
|
|
@@ -126,7 +126,7 @@ A mix engineer's value is what they've learned. reaper-mcp keeps all of that in
|
|
|
126
126
|
**[LoreKit](https://lorekit.io)**, a free, open-source memory store for AI agents. It's
|
|
127
127
|
what turns a remote control into an engineer that gets better every session.
|
|
128
128
|
|
|
129
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
129
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/knowledge-core.svg" alt="LoreKit at the center: the mix skills read plugin records and lessons before acting and write back what they learned." width="100%">
|
|
130
130
|
|
|
131
131
|
- 🎛️ **One record per plugin.** What it is, what each knob does, the settings that
|
|
132
132
|
worked and the gotchas. Ask for a plugin it has never seen and it **researches it,
|
|
@@ -141,12 +141,12 @@ what turns a remote control into an engineer that gets better every session.
|
|
|
141
141
|
overwritten. The built-in set comes with the server, read-only, and needs no
|
|
142
142
|
LoreKit account. Connect your own LoreKit to start your layer.
|
|
143
143
|
- 📚 **A built-in plugin library.** FabFilter, Soundtoys, Valhalla, iZotope, Melodyne, the
|
|
144
|
-
REAPER stock plugins and more: see the **[built-in plugin list](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
144
|
+
REAPER stock plugins and more: see the **[built-in plugin list](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/PLUGINS.md)**, and how
|
|
145
145
|
to add yours.
|
|
146
146
|
- 🤝 **Share what you taught it.** Press **Contribute** in the bridge page's Plugins tab
|
|
147
147
|
and your plugin records become a pull request. Once the maintainer approves it, they're
|
|
148
148
|
built in for every reaper-mcp user and added to the
|
|
149
|
-
[plugin list](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
149
|
+
[plugin list](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/PLUGINS.md) ([how it works](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/knowledge/contributions/README.md)).
|
|
150
150
|
Regular contributors can publish straight to built-in, no pull request: ask on
|
|
151
151
|
[Discord](https://discord.gg/Eg8tznuXp4).
|
|
152
152
|
- 🌍 **It follows you.** The memory isn't tied to one project folder. Whatever song
|
|
@@ -161,7 +161,7 @@ what turns a remote control into an engineer that gets better every session.
|
|
|
161
161
|
|
|
162
162
|
## 🚀 Install in 3 steps
|
|
163
163
|
|
|
164
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
164
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/install-steps.svg" alt="1. Get REAPER, Claude Code and Node.js. 2. Paste one command. 3. Click Run on mcp_bridge.lua in REAPER." width="100%">
|
|
165
165
|
|
|
166
166
|
### 1 · Get the apps
|
|
167
167
|
|
|
@@ -259,7 +259,7 @@ instead of just giving advice:
|
|
|
259
259
|
| 🔀 **Routing**: sends, buses, sidechains, hardware outputs | 🎹 **MIDI**: write, edit and analyze notes & CC, live MIDI out | ✂️ **Editing**: split, trim, move, fades, takes, stretch markers |
|
|
260
260
|
| 📍 **Arrangement**: markers, regions, tempo map | 〰️ **Automation**: envelopes, points and pooled automation items | 💾 **Project**: save, render, undo/redo, snapshots, REAPER actions |
|
|
261
261
|
|
|
262
|
-
👉 The main tools by area: **[docs/TOOLS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
262
|
+
👉 The main tools by area: **[docs/TOOLS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/TOOLS.md)**
|
|
263
263
|
|
|
264
264
|
### 🎸 Genre-aware out of the box
|
|
265
265
|
|
|
@@ -287,8 +287,8 @@ it's **just a plugin**: it keeps working with no bridge, no server and no Claude
|
|
|
287
287
|
> ↔️ *"/make-plugin keep everything under 120 Hz in mono and widen the rest"*
|
|
288
288
|
|
|
289
289
|
<p>
|
|
290
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
291
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
290
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/make-plugin-core.png" alt="A generated plugin, Mutate Verb: four large knobs in the core view and a collapsed Advanced header." width="49%">
|
|
291
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/make-plugin-advanced.png" alt="The same plugin with the Advanced drawer open over the core view, showing six more knobs." width="49%">
|
|
292
292
|
</p>
|
|
293
293
|
|
|
294
294
|
- 🎛️ **A simple core, the rest on demand.** A few big knobs up front; everything else lives in an **Advanced** drawer that overlays the view instead of squeezing it.
|
|
@@ -298,7 +298,7 @@ it's **just a plugin**: it keeps working with no bridge, no server and no Claude
|
|
|
298
298
|
- 📏 **Proven by measurement.** It renders with the plugin on and off and checks the audio changed, because a plugin that fails to compile still loads in REAPER.
|
|
299
299
|
- 🗂️ **Easy to find.** Plugins land in your FX list as `… (reaper-mcp)`, and old versions are kept.
|
|
300
300
|
|
|
301
|
-
📖 How it works, the toolkit, the examples and the limits: **[docs/PLUGIN-AUTHORING.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
301
|
+
📖 How it works, the toolkit, the examples and the limits: **[docs/PLUGIN-AUTHORING.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/PLUGIN-AUTHORING.md)**
|
|
302
302
|
|
|
303
303
|
> 🚧 **Coming next:** graphs. Frequency displays with band selection (for an EQ or a multiband
|
|
304
304
|
> compressor), spectrum and gain-reduction meters, and a MIDI keyboard.
|
|
@@ -312,7 +312,7 @@ isn't a knob: a synth's **wavetables**, its **modulation matrix**, a guitar rig'
|
|
|
312
312
|
file**. **Extensions** reach that. They're small add-ons you switch on, and you can have
|
|
313
313
|
Claude build one for the plugin *you* use.
|
|
314
314
|
|
|
315
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
315
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/extensions.svg" alt="Extensions plug into reaper-mcp through a small versioned API: the core on the left, and the Vital, Helix and your-own extensions on the right." width="100%">
|
|
316
316
|
|
|
317
317
|
> 🎹 *"On the Vital on track 2, route LFO 2 to the filter cutoff at 40% and make it a slow triangle."*
|
|
318
318
|
>
|
|
@@ -339,7 +339,7 @@ reaper-mcp extension list # what's installed, and why one can't load
|
|
|
339
339
|
- 🛡️ **A broken extension is skipped**, never a crash, and `reaper-mcp doctor` tells you why.
|
|
340
340
|
- 🧪 **Proven live.** `/new-extension` doesn't finish until the edit shows up in the plugin *and* in the audio.
|
|
341
341
|
|
|
342
|
-
📖 Full guide (the API, Lua handlers, testing, sharing, troubleshooting): **[docs/EXTENSIONS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
342
|
+
📖 Full guide (the API, Lua handlers, testing, sharing, troubleshooting): **[docs/EXTENSIONS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/EXTENSIONS.md)**
|
|
343
343
|
|
|
344
344
|
---
|
|
345
345
|
|
|
@@ -355,7 +355,7 @@ reaper-mcp extension list # what's installed, and why one can't load
|
|
|
355
355
|
- 📊 **Bridge status window.** See every action as it happens, with timing and errors,
|
|
356
356
|
in a small window next to REAPER ([see what it shows](#-see-what-your-agent-is-doing)).
|
|
357
357
|
|
|
358
|
-
📖 What it can and can't do to a session, and what isn't covered: **[docs/SAFETY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
358
|
+
📖 What it can and can't do to a session, and what isn't covered: **[docs/SAFETY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/SAFETY.md)**.
|
|
359
359
|
|
|
360
360
|
---
|
|
361
361
|
|
|
@@ -365,7 +365,7 @@ You shouldn't have to take its word for it. The **bridge window** opens next to
|
|
|
365
365
|
logs every move the agent makes, as it happens: what it did, how long it took and anything
|
|
366
366
|
that went wrong. With several Claude sessions connected, you can see which one did what.
|
|
367
367
|
|
|
368
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
368
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/bridge-status.png" alt="The MCP Bridge status window: uptime, command count, errors, latency, a commands-per-minute timeline, and a live log of tool calls such as read_track_spectrum, set_track_property and snapshot_save, tagged by session." width="100%">
|
|
369
369
|
|
|
370
370
|
<sub>Demo data. Add <code>?demo</code> to the window's address to explore it without REAPER.</sub>
|
|
371
371
|
|
|
@@ -375,7 +375,7 @@ Every call opens a drawer in plain words (*"midnight-drive wrote new points into
|
|
|
375
375
|
automation on track 5"*) with a picture of the change: **before → after** for edits, a
|
|
376
376
|
readout against your target for measurements.
|
|
377
377
|
|
|
378
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
378
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/bridge-drawer.png" alt="The bridge window with a call open in the drawer: Write automation, with a volume envelope drawn before and after, and the params the agent sent." width="100%">
|
|
379
379
|
|
|
380
380
|
### 📈 What it measured
|
|
381
381
|
|
|
@@ -383,14 +383,14 @@ readout against your target for measurements.
|
|
|
383
383
|
<tr>
|
|
384
384
|
<td width="50%" valign="top">
|
|
385
385
|
|
|
386
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
386
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/spectrum.png" alt="The spectrum view: third-octave bands from 25 Hz to 16 kHz as bars, hot bands in amber." width="100%">
|
|
387
387
|
|
|
388
388
|
**Spectrum**<br><sub>Where the energy sits, band by band, judged by perceived loudness. Hot bands turn amber.</sub>
|
|
389
389
|
|
|
390
390
|
</td>
|
|
391
391
|
<td width="50%" valign="top">
|
|
392
392
|
|
|
393
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
393
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/loudness.png" alt="The loudness view: integrated LUFS against a target range on a scale, with short-term, momentary and true peak readouts and the change since the previous call." width="100%">
|
|
394
394
|
|
|
395
395
|
**Loudness**<br><sub>LUFS against your target, true peak, and how it moved since the last measurement.</sub>
|
|
396
396
|
|
|
@@ -399,14 +399,14 @@ readout against your target for measurements.
|
|
|
399
399
|
<tr>
|
|
400
400
|
<td width="50%" valign="top">
|
|
401
401
|
|
|
402
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
402
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/loudness-curve.png" alt="The loudness curve view: short-term loudness over the length of a song against a target line, with the spans over target shaded." width="100%">
|
|
403
403
|
|
|
404
404
|
**Loudness over time**<br><sub>The whole song's loudness, with the stretches that run over target shaded.</sub>
|
|
405
405
|
|
|
406
406
|
</td>
|
|
407
407
|
<td width="50%" valign="top">
|
|
408
408
|
|
|
409
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
409
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/masking.png" alt="The masking view: a heat map of track pairs against frequency bands, with the worst conflicts and which track to cut." width="100%">
|
|
410
410
|
|
|
411
411
|
**Masking**<br><sub>Which tracks fight, at which frequency, and which one should give way.</sub>
|
|
412
412
|
|
|
@@ -415,14 +415,14 @@ readout against your target for measurements.
|
|
|
415
415
|
<tr>
|
|
416
416
|
<td width="50%" valign="top">
|
|
417
417
|
|
|
418
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
418
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/stereo-bands.png" alt="The stereo view: correlation per frequency band on a minus one to plus one scale." width="100%">
|
|
419
419
|
|
|
420
420
|
**Stereo, per band**<br><sub>Phase correlation per band. Catches a wide or out-of-phase low end before it hurts.</sub>
|
|
421
421
|
|
|
422
422
|
</td>
|
|
423
423
|
<td width="50%" valign="top">
|
|
424
424
|
|
|
425
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
425
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/waveform.png" alt="The waveform view: a rendered track drawn on a decibel scale with its peak, RMS and clipped sample count." width="100%">
|
|
426
426
|
|
|
427
427
|
**Waveform**<br><sub>What a rendered track really looks like, with clipping counted.</sub>
|
|
428
428
|
|
|
@@ -438,14 +438,14 @@ Every edit is drawn **before → after**: new in blue, old dashed or ghosted, re
|
|
|
438
438
|
<tr>
|
|
439
439
|
<td width="50%" valign="top">
|
|
440
440
|
|
|
441
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
441
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/mixer.png" alt="The mixer view: every track as a fader with its level in dB, pan, and mute, solo and arm badges, grouped by folder." width="100%">
|
|
442
442
|
|
|
443
443
|
**Mixer**<br><sub>The session as a mixer: folders, levels, pans, mute, solo and arm.</sub>
|
|
444
444
|
|
|
445
445
|
</td>
|
|
446
446
|
<td width="50%" valign="top">
|
|
447
447
|
|
|
448
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
448
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/routing.png" alt="The routing view: a signal-flow diagram of a track's sends, receives and hardware outputs, with added, changed and removed routes marked." width="100%">
|
|
449
449
|
|
|
450
450
|
**Routing**<br><sub>Sends, receives and outputs as signal flow. Thicker wire means louder.</sub>
|
|
451
451
|
|
|
@@ -454,14 +454,14 @@ Every edit is drawn **before → after**: new in blue, old dashed or ghosted, re
|
|
|
454
454
|
<tr>
|
|
455
455
|
<td width="50%" valign="top">
|
|
456
456
|
|
|
457
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
457
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/automation.png" alt="The automation view: a volume envelope with pooled automation items drawn as blocks tinted by pool." width="100%">
|
|
458
458
|
|
|
459
459
|
**Automation**<br><sub>Envelope points and pooled automation items, before and after.</sub>
|
|
460
460
|
|
|
461
461
|
</td>
|
|
462
462
|
<td width="50%" valign="top">
|
|
463
463
|
|
|
464
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
464
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/piano-roll.png" alt="The piano roll view: added notes in blue, unchanged notes in grey, removed notes dashed, and a velocity lane." width="100%">
|
|
465
465
|
|
|
466
466
|
**Piano roll**<br><sub>MIDI edits as a piano roll: added, kept and removed notes, with velocity.</sub>
|
|
467
467
|
|
|
@@ -470,14 +470,14 @@ Every edit is drawn **before → after**: new in blue, old dashed or ghosted, re
|
|
|
470
470
|
<tr>
|
|
471
471
|
<td width="50%" valign="top">
|
|
472
472
|
|
|
473
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
473
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/pins.png" alt="The plugin pins view: track channels wired into a compressor's input pins, with a newly connected sidechain highlighted." width="100%">
|
|
474
474
|
|
|
475
475
|
**Plugin pins**<br><sub>Which track channels feed which plugin pins. Here, a sidechain just got wired in.</sub>
|
|
476
476
|
|
|
477
477
|
</td>
|
|
478
478
|
<td width="50%" valign="top">
|
|
479
479
|
|
|
480
|
-
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.
|
|
480
|
+
<img src="https://raw.githubusercontent.com/mthines/reaper-mcp/v0.82.1-beta.113.2/docs/assets/views/render.png" alt="The render view: three rendered versions of a song with a waveform, LUFS, peak and length for each, against a loudness target." width="100%">
|
|
481
481
|
|
|
482
482
|
**Renders**<br><sub>Every rendered file with its LUFS, peak and length against your target.</sub>
|
|
483
483
|
|
|
@@ -500,7 +500,7 @@ It has no model of its own, so the AI is whichever one your client runs.
|
|
|
500
500
|
| Client | Status |
|
|
501
501
|
|---|---|
|
|
502
502
|
| **Claude Code** | Tested daily. The installer sets it up, and the `/mixer`, `/critique`, `/mastering` and `/editing` skills are written for it. |
|
|
503
|
-
| **Other MCP clients** (Claude Desktop, Cursor, VS Code, …) | Not tested. The tools work from any client that runs a local stdio server: [config](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
503
|
+
| **Other MCP clients** (Claude Desktop, Cursor, VS Code, …) | Not tested. The tools work from any client that runs a local stdio server: [config](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/REFERENCE.md#other-mcp-clients). The skills only load where the client reads `SKILL.md` files. |
|
|
504
504
|
|
|
505
505
|
**Typed or voice?**
|
|
506
506
|
Typed. reaper-mcp never listens to a microphone for instructions: it gets text from your client.
|
|
@@ -525,17 +525,17 @@ Tried one? [Tell us how it went](https://github.com/mthines/reaper-mcp/issues/72
|
|
|
525
525
|
|
|
526
526
|
**What is it trained on?**
|
|
527
527
|
Nothing. There is no reaper-mcp model and nothing is trained on your sessions.
|
|
528
|
-
The skills and [`knowledge/`](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
528
|
+
The skills and [`knowledge/`](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/knowledge/) are plain text: opinions and checklists your model reads, which you can edit or skip.
|
|
529
529
|
Where your data goes:
|
|
530
530
|
|
|
531
531
|
- **Your model** sees what the tools return: track names, FX settings, meter readings, file paths,
|
|
532
532
|
and MIDI notes when a tool reads them.
|
|
533
|
-
Audio stays on your machine; analysis that needs audio runs in the optional local Python sidecar ([`reaper-mcp setup-sidecar`](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
533
|
+
Audio stays on your machine; analysis that needs audio runs in the optional local Python sidecar ([`reaper-mcp setup-sidecar`](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/REFERENCE.md#cli-commands)).
|
|
534
534
|
- **LoreKit, built-in layer:** the skills look up shared plugin knowledge with a public read-only key,
|
|
535
535
|
so search terms such as plugin names reach LoreKit even if you never connect it.
|
|
536
536
|
- **LoreKit, your layer** (only if you connect it) stores what the skills learn about plugins and your preferences.
|
|
537
537
|
- **Usage telemetry** (on by default, [easy to turn off](#-privacy--telemetry)) sends tool names, the kind of
|
|
538
|
-
error and timings, never content. The bridge page has its own switch: [TELEMETRY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
538
|
+
error and timings, never content. The bridge page has its own switch: [TELEMETRY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/TELEMETRY.md#the-bridge-page).
|
|
539
539
|
|
|
540
540
|
---
|
|
541
541
|
|
|
@@ -555,7 +555,7 @@ messages, audio or MIDI. I respect your privacy 🙏
|
|
|
555
555
|
|
|
556
556
|
You're in control: setup asks before anything is sent, and `reaper-mcp telemetry off`
|
|
557
557
|
turns it off for good — no hard feelings. Everything that's collected, and where it
|
|
558
|
-
goes, is in [TELEMETRY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
558
|
+
goes, is in [TELEMETRY.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/TELEMETRY.md).
|
|
559
559
|
|
|
560
560
|
---
|
|
561
561
|
|
|
@@ -603,7 +603,7 @@ explains its reasoning so you can push back.
|
|
|
603
603
|
<br>
|
|
604
604
|
Every edit is a single undo step, and the mix skills snapshot before and after a task. Use
|
|
605
605
|
<code>/critique</code> or read-only mode if you only want advice. Saving a copy of your project
|
|
606
|
-
before a big session never hurts. <a href="https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
606
|
+
before a big session never hurts. <a href="https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/SAFETY.md">What is and isn't guarded</a>.
|
|
607
607
|
</details>
|
|
608
608
|
|
|
609
609
|
<details>
|
|
@@ -611,7 +611,7 @@ before a big session never hurts. <a href="https://github.com/mthines/reaper-mcp
|
|
|
611
611
|
<br>
|
|
612
612
|
Any plugin REAPER can load (VST, VST3, AU, CLAP, JS). It finds what you have installed
|
|
613
613
|
and reaches for the best tool for each job. The ones it already knows are in the
|
|
614
|
-
<a href="https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
614
|
+
<a href="https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/PLUGINS.md">built-in plugin list</a>. When it meets a plugin it doesn't know, it
|
|
615
615
|
researches it, inspects its controls live and saves what it learns to LoreKit. You can
|
|
616
616
|
also teach it one up front with <code>/learn-plugin</code>.
|
|
617
617
|
</details>
|
|
@@ -642,12 +642,12 @@ No. It reads meter values and settings from your running session, not your audio
|
|
|
642
642
|
|
|
643
643
|
## 🛠️ For developers
|
|
644
644
|
|
|
645
|
-
- 📖 **[docs/REFERENCE.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
645
|
+
- 📖 **[docs/REFERENCE.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/REFERENCE.md)**: architecture, install internals, CLI,
|
|
646
646
|
environment variables, telemetry, project structure
|
|
647
|
-
- 🧰 **[docs/TOOLS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
648
|
-
- 🧩 **[docs/EXTENSIONS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
649
|
-
- 🧑💻 **[DEVELOPMENT.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
650
|
-
- 🧪 **[docs/TESTING.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.
|
|
647
|
+
- 🧰 **[docs/TOOLS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/TOOLS.md)**: the main tools by area
|
|
648
|
+
- 🧩 **[docs/EXTENSIONS.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/EXTENSIONS.md)**: write, test and share an extension (the API, Lua handlers, Vital and Helix)
|
|
649
|
+
- 🧑💻 **[DEVELOPMENT.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/DEVELOPMENT.md)**: build, test, run from source, MCP Inspector
|
|
650
|
+
- 🧪 **[docs/TESTING.md](https://github.com/mthines/reaper-mcp/blob/v0.82.1-beta.113.2/docs/TESTING.md)**: end-to-end testing guide
|
|
651
651
|
|
|
652
652
|
```
|
|
653
653
|
Claude Code ⇄ MCP server (TypeScript) ⇄ file IPC ⇄ Lua bridge in REAPER ⇄ ReaScript API + JSFX meters
|
package/main.js
CHANGED
|
@@ -140,6 +140,20 @@ var ALLOWED_SPAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
140
140
|
// (a fixed set: connected, stale, never_started, not_installed, no_reaper — never a path)
|
|
141
141
|
"reaper.bridge.connected",
|
|
142
142
|
"reaper.bridge.state",
|
|
143
|
+
// Whether this start brought REAPER's files up to its release (bridge-repair.ts): the bridge files
|
|
144
|
+
// changed, and the start-with-REAPER block was added (booleans, set only when true)
|
|
145
|
+
"reaper.bridge.files_updated",
|
|
146
|
+
"reaper.bridge.autostart_added",
|
|
147
|
+
// How far setup got, on the startup span (setup-health.ts): whether REAPER is running when the bridge
|
|
148
|
+
// did not answer, the heartbeat's age as a range (<1m … >7d), whether the bridge starts with REAPER,
|
|
149
|
+
// whether the audio sidecar is installed. Booleans and a fixed set of ranges, never a path or a time.
|
|
150
|
+
"reaper.app.running",
|
|
151
|
+
"reaper.bridge.heartbeat_age",
|
|
152
|
+
"reaper.bridge.autostart",
|
|
153
|
+
"reaper.sidecar.installed",
|
|
154
|
+
// A failed tool call's missing setup step, a fixed set (toolErrorCause in server.ts):
|
|
155
|
+
// sidecar_not_installed, bridge_not_running, bridge_outdated
|
|
156
|
+
"reaper.tool.error.cause",
|
|
143
157
|
// detect_key / detect_chords: where they read from and how sure they were, never the key or chords
|
|
144
158
|
"reaper.key.source",
|
|
145
159
|
"reaper.key.confidence",
|
|
@@ -1109,6 +1123,22 @@ function stopPollers() {
|
|
|
1109
1123
|
}
|
|
1110
1124
|
}
|
|
1111
1125
|
|
|
1126
|
+
// apps/reaper-mcp-server/src/notices.ts
|
|
1127
|
+
var NOTICE_HEADING = "Note from reaper-mcp for the user (pass this on; it is not part of the result):";
|
|
1128
|
+
var pending = [];
|
|
1129
|
+
function addNotice(notice) {
|
|
1130
|
+
pending.push(notice);
|
|
1131
|
+
}
|
|
1132
|
+
function withNotices(result) {
|
|
1133
|
+
if (pending.length === 0) return result;
|
|
1134
|
+
const res = result;
|
|
1135
|
+
if (!res || !Array.isArray(res.content)) return result;
|
|
1136
|
+
const notices = pending.splice(0);
|
|
1137
|
+
const text8 = [NOTICE_HEADING, ...notices.map((n) => `- ${n.text}`)].join("\n");
|
|
1138
|
+
for (const n of notices) n.onDelivered?.();
|
|
1139
|
+
return { ...res, content: [...res.content, { type: "text", text: text8 }] };
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1112
1142
|
// apps/reaper-mcp-server/src/tools/project.ts
|
|
1113
1143
|
import { z as z3 } from "zod/v4";
|
|
1114
1144
|
|
|
@@ -5343,7 +5373,7 @@ var SidecarRpcError = class extends Error {
|
|
|
5343
5373
|
}
|
|
5344
5374
|
};
|
|
5345
5375
|
var INVALID_PARAMS = -32602;
|
|
5346
|
-
var REJECTED_INPUT = /^(Audio file not found|Audio too short|Sample rates differ)\b/;
|
|
5376
|
+
var REJECTED_INPUT = /^(Audio file not found|Audio file unreadable|Audio too short|Sample rates differ)\b/;
|
|
5347
5377
|
var NOT_INSTALLED = /^Audio understanding sidecar not installed|\b(audiobox-aesthetics not installed|Stem separation is not installed|FluidSynth native library is not installed)\b/;
|
|
5348
5378
|
function classifySidecarError(err) {
|
|
5349
5379
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -5610,18 +5640,18 @@ var SidecarClientImpl = class {
|
|
|
5610
5640
|
}
|
|
5611
5641
|
return;
|
|
5612
5642
|
}
|
|
5613
|
-
const
|
|
5614
|
-
if (!
|
|
5643
|
+
const pending2 = this.pending.get(response.id);
|
|
5644
|
+
if (!pending2) {
|
|
5615
5645
|
emitLog("warn", `Sidecar response for unknown id ${response.id}`);
|
|
5616
5646
|
return;
|
|
5617
5647
|
}
|
|
5618
5648
|
this.pending.delete(response.id);
|
|
5619
5649
|
if (response.error) {
|
|
5620
|
-
|
|
5650
|
+
pending2.reject(new SidecarRpcError(response.error.message, response.error.code));
|
|
5621
5651
|
} else if (response.result) {
|
|
5622
|
-
|
|
5652
|
+
pending2.resolve(response.result);
|
|
5623
5653
|
} else {
|
|
5624
|
-
|
|
5654
|
+
pending2.reject(new Error("Sidecar response missing both result and error fields"));
|
|
5625
5655
|
}
|
|
5626
5656
|
}
|
|
5627
5657
|
handleProcessDeath() {
|
|
@@ -9424,6 +9454,11 @@ function registerPluginBuildTools(server) {
|
|
|
9424
9454
|
// apps/reaper-mcp-server/src/server.ts
|
|
9425
9455
|
var MAX_STATUS_MESSAGE = 256;
|
|
9426
9456
|
var TOOL_ERROR_MESSAGE = "reaper.tool.error.message";
|
|
9457
|
+
function toolErrorCause(text8) {
|
|
9458
|
+
if (/sidecar not installed|needs the Python sidecar/i.test(text8)) return "sidecar_not_installed";
|
|
9459
|
+
const type = classifyBridgeError(text8.replace(/^Error:\s*/, ""));
|
|
9460
|
+
return type === "bridge_not_running" || type === "bridge_outdated" ? type : void 0;
|
|
9461
|
+
}
|
|
9427
9462
|
function instrumentToolHandlers(server) {
|
|
9428
9463
|
const originalTool = server.tool.bind(server);
|
|
9429
9464
|
server.tool = (...args) => {
|
|
@@ -9452,7 +9487,7 @@ function instrumentToolHandlers(server) {
|
|
|
9452
9487
|
async (span) => {
|
|
9453
9488
|
try {
|
|
9454
9489
|
const { result: collected, outcome } = await trackCallOutcome(() => collectPageLinks(() => originalCb(...cbArgs)));
|
|
9455
|
-
const result = withPageLink(collected.result, collected.links);
|
|
9490
|
+
const result = withNotices(withPageLink(collected.result, collected.links));
|
|
9456
9491
|
const res = result;
|
|
9457
9492
|
if (res?.isError) {
|
|
9458
9493
|
const errorText = res.content?.[0]?.text ?? "Tool error";
|
|
@@ -9461,6 +9496,8 @@ function instrumentToolHandlers(server) {
|
|
|
9461
9496
|
metricAttrs["error.type"] = "tool_error";
|
|
9462
9497
|
span.setAttribute("error.type", "tool_error");
|
|
9463
9498
|
span.setAttribute(TOOL_ERROR_MESSAGE, message);
|
|
9499
|
+
const cause = toolErrorCause(errorText);
|
|
9500
|
+
if (cause) span.setAttribute("reaper.tool.error.cause", cause);
|
|
9464
9501
|
if (regression) span.setStatus({ code: SpanStatusCode3.ERROR, message });
|
|
9465
9502
|
if (!outcome.logged) {
|
|
9466
9503
|
emitLog(
|
|
@@ -10116,10 +10153,10 @@ Try it: reaper-mcp extension link ${basename4(r.dir)}`);
|
|
|
10116
10153
|
}
|
|
10117
10154
|
|
|
10118
10155
|
// apps/reaper-mcp-server/src/main.ts
|
|
10119
|
-
import { existsSync as
|
|
10120
|
-
import { join as
|
|
10156
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync11, readFileSync as readFileSync11, realpathSync, rmSync as rmSync3, writeFileSync as writeFileSync10 } from "node:fs";
|
|
10157
|
+
import { join as join18, dirname as dirname10, resolve as resolve3 } from "node:path";
|
|
10121
10158
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
10122
|
-
import { homedir as
|
|
10159
|
+
import { homedir as homedir10, platform as platform5 } from "node:os";
|
|
10123
10160
|
import { exec as execCb, execFileSync } from "node:child_process";
|
|
10124
10161
|
import { promisify as promisifyUtil } from "node:util";
|
|
10125
10162
|
|
|
@@ -10302,26 +10339,236 @@ function renderDoctor(sections3, opts = {}) {
|
|
|
10302
10339
|
return out2.join("\n");
|
|
10303
10340
|
}
|
|
10304
10341
|
|
|
10342
|
+
// apps/reaper-mcp-server/src/bridge-repair.ts
|
|
10343
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync9, readFileSync as readFileSync8, rmSync as rmSync2, writeFileSync as writeFileSync8 } from "node:fs";
|
|
10344
|
+
import { join as join15 } from "node:path";
|
|
10345
|
+
|
|
10346
|
+
// apps/reaper-mcp-server/src/version.ts
|
|
10347
|
+
function compareVersions(a, b) {
|
|
10348
|
+
const parts = (v) => v.replace(/^v/, "").split("-")[0].split(".").map((n) => parseInt(n, 10) || 0);
|
|
10349
|
+
const [pa, pb] = [parts(a), parts(b)];
|
|
10350
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
10351
|
+
const d = (pa[i] ?? 0) - (pb[i] ?? 0);
|
|
10352
|
+
if (d) return Math.sign(d);
|
|
10353
|
+
}
|
|
10354
|
+
return 0;
|
|
10355
|
+
}
|
|
10356
|
+
|
|
10357
|
+
// apps/reaper-mcp-server/src/bridge-repair.ts
|
|
10358
|
+
var BRIDGE_VERSION_FILE = "mcp_bridge_version.txt";
|
|
10359
|
+
function readBridgeVersion(scriptsDir) {
|
|
10360
|
+
try {
|
|
10361
|
+
const v = readFileSync8(join15(scriptsDir, BRIDGE_VERSION_FILE), "utf-8").trim();
|
|
10362
|
+
return /^\d+\.\d+\.\d+/.test(v) ? v : void 0;
|
|
10363
|
+
} catch {
|
|
10364
|
+
return void 0;
|
|
10365
|
+
}
|
|
10366
|
+
}
|
|
10367
|
+
function writeBridgeVersion(scriptsDir, version) {
|
|
10368
|
+
writeFileSync8(join15(scriptsDir, BRIDGE_VERSION_FILE), `${version}
|
|
10369
|
+
`, "utf-8");
|
|
10370
|
+
}
|
|
10371
|
+
function sameContent(a, b) {
|
|
10372
|
+
try {
|
|
10373
|
+
return readFileSync8(a).equals(readFileSync8(b));
|
|
10374
|
+
} catch {
|
|
10375
|
+
return false;
|
|
10376
|
+
}
|
|
10377
|
+
}
|
|
10378
|
+
function installReaperFiles(paths) {
|
|
10379
|
+
let luaChanged = false;
|
|
10380
|
+
for (const asset of REAPER_ASSETS) {
|
|
10381
|
+
const src = join15(paths.assetsDir, asset);
|
|
10382
|
+
if (!existsSync10(src)) continue;
|
|
10383
|
+
const lua = asset.endsWith(".lua");
|
|
10384
|
+
const destDir = lua ? paths.scriptsDir : join15(paths.effectsDir, "reaper-mcp");
|
|
10385
|
+
mkdirSync9(destDir, { recursive: true });
|
|
10386
|
+
const dest = join15(destDir, asset);
|
|
10387
|
+
if (lua && !sameContent(src, dest)) luaChanged = true;
|
|
10388
|
+
installFile(src, dest);
|
|
10389
|
+
}
|
|
10390
|
+
for (const asset of RETIRED_ASSETS) rmSync2(join15(paths.scriptsDir, asset), { force: true });
|
|
10391
|
+
if (existsSync10(join15(paths.wwwSrcDir, BRIDGE_UI_FILE))) copyDirSync(paths.wwwSrcDir, paths.wwwDir);
|
|
10392
|
+
return luaChanged;
|
|
10393
|
+
}
|
|
10394
|
+
function repairBridgeInstall(paths, version, opts) {
|
|
10395
|
+
const none = { bridgeChanged: false, autostartAdded: false };
|
|
10396
|
+
if (opts.inClone) return { skipped: "clone", ...none };
|
|
10397
|
+
const reapack = existsSync10(join15(paths.scriptsDir, "reaper-mcp", "MCP Bridge", "mcp_bridge.lua"));
|
|
10398
|
+
const ours = existsSync10(join15(paths.scriptsDir, "mcp_bridge.lua"));
|
|
10399
|
+
if (!reapack && !ours) return { skipped: "not_installed", ...none };
|
|
10400
|
+
const from = readBridgeVersion(paths.scriptsDir);
|
|
10401
|
+
if (from && compareVersions(from, version) >= 0) return { skipped: "current", from, ...none };
|
|
10402
|
+
const bridgeChanged = reapack ? false : installReaperFiles(paths);
|
|
10403
|
+
const startupPath = join15(paths.scriptsDir, "__startup.lua");
|
|
10404
|
+
const startup = existsSync10(startupPath) ? readFileSync8(startupPath, "utf-8") : "";
|
|
10405
|
+
const { text: text8, changed } = ensureBridgeAutostart(startup);
|
|
10406
|
+
if (changed) writeFileSync8(startupPath, text8, "utf-8");
|
|
10407
|
+
writeBridgeVersion(paths.scriptsDir, version);
|
|
10408
|
+
return { from, bridgeChanged, autostartAdded: !startup.includes(AUTOSTART_MARKER) };
|
|
10409
|
+
}
|
|
10410
|
+
function repairNotices(repair, version, bridgeRunning) {
|
|
10411
|
+
const notices = [];
|
|
10412
|
+
if (repair.bridgeChanged) {
|
|
10413
|
+
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.`);
|
|
10414
|
+
}
|
|
10415
|
+
if (repair.autostartAdded) {
|
|
10416
|
+
notices.push("The REAPER bridge now starts with REAPER (reaper-mcp added it to REAPER's Scripts/__startup.lua; turn it off in the bridge window under Settings \u2192 Start with REAPER). " + (bridgeRunning ? "It takes effect the next time REAPER starts." : "Start or restart REAPER and the bridge starts with it."));
|
|
10417
|
+
}
|
|
10418
|
+
return notices;
|
|
10419
|
+
}
|
|
10420
|
+
|
|
10421
|
+
// apps/reaper-mcp-server/src/update-check.ts
|
|
10422
|
+
import { mkdirSync as mkdirSync10, readFileSync as readFileSync9, writeFileSync as writeFileSync9 } from "node:fs";
|
|
10423
|
+
import { dirname as dirname9, join as join16 } from "node:path";
|
|
10424
|
+
import { homedir as homedir9 } from "node:os";
|
|
10425
|
+
var NPM_PACKAGE = "@mthines/reaper-mcp";
|
|
10426
|
+
var LATEST_URL = "https://registry.npmjs.org/@mthines%2Freaper-mcp/latest";
|
|
10427
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
10428
|
+
function defaultUpdateStatePath() {
|
|
10429
|
+
return join16(homedir9(), ".reaper-mcp", "update-check.json");
|
|
10430
|
+
}
|
|
10431
|
+
function updateCheckDisabled(env = process.env) {
|
|
10432
|
+
const setting = (env["REAPER_MCP_UPDATE_CHECK"] ?? "").trim().toLowerCase();
|
|
10433
|
+
return ["0", "false", "off", "no"].includes(setting) || Boolean(env["NO_UPDATE_NOTIFIER"]) || Boolean(env["CI"]);
|
|
10434
|
+
}
|
|
10435
|
+
async function fetchLatestVersion(fetchImpl = fetch, timeoutMs = 3e3) {
|
|
10436
|
+
try {
|
|
10437
|
+
const res = await fetchImpl(LATEST_URL, { signal: AbortSignal.timeout(timeoutMs), headers: { accept: "application/json" } });
|
|
10438
|
+
if (!res.ok) return void 0;
|
|
10439
|
+
const body = await res.json();
|
|
10440
|
+
return typeof body.version === "string" && /^\d+\.\d+\.\d+/.test(body.version) ? body.version : void 0;
|
|
10441
|
+
} catch {
|
|
10442
|
+
return void 0;
|
|
10443
|
+
}
|
|
10444
|
+
}
|
|
10445
|
+
function updateNotice(current, latest) {
|
|
10446
|
+
return `reaper-mcp ${latest} is out (this is ${current}). To update, run in a terminal: npm install -g ${NPM_PACKAGE}@latest, then restart Claude Code (or run /mcp). The next start updates the REAPER side too.`;
|
|
10447
|
+
}
|
|
10448
|
+
function readState(path) {
|
|
10449
|
+
try {
|
|
10450
|
+
const s = JSON.parse(readFileSync9(path, "utf-8"));
|
|
10451
|
+
return s && typeof s === "object" ? s : {};
|
|
10452
|
+
} catch {
|
|
10453
|
+
return {};
|
|
10454
|
+
}
|
|
10455
|
+
}
|
|
10456
|
+
function writeState(path, state) {
|
|
10457
|
+
try {
|
|
10458
|
+
mkdirSync10(dirname9(path), { recursive: true });
|
|
10459
|
+
writeFileSync9(path, JSON.stringify(state) + "\n", "utf-8");
|
|
10460
|
+
} catch {
|
|
10461
|
+
}
|
|
10462
|
+
}
|
|
10463
|
+
async function checkForUpdate(opts) {
|
|
10464
|
+
const statePath = opts.statePath ?? defaultUpdateStatePath();
|
|
10465
|
+
const now = opts.now ?? Date.now();
|
|
10466
|
+
const state = readState(statePath);
|
|
10467
|
+
if (state.notifiedAt !== void 0 && now - state.notifiedAt < DAY_MS) return void 0;
|
|
10468
|
+
let latest = state.latest;
|
|
10469
|
+
if (state.checkedAt === void 0 || now - state.checkedAt >= DAY_MS) {
|
|
10470
|
+
latest = await (opts.fetchLatest ?? fetchLatestVersion)() ?? latest;
|
|
10471
|
+
writeState(statePath, { ...state, checkedAt: now, ...latest ? { latest } : {} });
|
|
10472
|
+
}
|
|
10473
|
+
if (!latest || compareVersions(latest, opts.current) <= 0) return void 0;
|
|
10474
|
+
return {
|
|
10475
|
+
latest,
|
|
10476
|
+
text: updateNotice(opts.current, latest),
|
|
10477
|
+
markNotified: () => writeState(statePath, { ...readState(statePath), notifiedAt: Date.now() })
|
|
10478
|
+
};
|
|
10479
|
+
}
|
|
10480
|
+
|
|
10481
|
+
// apps/reaper-mcp-server/src/sidecar-offer.ts
|
|
10482
|
+
import { createInterface as createInterface4 } from "node:readline";
|
|
10483
|
+
var SIDECAR_OFFER_TEXT = "Audio analysis needs the Python sidecar, which this setup does not install: analyze_audio_file, analyze_track_offline, detect_key and detect_chords on audio, detect_transients, separate_stems and the mix checks fail without it. It needs Python 3.10+ and downloads PyTorch (CPU) and audio libraries (~0.5-1 GB; up to ~2.5 GB on Linux), then lets you pick the optional models.";
|
|
10484
|
+
async function offerSidecarSetup(io, installed, install) {
|
|
10485
|
+
if (installed) return "present";
|
|
10486
|
+
io.output.write(`
|
|
10487
|
+
${SIDECAR_OFFER_TEXT}
|
|
10488
|
+
`);
|
|
10489
|
+
if (!io.interactive) {
|
|
10490
|
+
io.output.write(`Add it any time: ${SETUP_SIDECAR_COMMAND}
|
|
10491
|
+
`);
|
|
10492
|
+
return "told";
|
|
10493
|
+
}
|
|
10494
|
+
const rl = createInterface4({ input: io.input, output: io.output, terminal: false });
|
|
10495
|
+
io.output.write("Set it up now? [y/N] ");
|
|
10496
|
+
const answer = await new Promise((resolve4) => {
|
|
10497
|
+
rl.once("line", resolve4);
|
|
10498
|
+
rl.once("close", () => resolve4(""));
|
|
10499
|
+
}).then((a) => a.trim().toLowerCase());
|
|
10500
|
+
rl.close();
|
|
10501
|
+
if (answer !== "y" && answer !== "yes") {
|
|
10502
|
+
io.output.write(`Skipped. Add it any time: ${SETUP_SIDECAR_COMMAND}
|
|
10503
|
+
`);
|
|
10504
|
+
return "declined";
|
|
10505
|
+
}
|
|
10506
|
+
await install();
|
|
10507
|
+
return "installed";
|
|
10508
|
+
}
|
|
10509
|
+
|
|
10510
|
+
// apps/reaper-mcp-server/src/setup-health.ts
|
|
10511
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
10512
|
+
import { readFileSync as readFileSync10 } from "node:fs";
|
|
10513
|
+
import { join as join17 } from "node:path";
|
|
10514
|
+
import { platform as platform4 } from "node:os";
|
|
10515
|
+
function heartbeatAgeBucket(ms) {
|
|
10516
|
+
const min = 6e4;
|
|
10517
|
+
if (ms < min) return "<1m";
|
|
10518
|
+
if (ms < 60 * min) return "1m-1h";
|
|
10519
|
+
if (ms < 24 * 60 * min) return "1h-1d";
|
|
10520
|
+
if (ms < 7 * 24 * 60 * min) return "1d-7d";
|
|
10521
|
+
return ">7d";
|
|
10522
|
+
}
|
|
10523
|
+
function isReaperProcessRunning(timeoutMs = 2e3) {
|
|
10524
|
+
const win = platform4() === "win32";
|
|
10525
|
+
const [cmd, args] = win ? ["tasklist", ["/FI", "IMAGENAME eq reaper.exe", "/NH"]] : ["pgrep", ["-xi", "reaper"]];
|
|
10526
|
+
return new Promise((resolve4) => {
|
|
10527
|
+
execFile2(cmd, args, { timeout: timeoutMs, windowsHide: true }, (err, stdout) => {
|
|
10528
|
+
if (win) return resolve4(err ? void 0 : /reaper\.exe/i.test(String(stdout)));
|
|
10529
|
+
if (!err) return resolve4(true);
|
|
10530
|
+
resolve4(Number(err.code) === 1 ? false : void 0);
|
|
10531
|
+
});
|
|
10532
|
+
});
|
|
10533
|
+
}
|
|
10534
|
+
function autostartInstalled(scriptsDir) {
|
|
10535
|
+
try {
|
|
10536
|
+
return readFileSync10(join17(scriptsDir, "__startup.lua"), "utf-8").includes(AUTOSTART_MARKER);
|
|
10537
|
+
} catch {
|
|
10538
|
+
return false;
|
|
10539
|
+
}
|
|
10540
|
+
}
|
|
10541
|
+
function setupHealthAttributes(h) {
|
|
10542
|
+
const attrs = { "reaper.sidecar.installed": h.sidecarInstalled };
|
|
10543
|
+
const { state, heartbeatAgeMs: heartbeatAgeMs2 } = h.status;
|
|
10544
|
+
if (state === "connected" || state === "stale" || state === "never_started") attrs["reaper.bridge.autostart"] = h.autostart;
|
|
10545
|
+
if (state !== "connected" && h.reaperRunning !== void 0) attrs["reaper.app.running"] = h.reaperRunning;
|
|
10546
|
+
if (state === "stale" && heartbeatAgeMs2 !== void 0) attrs["reaper.bridge.heartbeat_age"] = heartbeatAgeBucket(heartbeatAgeMs2);
|
|
10547
|
+
return attrs;
|
|
10548
|
+
}
|
|
10549
|
+
|
|
10305
10550
|
// apps/reaper-mcp-server/src/main.ts
|
|
10306
10551
|
var execAsync = promisifyUtil(execCb);
|
|
10307
|
-
var __dirname2 =
|
|
10552
|
+
var __dirname2 = dirname10(fileURLToPath6(import.meta.url));
|
|
10308
10553
|
async function setup() {
|
|
10309
10554
|
console.log("REAPER MCP Server \u2014 Setup\n");
|
|
10310
10555
|
const bridgeDir = await ensureBridgeDir();
|
|
10311
10556
|
console.log(`Bridge directory: ${bridgeDir}
|
|
10312
10557
|
`);
|
|
10313
10558
|
const scriptsDir = getReaperScriptsPath();
|
|
10314
|
-
|
|
10559
|
+
mkdirSync11(scriptsDir, { recursive: true });
|
|
10315
10560
|
const reaperDir = resolveAssetDir(__dirname2, "reaper");
|
|
10316
|
-
const filesPlan = setupFilesPlan(
|
|
10561
|
+
const filesPlan = setupFilesPlan(existsSync11(join18(scriptsDir, "reaper-mcp", "MCP Bridge", "mcp_bridge.lua")), findCloneRoot(__dirname2) !== null);
|
|
10317
10562
|
if (filesPlan === "leave") {
|
|
10318
10563
|
console.log("The bridge is installed by ReaPack: leaving its scripts, JSFX and status page to ReaPack.");
|
|
10319
10564
|
console.log("Setup only turns on starting with REAPER and the web interface.\n");
|
|
10320
10565
|
installBridgeAutostart(scriptsDir);
|
|
10566
|
+
writeBridgeVersion(scriptsDir, readServiceVersion());
|
|
10321
10567
|
const port = await enableWebInterface();
|
|
10322
10568
|
console.log("\nSetup complete!\n");
|
|
10323
10569
|
console.log("Restart REAPER (or run the bridge once from the Action List) and add reaper-mcp to Claude Code: reaper-mcp doctor");
|
|
10324
10570
|
if (port) console.log(`The bridge opens its status window on start: http://localhost:${port}/${BRIDGE_UI_FILE}`);
|
|
10571
|
+
await offerSidecar();
|
|
10325
10572
|
return;
|
|
10326
10573
|
}
|
|
10327
10574
|
if (filesPlan === "install-with-warning") {
|
|
@@ -10333,8 +10580,8 @@ async function setup() {
|
|
|
10333
10580
|
console.log("Installing Lua scripts...");
|
|
10334
10581
|
for (const asset of REAPER_ASSETS) {
|
|
10335
10582
|
if (!asset.endsWith(".lua")) continue;
|
|
10336
|
-
const src =
|
|
10337
|
-
const dest =
|
|
10583
|
+
const src = join18(reaperDir, asset);
|
|
10584
|
+
const dest = join18(scriptsDir, asset);
|
|
10338
10585
|
if (installFile(src, dest)) {
|
|
10339
10586
|
console.log(` Installed: ${asset}`);
|
|
10340
10587
|
} else {
|
|
@@ -10342,25 +10589,25 @@ async function setup() {
|
|
|
10342
10589
|
}
|
|
10343
10590
|
}
|
|
10344
10591
|
for (const asset of RETIRED_ASSETS) {
|
|
10345
|
-
const dest =
|
|
10346
|
-
if (
|
|
10347
|
-
|
|
10592
|
+
const dest = join18(scriptsDir, asset);
|
|
10593
|
+
if (existsSync11(dest)) {
|
|
10594
|
+
rmSync3(dest);
|
|
10348
10595
|
console.log(` Removed: ${asset} (retired)`);
|
|
10349
10596
|
}
|
|
10350
10597
|
}
|
|
10351
10598
|
const cloneRoot = findCloneRoot(__dirname2);
|
|
10352
10599
|
if (cloneRoot) {
|
|
10353
10600
|
const dev = isDevClone(await cloneState(cloneRoot));
|
|
10354
|
-
|
|
10601
|
+
writeFileSync10(join18(scriptsDir, "mcp_update.conf"), updateConfigText(cloneRoot, process.execPath, dev));
|
|
10355
10602
|
console.log(` Installed: mcp_update.conf (${dev ? "developer clone: Rebuild & reload" : "one-click updates"} from the status page)`);
|
|
10356
10603
|
}
|
|
10357
|
-
const effectsDir =
|
|
10358
|
-
|
|
10604
|
+
const effectsDir = join18(getReaperEffectsPath(), "reaper-mcp");
|
|
10605
|
+
mkdirSync11(effectsDir, { recursive: true });
|
|
10359
10606
|
console.log("\nInstalling JSFX analyzers...");
|
|
10360
10607
|
for (const asset of REAPER_ASSETS) {
|
|
10361
10608
|
if (asset.endsWith(".lua")) continue;
|
|
10362
|
-
const src =
|
|
10363
|
-
const dest =
|
|
10609
|
+
const src = join18(reaperDir, asset);
|
|
10610
|
+
const dest = join18(effectsDir, asset);
|
|
10364
10611
|
if (installFile(src, dest)) {
|
|
10365
10612
|
console.log(` Installed: reaper-mcp/${asset}`);
|
|
10366
10613
|
} else {
|
|
@@ -10368,8 +10615,8 @@ async function setup() {
|
|
|
10368
10615
|
}
|
|
10369
10616
|
}
|
|
10370
10617
|
console.log("\nInstalling example plugins...");
|
|
10371
|
-
const examplesDir =
|
|
10372
|
-
const examples = installExamplePlugins(examplesDir,
|
|
10618
|
+
const examplesDir = join18(resolveAssetDir(__dirname2, "claude"), "skills", "make-plugin", "examples");
|
|
10619
|
+
const examples = installExamplePlugins(examplesDir, join18(generatedDir(), "examples"), loadToolkit(), presetsDir());
|
|
10373
10620
|
for (const f of examples.installed) console.log(` Installed: reaper-mcp-generated/examples/${f}`);
|
|
10374
10621
|
for (const f of examples.kept) console.log(` Kept your edited copy: reaper-mcp-generated/examples/${f}`);
|
|
10375
10622
|
for (const [f, names] of Object.entries(examples.presets)) if (names.length) console.log(` Presets for ${f}: ${names.join(", ")}`);
|
|
@@ -10377,25 +10624,31 @@ async function setup() {
|
|
|
10377
10624
|
if (!examples.installed.length && !examples.kept.length) console.log(` Not found: ${examplesDir}`);
|
|
10378
10625
|
const wwwSrc = resolveAssetDir(__dirname2, "bridge-ui");
|
|
10379
10626
|
console.log("\nInstalling bridge status UI...");
|
|
10380
|
-
if (
|
|
10627
|
+
if (existsSync11(join18(wwwSrc, BRIDGE_UI_FILE))) {
|
|
10381
10628
|
const count = copyDirSync(wwwSrc, getReaperWwwPath());
|
|
10382
10629
|
console.log(` Installed: reaper_www_root/${BRIDGE_UI_FILE} (+${count - 1} PWA files)`);
|
|
10383
10630
|
} else {
|
|
10384
|
-
console.log(` Not found: ${
|
|
10631
|
+
console.log(` Not found: ${join18(wwwSrc, BRIDGE_UI_FILE)} (build bridge-ui first)`);
|
|
10385
10632
|
}
|
|
10386
10633
|
installBridgeAutostart(scriptsDir);
|
|
10634
|
+
writeBridgeVersion(scriptsDir, readServiceVersion());
|
|
10387
10635
|
const webPort = await enableWebInterface();
|
|
10388
10636
|
await registerSnapshotActions();
|
|
10389
10637
|
console.log("\nSetup complete!\n");
|
|
10390
10638
|
console.log("Next steps:");
|
|
10391
10639
|
console.log(" 1. Start REAPER: the bridge starts with it. If REAPER is already open, restart it,");
|
|
10392
10640
|
console.log(" or run the bridge once by hand: Actions > Show action list > Load ReaScript,");
|
|
10393
|
-
console.log(` select ${
|
|
10641
|
+
console.log(` select ${join18(scriptsDir, "mcp_bridge.lua")} and click Run.`);
|
|
10394
10642
|
console.log(" 2. Add reaper-mcp to your Claude Code config (see: reaper-mcp doctor)");
|
|
10395
10643
|
if (webPort) {
|
|
10396
10644
|
console.log(`
|
|
10397
10645
|
The bridge opens its status window on start: http://localhost:${webPort}/${BRIDGE_UI_FILE}`);
|
|
10398
10646
|
}
|
|
10647
|
+
await offerSidecar();
|
|
10648
|
+
}
|
|
10649
|
+
async function offerSidecar() {
|
|
10650
|
+
const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY) && !process.env["CI"];
|
|
10651
|
+
await offerSidecarSetup({ input: process.stdin, output: process.stdout, interactive }, getSidecarClient().isAvailable(), () => setupSidecar([]));
|
|
10399
10652
|
}
|
|
10400
10653
|
async function cloneState(repo) {
|
|
10401
10654
|
const git = async (args) => (await execAsync(`git -C "${repo}" ${args}`)).stdout.trim();
|
|
@@ -10408,23 +10661,17 @@ async function cloneState(repo) {
|
|
|
10408
10661
|
}
|
|
10409
10662
|
}
|
|
10410
10663
|
async function isReaperRunning() {
|
|
10411
|
-
|
|
10412
|
-
try {
|
|
10413
|
-
const { stdout } = await execAsync(cmd);
|
|
10414
|
-
return platform4() === "win32" ? /reaper\.exe/i.test(stdout) : true;
|
|
10415
|
-
} catch {
|
|
10416
|
-
return false;
|
|
10417
|
-
}
|
|
10664
|
+
return await isReaperProcessRunning(1e4) ?? false;
|
|
10418
10665
|
}
|
|
10419
10666
|
async function enableWebInterface() {
|
|
10420
10667
|
console.log("\nEnabling REAPER web interface...");
|
|
10421
|
-
const iniPath =
|
|
10422
|
-
if (!
|
|
10668
|
+
const iniPath = join18(getReaperResourcePath(), "reaper.ini");
|
|
10669
|
+
if (!existsSync11(iniPath)) {
|
|
10423
10670
|
console.log(` Skipped: ${iniPath} not found (start REAPER once, quit it, then re-run setup)`);
|
|
10424
10671
|
return null;
|
|
10425
10672
|
}
|
|
10426
10673
|
const requested = Number(process.env["REAPER_WEB_PORT"]) || DEFAULT_WEB_PORT;
|
|
10427
|
-
const result = ensureWebInterface(
|
|
10674
|
+
const result = ensureWebInterface(readFileSync11(iniPath, "utf-8"), requested);
|
|
10428
10675
|
if (!result.changed) {
|
|
10429
10676
|
console.log(` Already enabled on port ${result.port}`);
|
|
10430
10677
|
return result.port;
|
|
@@ -10439,41 +10686,41 @@ async function enableWebInterface() {
|
|
|
10439
10686
|
console.log(" Quit REAPER to finish (Ctrl+C to skip)...");
|
|
10440
10687
|
while (await isReaperRunning()) await new Promise((r) => setTimeout(r, 1e3));
|
|
10441
10688
|
}
|
|
10442
|
-
|
|
10689
|
+
writeFileSync10(iniPath, ensureWebInterface(readFileSync11(iniPath, "utf-8"), requested).ini, "utf-8");
|
|
10443
10690
|
console.log(` Enabled on port ${result.port} (override with REAPER_WEB_PORT)`);
|
|
10444
10691
|
return result.port;
|
|
10445
10692
|
}
|
|
10446
10693
|
function installBridgeAutostart(scriptsDir) {
|
|
10447
10694
|
console.log("\nStarting the bridge with REAPER...");
|
|
10448
|
-
const path =
|
|
10449
|
-
const { text: text8, changed } = ensureBridgeAutostart(
|
|
10450
|
-
if (changed)
|
|
10695
|
+
const path = join18(scriptsDir, "__startup.lua");
|
|
10696
|
+
const { text: text8, changed } = ensureBridgeAutostart(existsSync11(path) ? readFileSync11(path, "utf-8") : "");
|
|
10697
|
+
if (changed) writeFileSync10(path, text8, "utf-8");
|
|
10451
10698
|
console.log(changed ? " Added to Scripts/__startup.lua (REAPER runs it at launch)" : " Already in Scripts/__startup.lua");
|
|
10452
10699
|
console.log(" Turn it off in the bridge window: Settings > Start with REAPER.");
|
|
10453
10700
|
}
|
|
10454
10701
|
async function registerSnapshotActions() {
|
|
10455
10702
|
console.log("\nRegistering snapshot actions (quick save, next, previous)...");
|
|
10456
|
-
const kbPath =
|
|
10457
|
-
const kb =
|
|
10703
|
+
const kbPath = join18(getReaperResourcePath(), "reaper-kb.ini");
|
|
10704
|
+
const kb = existsSync11(kbPath) ? readFileSync11(kbPath, "utf-8") : "";
|
|
10458
10705
|
const { added } = ensureSnapshotActions(kb);
|
|
10459
10706
|
if (!added.length) {
|
|
10460
10707
|
console.log(" Already in the Action List");
|
|
10461
10708
|
} else if (await isReaperRunning()) {
|
|
10462
10709
|
console.log(" REAPER is running: the bridge adds them when it next starts (re-run mcp_bridge.lua).");
|
|
10463
10710
|
} else {
|
|
10464
|
-
|
|
10711
|
+
writeFileSync10(kbPath, ensureSnapshotActions(kb).kb, "utf-8");
|
|
10465
10712
|
console.log(` Added: ${added.join(", ")}`);
|
|
10466
10713
|
}
|
|
10467
10714
|
console.log(' Bind keys in Actions > Show action list: search "mcp_snapshot".');
|
|
10468
10715
|
}
|
|
10469
10716
|
async function init() {
|
|
10470
10717
|
console.log("REAPER MCP \u2014 Configure Claude Code\n");
|
|
10471
|
-
const settingsPath =
|
|
10472
|
-
|
|
10718
|
+
const settingsPath = join18(homedir10(), ".claude", "settings.json");
|
|
10719
|
+
mkdirSync11(dirname10(settingsPath), { recursive: true });
|
|
10473
10720
|
const result = ensureClaudeSettings(settingsPath);
|
|
10474
10721
|
console.log(`Claude settings (${MCP_TOOL_NAMES.length} REAPER tools allow-listed): ${result} \u2192 ${settingsPath}`);
|
|
10475
10722
|
if (findCloneRoot(__dirname2)) {
|
|
10476
|
-
const mcpJsonPath =
|
|
10723
|
+
const mcpJsonPath = join18(process.cwd(), ".mcp.json");
|
|
10477
10724
|
if (createMcpJson(mcpJsonPath, resolve3(process.argv[1]))) {
|
|
10478
10725
|
console.log(`Created: ${mcpJsonPath}`);
|
|
10479
10726
|
} else {
|
|
@@ -10497,7 +10744,7 @@ async function init() {
|
|
|
10497
10744
|
console.log('\nTry: /mixer "Please gain stage my tracks" \xB7 /critique "Roast my mix"');
|
|
10498
10745
|
}
|
|
10499
10746
|
function registerUserMcpServer() {
|
|
10500
|
-
const claudeJson =
|
|
10747
|
+
const claudeJson = join18(homedir10(), ".claude.json");
|
|
10501
10748
|
const registered = hasUserMcpServer(claudeJson);
|
|
10502
10749
|
if (registered && !userMcpServerIsStale(claudeJson)) {
|
|
10503
10750
|
console.log('Claude Code already knows REAPER (user-scope server "reaper" is registered).');
|
|
@@ -10522,13 +10769,13 @@ function installSkills(dryRun = false) {
|
|
|
10522
10769
|
console.log("Running from a clone: scripts/sync-symlinks.sh links the skills and knowledge into ~/.claude.");
|
|
10523
10770
|
return;
|
|
10524
10771
|
}
|
|
10525
|
-
const src =
|
|
10526
|
-
if (!
|
|
10772
|
+
const src = join18(resolveAssetDir(__dirname2, "claude"));
|
|
10773
|
+
if (!existsSync11(src)) {
|
|
10527
10774
|
console.log(`Skills not found: ${src} (this build has no claude/ folder)`);
|
|
10528
10775
|
process.exitCode = 1;
|
|
10529
10776
|
return;
|
|
10530
10777
|
}
|
|
10531
|
-
const r = installClaudeAssets(src,
|
|
10778
|
+
const r = installClaudeAssets(src, join18(homedir10(), ".claude"), { dryRun });
|
|
10532
10779
|
const verb = dryRun ? "Would install" : "Installed";
|
|
10533
10780
|
console.log(`${verb} the mix skills, agents and knowledge in ~/.claude: ${r.installed.length} new, ${r.updated.length} updated, ${r.unchanged} already current.`);
|
|
10534
10781
|
for (const s of r.skipped) {
|
|
@@ -10576,25 +10823,25 @@ async function doctor() {
|
|
|
10576
10823
|
core2.push(
|
|
10577
10824
|
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" }
|
|
10578
10825
|
);
|
|
10579
|
-
const readIfExists = (path) =>
|
|
10826
|
+
const readIfExists = (path) => existsSync11(path) ? readFileSync11(path, "utf-8") : null;
|
|
10580
10827
|
core2.push(autostartCheck(
|
|
10581
|
-
readIfExists(
|
|
10582
|
-
readIfExists(
|
|
10828
|
+
readIfExists(join18(getReaperScriptsPath(), "__startup.lua")),
|
|
10829
|
+
readIfExists(join18(getReaperResourcePath(), "reaper-extstate.ini")),
|
|
10583
10830
|
await isReaperRunning()
|
|
10584
10831
|
));
|
|
10585
|
-
const globalClaudeDir =
|
|
10586
|
-
const localSkills =
|
|
10587
|
-
const globalSkills =
|
|
10832
|
+
const globalClaudeDir = join18(homedir10(), ".claude");
|
|
10833
|
+
const localSkills = existsSync11(join18(process.cwd(), ".claude", "skills", "mixer", "SKILL.md"));
|
|
10834
|
+
const globalSkills = existsSync11(join18(globalClaudeDir, "skills", "mixer", "SKILL.md"));
|
|
10588
10835
|
core2.push(
|
|
10589
10836
|
localSkills || globalSkills ? { label: "Mix skills", status: "ok", detail: localSkills ? ".claude/skills" : "~/.claude/skills" } : { label: "Mix skills", status: "fail", detail: "Not linked", fix: findCloneRoot(__dirname2) ? "scripts/sync-symlinks.sh (from your clone)" : "reaper-mcp install-skills" }
|
|
10590
10837
|
);
|
|
10591
|
-
const localKnowledge =
|
|
10592
|
-
const knowledgeLinked = localKnowledge ||
|
|
10838
|
+
const localKnowledge = existsSync11(join18(process.cwd(), ".claude", "knowledge"));
|
|
10839
|
+
const knowledgeLinked = localKnowledge || existsSync11(join18(globalClaudeDir, "knowledge"));
|
|
10593
10840
|
core2.push(
|
|
10594
10841
|
knowledgeLinked ? { label: "Knowledge base", status: "ok", detail: localKnowledge ? ".claude/knowledge" : "~/.claude/knowledge" } : { label: "Knowledge base", status: "fail", detail: "Not linked", fix: findCloneRoot(__dirname2) ? "scripts/sync-symlinks.sh (from your clone)" : "reaper-mcp install-skills" }
|
|
10595
10842
|
);
|
|
10596
|
-
const userServer = hasUserMcpServer(
|
|
10597
|
-
const mcpJsonExists =
|
|
10843
|
+
const userServer = hasUserMcpServer(join18(homedir10(), ".claude.json"));
|
|
10844
|
+
const mcpJsonExists = existsSync11(join18(process.cwd(), ".mcp.json"));
|
|
10598
10845
|
const mcpRegistered = userServer || mcpJsonExists;
|
|
10599
10846
|
core2.push(
|
|
10600
10847
|
mcpRegistered ? { label: "MCP config", status: "ok", detail: userServer ? "Registered for your user (any folder)" : ".mcp.json in this folder" } : { label: "MCP config", status: "fail", detail: "Not registered", fix: findCloneRoot(__dirname2) ? "scripts/install.sh (from your clone)" : "reaper-mcp init" }
|
|
@@ -10606,11 +10853,11 @@ async function doctor() {
|
|
|
10606
10853
|
status: "info",
|
|
10607
10854
|
detail: { default: "On, pseudonymous \xB7 turn off: reaper-mcp telemetry off", custom: "Your own OTEL_* destination", off: "Off" }[telemetry]
|
|
10608
10855
|
});
|
|
10609
|
-
const sidecarVenvPath =
|
|
10610
|
-
const venvBin =
|
|
10611
|
-
const venvPythonName =
|
|
10612
|
-
const venvPython =
|
|
10613
|
-
const hfCachePath =
|
|
10856
|
+
const sidecarVenvPath = join18(homedir10(), ".reaper-mcp", "sidecar-venv");
|
|
10857
|
+
const venvBin = platform5() === "win32" ? "Scripts" : "bin";
|
|
10858
|
+
const venvPythonName = platform5() === "win32" ? "python.exe" : "python";
|
|
10859
|
+
const venvPython = join18(sidecarVenvPath, venvBin, venvPythonName);
|
|
10860
|
+
const hfCachePath = join18(homedir10(), ".cache", "huggingface", "hub");
|
|
10614
10861
|
let pythonOk = false;
|
|
10615
10862
|
let pythonDetail = "Not found";
|
|
10616
10863
|
try {
|
|
@@ -10627,9 +10874,9 @@ async function doctor() {
|
|
|
10627
10874
|
} catch {
|
|
10628
10875
|
pythonDetail = "Not found";
|
|
10629
10876
|
}
|
|
10630
|
-
const venvExists =
|
|
10877
|
+
const venvExists = existsSync11(sidecarVenvPath);
|
|
10631
10878
|
let depsOk = false;
|
|
10632
|
-
if (venvExists &&
|
|
10879
|
+
if (venvExists && existsSync11(venvPython)) {
|
|
10633
10880
|
try {
|
|
10634
10881
|
await execAsync(`"${venvPython}" -c "import audiobox_aesthetics.infer"`);
|
|
10635
10882
|
depsOk = true;
|
|
@@ -10643,14 +10890,14 @@ async function doctor() {
|
|
|
10643
10890
|
addOns.demucs = found.separation;
|
|
10644
10891
|
addOns.lv_chordia = found.chords;
|
|
10645
10892
|
}
|
|
10646
|
-
const weightsPath =
|
|
10647
|
-
const weightsExist =
|
|
10893
|
+
const weightsPath = join18(hfCachePath, "models--facebook--audiobox-aesthetics");
|
|
10894
|
+
const weightsExist = existsSync11(weightsPath);
|
|
10648
10895
|
const sidecarReady = venvExists && depsOk;
|
|
10649
10896
|
const sidecarOptedIn = venvExists;
|
|
10650
10897
|
const sidecarBroken = sidecarOptedIn && !sidecarReady;
|
|
10651
10898
|
const missing = sidecarOptedIn ? "fail" : "info";
|
|
10652
10899
|
const repair = "reaper-mcp setup-sidecar";
|
|
10653
|
-
const home = (p) => p.replace(
|
|
10900
|
+
const home = (p) => p.replace(homedir10(), "~");
|
|
10654
10901
|
const sidecar = {
|
|
10655
10902
|
title: "Python sidecar",
|
|
10656
10903
|
note: "optional \xB7 lets Claude listen to the audio",
|
|
@@ -10688,6 +10935,28 @@ async function doctor() {
|
|
|
10688
10935
|
console.log(renderDoctor(sections3, { version: readServiceVersion(), color: useColor() }));
|
|
10689
10936
|
process.exit(bridgeRunning && knowledgeLinked && mcpRegistered && !sidecarBroken && !extensionsBroken ? 0 : 1);
|
|
10690
10937
|
}
|
|
10938
|
+
function notifyNewerRelease(log) {
|
|
10939
|
+
if (findCloneRoot(__dirname2) || updateCheckDisabled()) return;
|
|
10940
|
+
checkForUpdate({ current: readServiceVersion() }).then((update) => {
|
|
10941
|
+
if (!update) return;
|
|
10942
|
+
log(`reaper-mcp ${update.latest} is available (this is ${readServiceVersion()})`);
|
|
10943
|
+
addNotice({ text: update.text, onDelivered: update.markNotified });
|
|
10944
|
+
}).catch(() => void 0);
|
|
10945
|
+
}
|
|
10946
|
+
function repairReaperSide(log) {
|
|
10947
|
+
try {
|
|
10948
|
+
return repairBridgeInstall({
|
|
10949
|
+
scriptsDir: getReaperScriptsPath(),
|
|
10950
|
+
effectsDir: getReaperEffectsPath(),
|
|
10951
|
+
wwwDir: getReaperWwwPath(),
|
|
10952
|
+
assetsDir: resolveAssetDir(__dirname2, "reaper"),
|
|
10953
|
+
wwwSrcDir: resolveAssetDir(__dirname2, "bridge-ui")
|
|
10954
|
+
}, readServiceVersion(), { inClone: findCloneRoot(__dirname2) !== null });
|
|
10955
|
+
} catch (err) {
|
|
10956
|
+
log(`Could not update REAPER's reaper-mcp files: ${err instanceof Error ? err.message : String(err)}`);
|
|
10957
|
+
return void 0;
|
|
10958
|
+
}
|
|
10959
|
+
}
|
|
10691
10960
|
async function serve() {
|
|
10692
10961
|
const log = (...args) => console.error("[reaper-mcp]", ...args);
|
|
10693
10962
|
await initTelemetry();
|
|
@@ -10705,6 +10974,7 @@ async function serve() {
|
|
|
10705
10974
|
startupSpan.setAttribute("reaper.bridge.stale_files_cleaned", cleaned);
|
|
10706
10975
|
log(`Cleaned up ${cleaned} stale bridge files`);
|
|
10707
10976
|
}
|
|
10977
|
+
const repair = repairReaperSide(log);
|
|
10708
10978
|
const bridge = await tracer.startActiveSpan("check bridge connection", { kind: SpanKind5.INTERNAL }, async (bridgeSpan) => {
|
|
10709
10979
|
const status = await getBridgeState();
|
|
10710
10980
|
const running = status.state === "connected";
|
|
@@ -10726,6 +10996,14 @@ async function serve() {
|
|
|
10726
10996
|
});
|
|
10727
10997
|
startupSpan.setAttribute("reaper.bridge.connected", bridge.state === "connected");
|
|
10728
10998
|
startupSpan.setAttribute("reaper.bridge.state", bridge.state);
|
|
10999
|
+
const reaperRunning = bridge.state === "connected" ? Promise.resolve(void 0) : isReaperProcessRunning();
|
|
11000
|
+
if (repair && !repair.skipped) {
|
|
11001
|
+
const version = readServiceVersion();
|
|
11002
|
+
if (repair.bridgeChanged) startupSpan.setAttribute("reaper.bridge.files_updated", true);
|
|
11003
|
+
if (repair.autostartAdded) startupSpan.setAttribute("reaper.bridge.autostart_added", true);
|
|
11004
|
+
log(`Updated REAPER's reaper-mcp files from ${repair.from ?? "an earlier release"} to ${version}`);
|
|
11005
|
+
for (const text8 of repairNotices(repair, version, bridge.state === "connected")) addNotice({ text: text8 });
|
|
11006
|
+
}
|
|
10729
11007
|
const profile = resolveProfile();
|
|
10730
11008
|
const server = createServer(profile);
|
|
10731
11009
|
const selected = profile.categories;
|
|
@@ -10747,6 +11025,13 @@ async function serve() {
|
|
|
10747
11025
|
recordClientConnected();
|
|
10748
11026
|
};
|
|
10749
11027
|
startSessionPing();
|
|
11028
|
+
notifyNewerRelease(log);
|
|
11029
|
+
startupSpan.setAttributes(setupHealthAttributes({
|
|
11030
|
+
status: bridge,
|
|
11031
|
+
reaperRunning: await reaperRunning,
|
|
11032
|
+
autostart: autostartInstalled(getReaperScriptsPath()),
|
|
11033
|
+
sidecarInstalled: getSidecarClient().isAvailable()
|
|
11034
|
+
}));
|
|
10750
11035
|
startupSpan.setStatus({ code: SpanStatusCode4.OK });
|
|
10751
11036
|
log("MCP server connected via stdio");
|
|
10752
11037
|
} catch (error7) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mthines/reaper-mcp",
|
|
3
|
-
"version": "0.82.1-beta.113.
|
|
3
|
+
"version": "0.82.1-beta.113.2",
|
|
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",
|
package/sidecar/server.py
CHANGED
|
@@ -90,7 +90,7 @@ def _get_audio_duration(path: str) -> float:
|
|
|
90
90
|
info = torchaudio.info(path)
|
|
91
91
|
return info.num_frames / info.sample_rate
|
|
92
92
|
except Exception as exc:
|
|
93
|
-
raise RuntimeError(f"
|
|
93
|
+
raise RuntimeError(f"Audio file unreadable: {path}: {exc}") from exc
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
# ---------------------------------------------------------------------------
|
|
@@ -189,13 +189,22 @@ def handle_analyze(request_id: Any, params: dict) -> str:
|
|
|
189
189
|
return _err(request_id, -32000, f"Inference failed: {exc}")
|
|
190
190
|
|
|
191
191
|
|
|
192
|
-
def _check_file(request_id: Any, params: dict, key: str) -> str | None:
|
|
193
|
-
"""Return an error response when params[key] is missing or not
|
|
192
|
+
def _check_file(request_id: Any, params: dict, key: str, readable: bool = True) -> str | None:
|
|
193
|
+
"""Return an error response when params[key] is missing, not a file, or (readable) not audio soundfile opens."""
|
|
194
194
|
path = params.get(key)
|
|
195
195
|
if not path:
|
|
196
196
|
return _err(request_id, -32602, f"Missing required param: {key}")
|
|
197
197
|
if not os.path.exists(path):
|
|
198
198
|
return _err(request_id, -32000, f"Audio file not found: {path}")
|
|
199
|
+
if not readable:
|
|
200
|
+
return None
|
|
201
|
+
import soundfile as sf # type: ignore
|
|
202
|
+
try:
|
|
203
|
+
sf.info(path)
|
|
204
|
+
except RuntimeError as exc:
|
|
205
|
+
# The handler reads through soundfile (analysis.load_audio), so this file would fail there too, as a
|
|
206
|
+
# crash-looking "… failed: Error opening …"; say it is the input (an .m4a, a text file) instead.
|
|
207
|
+
return _err(request_id, -32000, f"Audio file unreadable: {path}: {exc}")
|
|
199
208
|
return None
|
|
200
209
|
|
|
201
210
|
|
|
@@ -456,7 +465,8 @@ def handle_chords(request_id: Any, params: dict) -> str:
|
|
|
456
465
|
"""
|
|
457
466
|
import chords
|
|
458
467
|
|
|
459
|
-
|
|
468
|
+
# The chord model loads a whole file itself (librosa, so an .m4a works); soundfile reads only a cut range.
|
|
469
|
+
error = _check_file(request_id, params, "path", readable=False)
|
|
460
470
|
if error:
|
|
461
471
|
return error
|
|
462
472
|
try:
|
|
@@ -83,6 +83,21 @@ def test_a_range_is_cut_out_and_its_times_stay_in_file_seconds(wav, fake_model):
|
|
|
83
83
|
assert result["vocabulary"] == "ismir2017"
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
def test_a_whole_file_soundfile_cannot_open_still_reaches_the_model(tmp_path, monkeypatch):
|
|
87
|
+
# The model loads the file itself, so a format soundfile does not read (an .m4a) is not refused up front.
|
|
88
|
+
song = tmp_path / "song.m4a"
|
|
89
|
+
song.write_bytes(b"not a format soundfile reads")
|
|
90
|
+
seen = []
|
|
91
|
+
monkeypatch.setattr(chords, "is_installed", lambda: True)
|
|
92
|
+
monkeypatch.setattr(chords, "_recognize",
|
|
93
|
+
lambda source, vocabulary: seen.append(source) or [{"start_time": 0, "end_time": 2, "chord": "A:min"}])
|
|
94
|
+
|
|
95
|
+
result = call("chords", path=str(song))["result"]
|
|
96
|
+
|
|
97
|
+
assert seen == [str(song)]
|
|
98
|
+
assert result["segments"] == [{"start": 0.0, "end": 2.0, "label": "A:min"}]
|
|
99
|
+
|
|
100
|
+
|
|
86
101
|
def test_refuses_an_unknown_vocabulary_and_a_missing_file(wav, fake_model):
|
|
87
102
|
assert call("chords", path=wav, vocabulary="jazz")["error"]["code"] == -32602
|
|
88
103
|
assert "not found" in call("chords", path="/nope/missing.wav")["error"]["message"]
|
|
@@ -149,6 +149,19 @@ def test_audio_file_not_found():
|
|
|
149
149
|
assert "not found" in resp["error"]["message"].lower()
|
|
150
150
|
|
|
151
151
|
|
|
152
|
+
def test_a_file_that_is_not_audio_is_refused_as_unreadable_input(tmp_path):
|
|
153
|
+
# The phrase is what sidecar.ts classifies as rejected input (sidecar_rejected), not a sidecar fault.
|
|
154
|
+
notes = tmp_path / "reference.m4a"
|
|
155
|
+
notes.write_text("not audio soundfile can open")
|
|
156
|
+
|
|
157
|
+
for method in ("analyze_audio", "analyze"):
|
|
158
|
+
error = parse_response(server.dispatch(json.dumps({
|
|
159
|
+
"jsonrpc": "2.0", "id": 9, "method": method, "params": {"path": str(notes)},
|
|
160
|
+
})))["error"]
|
|
161
|
+
assert error["code"] == -32000
|
|
162
|
+
assert error["message"].startswith(f"Audio file unreadable: {notes}")
|
|
163
|
+
|
|
164
|
+
|
|
152
165
|
# ---------------------------------------------------------------------------
|
|
153
166
|
# Test 4: Audio too short (<0.5s) → JSON-RPC error with duration in message
|
|
154
167
|
# ---------------------------------------------------------------------------
|
|
@@ -213,7 +213,7 @@ def test_failed_soundfont_load_removes_only_the_new_output_folder(tmp_path):
|
|
|
213
213
|
sentinel = tmp_path / "keep.txt"
|
|
214
214
|
sentinel.write_text("user data")
|
|
215
215
|
for _ in range(2):
|
|
216
|
-
with pytest.raises(
|
|
216
|
+
with pytest.raises(ValueError, match="SoundFont|soundfontPath"):
|
|
217
217
|
render(params)
|
|
218
218
|
assert not (tmp_path / "render").exists()
|
|
219
219
|
assert sentinel.read_text() == "user data"
|
package/sidecar/voice_render.py
CHANGED
|
@@ -154,13 +154,15 @@ def _synth(lib: Any, font: Path, track: dict[str, Any]) -> Iterator[Any]:
|
|
|
154
154
|
synth = lib.new_fluid_synth(settings)
|
|
155
155
|
if not synth:
|
|
156
156
|
raise RuntimeError("FluidSynth could not allocate an offline synthesizer")
|
|
157
|
+
# The SoundFont is the caller's file: one FluidSynth cannot use is bad input (ValueError, answered -32602
|
|
158
|
+
# and reported as rejected), not a sidecar fault like the allocation failures above.
|
|
157
159
|
font_id = lib.fluid_synth_sfload(synth, os.fsencode(font), 1)
|
|
158
160
|
if font_id < 0:
|
|
159
|
-
raise
|
|
161
|
+
raise ValueError("FluidSynth could not load soundfontPath as a SoundFont")
|
|
160
162
|
channel, program = int(track["channel"]), int(track["program"])
|
|
161
163
|
bank = 128 if channel == 9 else 0
|
|
162
164
|
if lib.fluid_synth_program_select(synth, channel, font_id, bank, program) != 0:
|
|
163
|
-
raise
|
|
165
|
+
raise ValueError(f"SoundFont has no bank {bank} program {program} for track '{track['name']}'")
|
|
164
166
|
# No audio or MIDI driver is created. Samples only leave through write_float.
|
|
165
167
|
yield synth
|
|
166
168
|
finally:
|