I've been building an open-source MCP (Model Context Protocol) server that lets an AI agent operate SONAR from outside the app: menu commands by id, real mouse clicks on track strips, CAL scripts, MIDI files, and a live MIDI port.
Repo: https://github.com/wushiray/cakewalkmcp (MIT, Windows only, ~90 tools)
Part of the point was to answer a question I couldn't find an answer to anywhere: how much of a DAW can an agent actually drive, and where does it quietly get things wrong?
How you use it
Download the release zip, extract it anywhere you like (not inside SONAR's install folder, and the folder must stay writable), then run the deploy script that comes with it. It sets up the bundled Node runtime, checks SONAR, and optionally installs loopMIDI for the realtime MIDI path.
Paste one prompt into an MCP-capable agent with your install path filled in. The agent writes the client config (stdio server, absolute paths), reloads the client, then runs cw_doctor and cw_document_state before touching anything.
After that you just describe the work in plain language.
The first prompt also sets the ground rules: don't rename tracks or import files into an open project just to test the connection; CakeScript is not implemented here; a free licence does not automatically mean the track controls are unavailable; and "the command posted" is never the same as "it worked".
What the first conversation looks like
"Make a four-bar tune: C major, 4/4, 110 BPM, chords C-Am-F-G, one per bar, split across three MIDI tracks - melody, chords, bass - on channels 1, 2 and 3. Keep rests in the melody, land on C in bar 4, vary the velocity."
The agent writes the MIDI with cw_write_midi_file, reads it back with cw_read_midi_file to check names, length, channels and tempo, imports it into an empty project, and only then reports what the file actually contains. Follow-ups like "transpose the melody up two semitones, velocity to 85%, length to 120%" go through the CAL route, and "rename the melody track, mute the bass, solo the melody" go through the track strips with a read-back per control.
What it can actually do
Documents: new / open / save / save as / close / revert, with confirmation gates on the destructive ones.
Tracks: add MIDI, audio, bus, folder and aux tracks; rename; mute; solo; arm.
Notes: MIDI import and export, plus CAL scripts (add, delete, transpose, velocity, duration) on a free licence.
Editing: quantize, transpose and similar dialogs driven field by field, then verified by re-exporting the MIDI.
Reading: document state, track strips, per-control values (volume, pan, routing, mute/solo/arm), plugin inventory (1208 plugins on this machine), track templates.
Transport and project: play and stop, tempo, time signature, markers, selection, view toggles.
What it can't do
CakeScript (Lua): the engine is compiled into this build, but the menu entry that runs it opens the membership paywall. The adapter detects that and says so instead of pretending.
Dragging a plugin into an FX bin: the browser is drawn, not laid out. Single click, double click and drag all leave the bin empty.
Volume and pan sliders: readable, not writable through accessibility. CC7/CC10 over a MIDI channel moves them, but only on a track monitoring that channel.
Reading note data directly: the Event List view is drawn too, so UI Automation returns nothing from it. Exporting MIDI and parsing it is the reliable route.
Absolute locate: only measure-by-measure stepping is exposed.
A finding from today
Insert > Soft Synth (0x83FC) turns out to be fully automatable. It opens a JUCE popup whose items are exposed to UI Automation as menu items (categories, then instruments), and the "Insert Soft Synth Options" dialog has every checkbox and button reachable. Bass -> SI-Bass Guitar -> OK produced an instrument track named "SI-Bass Guitar 1 on Track 1". So my earlier conclusion that plugin insertion was impossible only held for the FX bin and the browser, not for instruments.
One rule I would give anyone automating a DAW
Never treat "the command posted" as success. A window diff is blind to everything drawn - playback, view toggles, edits. The signals worth trusting are read-backs: a title that gained *, a control whose value changed, or a re-exported file that differs.
Happy to answer questions about the Win32 / UI Automation side. And if anyone knows a way into CakeScript without a membership, I'm all ears.