@mthines/reaper-mcp 0.6.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mthines/reaper-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "MCP server for controlling REAPER DAW — real-time mixing, FX control, and frequency analysis for AI agents",
6
6
  "license": "MIT",
@@ -28,6 +28,11 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@modelcontextprotocol/sdk": "^1.12.0",
31
+ "@opentelemetry/api": "^1.9.0",
32
+ "@opentelemetry/auto-instrumentations-node": "^0.71.0",
33
+ "@opentelemetry/resources": "^2.6.0",
34
+ "@opentelemetry/sdk-node": "^0.213.0",
35
+ "@opentelemetry/semantic-conventions": "^1.40.0",
31
36
  "zod": "^4.3.6"
32
37
  },
33
38
  "engines": {
@@ -0,0 +1,60 @@
1
+ # REAPER Scripts
2
+
3
+ Files installed INTO the REAPER DAW by the `setup` command. These run inside REAPER's scripting environment.
4
+
5
+ ## Files
6
+
7
+ | File | Language | Purpose |
8
+ |------|----------|---------|
9
+ | `mcp_bridge.lua` | Lua | Persistent bridge: polls for JSON commands, executes ReaScript API, writes responses |
10
+ | `mcp_analyzer.jsfx` | JSFX/EEL2 | Real-time FFT spectrum analyzer, writes to gmem[] |
11
+ | `mcp_lufs_meter.jsfx` | JSFX/EEL2 | LUFS loudness metering |
12
+ | `mcp_correlation_meter.jsfx` | JSFX/EEL2 | Stereo correlation and width analysis |
13
+ | `mcp_crest_factor.jsfx` | JSFX/EEL2 | Crest factor (peak-to-RMS) measurement |
14
+ | `install.sh` | Shell | Manual install helper |
15
+
16
+ ## Lua Bridge (`mcp_bridge.lua`)
17
+
18
+ ### How It Works
19
+ 1. Runs as a persistent `reaper.defer()` loop (polls every ~30ms)
20
+ 2. Reads `command_{uuid}.json` from bridge directory
21
+ 3. Dispatches to handler function in the `handlers` table
22
+ 4. Writes `response_{uuid}.json` with results
23
+ 5. Writes `heartbeat.json` every 1s for liveness detection
24
+
25
+ ### Adding a Handler
26
+ ```lua
27
+ handlers["command_type"] = function(params)
28
+ local result = reaper.SomeApiCall(params.paramName)
29
+ return { field = result }
30
+ end
31
+ ```
32
+
33
+ The command type string must exactly match `CommandType` in `libs/protocol/src/commands.ts`.
34
+
35
+ ### Key Constraints
36
+ - REAPER Lua is sandboxed: **no sockets, no HTTP, no stdin/stdout** — file-based IPC only
37
+ - JSON parsing: uses `CF_Json_Parse` if available (REAPER 7+), falls back to custom Lua parser
38
+ - Track indices are 0-based (same as ReaScript)
39
+ - Volume values: bridge converts between dB (MCP protocol) and linear (ReaScript internally)
40
+ - Always wrap file reads in `pcall` for resilience
41
+
42
+ ## JSFX Meters
43
+
44
+ - Run in REAPER's **audio thread** (not scripting thread)
45
+ - Communicate with Lua via `gmem[]` shared memory
46
+ - Each JSFX uses a unique gmem namespace (e.g., `MCPAnalyzer`, `MCPLufsMeter`)
47
+ - Must pass audio through unmodified (transparent inserts)
48
+ - Auto-inserted by corresponding MCP tools (`read_track_spectrum`, `read_track_lufs`, etc.)
49
+
50
+ ## Testing
51
+
52
+ - **No automated tests possible** — REAPER's Lua/JSFX environment cannot be unit tested outside REAPER
53
+ - Test manually: install bridge, run MCP Inspector, exercise commands
54
+ - Server-side tests mock `sendCommand()` in `bridge.ts`
55
+
56
+ ## Installation
57
+
58
+ Files are copied to `{REAPER_RESOURCE_PATH}/Scripts/` by:
59
+ - `node dist/apps/reaper-mcp-server/main.js setup` (programmatic)
60
+ - `install.sh` (manual)
package/reaper/install.sh CHANGED
@@ -29,11 +29,15 @@ mkdir -p "$SCRIPTS_DIR"
29
29
  cp "$SCRIPT_DIR/mcp_bridge.lua" "$SCRIPTS_DIR/mcp_bridge.lua"
30
30
  echo "Installed: $SCRIPTS_DIR/mcp_bridge.lua"
31
31
 
32
- # Install JSFX analyzer
33
- EFFECTS_DIR="$REAPER_PATH/Effects"
32
+ # Install JSFX analyzers
33
+ EFFECTS_DIR="$REAPER_PATH/Effects/reaper-mcp"
34
34
  mkdir -p "$EFFECTS_DIR"
35
- cp "$SCRIPT_DIR/mcp_analyzer.jsfx" "$EFFECTS_DIR/mcp_analyzer.jsfx"
36
- echo "Installed: $EFFECTS_DIR/mcp_analyzer.jsfx"
35
+ for jsfx in "$SCRIPT_DIR"/*.jsfx; do
36
+ [ -f "$jsfx" ] || continue
37
+ fname="$(basename "$jsfx")"
38
+ cp "$jsfx" "$EFFECTS_DIR/$fname"
39
+ echo "Installed: $EFFECTS_DIR/$fname"
40
+ done
37
41
 
38
42
  # Create bridge data directory
39
43
  BRIDGE_DIR="$SCRIPTS_DIR/mcp_bridge_data"