@ulm0/ableton-live-mcp 0.0.0-stage → 1.1.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.
Binary file
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ulm0
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,602 @@
1
- # Temporary Holding Version
1
+ # Ableton Live MCP
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An [MCP](https://modelcontextprotocol.io) server for **Ableton Live 12**, built on the official
4
+ [Ableton Extensions SDK](https://ableton.github.io/extensions-sdk). The MCP server runs *inside*
5
+ Live as an extension — no bridge process, no MIDI remote scripts. Any MCP client (Claude Code,
6
+ Claude Desktop, Cursor, ...) connects over streamable HTTP and gets full programmatic control of
7
+ the Live Set: tracks, clips, MIDI notes, devices, parameters, mixer, scenes, warping, rendering,
8
+ and more.
9
+
10
+ ```
11
+ MCP client (Claude, ...) ──streamable HTTP──▶ http://127.0.0.1:8722/mcp
12
+ │
13
+ Live Extension Host (Node.js)
14
+ │
15
+ Ableton Live 12
16
+ ```
17
+
18
+ ## Requirements
19
+
20
+ - Ableton Live 12.4.5 or newer (Extensions support)
21
+ - Node.js >= 24.16 (build only; required by the Ableton Extensions SDK 1.0.0-beta.1)
22
+
23
+ ## Install
24
+
25
+ Download `Ableton-Live-MCP-<version>.ablx` from the
26
+ [latest GitHub Release](https://github.com/ulm0/ableton-live-mcp/releases/latest) (check it against
27
+ `SHA256SUMS`), or take it from the npm package
28
+ [`@ulm0/ableton-live-mcp`](https://www.npmjs.com/package/@ulm0/ableton-live-mcp):
29
+
30
+ ```bash
31
+ npm pack @ulm0/ableton-live-mcp && tar -xzf ulm0-ableton-live-mcp-*.tgz package/*.ablx
32
+ ```
33
+
34
+ Or build it from source:
35
+
36
+ ```bash
37
+ npm install
38
+ npm run package # builds and produces Ableton-Live-MCP-<version>.ablx
39
+ ```
40
+
41
+ Then drag the `.ablx` file onto **Settings → Extensions** in Live. The MCP endpoint starts with
42
+ Live at `http://127.0.0.1:8722/mcp` (`GET /health` for a quick check: version, host API version,
43
+ tool count, uptime).
44
+
45
+ ### Development mode
46
+
47
+ Enable **Settings → Extensions → Developer Mode** in Live, then:
48
+
49
+ ```bash
50
+ npm start # builds and runs the extension against the running Live
51
+ ```
52
+
53
+ `.env` must point at your Live installation, e.g.
54
+ `EXTENSION_HOST_PATH=/Applications/Ableton Live 12 Beta.app`.
55
+
56
+ ### Connect a client
57
+
58
+ Claude Code:
59
+
60
+ ```bash
61
+ claude mcp add --transport http ableton-live http://127.0.0.1:8722/mcp
62
+ ```
63
+
64
+ Claude Desktop (or any stdio-only client) via `mcp-remote`:
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "ableton-live": {
70
+ "command": "npx",
71
+ "args": ["mcp-remote", "http://127.0.0.1:8722/mcp"]
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ With an `auth_token` in `config.json` (see [Security](#security)), the client sends it as a
78
+ bearer token:
79
+
80
+ ```bash
81
+ claude mcp add --transport http ableton-live http://127.0.0.1:8722/mcp \
82
+ --header "Authorization: Bearer <token>"
83
+ ```
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "ableton-live": {
89
+ "command": "npx",
90
+ "args": ["mcp-remote", "http://127.0.0.1:8722/mcp", "--header", "Authorization:${AUTH_HEADER}"],
91
+ "env": { "AUTH_HEADER": "Bearer <token>" }
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ ### Configuration
98
+
99
+ Settings live in `config.json` inside the extension's storage directory (created on first run
100
+ with the port; the path is reported by `song_get` under `environment.storage_directory` and by
101
+ the Status dialog in Live). It is read once, when the extension starts (`sample_roots` excepted):
102
+ restart Live after a change. Default:
103
+
104
+ ```json
105
+ { "port": 8722 }
106
+ ```
107
+
108
+ | Setting | Default | Meaning |
109
+ |---|---|---|
110
+ | `port` | `8722` | TCP port on 127.0.0.1 |
111
+ | `progress_notifications` | `true` | `false` answers every request as plain JSON (no progress for long calls) |
112
+ | `sample_roots` | `[]` | Folders `sample_search` searches (read on every search) |
113
+ | `read_only` | `false` | `true` registers only the tools that read the Live Set (`readOnlyHint`) |
114
+ | `disabled_tools` | `[]` | Tool names not to register, e.g. `["execute_command", "show_dialog"]` |
115
+ | `auth_token` | `null` | Require `Authorization: Bearer <token>` on `/mcp` (16+ visible ASCII characters) |
116
+
117
+ Every value is validated at startup. Problems are logged to `ExtensionHost.txt` (prefixed
118
+ `[ableton-live-mcp] config:`) and listed in the Status dialog: a `port` or
119
+ `progress_notifications` of the wrong type falls back to its default, unknown keys are ignored
120
+ (misspelled security settings excepted, see below).
121
+ The security settings never fall back to something less safe: an invalid `read_only`,
122
+ `disabled_tools` or `auth_token`, a misspelled one (`readOnly`, `auth-token`, ...), a
123
+ `disabled_tools` entry that names no tool (probably a typo), or a file that exists but cannot be
124
+ read or parsed (smart quotes, unquoted keys, ...), makes `/mcp` refuse every request with `503`
125
+ and the reason until the file is fixed. The file is read as UTF-8, or as UTF-16 when it starts
126
+ with a byte order mark (as Windows PowerShell 5.1 writes it); an empty file means the defaults.
127
+ A switched-off tool is not listed at all; `batch` steps naming it fail with "switched off", the
128
+ server instructions tell the agent which tools are off, and a prompt is only offered when every
129
+ tool it uses is on.
130
+
131
+ For example `{ "port": 8722, "read_only": true }`,
132
+ `{ "port": 8722, "disabled_tools": ["execute_command", "track_delete", "scene_delete"] }` or
133
+ `{ "port": 8722, "auth_token": "<a long random string>" }`.
134
+
135
+ `sample_roots` lists the folders `sample_search` may search for audio files (absolute paths, or
136
+ `~/...`), in addition to Live's default User Library and Factory Packs folders
137
+ (`~/Music/Ableton/...` on macOS, `~/Documents/Ableton/...` on Windows) when they exist. Unlike
138
+ the port, it is read on every search, so no restart is needed:
139
+
140
+ ```json
141
+ { "port": 8722, "sample_roots": ["/Users/me/Samples", "~/Splice"] }
142
+ ```
143
+
144
+ Long calls (`show_dialog`, `dialog_result`, `selection_wait`, `render_track_audio`,
145
+ `audio_track_consolidate`, `batch`, `batch_read`) send MCP progress notifications when the client
146
+ asks for them; such a call is then answered as an SSE stream instead of plain JSON (see
147
+ [How it works](#how-it-works)). `"progress_notifications": false` answers every request as JSON
148
+ again (read at startup):
149
+
150
+ ```json
151
+ { "port": 8722, "progress_notifications": false }
152
+ ```
153
+
154
+ Device presets saved with `device_preset_save` are JSON files in `presets/` in the same
155
+ directory (one file per preset, named after it); they can be copied between machines, and
156
+ deleting a file deletes the preset.
157
+
158
+ ## How it works
159
+
160
+ - Every Live object (track, clip, device, parameter, ...) is addressed by a stable **object id**
161
+ discovered through listing tools (`song_get`, `track_get`, `device_get`, ...).
162
+ - Tracks and scenes can also be addressed **by name or index**: every tool that acts on one
163
+ track takes `track_id`, `track_index` (regular tracks) or `track_name` (exact match first,
164
+ then case-insensitive; regular, return and main tracks), and the scene tools take `scene_id`,
165
+ `scene_index` or `scene_name`. When several are given they must name the same object. An
166
+ ambiguous name is an error that lists only the matching candidates; deletes need the exact
167
+ name.
168
+ - Ids stay valid until the object is deleted or moved, or another Live Set is loaded. Stale ids
169
+ return an error telling the client to re-list. Errors in the arguments themselves (unknown
170
+ name, index out of range, conflicting fields) come without that hint.
171
+ - All times/positions are in **beats**; colors are `#RRGGBB`; MIDI pitches are 0–127, or note
172
+ names in Live's naming (`"C3"` = 60, `"F#1"`, `"Bb2"`) wherever a pitch is taken: notes,
173
+ patterns, note selections, drum pads in device paths and `drum_chain_set`. Drum chains report
174
+ `receiving_note_name` next to `receiving_note`.
175
+ - **Batched writes**: `track_set`, `scene_set`, `cue_point_set`, `clip_set`, `take_lane_set` and
176
+ `mixer_set` take `items: [{<address>, ...values}]` to change many objects in one call.
177
+ `clip_set` also takes `select: {track, scope, name_contains}` (e.g. every clip of the Drums
178
+ track), and `mixer_set` takes `targets` (same values on several mixers) or `all_tracks` with
179
+ `exclude`. Every entry is validated before the first write, and all of a call's changes form
180
+ **one undo step** in Live — as do the multi-value writes of `parameter_set` and `mixer_set`.
181
+ The exception: `cue_point_set` moves take up to three undo steps (creates, names, deletes);
182
+ its renames are one.
183
+ - **Create with initial config**: `track_create` takes a `name` and `devices` (each a name or
184
+ `{name, parameters}`) and returns the new track's `index` (Live inserts it after the selected
185
+ track); `device_insert` takes initial `parameters`; `scene_create` and `cue_point_create` take
186
+ a `name` or `items` for several at once.
187
+ - **Parameters by name**: `parameter_get` / `parameter_set` entries take
188
+ `{track_name, device, parameter}` (or `device_id` + `parameter`) instead of a `parameter_id`.
189
+ `device` is a name, an index, or a path into racks, e.g. `["Drum Rack", {"pad": 36}, "Simpler"]`
190
+ (drum pads by receiving note) or `[0, {"chain": 1}, "Reverb"]` (chains by index); `parameter`
191
+ matches exactly first, then case-insensitively, then by unique substring. Each write gives
192
+ exactly one of `value` (internal units), `value_item` (a quantized parameter's choice by name,
193
+ e.g. `"Saw"`), `reset: true` (default value) or `delta` (relative, clamped). `device_set`
194
+ switches a device on or off and sets several of its parameters in one undo step;
195
+ `parameter_find` searches parameter names across the set, a track or a device. Values stay in
196
+ internal units — the API has no display values (dB, Hz, ms).
197
+ - **MIDI shortcuts**: MIDI writes (`clip_create`, `midi_clip_set_notes`) take step `patterns`
198
+ (`{note: "C1", steps: "x...X...", step: 0.25}`, `X` = accent) and `repeat: {length, times?}`,
199
+ which copies the notes every `length` beats up to the clip's end. `midi_clip_get_notes` takes a
200
+ `select` filter and `format: "compact"` (`[pitch, start, duration, velocity]` tuples plus the
201
+ fields that differ from the result's `defaults`). `midi_clip_edit_notes` adds `set`,
202
+ `snap_to_scale` (the song's scale or `{root, intervals}`, ties go down), `swing`, seeded
203
+ `humanize`, `duration_set` / `duration_scale` / `legato` (a chord ends together), quantizing
204
+ to Live's grid (`grid: "song"`), selecting by `in_scale`, `every_nth` or the user's note
205
+ selection (`only_selected`), and `clip_ids` to edit several clips in one undo step.
206
+ Whether Live reports the note selection (`NoteDescription.selected`) to extensions is not
207
+ verified yet; when no note reports one, results carry a `warning`.
208
+ - **Copy, move and presets** (lossy by design): Live's API cannot move, reorder or copy devices,
209
+ so `device_copy` inserts a fresh built-in device and copies the parameter values by name (a
210
+ Simpler also gets its sample); `move: true` then deletes the original. Automation, mappings, a
211
+ custom device name and non-parameter state are lost, and ids change. `device_preset_save` /
212
+ `device_preset_load` / `device_preset_list` keep the same kind of snapshot as named JSON files
213
+ in the extension's storage directory (`presets/`) — not Live `.adv` presets. Racks are refused
214
+ by both.
215
+ - **Samples, kits and copies in one call**: `drum_kit_build {track_name | rack_device_id, pads:
216
+ [{note, sample_path, volume?, panning?}]}` builds or updates a Drum Rack kit — per pad it reuses
217
+ or creates the chain receiving that note, inserts a Simpler, imports the sample into the project
218
+ and loads it; every path is checked before anything changes. `device_insert {device_name:
219
+ "Simpler", sample_path}` imports the sample into the project by default (`import_into_project`),
220
+ so the set survives being moved; `simpler_replace_sample` loads the file as it is, as before,
221
+ unless it is given `import_into_project: true` (recommended). `sample_search` finds audio files in
222
+ the configured `sample_roots` and Live's library folders (read-only, confined to those folders).
223
+ Live's API has no clip copy, so `clip_copy` creates a new clip: MIDI notes are re-based to where
224
+ the source plays them (markers, loop) and repeated when the copy is longer, so it plays the same
225
+ in the arrangement; a session copy loops its whole length, so a source that starts before its
226
+ loop, or a length that is not whole loops, repeats differently (`lost` says so); audio copies
227
+ get the file, warping and markers/loop but Live warps them itself (`fidelity: "approximate"`,
228
+ `lost`, `warp_markers_match`). `move: true` deletes the source once
229
+ the copy exists. `arrangement_copy_range` overwrites a target range with a copy of a source range
230
+ across tracks ("repeat the chorus"): MIDI clips crossing the edges are trimmed, audio clips
231
+ crossing them are skipped and listed (there is no way to insert time). `audio_track_consolidate`
232
+ renders a range of an audio track, imports the render, clears the range and puts one unwarped
233
+ clip there. `render_track_audio {analyze: true}` returns peak/RMS levels (dBFS), clipped samples,
234
+ a silence flag and a 32-part envelope read from the render (WAV or AIFF); `persist: true` imports
235
+ the render;
236
+ `tracks` renders several audio tracks.
237
+ - **Whole-set reads**: `song_get` lists every track with its `index`, `depth` in the group
238
+ hierarchy, `is_group` and, for group tracks, `child_track_ids` (their `type` stays `other`);
239
+ `include: ["devices", "mixer", "clips"]` adds each track's device tree (through racks, with each
240
+ device's on-state), mixer values (sends labeled with return names) and clips (session and
241
+ arrangement, in brief), capped at 500 devices / 500 clips (`truncated` says where it stopped).
242
+ `scene_get` returns one session row across all tracks, `session_grid` a compact track × scene
243
+ matrix, and `arrangement_get {start_time, end_time, tracks?, include_take_lanes?}` the cue
244
+ points and every track's clips in a beat range, plus a derived `song_end` (the API has no song
245
+ length).
246
+ `song_audit` lists missing media files, Simplers without a sample, empty drum pads and track
247
+ names that make `track_name` ambiguous. `clip_get`, `device_get` and `chain_get` report a
248
+ `location` (track, scene index or take lane, path through racks).
249
+ - **The user's selection**: Live's API has no selection getter; it hands the selection to an
250
+ extension only through context-menu commands. So the extension adds **"MCP: Use as selection"**
251
+ to every context menu it can (clips, clip slots, tracks, scenes, Drum Racks, Simplers, samples,
252
+ clip-slot selections and arrangement time selections). The user right-clicks and picks it;
253
+ `selection_get` returns the last capture (ids, summaries, locations; for a time selection the
254
+ start/end beats and the selected lanes with their overlapping clips), `selection_wait` waits up
255
+ to 55 s for the next one. Captures are kept until the next one (or a restart of Live).
256
+ - **Dialogs in Live**: `show_dialog {form: {title?, message?, fields?, choices?}}` builds the
257
+ page itself (every text escaped) and returns the answer as JSON — `choice` (the button's label),
258
+ `choice_index` and `values` by field name (text, textarea, number, checkbox, select) — e.g. to
259
+ confirm a bulk delete; `html` (your own page) and `url` (https:, file: or http://localhost)
260
+ return the string the page sends. Live's dialogs are modal, have no timeout and can't be closed
261
+ from code, so a waiting call can outlast the client's request timeout: `wait: false` returns a
262
+ `dialog_id` at once and `dialog_result {dialog_id?, wait_s ≤ 50}` polls for the answer (also
263
+ for a dialog whose waiting call was cut off). One dialog at a time (the next is refused while
264
+ one is open; `force` if Live never reported it closed); answers are kept for 10 minutes.
265
+ - **Chains of calls**: `batch {steps: [{tool, args, as?}]}` runs up to 50 tool calls in order;
266
+ an argument `{"$ref": "<step>.<path>"}` takes a value from an earlier step's result (step index
267
+ or `as` name, then keys and array indexes, e.g. `{"$ref": "0.id"}`). Every tool name, `$ref` and
268
+ the arguments of steps without a `$ref` are checked against the tools' own schemas before the
269
+ first step runs; each step is its own undo step, and `on_error` stops (default) or continues
270
+ after a failing step. `batch_read` does the same for read-only tools only and refuses any other.
271
+ `show_dialog`, `execute_command` and the batch tools themselves can't be steps.
272
+ - **Long calls**: `show_dialog`, `dialog_result`, `selection_wait`, `render_track_audio`,
273
+ `audio_track_consolidate`, `batch` and `batch_read` send `notifications/progress` when the
274
+ request carries a `progressToken` — right away, then every 10 s (batches: one per step, with the
275
+ total) — so a client that resets its timeout on progress keeps waiting. Only such a call is
276
+ answered as an SSE stream (with the SDK's 15 s keep-alive); every other request keeps a plain
277
+ JSON response. When the client goes away (the connection drops), waiting calls stop waiting,
278
+ multi-track renders and batches start no further render or step (a dialog stays open in Live:
279
+ `dialog_result` gets it). A `notifications/cancelled` cannot reach a running call: the server is
280
+ stateless, so it arrives in a request of its own.
281
+ - **Resources** (read-only snapshots for clients that attach context): `live://song` is
282
+ `song_get` without arguments, `live://tracks/{track}` is `track_get` for the track named
283
+ `{track}` — percent-encoded with `encodeURIComponent`, so a `/` in a name cannot break the
284
+ match (`live://tracks/Drums%2FBus`); `resources/list` has one entry per uniquely named track
285
+ and completions for the names — and `live://guide` is the full [skill](#skills). There are no
286
+ subscriptions: the server is stateless and Live reports no changes, so read again for fresh
287
+ data. They follow their tools: with `song_get` or `track_get` switched off, theirs are gone.
288
+ - **Prompts** the user picks in the client, each expanding into step-by-step instructions with
289
+ exact tool calls: `song_skeleton` (scenes and locators per section, positions computed from
290
+ the bar counts, optional tempo and tracks), `chord_progression` (Roman numerals in a key —
291
+ default Live's current scale — or chord names, voiced and timed by the server into one
292
+ `clip_create` call) and `drum_beat` (a style's step patterns as one `clip_create`, with a kit
293
+ from `sample_search` + `drum_kit_build` when the pads are empty). Arguments are optional;
294
+ `style`, `voicing` and track names have completions.
295
+ - On `initialize` the server sends short **instructions** (a digest of the
296
+ [skill](#skills), kept in `src/instructions.md`): ids, beats, pitch and volume conventions,
297
+ and what the API cannot do. Clients that support server instructions (Claude Code) add them
298
+ to the agent's prompt.
299
+ - Every tool has a **title and MCP annotations**, so clients can auto-approve reads and single
300
+ out destructive calls:
301
+ - read-only (`readOnlyHint`): the `*_get` tools, `midi_clip_get_notes`, `parameter_find`,
302
+ `device_preset_list`, `session_grid`, `song_audit`, `selection_wait`, `sample_search`,
303
+ `dialog_result`, `batch_read` (it refuses steps that are not read-only);
304
+ - setters (`*_set`): non-destructive, idempotent — except `parameter_set` and `device_set`,
305
+ which take `delta` (added to the current value on every call), so they are not idempotent;
306
+ - creators (`*_create`, `*_duplicate`, `*_insert*`, `import_file`, `render_track_audio` —
307
+ `persist` copies the render into the project): non-destructive;
308
+ - destructive (`destructiveHint`): the deletes, `track_clear_clips_in_range`,
309
+ `midi_clip_set_notes`, `midi_clip_edit_notes`, `simpler_replace_sample`, `device_copy` and
310
+ `clip_copy` (`move` deletes the original), `device_preset_load` and `drum_kit_build` (replace
311
+ Simpler samples), `device_preset_save` (`overwrite` replaces a preset),
312
+ `arrangement_copy_range` (overwrites its target range), `audio_track_consolidate` (clears
313
+ its range), `batch` (as destructive as its steps);
314
+ - `show_dialog` (non-destructive) and `execute_command` (destructive) are open-world.
315
+
316
+ ## Security
317
+
318
+ The endpoint binds to `127.0.0.1` only, so other computers cannot reach it; every program on
319
+ this computer can. Requests go through these checks, in order:
320
+
321
+ 1. **Host and Origin** (DNS rebinding): the `Host` header must be `127.0.0.1`, `localhost` or
322
+ `[::1]` (any port), and an `Origin` header, if sent, must be an `http(s)` origin on one of
323
+ those hosts (`Origin: null` is refused). Anything else gets `403` with a JSON-RPC error, on
324
+ every path. MCP clients such as Claude Code and `mcp-remote` send a loopback `Host` and no
325
+ `Origin`, so they are unaffected.
326
+ 2. `GET /health` answers without a token: `ok`, `name`, `version`, `host_api_version`,
327
+ `tool_count`, `read_only`, `auth_required` and `uptime_s` — no paths, no settings beyond
328
+ those, never the token (`503` and `ok: false` while config.json locks `/mcp`).
329
+ 3. **Bearer token** (optional, `auth_token` in config.json): `/mcp` then answers `401` with
330
+ `WWW-Authenticate: Bearer` unless the request carries `Authorization: Bearer <token>` — before
331
+ anything else about the request is looked at, its method and body included. The server keeps
332
+ only the token's SHA-256 digest and compares digests with `crypto.timingSafeEqual`. The token
333
+ itself is stored **in plaintext** in `config.json`: anyone who can read that file (your user
334
+ account) can use it, so treat the file like a password, and pick a long random token (at
335
+ least 16 visible ASCII characters). It keeps out other users and programs that can reach the
336
+ port but not your files.
337
+ 4. A `config.json` with an invalid security setting answers `503` with the reason (see
338
+ [Configuration](#configuration)).
339
+ 5. `/mcp` only serves `POST` (`GET`/`DELETE` answer `405`, `Allow: POST`; the server is
340
+ stateless); request bodies over 4 MiB are refused with `413`.
341
+
342
+ To limit what a connected agent can do at all, set `read_only` or `disabled_tools` (see
343
+ [Configuration](#configuration)): switched-off tools are not registered, so neither a direct
344
+ call nor `batch` can reach them.
345
+
346
+ ## Tools
347
+
348
+ ### Song
349
+ | Tool | Description |
350
+ |------|-------------|
351
+ | `song_get` | Live Set state: tempo, scale, grid, tracks (with `index`, group hierarchy: `depth`, `is_group`, `child_track_ids`), return/main tracks, scenes, cue points, environment info (incl. `server_version`). The entry point — returns the object ids used everywhere else. `include` fetches only selected sections; the opt-in `devices`, `mixer` and `clips` add every track's device tree (with on-states), mixer values and clips in one call (capped, see `truncated`). |
352
+ | `song_set` | Set song properties (tempo). |
353
+ | `song_audit` | Read-only check for missing media files (audio clips, Simpler samples), Simplers without a sample, empty drum pads and duplicate track names, each entry with ids and location. |
354
+
355
+ ### Tracks
356
+ | Tool | Description |
357
+ |------|-------------|
358
+ | `track_get` | Track detail: clip slots + clips, take lanes, arrangement clips, devices, mixer with values. Address by `track_id`, `track_index`, or `track_name`; `include` selects sections. Group tracks have `is_group: true` (their `type` is `other`). |
359
+ | `track_set` | Name / mute / solo / arm, by id, index or name; `items` changes many tracks in one undo step. |
360
+ | `track_create` | New audio or MIDI track, optionally with a `name` and `devices` (names, or `{name, parameters}` with initial values). Returns the track's `index` (Live inserts it after the selected track); a failing device is reported in `errors` instead of failing the call. |
361
+ | `track_delete` | Delete track (by id, index, or exact name). |
362
+ | `track_duplicate` | Duplicate track. |
363
+ | `track_clear_clips_in_range` | Delete/truncate arrangement clips in a beat range. |
364
+ | `take_lane_create` | Add a take lane to a track. |
365
+ | `take_lane_set` | Rename take lanes (`items` for several, one undo step). |
366
+
367
+ Every tool above except `take_lane_set` takes the track as `track_id`, `track_index` or `track_name`.
368
+
369
+ ### Scenes, session & arrangement
370
+ | Tool | Description |
371
+ |------|-------------|
372
+ | `scene_get` | One session row: a scene (by id, index or name) with every regular track's clip slot and clip in it (`only_clips` drops the empty ones). |
373
+ | `session_grid` | The Session View as a compact track × scene matrix (`null` or a brief clip per cell); narrow with `tracks` and `scene_index_min`/`scene_index_max`. |
374
+ | `arrangement_get` | A beat range of the arrangement (`start_time`/`end_time`, default the whole song): cue points in it and each track's overlapping clips (`tracks` to pick, `include_take_lanes` for take lanes), plus a derived `song_end`. |
375
+ | `arrangement_copy_range` | Copy a beat range of the arrangement to `to_time` on every audio/MIDI track (or `tracks`), overwriting the target range (cleared first; no insert-time). MIDI clips crossing the range edges are trimmed, audio clips crossing them skipped and listed; `include_cue_points` copies the locators too. |
376
+ | `scene_create` / `scene_set` / `scene_delete` / `scene_duplicate` | Manage scenes, addressed by `scene_id`, `scene_index` or `scene_name` (exact for delete). `scene_create` takes a `name`, or `items` to create several in order; `scene_set` renames many with `items` in one undo step. |
377
+ | `cue_point_create` / `cue_point_set` / `cue_point_delete` | Manage arrangement locators. Create with a `name`, or several with `items`. `cue_point_set` renames (`items` for many) and moves: with `time` it re-creates the locator at the new position with its name, deletes the old one and returns the new id plus `replaced_id`. |
378
+
379
+ ### Clips
380
+ | Tool | Description |
381
+ |------|-------------|
382
+ | `clip_create` | Create MIDI or audio clips in a session slot (by id, or track + `scene_index`/`scene_id`/`scene_name`), arrangement track, or take lane. The track can be given as `target_id` or `track_id`/`track_index`/`track_name`. MIDI clips take inline `notes`, step `patterns` and `repeat` (and ignore the audio-only `file_path`/`is_warped`/`loop_settings`, with a `warning`); `name`/`color` apply at creation. Audio files are imported into the project automatically. |
383
+ | `clip_get` | Full clip detail (audio: warp settings + markers; MIDI: note count) and its `location`: session (track, scene, slot), arrangement (track) or take lane. |
384
+ | `clip_set` | Name, color, mute, looping, warping, warp mode — for one clip, several (`items`), or every clip of a track (`select: {track_name, scope, name_contains}`), in one undo step. |
385
+ | `clip_delete` | Delete a session or arrangement clip. |
386
+ | `clip_copy` | Copy a clip to an empty session slot, an arrangement position or a take lane (`move: true` deletes the source afterwards). MIDI notes are re-based from the source's markers/loop and repeated to fill a longer `duration` (a session copy loops its whole length: `lost` says when that repeats differently from the source); audio copies keep file, warping, warp mode and markers/loop but are re-warped by Live (`fidelity`, `lost`, `warp_markers_match`, `differs`). |
387
+ | `midi_clip_get_notes` | Read MIDI notes: all, or those matching `select` (pitch/time range, `in_scale`, `every_nth`, `only_selected`); `format: "compact"` returns tuples. Notes carry `selected` when Live reports it. |
388
+ | `midi_clip_set_notes` | Write notes: `replace` all or `merge` (layer on top); step `patterns` and `repeat` write repetitive parts in a few characters. |
389
+ | `midi_clip_edit_notes` | Server-side note transforms — transpose, snap to scale, set fields, velocity scale/offset, time-shift, quantize (beats or Live's grid), swing, duration set/scale, legato, seeded humanize, delete — on the notes matching `select`, for one clip or several (`clip_ids`, one undo step). No read-modify-write roundtrip. |
390
+
391
+ ### Devices & racks
392
+ | Tool | Description |
393
+ |------|-------------|
394
+ | `device_get` | Device detail: parameters with ranges/value items (`parameter_filter` substring, `include_values`, `include_value_items`), rack chains (`include_chain_devices` inlines pad devices), Simpler sample, and its `location` (track, path through racks, position). |
395
+ | `device_insert` | Insert a built-in Live device into a track (by id, index or name) or rack chain, optionally with initial `parameters` (one more undo step); a Simpler can load a `sample_path` (imported into the project by default; removed again if the sample fails). |
396
+ | `device_set` | Switch a device on/off (`enabled`: its "Device On" parameter, or a two-state first parameter as a reported fallback) and set several of its parameters by name, `value_item`, `reset` or `delta` — one undo step. The device is `device_id` or track + `device` (name, index or rack path). |
397
+ | `device_delete` / `device_duplicate` | Remove or copy devices (the duplicate lands right after the original). |
398
+ | `device_copy` | Copy a device to another track or chain, or with `move: true` move/reorder it: inserts the built-in device by name and copies parameter values by name (Simpler: and its sample). Lossy — automation, mappings and non-parameter state are lost, ids change; racks are refused. |
399
+ | `device_preset_save` / `device_preset_load` / `device_preset_list` | Named parameter snapshots (plus a Simpler's sample path) stored as JSON under the extension's storage directory. Load onto an existing device or insert a new one. Not Live presets. |
400
+ | `chain_get` | Rack chain detail: devices + chain mixer and `location`; drum chains report `receiving_note` and `receiving_note_name`. |
401
+ | `rack_insert_chain` | Add a chain to a rack. |
402
+ | `drum_chain_set` | Set the MIDI note of a drum rack pad (a number or a name like `"D1"`). |
403
+ | `simpler_replace_sample` | Swap the sample in a Simpler; `import_into_project: true` (recommended; default `false`, as before the option existed) imports the file into the project first and loads the copy. |
404
+ | `drum_kit_build` | Build or update a Drum Rack kit from sample files: per pad `{note, sample_path, volume?, panning?}` the chain receiving the note is reused or created, a Simpler inserted, the sample imported and loaded. All paths are checked first; later per-pad failures are reported per pad. The rack is `rack_device_id`, or a MIDI track's Drum Rack (inserted when missing). |
405
+
406
+ ### Parameters & mixing
407
+ | Tool | Description |
408
+ |------|-------------|
409
+ | `parameter_get` | Read device/mixer parameter values (batch) by id or by `{track, device, parameter}`; quantized parameters report their `value_item`. |
410
+ | `parameter_set` | Write parameter values (batch, single undo step, nothing written if any entry is invalid): each entry by id or `{track, device, parameter}` with one of `value`, `value_item`, `reset` or `delta`. |
411
+ | `parameter_find` | Search parameter names (and quantized choices) across the set, a track or a device, through racks; returns ids, devices and readable paths. |
412
+ | `mixer_get` | Volume / pan / sends of a track (by id, index or name) or chain, with parameter ids and unit hints. |
413
+ | `mixer_set` | Set volume / pan / sends (by index or `return_name`) in one undo step: one track or chain, the same values on several (`targets`) or on every track (`all_tracks` minus `exclude`), or per-target values (`items`). `all_tracks` sets volume on the top-most tracks only (a group covers its tracks, which keep their volume: `skipped`, or `volume_skipped` when they get panning or sends); panning and sends go to every track, grouped ones included. An excluded group keeps its tracks, and a group holding an excluded track is skipped while its other tracks are set; the result lists what was `skipped` and why. |
414
+
415
+ ### Files & rendering
416
+ | Tool | Description |
417
+ |------|-------------|
418
+ | `import_file` | Copy a file into the Live project. |
419
+ | `render_track_audio` | Render the pre-FX audio of an audio track (by id, index or name; clip audio before the device chain) to a WAV or AIFF file (Live's Record File Type setting decides) in the extension's temp directory, which may be cleaned — `persist: true` imports it into the project. Not normalized since Live 12.4.15. `analyze: true` adds overall and per-channel peak/RMS in dBFS, clipped samples, a silence flag and a 32-part envelope; `tracks` renders several audio tracks. |
420
+ | `audio_track_consolidate` | Render a range of an audio track (pre-FX), import it, clear the range and create one unwarped clip of the render there, optionally named and colored — Live's Consolidate for comps. Destructive. |
421
+ | `sample_search` | Find audio files by words in their path, read-only, in the `sample_roots` of config.json and Live's User Library / Factory Packs folders; confined to those folders, with depth, time and result limits. |
422
+
423
+ ### Selection
424
+ | Tool | Description |
425
+ |------|-------------|
426
+ | `selection_get` | The selection the user last handed over with the context-menu entry "MCP: Use as selection": ids, summaries and locations of the clicked object or selected clip slots, or an arrangement time selection (start/end beats, selected lanes with their overlapping clips). |
427
+ | `selection_wait` | Wait (up to `timeout_s` ≤ 55 s) for the user's next "MCP: Use as selection", then return it like `selection_get`. |
428
+
429
+ ### UI & commands
430
+ | Tool | Description |
431
+ |------|-------------|
432
+ | `show_dialog` | Show a modal dialog inside Live: a `form` (title, message, text/number/checkbox/select fields, buttons) answered as JSON (`choice`, `values`), your own `html`, or an https:/file:/localhost `url`. `wait: false` returns a `dialog_id` at once. One dialog at a time; dialogs keep no state between calls. |
433
+ | `dialog_result` | The answer of a dialog (by `dialog_id`, default the last one): open, closed with the answer, or failed; waits up to `wait_s` ≤ 50 s for an open one. Kept 10 minutes after closing. |
434
+ | `execute_command` | Invoke Extension Host commands, e.g. `ableton-live-mcp.status`. |
435
+
436
+ ### Batches
437
+ | Tool | Description |
438
+ |------|-------------|
439
+ | `batch` | Run up to 50 tool calls in order (`steps: [{tool, args, as?}]`); `{"$ref": "<step>.<path>"}` passes an earlier step's result on. Names, `$ref`s and ref-free arguments are checked first; each step is its own undo step; `on_error` stop (default) or continue. Not for `show_dialog`, `execute_command` or the batch tools. |
440
+ | `batch_read` | The same for read-only tools only (any other step is refused); continues after a failed step by default. |
441
+
442
+ ### Resources
443
+ | URI | Content |
444
+ |-----|---------|
445
+ | `live://song` | JSON: `song_get` without arguments (tempo, scale, grid, tracks, return/main tracks, scenes, cue points, environment). |
446
+ | `live://tracks/{track}` | JSON: `track_get` for the track named `{track}` (percent-encoded; exact name first, then case-insensitive; regular, return and main tracks). Listed per uniquely named track, with name completions. |
447
+ | `live://guide` | Markdown: the full agent guide (`skills/ableton-live/SKILL.md`). |
448
+
449
+ ### Prompts
450
+ | Prompt | Arguments (all optional) | Produces |
451
+ |--------|--------------------------|----------|
452
+ | `song_skeleton` | `sections` (`"Intro:8, Verse:16, Chorus"`), `tempo`, `beats_per_bar`, `tracks` (`"Drums, Vox:audio"`) | `song_get` check, `song_set`, one `scene_create` and one `cue_point_create` with computed positions, `track_create` per track, then `session_grid` / `arrangement_get` to verify. |
453
+ | `chord_progression` | `progression` (`"ii7 V7 Imaj7"`, `"Am F C/E"`), `key` (default Live's scale), `bars_per_chord`, `beats_per_bar`, `octave`, `voicing` (`close`/`root`), `track` | The chords spelled and voiced, a track with an instrument if needed, and one `clip_create` with every note. |
454
+ | `drum_beat` | `style` (house, techno, hip_hop, trap, dnb, breakbeat, rock, reggaeton), `bars`, `track`, `tempo`, `swing` | The pattern per pad, `sample_search` + `drum_kit_build` for empty pads, one `clip_create` with step `patterns` and `repeat`, swing for swung styles. |
455
+
456
+ ## Skills
457
+
458
+ `skills/ableton-live/SKILL.md` is an installable [agent skill](https://docs.claude.com/en/docs/claude-code/skills)
459
+ that teaches an MCP client how to use these tools well (id discovery flow, beats vs. seconds,
460
+ note-editing patterns, device workflows). The server sends a short digest of it as MCP
461
+ instructions anyway; the full skill adds the detailed workflows. Install it for Claude Code with:
462
+
463
+ ```bash
464
+ mkdir -p ~/.claude/skills && cp -r skills/ableton-live ~/.claude/skills/
465
+ ```
466
+
467
+ The skill is also in the npm package (`npm pack @ulm0/ableton-live-mcp`, then copy
468
+ `package/skills/ableton-live`), and the server serves it as the `live://guide` resource.
469
+
470
+ Typical things you can ask a connected assistant to do:
471
+
472
+ - "Create a 4-bar house drum pattern on a new MIDI track with a Drum Rack"
473
+ - "Warp all clips on the Drums track in Complex Pro mode"
474
+ - "Turn down every track that isn't the vocal bus by 3 dB"
475
+ - "Build a song skeleton: intro, verse, chorus scenes with locators"
476
+ - "Replace the sample in Simpler with /path/to/kick.wav and map it to C1"
477
+ - "Build an 8-pad kit from the 808 samples in my sample folder" (`sample_search`, then `drum_kit_build`)
478
+ - "Repeat the chorus at bar 33" / "Put this clip in the arrangement at bar 17" (`arrangement_copy_range`, `clip_copy`)
479
+ - "Is the vocal take clipping anywhere?" (`render_track_audio {analyze: true}`)
480
+ - "Bypass the compressor on the vocals and switch the bass filter to high-pass"
481
+ - "Move the reverb before the EQ" (a lossy copy-and-delete: see `device_copy`)
482
+ - "What happens in bars 17 to 33?" / "Check the set for missing samples"
483
+ - "Quantize the clip I selected" (after right-clicking it → "MCP: Use as selection")
484
+ - "Delete the unused scenes, but ask me in Live first" (`show_dialog {form, wait: false}`, `dialog_result`)
485
+
486
+ ## Limitations
487
+
488
+ - The extension (and thus the MCP endpoint) only runs while Live is open.
489
+ - Only built-in Live devices can be inserted; third-party plug-ins can't be loaded by the SDK.
490
+ Devices cannot be moved, renamed or loaded from Live presets: `device_copy` and the JSON
491
+ `device_preset_*` tools rebuild a device from its parameter values only.
492
+ - No transport control (play/stop/record) or clip launching — the Extensions API v1.0.0 does not
493
+ expose them. Same for browser access, parameter automation curves, track color, routing and
494
+ sidechain, reordering or grouping tracks, creating return tracks, metering, editing clip
495
+ markers or loops after creation, and the song time signature.
496
+ - The user's selection can't be read directly: it is only available once the user hands it over
497
+ with the "MCP: Use as selection" context-menu entry.
498
+ - Clips can't be copied, moved or trimmed by the API: `clip_copy` and `arrangement_copy_range`
499
+ create new clips. Audio copies are re-warped by Live (warp markers can't be set), clip
500
+ envelopes, groove and launch settings are lost, and time can't be inserted into the
501
+ arrangement. Racks can't delete chains, so `drum_kit_build` keeps a chain it created even if
502
+ its pad fails.
503
+ - `sample_search` only sees the folders it is given (`sample_roots`) and Live's default library
504
+ folders — the API has no browser access.
505
+ - Dialogs are modal: they block Live's UI until the user closes them, and Live can't close them
506
+ from code. A `show_dialog` call waits by default (`wait: false` + `dialog_result` don't).
507
+ - `batch` is not atomic: each step is its own undo step, and a failing step leaves the earlier
508
+ ones applied. Live's `withinTransaction` only groups synchronous changes, so steps that wait for
509
+ Live can't share one undo step.
510
+
511
+ ## Tests
512
+
513
+ ```bash
514
+ npm test # E2E against a mock Extension Host: MCP client ↔ HTTP ↔ all tools,
515
+ # resources and prompts, extra instances for the config.json switches,
516
+ # then the bundle loaded in a bare VM context (test/vm-context.mjs)
517
+ node test/live-smoke.mjs # against a real running Live with the extension loaded
518
+ # (MCP_TOKEN=<token> when config.json sets an auth_token)
519
+ ```
520
+
521
+ The prompts' tool calls are checked by running them: every `` `tool {json}` `` in a prompt's text
522
+ without a `"<...>"` placeholder is called against the mock, and every tool in `tools/list` must
523
+ appear in README.md's tool tables and in the skill.
524
+
525
+ `test/vm-context.mjs` evaluates `dist/extension.cjs` the way the Extension Host does (no
526
+ `global`, no web globals), so a broken `build.ts` banner fails CI instead of failing in Live. It
527
+ also runs an SSE (progress) response inside that context; the real Extension Host has not been
528
+ tested with SSE responses yet (`test/live-smoke.mjs` checks them against Live) — if long calls
529
+ fail there, set `"progress_notifications": false`.
530
+
531
+ The live smoke test creates its own tracks/clips/devices, verifies every tool family
532
+ (MIDI notes, warping, drum racks, rendering, ...), and deletes everything it created.
533
+
534
+ ## Releasing
535
+
536
+ Set the same version in `package.json` and `manifest.json`, merge that to `main`, then push a
537
+ matching tag:
538
+
539
+ ```bash
540
+ git tag v1.0.0 && git push origin v1.0.0
541
+ ```
542
+
543
+ `.github/workflows/release.yml` then checks that the tag matches both versions, runs the tests,
544
+ builds the `.ablx` and `SHA256SUMS`, publishes `@ulm0/ableton-live-mcp` to npm with provenance,
545
+ and creates the GitHub Release with both files attached. It authenticates to npm with trusted
546
+ publishing (OIDC), so no npm token is stored in the repository. The workflow can run again for
547
+ the same tag: a version already on npm is skipped, and an existing release gets its assets
548
+ replaced.
549
+
550
+ ## Extension Host quirks (worth knowing)
551
+
552
+ Two behaviors of the beta Extension Host that this project works around:
553
+
554
+ 1. **Bare VM context.** Extensions are evaluated in a V8 context without `global` or web
555
+ globals (`Request`, `Response`, `ReadableStream`, `fetch`, `EventTarget`, ...), which the
556
+ MCP SDK needs at load time. `build.ts` injects a banner that pulls them in from the main
557
+ Node context (core-module functions are shared, so their `Function` constructor evaluates
558
+ there). See `build.ts` for details.
559
+ 2. **bigint numerics.** The host returns `bigint` for some values the SDK types as `number`
560
+ (clip colors, note pitches, ...). `src/serialize.ts` normalizes with `num()` before
561
+ arithmetic/JSON.
562
+ 3. **Asynchronous writes.** SDK property setters (notes, names, values) return before Live
563
+ has applied the change; a read within a few tens of ms can return the previous state.
564
+ Agents rarely notice, but read-after-write tests must retry briefly
565
+ (see `eventually()` in `test/live-smoke.mjs`).
566
+
567
+ Also: if the dev Extension Host crashes, Live may refuse the next control-channel handshake
568
+ ("bring-up timed out") — restart Live and run `npm start` again.
569
+
570
+ ## Troubleshooting
571
+
572
+ - **Endpoint not responding**: check `curl http://127.0.0.1:8722/health`. Right-click any
573
+ track in Live — the "Ableton Live MCP: Status" context-menu action shows the endpoint the
574
+ extension actually bound, or why it failed to start, and the path of its `config.json`.
575
+ - **`selection_get` returns an error per item**: the object was deleted or moved after the user
576
+ chose "MCP: Use as selection", or Live passed something the extension could not resolve —
577
+ ask the user to select again.
578
+ - **Port already in use**: if another process holds the configured port, the server logs the
579
+ failure to `ExtensionHost.txt` and does not start; the Status dialog shows the error
580
+ (`EADDRINUSE`) and the `config.json` path. Change `port` there — the file is read once at
581
+ startup, so restart Live afterwards.
582
+ - **403 Forbidden**: the request's `Host` or `Origin` is not a loopback address (see
583
+ [Security](#security)). Connect to `http://127.0.0.1:<port>/mcp` or `http://localhost:<port>/mcp`.
584
+ - **401 Unauthorized**: `config.json` has an `auth_token` and the client did not send it as
585
+ `Authorization: Bearer <token>` (see [Connect a client](#connect-a-client)).
586
+ - **503 Service unavailable**: a security setting in `config.json` (`read_only`,
587
+ `disabled_tools`, `auth_token`) is invalid or misspelled, or the file exists but cannot be read
588
+ or parsed; the error and the Status dialog say which. Fix it and restart Live.
589
+ - **A tool is missing**: `read_only` or `disabled_tools` in `config.json` switched it off.
590
+ - **"A dialog is already open in Live"**: the server shows one dialog at a time. `dialog_result`
591
+ returns the open one's answer once the user closes it; if the user did close it and Live
592
+ never reported it, `show_dialog {force: true}` opens the next one anyway.
593
+ - **Failed tool calls** are logged to `ExtensionHost.txt` with the tool name, duration and
594
+ error message (never the arguments).
595
+ - **Changed config.json but nothing happened**: config is only read when the extension
596
+ starts (`sample_roots` excepted). Restart Live (or the dev Extension Host). Invalid values are
597
+ logged with the prefix `[ableton-live-mcp] config:` and listed in the Status dialog.
598
+
599
+ ## License
600
+
601
+ MIT for the code in this repository. The `vendor/` tarballs (Ableton Extensions SDK & CLI) are
602
+ Ableton's and covered by their own license (see `sdk/LICENSE.md` in the SDK distribution).