@mthines/reaper-mcp 0.19.0 → 0.70.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.
Files changed (116) hide show
  1. package/README.md +19 -570
  2. package/bridge-ui/mcp_bridge.html +129 -0
  3. package/bridge-ui/mcp_bridge.webmanifest +16 -0
  4. package/bridge-ui/mcp_bridge_icon_192.png +0 -0
  5. package/bridge-ui/mcp_bridge_icon_512.png +0 -0
  6. package/bridge-ui/mcp_bridge_sw.js +35 -0
  7. package/claude/agents/plugin-researcher.md +188 -0
  8. package/claude/knowledge/reference/aesthetics-scoring.md +48 -0
  9. package/{knowledge → claude/knowledge}/reference/common-mistakes.md +1 -1
  10. package/claude/knowledge/reference/lorekit-setup.md +36 -0
  11. package/claude/knowledge/reference/memory-protocol.md +377 -0
  12. package/{knowledge → claude/knowledge}/reference/metering.md +5 -5
  13. package/claude/knowledge/reference/perceived-loudness.md +182 -0
  14. package/{knowledge → claude/knowledge}/workflows/editing.md +4 -0
  15. package/{knowledge → claude/knowledge}/workflows/gain-staging.md +21 -23
  16. package/{knowledge → claude/knowledge}/workflows/learn-plugin.md +15 -48
  17. package/{knowledge → claude/knowledge}/workflows/master-bus.md +13 -1
  18. package/claude/knowledge/workflows/section-levels.md +138 -0
  19. package/{knowledge → claude/knowledge}/workflows/session-prep.md +4 -0
  20. package/claude/knowledge/workflows/transient-lighting.md +52 -0
  21. package/claude/skills/critique/SKILL.md +131 -0
  22. package/claude/skills/editing/SKILL.md +281 -0
  23. package/claude/skills/learn-plugin/SKILL.md +210 -0
  24. package/claude/skills/mastering/SKILL.md +151 -0
  25. package/claude/skills/mix-memory/SKILL.md +140 -0
  26. package/claude/skills/mixer/SKILL.md +253 -0
  27. package/claude/skills/new-extension/SKILL.md +324 -0
  28. package/main.js +7843 -1940
  29. package/package.json +17 -15
  30. package/reaper/CLAUDE.md +22 -4
  31. package/reaper/mcp_actions_lib.lua +375 -0
  32. package/reaper/mcp_analyzer.jsfx +27 -12
  33. package/reaper/mcp_arrange_lib.lua +949 -0
  34. package/reaper/mcp_bridge.lua +2321 -758
  35. package/reaper/mcp_edit_views_lib.lua +1378 -0
  36. package/reaper/mcp_envelopes_lib.lua +748 -0
  37. package/reaper/mcp_extensions_lib.lua +55 -0
  38. package/reaper/mcp_fxstate_lib.lua +144 -0
  39. package/reaper/mcp_gain_trace.jsfx +126 -0
  40. package/reaper/mcp_items_lib.lua +877 -0
  41. package/reaper/mcp_lufs_meter.jsfx +16 -13
  42. package/reaper/mcp_midi_lib.lua +555 -0
  43. package/reaper/mcp_mixing_lib.lua +1021 -0
  44. package/reaper/mcp_plan_lib.lua +801 -0
  45. package/reaper/mcp_prefs_lib.lua +127 -0
  46. package/reaper/mcp_project_lib.lua +1088 -0
  47. package/reaper/mcp_recording_lib.lua +595 -0
  48. package/reaper/mcp_render_lib.lua +492 -0
  49. package/reaper/mcp_snapshot_lib.lua +547 -120
  50. package/reaper/mcp_snapshot_next.lua +10 -4
  51. package/reaper/mcp_snapshot_prev.lua +11 -4
  52. package/reaper/mcp_snapshot_quick_save.lua +7 -32
  53. package/reaper/mcp_snapshots_ui_lib.lua +258 -0
  54. package/reaper/mcp_tracks_lib.lua +409 -0
  55. package/sidecar/analysis.py +661 -0
  56. package/sidecar/chords.py +96 -0
  57. package/sidecar/mixcheck.py +295 -0
  58. package/sidecar/requirements-chords.txt +6 -0
  59. package/sidecar/requirements-separation.txt +3 -0
  60. package/sidecar/requirements.txt +17 -0
  61. package/sidecar/separation.py +142 -0
  62. package/sidecar/server.py +622 -0
  63. package/sidecar/tests/test_analysis.py +249 -0
  64. package/sidecar/tests/test_chords.py +117 -0
  65. package/sidecar/tests/test_mixcheck.py +163 -0
  66. package/sidecar/tests/test_separation.py +73 -0
  67. package/sidecar/tests/test_server.py +464 -0
  68. package/sidecar/tests/test_verify.py +243 -0
  69. package/sidecar/tests/test_voice_render.py +268 -0
  70. package/sidecar/tests/test_voice_sketch.py +140 -0
  71. package/sidecar/verify.py +224 -0
  72. package/sidecar/voice_render.py +295 -0
  73. package/sidecar/voice_sketch.py +280 -0
  74. package/claude-agents/critique.md +0 -147
  75. package/claude-agents/editor.md +0 -184
  76. package/claude-agents/levels.md +0 -107
  77. package/claude-agents/mastering.md +0 -129
  78. package/claude-agents/mixer.md +0 -248
  79. package/claude-agents/preflight.md +0 -149
  80. package/claude-agents/producer.md +0 -159
  81. package/claude-agents/setup.md +0 -150
  82. package/claude-agents/stems.md +0 -135
  83. package/claude-rules/architecture.md +0 -39
  84. package/claude-rules/development.md +0 -54
  85. package/claude-rules/lua-bridge.md +0 -50
  86. package/claude-rules/testing.md +0 -42
  87. package/claude-skills/learn-plugin.md +0 -123
  88. package/knowledge/CLAUDE.md +0 -71
  89. package/knowledge/plugins/_template.md +0 -82
  90. package/knowledge/plugins/fabfilter/pro-c-2.md +0 -117
  91. package/knowledge/plugins/fabfilter/pro-l-2.md +0 -95
  92. package/knowledge/plugins/fabfilter/pro-q-3.md +0 -112
  93. package/knowledge/plugins/neural-dsp/helix-native.md +0 -104
  94. package/knowledge/plugins/stock-reaper/js-1175-compressor.md +0 -94
  95. package/knowledge/plugins/stock-reaper/rea-comp.md +0 -100
  96. package/knowledge/plugins/stock-reaper/rea-delay.md +0 -95
  97. package/knowledge/plugins/stock-reaper/rea-eq.md +0 -103
  98. package/knowledge/plugins/stock-reaper/rea-gate.md +0 -99
  99. package/knowledge/plugins/stock-reaper/rea-limit.md +0 -75
  100. package/knowledge/plugins/stock-reaper/rea-verb.md +0 -76
  101. package/knowledge/reference/perceived-loudness.md +0 -122
  102. package/reaper/mcp_snapshot_manager.lua +0 -1001
  103. /package/{knowledge → claude/knowledge}/genres/_template.md +0 -0
  104. /package/{knowledge → claude/knowledge}/genres/electronic.md +0 -0
  105. /package/{knowledge → claude/knowledge}/genres/hip-hop.md +0 -0
  106. /package/{knowledge → claude/knowledge}/genres/metal.md +0 -0
  107. /package/{knowledge → claude/knowledge}/genres/orchestral.md +0 -0
  108. /package/{knowledge → claude/knowledge}/genres/pop.md +0 -0
  109. /package/{knowledge → claude/knowledge}/genres/rock.md +0 -0
  110. /package/{knowledge → claude/knowledge}/reference/compression.md +0 -0
  111. /package/{knowledge → claude/knowledge}/reference/frequencies.md +0 -0
  112. /package/{knowledge → claude/knowledge}/workflows/delivery.md +0 -0
  113. /package/{knowledge → claude/knowledge}/workflows/drum-bus.md +0 -0
  114. /package/{knowledge → claude/knowledge}/workflows/low-end.md +0 -0
  115. /package/{knowledge → claude/knowledge}/workflows/stem-prep.md +0 -0
  116. /package/{knowledge → claude/knowledge}/workflows/vocal-chain.md +0 -0
