openDAW MCP Server
by ckeraz
README.md
# openDAW MCP Server
Connect an MCP client to the project open in your browser in openDAW Studio. An assistant can inspect the arrangement, compose or edit parts, import MIDI references, and measure the mix. The client launches the Node.js server locally over stdio. The studio connects to it over a loopback WebSocket.
## Features
- **Inspect and audition the project.** Read tempo, time signature, key, tracks, effects, regions, and individual notes. Use the studio's current selection to identify a part, then start playback or loop a passage. Arrangement analysis estimates key, chords, and instrument roles from the notes and summarizes sections, drum patterns, and timing against the grid.
- **Preview project edits.** Write JavaScript against the openDAW scripting API to add or edit instruments, notes, regions, automation, and mixer settings. Review a report of the proposed changes before applying them. An applied edit to the open project is one undo step.
- **Analyze the mix offline.** Measure peak, RMS, LUFS, clipping, stereo correlation, and frequency-band energy for the mix or selected units. Compare isolated instruments, flag possible clicks and off-grid onsets, or render a PNG spectrogram with bar markers and a level trace. Bar ranges follow tempo automation and time-signature changes.
- **Work from a MIDI reference.** Analyze a local `.mid` or `.midi` file before importing it. Review the opening tempo and time signature, estimated key and chords, and the parts and sections. Import all or selected track/channel parts as new instrument tracks in one undo step, with the option to adopt the opening tempo.
- **Work with WebCLAP plugins.** Discover published and locally installed plugins, load instrument plugins in scripts, and look up factory presets for plugins with a preset list. Import a local build with confirmation in the studio and optionally update matching devices in the project while keeping their state.
## Quick start
The server builds as an npm workspace in openDAW. You need Node.js 23 or later, an MCP client that can launch a local stdio server, and an openDAW source checkout with the companion AI Bridge changes. The studio build must show **AI Bridge...** in its menu and support bridge protocol v2. The build uses the matching checkout's MIDI and scripting packages.
1. If your openDAW checkout already contains this package at `packages/server/mcp-server`, build it in place. For a compatible checkout that lacks the package, clone this repository separately and copy its tracked files into that directory from the openDAW checkout root.
```sh
git clone https://github.com/ckeraz/opendaw-mcp-server.git /path/to/opendaw-mcp-server
mkdir -p packages/server/mcp-server
git -C /path/to/opendaw-mcp-server archive HEAD | tar -x -C packages/server/mcp-server
```
Install the workspace dependencies and build the prerequisite packages as described in the openDAW checkout's root README. Then build the MCP server from the openDAW checkout root.
```sh
npm run build -w @opendaw/mcp-server
```
The `@opendaw/studio-scripting` build generates `src/api.declaration.d.ts`, which `search_api` reads. To regenerate that file on its own, run `npm run generate-api -w @opendaw/studio-scripting`.
2. Register the server in your MCP client. Set its command to `node` and pass the absolute path to the built server as its argument. For Claude Code, use the following command.
```sh
claude mcp add opendaw -- node /absolute/path/to/openDAW/packages/server/mcp-server/dist/index.js
```
3. Start the client and open your project in the studio. In the openDAW menu, choose **AI Bridge... → Pair** and tell the assistant the six-digit code shown in the studio, for example, “Pair openDAW with code 123 456.” The assistant uses `pair_studio` to complete the connection. A code expires after five minutes or three incorrect attempts.
4. Ask the assistant to summarize the open project to verify the connection.
The bridge listens on `ws://127.0.0.1:47110` by default and accepts one studio tab at a time. The studio remembers the port and token. Use **Connect** to reconnect in a later session and **Switch Off** to disconnect.
### Connect with a token
For manual setup, run the following from the repository root. Paste the output into the **Token** field in **AI Bridge...**, then select **Connect**. If your client sets `OPENDAW_MCP_TOKEN`, use the same value for this command.
```sh
node packages/server/mcp-server/dist/index.js token
```
The server creates a token on first use unless you supply one through the environment. Pairing sends the token directly to the studio.
## Tools
| Tool | Purpose |
|---|---|
| `pair_studio` | Pair a studio tab using its six-digit code. |
| `get_project_summary` | Read project metadata, audio units, instruments, known presets, effects, tracks, and regions with UUIDs. |
| `get_studio_context` | Read the studio page, transport state, playhead, loop range, selection, and active editors. |
| `read_notes` | Read position, duration, MIDI pitch, note name, and velocity from one note region. Positions are relative to the region start in PPQN. |
| `control_playback` | Start or stop playback, with an optional playhead position or loop range. |
| `analyze_project` | Estimate key, chords, and instrument roles and report sections, drum patterns, note density, and grid alignment from unmuted note regions. |
| `analyze_audio` | Render the mix or selected units offline and report levels, loudness, stereo correlation, frequency bands, possible clicks, and onset timing. |
| `analyze_levels` | Render instrument units individually and compare level, loudness, crest factor, bands, and stereo correlation. Bypasses the master chain and aux returns by default. |
| `render_spectrogram` | Return a log-frequency PNG of the mix or selected units, with bar markers and a level trace. |
| `analyze_midi_file` | Analyze a local MIDI file's opening tempo, time signature, parts, estimated harmony, and sections. |
| `import_midi_file` | Import all or selected MIDI parts as new tracks and return their unit and region UUIDs. |
| `list_plugins` | List published and locally installed WebCLAP instruments, audio effects, and note effects. |
| `list_presets` | Browse a plugin's preset list by name or category and get the parameter ID and preset index used to select a sound. |
| `import_plugin_bundle` | Import a local `.tar.gz`, `.tgz`, or `.wasm` WebCLAP bundle with studio confirmation. By default, matching project devices move to the new build in one undo step. |
| `search_api` | Search the scripting API's TypeScript declarations and documentation by keyword. |
| `run_script` | Run JavaScript in the studio, return a JSON value and console output, and preview or apply project edits. |
| `save_helper` | Save a reusable JavaScript helper as `mcp.<name>` across sessions. Send empty source to delete it. |
| `guide` | Read practical notes on workflow, notes, instruments, drums, mixing, automation, samples, and helpers. |
### Preview and apply scripts
A script can edit a copy of the current project from `await openDAW.getProject()` and submit its changes with `project.openInStudio()`. By default, `run_script` previews the edit and reports what it would create, remove, or change. If the preview produces changes, it also returns a `scriptId`.
Call `run_script` again with that `scriptId` and `apply: true` to rerun the script and apply the edit. The server keeps the last 16 previews in memory. The studio rejects the edit if the project changes while the script runs. You can set `timeoutSeconds` up to 600 for an individual call.
Scripts have access to the global `mcp` object for tempo-aware timeline calculations, audio measurement, unit isolation, note cleanup and placement, pitch estimation, and spectrogram generation. Use `guide` with the `helpers` topic to see the built-in and saved helpers.
### Add a WebCLAP preset list
To make named presets available to `list_presets`, place a JSON file named `<clapId>.json` in the presets directory. The `parameter` is the CLAP parameter ID for preset selection, and the `index` is the value that selects the preset.
```json
{
"clapId": "local.example.synth",
"name": "Synth",
"parameter": 0,
"presets": [
{"index": 0, "name": "Warm Pad", "category": "Pad"}
]
}
```
You can also generate preset lists from plugin source directories. Each plugin subdirectory needs a `plugin.cpp` declaring its CLAP ID and `presetId`, plus a built `dist/bank.json` listing presets in selection order. Run the collector again after rebuilding the bank.
```sh
node packages/server/mcp-server/dist/index.js collect-presets /path/to/plugins
```
## Configuration
Set environment variables in the MCP client's server configuration. The default configuration directory is `~/.config/opendaw-mcp`. If you set `XDG_CONFIG_HOME`, the server uses its `opendaw-mcp` subdirectory instead. The server stores the token in `token` and saved script helpers in `helpers/` under that directory.
| Variable | Default | Purpose |
|---|---|---|
| `OPENDAW_MCP_PORT` | `47110` | Loopback WebSocket port. Set the same port in **AI Bridge...**. |
| `OPENDAW_MCP_TOKEN` | Stored token | Override the studio connection token. |
| `OPENDAW_MCP_ORIGINS` | Empty | Comma-separated extra browser origins. The default allowlist covers `https://opendaw.studio` and local hosts. |
| `OPENDAW_MCP_TIMEOUT_MS` | `120000` | Default timeout in milliseconds for studio requests. Rendering and plugin import tools use their own timeouts. |
| `OPENDAW_MCP_PRESETS` | `presets/` in the configuration directory | Directory containing WebCLAP preset lists. |
| `OPENDAW_MCP_API_FILE` | From `@opendaw/studio-scripting` | Override the declaration file used by `search_api`. |
## Development
Run the package tests from the repository root. They cover pairing and authentication, timeouts and disconnects, API search, helpers, analysis, and MCP calls against a fake studio using the real script runner.
```sh
npm test -w @opendaw/mcp-server
```
Licensed under the [GNU Affero General Public License v3.0 or later](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues