@williamzujkowski/live-coding-music-mcp 1.0.0 → 3.0.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/LICENSE +661 -21
- package/README.md +228 -233
- package/dist/AudioAnalyzer.js +0 -1
- package/dist/PatternStore.js +0 -1
- package/dist/index.js +0 -0
- package/dist/server/resources.js +175 -0
- package/dist/server/server.js +226 -348
- package/dist/server/tools/ai.js +78 -22
- package/dist/server/tools/analysis.js +266 -73
- package/dist/server/tools/capture.js +67 -20
- package/dist/server/tools/compose.js +159 -0
- package/dist/server/tools/diagnostics.js +112 -60
- package/dist/server/tools/editor.js +130 -66
- package/dist/server/tools/generate.js +190 -74
- package/dist/server/tools/history.js +149 -88
- package/dist/server/tools/playback.js +49 -18
- package/dist/server/tools/session.js +108 -70
- package/dist/server/tools/storage.js +86 -30
- package/dist/server/tools/transform.js +250 -116
- package/dist/server/tools/types.js +66 -1
- package/dist/services/AudioCaptureService.js +4 -3
- package/dist/services/GeminiService.js +1 -1
- package/dist/services/MIDIExportService.js +2 -4
- package/dist/services/SessionManager.js +4 -2
- package/dist/services/StrudelEngine.js +24 -126
- package/dist/services/StrudelEngineHelpers.js +151 -0
- package/package.json +2 -2
- package/dist/__tests__/MusicTheory.test.js +0 -245
- package/dist/__tests__/PatternGenerator.test.js +0 -337
- package/dist/__tests__/PatternStore.test.js +0 -153
- package/dist/__tests__/utils/MockPlaywright.js +0 -130
- package/dist/server/EnhancedMCPServer.js +0 -654
- package/dist/server/EnhancedMCPServerFixed.js +0 -2506
|
@@ -1,39 +1,76 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* storage domain — pattern persistence
|
|
2
|
+
* storage domain — pattern persistence.
|
|
3
3
|
*
|
|
4
|
-
* Owns
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Owns one consolidated tool (`pattern_store`) plus three deprecated
|
|
5
|
+
* aliases (`save`, `load`, `list`) per the #120 / #143 consolidation.
|
|
6
|
+
*
|
|
7
|
+
* The consolidation also resolves the `list` / `list_sessions` naming
|
|
8
|
+
* collision from #110 — `pattern_store(action='list')` is unambiguous
|
|
9
|
+
* versus `session(action='list')` after the #158 session consolidation.
|
|
10
|
+
*
|
|
11
|
+
* Aliases forward to `pattern_store` and will be removed in a future
|
|
12
|
+
* release per the deprecation policy in #120.
|
|
8
13
|
*/
|
|
9
14
|
import { InputValidator } from '../../utils/InputValidator.js';
|
|
15
|
+
const SESSION_ID_PROP = {
|
|
16
|
+
session_id: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Optional session ID (#108). Sources/targets the named session\'s current pattern; the on-disk catalog is shared across sessions.',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
10
21
|
export const tools = [
|
|
22
|
+
{
|
|
23
|
+
name: 'pattern_store',
|
|
24
|
+
description: 'Persist patterns to disk and read them back. ' +
|
|
25
|
+
'Use action=save to write the current session pattern under a name; ' +
|
|
26
|
+
'action=load to restore a named pattern into the current session; ' +
|
|
27
|
+
'action=list to enumerate the on-disk catalog (optionally filtered by tag). ' +
|
|
28
|
+
'Example: pattern_store({ action: "save", name: "my-jam", tags: ["techno"] }). ' +
|
|
29
|
+
'For session lifecycle (create/destroy/list active sessions) use the session tool — pattern_store deals with on-disk patterns, not runtime sessions.',
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
action: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
enum: ['save', 'load', 'list'],
|
|
36
|
+
description: 'Which on-disk operation to perform',
|
|
37
|
+
},
|
|
38
|
+
name: { type: 'string', description: 'Pattern name (required for save/load)' },
|
|
39
|
+
tags: { type: 'array', items: { type: 'string' }, description: 'Tags to attach (save only)' },
|
|
40
|
+
tag: { type: 'string', description: 'Filter by tag (list only)' },
|
|
41
|
+
...SESSION_ID_PROP,
|
|
42
|
+
},
|
|
43
|
+
required: ['action'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
11
46
|
{
|
|
12
47
|
name: 'save',
|
|
13
|
-
description: 'Save pattern with metadata',
|
|
48
|
+
description: '[DEPRECATED — use pattern_store({ action: "save" }) instead] Save pattern with metadata',
|
|
14
49
|
inputSchema: {
|
|
15
50
|
type: 'object',
|
|
16
51
|
properties: {
|
|
17
52
|
name: { type: 'string', description: 'Pattern name' },
|
|
18
53
|
tags: { type: 'array', items: { type: 'string' } },
|
|
54
|
+
...SESSION_ID_PROP,
|
|
19
55
|
},
|
|
20
56
|
required: ['name'],
|
|
21
57
|
},
|
|
22
58
|
},
|
|
23
59
|
{
|
|
24
60
|
name: 'load',
|
|
25
|
-
description: 'Load saved pattern',
|
|
61
|
+
description: '[DEPRECATED — use pattern_store({ action: "load" }) instead] Load saved pattern',
|
|
26
62
|
inputSchema: {
|
|
27
63
|
type: 'object',
|
|
28
64
|
properties: {
|
|
29
65
|
name: { type: 'string', description: 'Pattern name' },
|
|
66
|
+
...SESSION_ID_PROP,
|
|
30
67
|
},
|
|
31
68
|
required: ['name'],
|
|
32
69
|
},
|
|
33
70
|
},
|
|
34
71
|
{
|
|
35
72
|
name: 'list',
|
|
36
|
-
description: 'List saved patterns',
|
|
73
|
+
description: '[DEPRECATED — use pattern_store({ action: "list" }) instead] List saved patterns',
|
|
37
74
|
inputSchema: {
|
|
38
75
|
type: 'object',
|
|
39
76
|
properties: {
|
|
@@ -43,33 +80,52 @@ export const tools = [
|
|
|
43
80
|
},
|
|
44
81
|
];
|
|
45
82
|
export const toolNames = new Set(tools.map(t => t.name));
|
|
83
|
+
async function doSave(args, ctx, sid) {
|
|
84
|
+
InputValidator.validateStringLength(args.name, 'name', 255, false);
|
|
85
|
+
const toSave = await ctx.getCurrentPatternSafe(sid);
|
|
86
|
+
if (!toSave) {
|
|
87
|
+
return 'No pattern to save';
|
|
88
|
+
}
|
|
89
|
+
await ctx.store.save(args.name, toSave, args.tags || []);
|
|
90
|
+
return `Pattern saved as "${args.name}"`;
|
|
91
|
+
}
|
|
92
|
+
async function doLoad(args, ctx, sid) {
|
|
93
|
+
InputValidator.validateStringLength(args.name, 'name', 255, false);
|
|
94
|
+
const saved = await ctx.store.load(args.name);
|
|
95
|
+
if (saved) {
|
|
96
|
+
await ctx.writePatternSafe(saved.content, sid);
|
|
97
|
+
return `Loaded pattern "${args.name}"`;
|
|
98
|
+
}
|
|
99
|
+
return `Pattern "${args.name}" not found`;
|
|
100
|
+
}
|
|
101
|
+
async function doList(args, ctx) {
|
|
102
|
+
if (args?.tag) {
|
|
103
|
+
InputValidator.validateStringLength(args.tag, 'tag', 100, false);
|
|
104
|
+
}
|
|
105
|
+
const patterns = await ctx.store.list(args?.tag);
|
|
106
|
+
return patterns.map(p => `• ${p.name} [${p.tags.join(', ')}] - ${p.timestamp}`).join('\n') || 'No patterns found';
|
|
107
|
+
}
|
|
46
108
|
export async function execute(name, args, ctx) {
|
|
109
|
+
const sid = args?.session_id;
|
|
47
110
|
switch (name) {
|
|
48
|
-
case '
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return 'No pattern to save';
|
|
53
|
-
}
|
|
54
|
-
await ctx.store.save(args.name, toSave, args.tags || []);
|
|
55
|
-
return `Pattern saved as "${args.name}"`;
|
|
56
|
-
}
|
|
57
|
-
case 'load': {
|
|
58
|
-
InputValidator.validateStringLength(args.name, 'name', 255, false);
|
|
59
|
-
const saved = await ctx.store.load(args.name);
|
|
60
|
-
if (saved) {
|
|
61
|
-
await ctx.writePatternSafe(saved.content);
|
|
62
|
-
return `Loaded pattern "${args.name}"`;
|
|
111
|
+
case 'pattern_store': {
|
|
112
|
+
const action = args?.action;
|
|
113
|
+
if (!action || !['save', 'load', 'list'].includes(action)) {
|
|
114
|
+
throw new Error(`Invalid action: ${action}. Must be one of: save, load, list`);
|
|
63
115
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
InputValidator.validateStringLength(args.tag, 'tag', 100, false);
|
|
116
|
+
switch (action) {
|
|
117
|
+
case 'save': return await doSave(args, ctx, sid);
|
|
118
|
+
case 'load': return await doLoad(args, ctx, sid);
|
|
119
|
+
case 'list': return await doList(args, ctx);
|
|
69
120
|
}
|
|
70
|
-
|
|
71
|
-
return
|
|
121
|
+
// Unreachable due to enum check above, but TypeScript wants it.
|
|
122
|
+
return undefined;
|
|
72
123
|
}
|
|
124
|
+
// Aliases — forward to consolidated handler. Kept for ≥1 release per
|
|
125
|
+
// #120 migration rules; removed afterwards.
|
|
126
|
+
case 'save': return await doSave(args, ctx, sid);
|
|
127
|
+
case 'load': return await doLoad(args, ctx, sid);
|
|
128
|
+
case 'list': return await doList(args, ctx);
|
|
73
129
|
default:
|
|
74
130
|
throw new Error(`storage module does not handle tool: ${name}`);
|
|
75
131
|
}
|