@mthines/reaper-mcp 0.80.1 → 0.82.0-beta.107.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +50 -45
- package/bridge-ui/mcp_bridge.html +48 -38
- package/main.js +79 -10
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -4240,13 +4240,21 @@ function registerExtensionCategory(extension, description, tools) {
|
|
|
4240
4240
|
TOOL_CATEGORIES[name] = { name, description, tools };
|
|
4241
4241
|
return name;
|
|
4242
4242
|
}
|
|
4243
|
+
var visibleCategories = null;
|
|
4244
|
+
function setVisibleCategories(names) {
|
|
4245
|
+
visibleCategories = names;
|
|
4246
|
+
}
|
|
4247
|
+
function visible() {
|
|
4248
|
+
if (!visibleCategories) return TOOL_CATEGORIES;
|
|
4249
|
+
return Object.fromEntries(Object.entries(TOOL_CATEGORIES).filter(([n]) => visibleCategories?.has(n)));
|
|
4250
|
+
}
|
|
4243
4251
|
function registerCategoryTools(server) {
|
|
4244
4252
|
server.tool(
|
|
4245
4253
|
"list_tool_categories",
|
|
4246
|
-
`List all available tool categories with descriptions and tool names. Use this to discover what tools are available without loading every tool schema. Categories: ${Object.keys(
|
|
4254
|
+
`List all available tool categories with descriptions and tool names. Use this to discover what tools are available without loading every tool schema. Categories: ${Object.keys(visible()).join(", ")}.`,
|
|
4247
4255
|
{},
|
|
4248
4256
|
async () => {
|
|
4249
|
-
const categories = Object.values(
|
|
4257
|
+
const categories = Object.values(visible()).map((cat) => ({
|
|
4250
4258
|
name: cat.name,
|
|
4251
4259
|
description: cat.description,
|
|
4252
4260
|
toolCount: cat.tools.length,
|
|
@@ -4267,9 +4275,9 @@ function registerCategoryTools(server) {
|
|
|
4267
4275
|
category: z26.string().describe('Category name (e.g. "tracks", "fx", "midi", "media", "transport", "markers", "envelopes", "analysis", "discovery")')
|
|
4268
4276
|
},
|
|
4269
4277
|
async ({ category }) => {
|
|
4270
|
-
const cat =
|
|
4278
|
+
const cat = visible()[category];
|
|
4271
4279
|
if (!cat) {
|
|
4272
|
-
const available = Object.keys(
|
|
4280
|
+
const available = Object.keys(visible()).join(", ");
|
|
4273
4281
|
return {
|
|
4274
4282
|
content: [{
|
|
4275
4283
|
type: "text",
|
|
@@ -4299,9 +4307,9 @@ function registerCategoryTools(server) {
|
|
|
4299
4307
|
category: z26.string().describe('Category name (e.g. "tracks", "fx", "midi", "media", "transport", "markers", "envelopes", "analysis", "discovery")')
|
|
4300
4308
|
},
|
|
4301
4309
|
async ({ category }) => {
|
|
4302
|
-
const cat =
|
|
4310
|
+
const cat = visible()[category];
|
|
4303
4311
|
if (!cat) {
|
|
4304
|
-
const available = Object.keys(
|
|
4312
|
+
const available = Object.keys(visible()).join(", ");
|
|
4305
4313
|
return {
|
|
4306
4314
|
content: [{
|
|
4307
4315
|
type: "text",
|
|
@@ -4324,6 +4332,45 @@ function registerCategoryTools(server) {
|
|
|
4324
4332
|
);
|
|
4325
4333
|
}
|
|
4326
4334
|
|
|
4335
|
+
// apps/reaper-mcp-server/src/profile.ts
|
|
4336
|
+
var PROFILES = {
|
|
4337
|
+
/** Smoke test and basic control. */
|
|
4338
|
+
minimal: ["project", "tracks", "fx", "transport", "discovery", "selection"],
|
|
4339
|
+
/** Mixing and mastering: measure, set levels and FX, route, automate, snapshot, render. */
|
|
4340
|
+
mixing: ["project", "tracks", "fx", "fx_files", "transport", "discovery", "selection", "routing", "plan", "analysis", "snapshots", "envelopes", "actions", "knowledge", "recording"],
|
|
4341
|
+
/** Writing and editing music and arrangements (no takes or actions). Adding categories or an extension, e.g. `mixing,composition`, can push a profile past 128. */
|
|
4342
|
+
music: ["project", "tracks", "fx", "transport", "discovery", "selection", "midi", "media", "arrange", "markers", "tempo", "envelopes", "plan"],
|
|
4343
|
+
/** Inspect and measure; the tracks and project categories still hold a few writers, so this is not read-only. */
|
|
4344
|
+
analysis: ["project", "tracks", "transport", "discovery", "selection", "routing", "markers", "tempo", "analysis", "knowledge"]
|
|
4345
|
+
};
|
|
4346
|
+
function resolveProfile(value = process.env["REAPER_MCP_PROFILE"]) {
|
|
4347
|
+
const parts = (value ?? "").split(",").map((p) => p.trim()).filter(Boolean);
|
|
4348
|
+
if (parts.length === 0 || parts.includes("full")) return { name: "full", categories: null, extensions: [] };
|
|
4349
|
+
const categories = /* @__PURE__ */ new Set();
|
|
4350
|
+
const extensions = [];
|
|
4351
|
+
for (const part of parts) {
|
|
4352
|
+
const profile = PROFILES[part];
|
|
4353
|
+
if (profile) profile.forEach((c) => categories.add(c));
|
|
4354
|
+
else {
|
|
4355
|
+
categories.add(part);
|
|
4356
|
+
if (!(part in TOOL_CATEGORIES)) extensions.push(part);
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
return { name: parts.join(","), categories, extensions };
|
|
4360
|
+
}
|
|
4361
|
+
function blockedTools(categories) {
|
|
4362
|
+
if (!categories) return /* @__PURE__ */ new Set();
|
|
4363
|
+
const all = /* @__PURE__ */ new Set();
|
|
4364
|
+
const kept = /* @__PURE__ */ new Set();
|
|
4365
|
+
for (const cat of Object.values(TOOL_CATEGORIES)) {
|
|
4366
|
+
for (const t of cat.tools) {
|
|
4367
|
+
all.add(t);
|
|
4368
|
+
if (categories.has(cat.name)) kept.add(t);
|
|
4369
|
+
}
|
|
4370
|
+
}
|
|
4371
|
+
return new Set([...all].filter((t) => !kept.has(t)));
|
|
4372
|
+
}
|
|
4373
|
+
|
|
4327
4374
|
// apps/reaper-mcp-server/src/tools/aesthetics.ts
|
|
4328
4375
|
import { z as z27 } from "zod/v4";
|
|
4329
4376
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
@@ -9394,12 +9441,20 @@ function instrumentToolHandlers(server) {
|
|
|
9394
9441
|
return originalTool(...args);
|
|
9395
9442
|
};
|
|
9396
9443
|
}
|
|
9397
|
-
function
|
|
9444
|
+
function applyProfile(server, profile) {
|
|
9445
|
+
setVisibleCategories(profile.categories);
|
|
9446
|
+
const blocked = blockedTools(profile.categories);
|
|
9447
|
+
if (blocked.size === 0) return;
|
|
9448
|
+
const register = server.tool.bind(server);
|
|
9449
|
+
server.tool = (...args) => blocked.has(args[0]) ? void 0 : register(...args);
|
|
9450
|
+
}
|
|
9451
|
+
function createServer(profile = resolveProfile()) {
|
|
9398
9452
|
const server = new McpServer({
|
|
9399
9453
|
name: "reaper-mcp",
|
|
9400
9454
|
version: "0.1.0"
|
|
9401
9455
|
});
|
|
9402
9456
|
instrumentToolHandlers(server);
|
|
9457
|
+
applyProfile(server, profile);
|
|
9403
9458
|
registerProjectTools(server);
|
|
9404
9459
|
registerTrackTools(server);
|
|
9405
9460
|
registerFxTools(server);
|
|
@@ -9728,9 +9783,13 @@ async function loadOne(server, ext) {
|
|
|
9728
9783
|
return skipped(err instanceof Error ? err.message : String(err));
|
|
9729
9784
|
}
|
|
9730
9785
|
}
|
|
9731
|
-
async function loadExtensions(server, root = getExtensionsDir()) {
|
|
9786
|
+
async function loadExtensions(server, root = getExtensionsDir(), include) {
|
|
9732
9787
|
const statuses = [];
|
|
9733
9788
|
for (const ext of await discoverExtensions(root)) {
|
|
9789
|
+
if (include && !include(ext.manifest?.name ?? ext.folder)) {
|
|
9790
|
+
statuses.push({ name: ext.manifest?.name ?? ext.folder, status: "skipped", reason: "not in the REAPER_MCP_PROFILE", tools: [] });
|
|
9791
|
+
continue;
|
|
9792
|
+
}
|
|
9734
9793
|
if (!ext.manifest) {
|
|
9735
9794
|
statuses.push({ name: ext.folder, status: "skipped", reason: ext.errors.join("; "), tools: [] });
|
|
9736
9795
|
} else {
|
|
@@ -10049,6 +10108,7 @@ function installClaudeAssets(packageClaudeDir, claudeDir, opts = {}) {
|
|
|
10049
10108
|
if (existsSync8(skillsSrc)) {
|
|
10050
10109
|
for (const f of listFiles(skillsSrc)) {
|
|
10051
10110
|
const rel = relative(skillsSrc, f);
|
|
10111
|
+
if (existsSync8(join13(skillsSrc, rel.split(/[\\/]/)[0], ".repo-only"))) continue;
|
|
10052
10112
|
plan.push([f, join13(claudeDir, "skills", rel), join13(claudeDir, "skills", rel.split(/[\\/]/)[0])]);
|
|
10053
10113
|
}
|
|
10054
10114
|
}
|
|
@@ -10612,11 +10672,20 @@ async function serve() {
|
|
|
10612
10672
|
});
|
|
10613
10673
|
startupSpan.setAttribute("reaper.bridge.connected", bridge.state === "connected");
|
|
10614
10674
|
startupSpan.setAttribute("reaper.bridge.state", bridge.state);
|
|
10615
|
-
const
|
|
10616
|
-
|
|
10675
|
+
const profile = resolveProfile();
|
|
10676
|
+
const server = createServer(profile);
|
|
10677
|
+
const selected = profile.categories;
|
|
10678
|
+
const loadedExtensions = await loadExtensions(server, void 0, selected ? (name) => selected.has(name) : void 0);
|
|
10679
|
+
for (const ext of loadedExtensions) {
|
|
10617
10680
|
if (ext.status === "loaded") log(`Extension ${ext.name} ${ext.version ?? ""} loaded (${ext.tools.length} tools)`);
|
|
10618
10681
|
else log(`Extension ${ext.name} skipped: ${ext.reason}`);
|
|
10619
10682
|
}
|
|
10683
|
+
if (selected) {
|
|
10684
|
+
log(`Tool profile "${profile.name}": ${Object.keys(server._registeredTools).length} tools`);
|
|
10685
|
+
for (const name of profile.extensions) {
|
|
10686
|
+
if (!loadedExtensions.some((e) => e.name === name && e.status === "loaded")) log(`REAPER_MCP_PROFILE names "${name}", which is neither a profile, a tool category nor a loaded extension`);
|
|
10687
|
+
}
|
|
10688
|
+
}
|
|
10620
10689
|
const transport = new StdioServerTransport();
|
|
10621
10690
|
await server.connect(transport);
|
|
10622
10691
|
server.server.oninitialized = () => {
|
package/package.json
CHANGED