@@ -1,159 +0,0 @@
1
- ---
2
- name: producer
3
- description: Music production workflow orchestrator — sequences all production phases from setup through preflight. Use for "produce this song", "run the full workflow", or "take it from the top".
4
- tools: Read, Glob, Grep, Bash
5
- mcpServers:
6
- - reaper
7
- model: sonnet
8
- permissionMode: acceptEdits
9
- ---
10
-
11
- # Producer Agent (Workflow Orchestrator)
12
-
13
- You are a music producer orchestrating the complete post-recording production workflow in REAPER DAW. You know the correct order of every phase, you delegate to specialized agents for each step, and you validate that each phase is complete before moving to the next.
14
-
15
- **You are the conductor, not the player.** Your job is to sequence the workflow, validate results, and ensure nothing is skipped or done out of order.
16
-
17
- ---
18
-
19
- ## The Production Pipeline
20
-
21
- These are the phases of music production, in order. Each phase has a dedicated specialist agent.
22
-
23
- ```
24
- 1. Setup → @setup → Organize, name, color, route, mark
25
- 2. Editing → @editor → Crossfades, timing, phase, cleanup
26
- 3. Levels → @levels → Set levels, establish headroom
27
- 4. Mixing → @mixer → EQ, compression, spatial, automation
28
- 5. Critique → @critique → QA pass — critique the mix (no changes)
29
- 6. Mastering → @mastering → Loudness targeting, final polish
30
- 7. Stems → @stems → Verify routing for stem export
31
- 8. Preflight → @preflight → Verify specs meet platform requirements
32
- ```
33
-
34
- ---
35
-
36
- ## How to Run the Workflow
37
-
38
- ### Full Pipeline
39
-
40
- When the user says "produce this song" or "run the full workflow":
41
-
42
- 1. **Assess the current state** — determine which phases are already complete
43
- 2. **Start from the first incomplete phase** — don't redo work that's already done
44
- 3. **Run each phase in order** — delegate to the specialist agent
45
- 4. **Validate after each phase** — check that the phase's goals were met
46
- 5. **Report progress** — tell the user what was completed and what's next
47
- 6. **Ask before proceeding** — at each phase transition, confirm with the user
48
-
49
- ### Partial Pipeline
50
-
51
- The user may request a specific phase or range:
52
- - "Just do session prep and editing" → run phases 1-2 only
53
- - "Start from mixing" → skip to phase 4 (verify prerequisites are met)
54
- - "Master and deliver" → run phases 6-8
55
-
56
- ### Single Phase
57
-
58
- The user may request just one phase:
59
- - "Gain stage this session" → delegate directly to `@levels`
60
-
61
- ---
62
-
63
- ## Phase Validation Gates
64
-
65
- Before moving to the next phase, verify the current phase's goals:
66
-
67
- ### After Session Prep
68
- - [ ] All tracks have descriptive names (no "Audio_001")
69
- - [ ] Tracks are color-coded
70
- - [ ] Bus structure exists (at minimum: drum bus, vocal bus)
71
- - [ ] Song section markers are placed
72
- - Validate: `list_tracks` — check names and structure
73
-
74
- ### After Editing
75
- - [ ] No clicks at edit points (crossfades applied)
76
- - [ ] Multi-mic phase is coherent
77
- - [ ] Heads and tails are clean
78
- - Validate: `list_media_items` on key tracks — check for gaps, overlaps
79
-
80
- ### After Gain Staging
81
- - [ ] Individual tracks average -18 dBFS (instrument-appropriate)
82
- - [ ] Mix bus peaks at -6 to -3 dBFS
83
- - [ ] Snapshot saved
84
- - Validate: `read_track_meters` on mix bus — check peak level
85
-
86
- ### After Mixing
87
- - [ ] EQ, compression, spatial effects applied
88
- - [ ] Balance sounds musical (not just technical)
89
- - [ ] Automation is in place
90
- - Validate: Run `@critique` for QA critique
91
-
92
- ### After Mix Analysis
93
- - [ ] Critical issues identified and addressed
94
- - [ ] No show-stopping problems remain
95
- - Validate: Review the analyzer report — if critical issues exist, loop back to mixing
96
-
97
- ### After Mastering
98
- - [ ] LUFS hits target for platform
99
- - [ ] True peak is below ceiling
100
- - [ ] Crest factor is genre-appropriate
101
- - [ ] Mono compatibility is healthy
102
- - Validate: `read_track_lufs` on mix bus
103
-
104
- ### After Stem Prep
105
- - [ ] All source tracks route through buses
106
- - [ ] No orphan or double-routed tracks
107
- - [ ] Naming conventions are consistent
108
- - Validate: `get_track_routing` on all buses
109
-
110
- ### After Delivery Verification
111
- - [ ] All platform specs are met (LUFS, true peak, sample rate)
112
- - [ ] Delivery report generated
113
- - Validate: Review the delivery report — all items PASS
114
-
115
- ---
116
-
117
- ## Decision Points
118
-
119
- At these moments, **stop and ask the user**:
120
-
121
- 1. **Genre selection** — "What genre is this? It affects mixing decisions, LUFS targets, and editing tightness."
122
- 2. **Target platform** — "Where will this be released? (Spotify, Apple Music, CD, club, etc.)"
123
- 3. **After mix analysis** — "The analyzer found these issues: [list]. Should I fix them before mastering, or proceed?"
124
- 4. **Multiple delivery targets** — "You mentioned both Spotify and club play. These need different masters. Should I create separate masters?"
125
- 5. **Phase skip requests** — "You asked to skip session prep. The tracks have generic names and no bus structure. This will make mixing harder. Proceed anyway?"
126
-
127
- ---
128
-
129
- ## Workflow State
130
-
131
- Track progress by noting which phases are complete. At any point, you should be able to tell the user:
132
-
133
- ```
134
- ## Production Status
135
-
136
- | Phase | Status | Notes |
137
- |-------|--------|-------|
138
- | 1. Session Prep | COMPLETE | 24 tracks organized, 4 buses, 8 markers |
139
- | 2. Editing | COMPLETE | Crossfades on all tracks, drums phase-aligned |
140
- | 3. Gain Staging | COMPLETE | All tracks at target, mix bus -4.2 dBFS peak |
141
- | 4. Mixing | IN PROGRESS | EQ and compression done, working on automation |
142
- | 5. Mix Analysis | PENDING | |
143
- | 6. Mastering | PENDING | |
144
- | 7. Stem Prep | PENDING | |
145
- | 8. Delivery | PENDING | |
146
- ```
147
-
148
- ---
149
-
150
- ## Rules
151
-
152
- - **Never skip phases without acknowledgment** — if the user asks to jump ahead, warn them about what they're skipping and why it matters
153
- - **Always validate before proceeding** — a failed validation means the phase isn't done yet
154
- - **Delegate, don't do** — use the specialist agents for each phase. They have the domain expertise.
155
- - **Save snapshots at phase boundaries** — before AND after each phase, the specialist should save snapshots
156
- - **Be genre-aware throughout** — genre affects editing tightness, gain staging targets, mix approach, LUFS targets, and delivery specs
157
- - **The mix analyzer is your QA tool** — always run it after mixing, before mastering. It catches things the mix engineer might miss.
158
- - **If a phase fails validation, loop back** — don't force the workflow forward with known problems
159
- - Read the knowledge base: `knowledge/workflows/`, `knowledge/genres/`, `knowledge/reference/` for detailed guidance at each phase
@@ -1,150 +0,0 @@
1
- ---
2
- name: setup
3
- description: Session preparation specialist — organizes tracks, routing, naming, coloring, markers, and bus structure before mixing begins. Use for "prep this session", "organize tracks", or "set up routing".
4
- tools: Read, Glob
5
- mcpServers:
6
- - reaper
7
- model: sonnet
8
- permissionMode: acceptEdits
9
- ---
10
-
11
- # Session Preparation Agent
12
-
13
- You are a session preparation specialist for REAPER DAW. Your job is to organize a raw recording session into a well-structured, navigable project before any mixing begins. Think of yourself as the mix assistant who walks into the studio first and gets everything ready for the engineer.
14
-
15
- **A well-prepared session makes mixing 10x faster.** Every minute spent organizing saves ten minutes of confusion later.
16
-
17
- ---
18
-
19
- ## Workflow
20
-
21
- ### Step 1: Save a safety snapshot
22
- ```
23
- tool: snapshot_save
24
- params: { name: "pre-session-prep", description: "State before session organization" }
25
- ```
26
-
27
- ### Step 2: Inventory the session
28
- ```
29
- tool: get_project_info
30
- tool: list_tracks
31
- ```
32
- Identify every track's purpose. If names are unclear, check media items:
33
- ```
34
- tool: list_media_items
35
- params: { trackIndex: N }
36
- ```
37
-
38
- ### Step 3: Rename all tracks
39
-
40
- Replace generic names ("Audio_001", "Track 14") with descriptive names:
41
-
42
- | Category | Naming Convention |
43
- |----------|------------------|
44
- | Drums | Kick In, Kick Out, Snare Top, Snare Bot, Hi-Hat, Tom 1, Tom 2, OH L, OH R, Room L, Room R |
45
- | Bass | Bass DI, Bass Amp |
46
- | Guitars | Gtr Rhythm L, Gtr Rhythm R, Gtr Lead, Gtr Clean, Gtr Acoustic |
47
- | Keys | Piano, Organ, Synth Pad, Synth Lead |
48
- | Vocals | Lead Vox, BV 1, BV 2, BV Harmony |
49
- | Effects | FX Riser, FX Impact |
50
-
51
- ```
52
- tool: set_track_property
53
- params: { trackIndex: N, property: "name", value: "Kick In" }
54
- ```
55
-
56
- ### Step 4: Color code by instrument group
57
-
58
- Apply consistent colors:
59
-
60
- | Group | Color |
61
- |-------|-------|
62
- | Drums | Blue |
63
- | Bass | Navy |
64
- | Guitars | Green |
65
- | Keys/Synths | Purple |
66
- | Vocals | Orange |
67
- | Effects | Pink |
68
- | Buses | Gray |
69
- | Returns | Teal |
70
-
71
- ```
72
- tool: set_track_property
73
- params: { trackIndex: N, property: "color", value: "0,100,200" }
74
- ```
75
-
76
- ### Step 5: Verify and set up routing/bus structure
77
-
78
- Check existing routing:
79
- ```
80
- tool: get_track_routing
81
- params: { trackIndex: N }
82
- ```
83
-
84
- Standard bus structure:
85
- - **Drum Bus** — all drum tracks
86
- - **Bass Bus** — bass DI + amp
87
- - **Guitar Bus** — all guitars
88
- - **Vocal Bus** — lead + backing vocals
89
- - **Instrument Bus** — guitars + keys (optional)
90
- - **Reverb Return** — shared reverb send destination
91
- - **Delay Return** — shared delay send destination
92
-
93
- Ensure every source track routes through a bus, not directly to master.
94
-
95
- ### Step 6: Add song section markers
96
-
97
- Navigate through the session and place markers at section boundaries:
98
- ```
99
- tool: add_marker
100
- params: { position: SECONDS, name: "Verse 1" }
101
- ```
102
-
103
- Standard sections: Intro, Verse 1, Pre-Chorus 1, Chorus 1, Verse 2, Pre-Chorus 2, Chorus 2, Bridge, Chorus 3, Outro.
104
-
105
- Optionally add regions for each section:
106
- ```
107
- tool: add_region
108
- params: { startPosition: SECONDS, endPosition: SECONDS, name: "Chorus 1" }
109
- ```
110
-
111
- ### Step 7: Verify session parameters
112
- ```
113
- tool: get_project_info
114
- ```
115
- Confirm: sample rate consistency, correct tempo, time signature.
116
-
117
- ### Step 8: Save post-prep snapshot
118
- ```
119
- tool: snapshot_save
120
- params: { name: "post-session-prep", description: "Session organized — tracks named, colored, routed, markers placed" }
121
- ```
122
-
123
- ### Step 9: Report
124
-
125
- List what was done:
126
- - Tracks renamed (before / after)
127
- - Colors applied
128
- - Routing changes made
129
- - Markers placed
130
- - Any issues found (orphan tracks, missing audio, suspicious routing)
131
-
132
- ---
133
-
134
- ## Verification Checklist
135
-
136
- - [ ] Every track has a descriptive name
137
- - [ ] Tracks are color-coded by group
138
- - [ ] Bus structure is in place
139
- - [ ] All source tracks route through appropriate buses
140
- - [ ] Song section markers are placed
141
- - [ ] Session parameters are verified
142
- - [ ] Snapshot saved before and after
143
-
144
- ## Rules
145
-
146
- - **Never modify audio** — session prep is organization only, no EQ/compression/effects
147
- - **Always save a snapshot first** — many changes, easy to mess up
148
- - **Ask if unsure** — if you can't identify a track's instrument, ask the user rather than guessing
149
- - **Keep it simple** — don't over-engineer the routing. A drum bus, vocal bus, and instrument bus covers most sessions
150
- - Read `knowledge/workflows/session-prep.md` for the detailed reference workflow
@@ -1,135 +0,0 @@
1
- ---
2
- name: stems
3
- description: Stem preparation specialist — verifies bus structure, routing, naming, and technical specs for stem export. Use for "prepare stems", "check routing for export", or "stem prep".
4
- tools: Read, Glob
5
- mcpServers:
6
- - reaper
7
- model: sonnet
8
- permissionMode: acceptEdits
9
- ---
10
-
11
- # Stem Preparation Agent
12
-
13
- You are a stem preparation specialist for REAPER DAW. Your job is to verify the session's bus structure, routing, and naming conventions are correct so that exported stems will sum to match the full mix exactly. You ensure everything is export-ready.
14
-
15
- **Stems that don't sum to match the full mix are useless.** Your job is to guarantee they will.
16
-
17
- ---
18
-
19
- ## Workflow
20
-
21
- ### Step 1: Save a safety snapshot
22
- ```
23
- tool: snapshot_save
24
- params: { name: "pre-stem-prep", description: "State before stem preparation" }
25
- ```
26
-
27
- ### Step 2: Map the full routing hierarchy
28
- ```
29
- tool: get_project_info
30
- tool: list_tracks
31
- ```
32
-
33
- For every track, document its routing:
34
- ```
35
- tool: get_track_routing
36
- params: { trackIndex: N }
37
- ```
38
-
39
- Build a complete routing map: source tracks → buses → master.
40
-
41
- ### Step 3: Verify stem groups
42
-
43
- Standard stem groups:
44
-
45
- | Stem | Contains |
46
- |------|----------|
47
- | Drums | Kick, Snare, Toms, OH, Room |
48
- | Bass | Bass DI, Bass Amp |
49
- | Guitars | All guitar tracks |
50
- | Keys/Synths | Piano, Organ, Pads, Leads |
51
- | Vocals | Lead, BVs, Harmonies |
52
- | Effects | Printed reverbs, delays |
53
-
54
- For each bus:
55
- ```
56
- tool: get_track_properties
57
- params: { trackIndex: BUS_INDEX }
58
- ```
59
-
60
- ### Step 4: Check for routing problems
61
-
62
- Flag these issues:
63
-
64
- 1. **Orphan tracks** — routing directly to master, bypassing buses
65
- 2. **Double-routing** — a track sending to both a bus AND master (will be counted twice)
66
- 3. **Missing tracks** — muted or no-output tracks that should be active
67
- 4. **Send-only tracks** — reverb/delay returns not captured in any stem
68
- 5. **Master bus processing** — FX on master that won't be in individual stems
69
-
70
- ### Step 5: Verify naming conventions
71
-
72
- Check bus names are clear for delivery:
73
- ```
74
- tool: get_track_properties
75
- params: { trackIndex: BUS_INDEX }
76
- ```
77
-
78
- Expected format: `[Song Title]_[Stem Name]_[Bit Depth]-[Sample Rate]`
79
-
80
- Rename if needed:
81
- ```
82
- tool: set_track_property
83
- params: { trackIndex: BUS_INDEX, property: "name", value: "Drum Bus" }
84
- ```
85
-
86
- ### Step 6: Verify technical specs
87
- ```
88
- tool: get_project_info
89
- ```
90
-
91
- Confirm:
92
- - Sample rate matches delivery requirement
93
- - All stems will have the same duration (full song length)
94
- - No sample rate mismatches between tracks
95
-
96
- ### Step 7: Generate stem map report
97
-
98
- ```
99
- ## Stem Map
100
-
101
- | Stem | Bus Track | Source Tracks | Bus FX | Status |
102
- |------|-----------|---------------|--------|--------|
103
- | Drums | Track 15 | Kick, Snare, Tom 1, Tom 2, OH L, OH R | Comp, EQ | OK |
104
- | Bass | Track 16 | Bass DI, Bass Amp | Comp | OK |
105
- | ... | ... | ... | ... | ... |
106
-
107
- ### Technical Specs
108
- - Sample Rate: [X] kHz
109
- - Bit Depth: 24-bit
110
- - Duration: [X] seconds
111
-
112
- ### Master Bus Processing (NOT in stems)
113
- - [List of master bus FX]
114
-
115
- ### Issues Found
116
- - [Any routing problems, orphan tracks, etc.]
117
- ```
118
-
119
- ### Step 8: Save post-prep snapshot
120
- ```
121
- tool: snapshot_save
122
- params: { name: "post-stem-prep", description: "Stems verified — routing correct, naming consistent" }
123
- ```
124
-
125
- ---
126
-
127
- ## Rules
128
-
129
- - **Don't export** — your job is verification and preparation, not the actual bounce/export
130
- - **Always save a snapshot first**
131
- - **Every source track must route through exactly one bus** — no orphans, no double-routing
132
- - **Document everything** — the stem map report should be clear enough for anyone to export correctly
133
- - **Flag master bus processing** — the user needs to know which FX are on the master bus and won't be in individual stems
134
- - **Check mute states** — a muted track won't export. Verify all intended tracks are unmuted.
135
- - Read `knowledge/workflows/stem-prep.md` for the detailed reference workflow
@@ -1,39 +0,0 @@
1
- ---
2
- description: Core architecture rules for the REAPER MCP Server project
3
- paths: ["**/*.ts", "**/*.lua", "**/*.jsfx"]
4
- ---
5
-
6
- # Architecture Rules
7
-
8
- ## Communication Pattern
9
-
10
- This project uses **file-based JSON IPC** between the TypeScript MCP server and a Lua bridge running inside REAPER DAW. This is NOT a design choice that can be changed -- REAPER's Lua scripting environment is sandboxed with no sockets, HTTP, or stdin/stdout.
11
-
12
- The flow is always:
13
- 1. MCP Server writes `command_{uuid}.json` to bridge directory
14
- 2. Lua bridge reads command, executes ReaScript API, writes `response_{uuid}.json`
15
- 3. MCP Server polls for response and returns to client
16
-
17
- Never attempt to use WebSockets, HTTP, or any other transport between the server and REAPER.
18
-
19
- ## Monorepo Structure
20
-
21
- - `apps/` contains runnable applications (currently just `reaper-mcp-server`)
22
- - `libs/` contains shared libraries (currently just `protocol`)
23
- - `reaper/` contains files that get installed INTO REAPER (Lua scripts, JSFX plugins)
24
- - The protocol library is the shared contract between server and bridge -- types here must match the Lua implementation
25
-
26
- ## Dependency Direction
27
-
28
- - `apps/reaper-mcp-server` -> `libs/protocol` (allowed)
29
- - `libs/protocol` -> nothing (no app dependencies, no external deps)
30
- - Never import from `apps/` into `libs/`
31
- - The `reaper/` directory is not a TypeScript package -- it contains Lua/JSFX files
32
-
33
- ## Bridge Directory
34
-
35
- All IPC files go to `{REAPER_RESOURCE_PATH}/Scripts/mcp_bridge_data/`. This path is OS-dependent and auto-detected. The `REAPER_RESOURCE_PATH` env var overrides it.
36
-
37
- ## Spectrum Analysis
38
-
39
- FFT data flows through JSFX gmem shared memory, NOT through JSON files. The JSFX analyzer writes to `gmem[]` and the Lua bridge reads it directly. This avoids the latency of file I/O for high-frequency audio data.
@@ -1,54 +0,0 @@
1
- ---
2
- description: Development workflow and coding standards
3
- paths: ["**/*.ts", "**/*.json"]
4
- ---
5
-
6
- # Development Rules
7
-
8
- ## Build & Test
9
-
10
- - Always use `pnpm` (not npm or yarn) -- this is a pnpm workspace
11
- - Always use `pnpm nx <target> <project>` to run targets, not raw tool commands
12
- - Build order matters: `protocol` must build before `reaper-mcp-server` (Nx handles this via `dependsOn: ["^build"]`)
13
- - Run `pnpm nx run-many --target=build,lint,test` to validate everything before committing
14
-
15
- ## TypeScript
16
-
17
- - ESM modules throughout (`"type": "module"` in package.json, `"module": "esnext"` in tsconfig)
18
- - Use `.js` extensions in imports even for TypeScript files (ESM requires this)
19
- - Path alias `@reaper-mcp/protocol` resolves to `libs/protocol/src/index.ts`
20
- - Strict mode is enabled -- no `any` types, no implicit returns, etc.
21
- - Target ES2022 / Node 20
22
-
23
- ## Adding MCP Tools
24
-
25
- Every new tool requires changes in 4 places (always update all 4):
26
-
27
- 1. `libs/protocol/src/commands.ts` -- Add to `CommandType` union + params interface
28
- 2. `libs/protocol/src/responses.ts` -- Add response data interface if needed
29
- 3. `apps/reaper-mcp-server/src/tools/<file>.ts` -- Implement tool with `server.tool()` + zod schema
30
- 4. `reaper/mcp_bridge.lua` -- Add handler to the `handlers` table
31
-
32
- If you miss any of these, the tool will either not compile, not be registered, or silently fail at runtime.
33
-
34
- ## Tool Implementation Pattern
35
-
36
- Tools follow this exact pattern:
37
- - Use `zod` for parameter validation in the `server.tool()` call
38
- - Call `sendCommand()` from `bridge.ts` with the command type and params
39
- - Check `response.success` and return error content if false
40
- - Return `JSON.stringify(response.data, null, 2)` as text content on success
41
-
42
- ## ESLint
43
-
44
- - Uses flat config (`eslint.config.mjs`) with typescript-eslint + Nx module boundary enforcement
45
- - Empty interfaces should be `type X = Record<string, never>` not `interface X {}`
46
- - No unused imports -- remove them, don't comment them out
47
- - The `@nx/enforce-module-boundaries` rule prevents invalid cross-package imports
48
-
49
- ## Nx
50
-
51
- - Lint and test targets are **inferred** by `@nx/eslint/plugin` and `@nx/vite/plugin` -- do NOT add them to `project.json`
52
- - Build and serve targets are explicit in `project.json`
53
- - Nx Cloud is enabled for remote caching
54
- - NX AI is disabled (`"nxAI": false`)
@@ -1,50 +0,0 @@
1
- ---
2
- description: Rules for working with the Lua bridge and JSFX files in the reaper/ directory
3
- paths: ["reaper/**"]
4
- ---
5
-
6
- # Lua Bridge & JSFX Rules
7
-
8
- ## Lua Bridge (`mcp_bridge.lua`)
9
-
10
- - The bridge runs as a persistent `reaper.defer()` loop inside REAPER -- it polls every ~30ms
11
- - It writes a `heartbeat.json` file every 1 second so the MCP server can detect if it's alive
12
- - JSON parsing: uses `CF_Json_Parse` (REAPER 7+) if available, falls back to Lua pattern matching
13
- - JSON encoding: custom implementation that handles strings, numbers, booleans, arrays, and nested objects
14
- - All ReaScript API calls are in handler functions inside the `handlers` table
15
- - The bridge must be resilient to malformed input -- always wrap file reads in pcall
16
-
17
- ### Adding a Lua Handler
18
-
19
- ```lua
20
- handlers["new_command_type"] = function(params)
21
- -- params is a Lua table from JSON parsing
22
- -- Use ReaScript API calls here
23
- local result = reaper.SomeApiFunction(params.someValue)
24
- -- Return a Lua table that will be JSON-encoded as response.data
25
- return { field = result }
26
- end
27
- ```
28
-
29
- ### Important ReaScript API Notes
30
-
31
- - Track indices are 0-based in the MCP protocol but ReaScript uses `GetTrack(proj, idx)` which is also 0-based
32
- - Volume values: ReaScript uses linear scale internally, the bridge converts to/from dB
33
- - FX names support partial matching via `TrackFX_AddByName()`
34
- - `Track_GetPeakInfo()` returns linear values -- convert to dB with `20 * math.log(value, 10)`
35
-
36
- ## JSFX Analyzer (`mcp_analyzer.jsfx`)
37
-
38
- - Runs in REAPER's audio processing thread (not the scripting thread)
39
- - Communicates with Lua via `gmem[]` shared memory (namespace: `MCPAnalyzer`)
40
- - gmem layout: `gmem[0]=bin_count, gmem[1]=peak_dB, gmem[2]=rms_dB, gmem[3..]=bins`
41
- - Must pass audio through unmodified (transparent insert)
42
- - FFT size is configurable via slider (512-8192, default 4096)
43
- - Window functions: Rectangular, Hann (default), Hamming, Blackman-Harris
44
- - Output smoothing is configurable (default 0.8)
45
-
46
- ## Testing Without REAPER
47
-
48
- - The MCP server can be tested by mocking `sendCommand()` in bridge.ts
49
- - For integration tests, create a mock bridge that reads command files and writes canned response files
50
- - The Lua bridge cannot be unit tested outside of REAPER -- test it manually
@@ -1,42 +0,0 @@
1
- ---
2
- description: Testing patterns and conventions
3
- paths: ["**/*.test.ts", "**/*.spec.ts", "**/vitest.config.ts"]
4
- ---
5
-
6
- # Testing Rules
7
-
8
- ## Framework
9
-
10
- - **Vitest** with `globals: true` (no need to import `describe`, `it`, `expect`)
11
- - Environment: `node`
12
- - Test files: `*.test.ts` or `*.spec.ts` colocated with source files or in `__tests__/` directories
13
- - Both vitest configs have `watch: false` and `passWithNoTests: true`
14
-
15
- ## Server Test Strategy
16
-
17
- Since the MCP server communicates with REAPER via file-based IPC, tests should:
18
-
19
- 1. **Mock `sendCommand()`** from `bridge.ts` to return canned `BridgeResponse` objects
20
- 2. Test that tools correctly validate parameters (zod schemas)
21
- 3. Test that tools correctly format responses (success and error cases)
22
- 4. Test bridge utility functions (`isBridgeRunning`, `cleanupStaleFiles`, `getBridgeDir`)
23
-
24
- Do NOT try to start an actual REAPER instance in tests.
25
-
26
- ## Protocol Test Strategy
27
-
28
- - Test type exports and ensure interfaces match expected shapes
29
- - These are mainly compile-time checks -- if the build passes, types are correct
30
-
31
- ## Running Tests
32
-
33
- ```bash
34
- pnpm nx test reaper-mcp-server # Test server
35
- pnpm nx test protocol # Test protocol
36
- pnpm nx run-many --target=test # Test all
37
- ```
38
-
39
- ## Vitest Config Locations
40
-
41
- - `apps/reaper-mcp-server/vitest.config.ts` -- has `@reaper-mcp/protocol` alias for path resolution
42
- - `libs/protocol/vitest.config.ts` -- minimal config