FL Studio MCP
by Pabsetchak
README.md
# FL Studio MCP
**Let Claude, or any MCP client, make music in FL Studio.** It writes the notes, loads your installed plugins, sets their parameters, mixes, arranges, exports and changes settings, all in your running copy of FL Studio, using FL's own scripting API and windows.
[](#requirements)
[](https://www.image-line.com/)
[](https://www.python.org)
[](LICENSE)

*Recorded in FL Studio 2025: one request, an empty project, around thirty tool calls, a finished loop. Every caption is a real tool call. π§ [Listen to the result (MP3, 34 s)](assets/lofi-demo.mp3)*
---
## Contents
- [A session, step by step](#a-session-step-by-step)
- [What it can do](#what-it-can-do)
- [Quick start](#quick-start)
- [Requirements](#requirements)
- [Installation](#installation)
- [Before each session](#before-each-session)
- [Tools](#tools)
- [Conventions](#conventions)
- [More things to ask](#more-things-to-ask)
- [Limitations](#limitations)
- [Troubleshooting](#troubleshooting)
- [How it works](#how-it-works)
- [Development](#development)
- [Credits](#credits)
---
## A session, step by step
The request:
> *Make a 4-bar lo-fi loop at 85 BPM with Rhodes-style chords, a simple bassline and swung drums. Put some reverb on the keys, lay it out in the playlist and export an MP3.*
These are the actual tool calls that made the demo in FL Studio 2025, with FL's real answers (trimmed where marked `...`; file paths shortened).
### 1. Set up the project
```python
fl_song_settings(bpm=85) # β {"bpm": 85.0, "beats_per_bar": 4}
fl_add_instrument("FL Keys") # β {"channel": 1, "name": "FL Keys", "plugin": "FL Keys"}
fl_add_instrument("Transistor Bass") # β {"channel": 2, "name": "Transistor Bass", ...}
fl_add_instrument("FPC") # β {"channel": 3, "name": "FPC", "plugin": "FPC"}
fl_api([{"fn": "plugins.nextPreset", "args": [3, -1, True]},
{"fn": "plugins.getName", "args": [3, -1, "midi.FPN_Preset", 0, True]}])
# β [{"ok": null}, {"ok": "Breakbeat"}] (FPC drum kit)
fl_channel(1, name="Keys", color="#9B7BE0", mixer_track=1) # same for Bass β 2, Drums β 3
fl_mixer_track(1, name="Keys", color="#9B7BE0")
```

### 2. Write the parts
Notes go straight into each channel's piano roll. Keys can be names or MIDI numbers, and the tool answers with every note now in the pattern, so the assistant can check its work.
```python
fl_notes(channel=1, pattern=1, clear=True, add=[
{"key": "F4", "start": 0, "length": 3.8, "velocity": 92},
{"key": "A4", "start": 0.03, "length": 3.77, "velocity": 86},
... # 16 notes: Fmaj7 | Em7 | Dm7 | Cmaj7, lightly strummed
])
# β {"ppq": 96, "time_signature": [4, 4], "channel": 1, "pattern": 1,
# "notes": [{"key": 53, "start": 0.0, "length": 3.802, "velocity": 92, ...}, ... 16 notes]}
```

```python
fl_notes(channel=2, pattern=1, clear=True, add=[...]) # 12 bass notes: root, pickup, fifth
fl_notes(channel=3, pattern=1, clear=True, add=[...]) # 52 drum hits: kick 36, snare 38,
# closed hat 42 with swing and soft offbeats
```

### 3. Effects and mix
`fl_plugin_params` returns each parameter with the value FL shows, so the assistant can see what a number means before it commits to it. The first try at the reverb's decay (`0.45`) came back as `9.1sec`, so the value came down to `0.12`:
```python
fl_add_effect("Fruity Reeverb 2", mixer_track=1)
# β {"mixer_track": 1, "slot": 0, "plugin": "Fruity Reeverb 2"}
fl_plugin_params(mixer_track=1, slot=0)
# β {"plugin": "Fruity Reeverb 2", "param_count": 15, "params": [
# {"index": 0, "name": "Low cut", "value": 0.0188, "text": "75Hz"},
# {"index": 1, "name": "High cut", "value": 0.162, "text": "4.0kHz"}, ...]}
fl_set_plugin_params({"Room size": 0.75, "Decay time": 0.12, "Wet level": 0.32,
"High cut": 0.35}, mixer_track=1, slot=0)
# β {"3": "75", "5": "2.5sec", "12": "40%", "1": "8.1kHz"}
fl_add_effect("Fruity Limiter", mixer_track=0)
fl_mixer_track(1, volume=0.72, pan=-0.1)
fl_mixer_track(2, volume=0.70)
fl_mixer_track(3, volume=0.78, stereo=0.2)
```

### 4. Arrange and export
The playlist has no API for placing pattern clips, so the assistant takes a screenshot and clicks, the way a person would. The audio clip is a WAV bounce of the loop, dropped back in.
```python
fl_export("lofi_loop.wav", mode="pattern") # β {"bytes": 1992468, "mode": "pattern"}
fl_screenshot() # find track 1, bar 1 and bar 5
fl_click(190, 114); fl_click(424, 114) # paint two clips of the pattern
fl_drop_files(["lofi_loop.wav"], x=655, y=146) # audio clip on track 2 at bar 9
fl_api([{"fn": "playlist.setTrackName", "args": [1, "Beat (pattern)"]},
{"fn": "playlist.setTrackName", "args": [2, "Bounce (audio)"]}])
fl_export("lofi-demo.mp3", format="mp3", mode="song")
# β {"file": "...\\lofi-demo.mp3", "bytes": 822601, "mode": "song"}
```

**What the assistant cannot do is hear.** It checks its work by reading notes back, reading parameter values as FL displays them, and looking at screenshots. The ears in the loop are yours: ask for changes the way you would ask a producer ("darker chords", "less reverb", "push the hats back").
## What it can do
| You want to⦠| Tool |
|---|---|
| Write, read or delete notes in the piano roll | `fl_notes` |
| Program drums in the step sequencer | `fl_steps` |
| Set the BPM and time signature | `fl_song_settings` |
| Load an installed instrument (Serum 2, Vital, Sytrus, FLEXβ¦) | `fl_add_instrument` |
| Load an installed effect onto a mixer slot | `fl_add_effect` |
| Read and set plugin parameters | `fl_plugin_params`, `fl_set_plugin_params` |
| Set mixer faders, pan, stereo, mute, solo, arm, names, colours, routing | `fl_mixer_track` |
| Set channel volume, pan, pitch, mute, solo, names, colours, mixer routing | `fl_channel` |
| Play, stop, record, switch song/pattern mode, metronome, jump to a bar | `fl_transport` |
| Put audio clips in the playlist (or samples in the channel rack) | `fl_drop_files` |
| Export the song or a pattern to WAV, MP3 or MIDI | `fl_export` |
| Save, save as, open projects and files | `fl_save`, `fl_open` |
| Call anything in FL's scripting API | `fl_api`, `fl_api_docs` |
| Use any menu, dialog, tool or setting a person can | `fl_screenshot`, `fl_windows`, `fl_click`, `fl_drag`, `fl_scroll`, `fl_key`, `fl_type` |
## Quick start
1. Install [FL Studio](https://www.image-line.com/) and [loopMIDI](https://www.tobias-erichsen.de/software/loopmidi.html), and create a loopMIDI port.
2. Clone this repository and run the installer in PowerShell:
```powershell
git clone https://github.com/Pabsetchak/fl-studio-mcp.git
```
```powershell
cd fl-studio-mcp
```
```powershell
powershell -ExecutionPolicy Bypass -File .\install.ps1
```
3. In FL Studio, open **Options > MIDI settings**, enable the loopMIDI input and set its controller type to **FL Studio MCP Controller**.
4. Restart Claude, open a piano roll in FL Studio and run **Tools > Scripting > ComposeWithLLM** once.
5. Ask for something, for example the request in [the session above](#a-session-step-by-step).
The full steps are in [Installation](#installation).
## Requirements
- **Windows** with **FL Studio 2024 or 2025** (tested on FL Studio 2025 Producer Edition, scripting API v38). The desktop part of the server uses Windows APIs, so macOS is not supported.
- [loopMIDI](https://www.tobias-erichsen.de/software/loopmidi.html), a free virtual MIDI port.
- [uv](https://github.com/astral-sh/uv) (the installer gets it for you).
- An MCP client such as Claude Desktop or Claude Code.
## Installation
### 1. Run the installer
From PowerShell in the cloned folder:
```powershell
powershell -ExecutionPolicy Bypass -File .\install.ps1
```
It installs uv and the Python dependencies, copies the two FL Studio scripts into place and adds the server to Claude Desktop, Claude Code or both (it asks) as `fl-studio`. If you prefer to do it by hand:
- Copy `fl_controller\device_FLStudioMCP.py` to `Documents\Image-Line\FL Studio\Settings\Hardware\FLStudioMCP\`.
- Copy `scripts\ComposeWithLLM.pyscript` to `Documents\Image-Line\FL Studio\Settings\Piano roll scripts\`.
- Add this to your MCP client's configuration:
```json
"fl-studio": {
"command": "uv",
"args": ["run", "--directory", "C:\\path\\to\\fl-studio-mcp", "fl-studio-mcp"]
}
```
### 2. Create the loopMIDI port
Open loopMIDI, type a port name (the default "loopMIDI Port" is fine) and click **+**. loopMIDI must be running whenever you use the server. If your port's name does not contain "loopMIDI", set the environment variable `FL_MCP_MIDI_PORT` to part of its name.
### 3. Set up FL Studio
1. Start FL Studio and open **Options > MIDI settings** (F10, then the MIDI tab).
2. Under **Input**, click your loopMIDI port so it is enabled (highlighted).
3. Set its **Controller type** to **FL Studio MCP Controller**.
4. Restart your MCP client so it loads the server.
## Before each session
Run the piano roll script once each time FL Studio starts: open any piano roll and choose **Tools > Scripting > ComposeWithLLM**. The server then reruns it with Ctrl+Alt+Y ("run last script"), which only works after it has been run once by hand. If you skip this, `fl_notes` reports exactly this step as the fix.
**The server really moves your mouse and presses keys.** Loading effects, dropping audio, exporting, saving as, changing the time signature and every `fl_click`/`fl_key` tool use FL Studio's own windows. Do not touch the mouse or keyboard while the assistant is working, and keep FL Studio's window on screen.
## Tools
Start with `fl_status`: it lists the tempo, transport, patterns, every channel (index, name, plugin, mixer track) and the mixer tracks in use with their effects.
### Composition
- **`fl_notes(channel, pattern, add, clear, delete_from, delete_to, delete_keys)`** writes or reads notes in a channel's piano roll and returns every note in it. `add` takes notes like `{"key": "C5", "start": 0, "length": 1, "velocity": 100}`, with optional `pan`, `slide`, `porta`, `color` and `muted`. With nothing to change it just reads.
- **`fl_steps(channel, steps, pattern, clear)`** turns on step-sequencer steps (0 is the first 16th).
- **`fl_song_settings(bpm, numerator, denominator)`** sets the tempo and the time signature.
- **`fl_transport(action, bar)`**: `play`, `pause`, `stop`, `record`, `song_mode`, `pattern_mode`, `metronome_on`, `metronome_off`, or `goto` a bar.
### Plugins
- **`fl_installed_plugins(kind, search)`** lists the plugins in FL Studio's plugin database. If a plugin you own is missing, run a plugin scan in FL's Plugin Manager.
- **`fl_add_instrument(name)`** loads an instrument into a new channel and returns its index. Names match exactly first, then by substring; Fruity, then VST3, then CLAP, then VST versions are preferred.
- **`fl_add_effect(name, mixer_track, slot)`** loads an effect into a mixer track, on the first free slot unless you give one.
- **`fl_plugin_params(channel | mixer_track + slot, search, limit)`** lists parameters with their index, name, 0β1 value and display text.
- **`fl_set_plugin_params(values, channel | mixer_track + slot)`** sets parameters by name or index, for example `{"Cutoff": 0.4, "12": 1}`, and returns the display text of each.
### Mixing
- **`fl_mixer_track(track, volume, pan, stereo, mute, solo, arm, name, color, routes)`** sets a mixer track. `routes` adds or removes sends, as in `{"5": true}`.
- **`fl_channel(channel, volume, pan, pitch_cents, mute, solo, name, color, mixer_track)`** sets a channel and can route it to a mixer track.
### Files
- **`fl_drop_files(paths, x, y)`** drags files from disk onto FL Studio at a point in the latest screenshot, exactly like dropping them from Explorer. Audio on a playlist track makes an audio clip at that bar; on the channel rack it makes a new sampler channel.
- **`fl_open(path)`** opens a file as if double-clicked: a `.flp` project, a `.fst` plugin preset, or a `.mid` to import.
- **`fl_save(path)`** saves the project, or saves it as a new `.flp`. Save as never overwrites an existing file.
- **`fl_export(path, format, mode, timeout)`** renders the song (`mode="song"`) or the current pattern (`"pattern"`) to `wav`, `mp3` or `mid`, then waits until the file is written.
### Everything else
- **`fl_api(calls, stop_on_error)`** runs any functions of FL's scripting API (`transport`, `mixer`, `channels`, `patterns`, `playlist`, `arrangement`, `plugins`, `ui`, `general`, `device`) in one round trip, for example `[{"fn": "patterns.setPatternName", "args": [1, "Verse"]}]`. A string such as `"midi.FPT_Metronome"` is replaced by that constant.
- **`fl_api_docs(name, search)`** looks up that API: a module's functions, one function's documentation, or `midi` constants.
- **`fl_screenshot()`** shows the FL Studio window. **`fl_windows()`** gives where the playlist, mixer, channel rack, piano roll, plugin windows and dialogs are.
- **`fl_click`, `fl_drag`, `fl_scroll`, `fl_key`, `fl_type`** use the mouse and keyboard at screenshot coordinates. Together with FL's shortcuts (F10 settings, F11 project info, F8 plugin picker, Alt+F8 browser, Ctrl+Z undo), they reach every menu, dialog and setting.
## Conventions
- **Channels** use the channel rack's global index from 0, as `fl_status` lists them, even when a channel filter group hides some.
- **Mixer** track 0 is Master; inserts are 1 to 125. Effect slots are 0 to 9.
- **Patterns** and **playlist tracks** start at 1.
- **Notes**: `key` is a MIDI number or a name in FL's naming, where C5 = 60. Times and lengths are in beats (quarter notes). Velocity is 0β127.
- **Levels**: volumes and plugin parameters are 0β1. Mixer 0.8 is 0 dB; a new channel sits at 0.78. Pan and stereo are β1 to 1.
## More things to ask
- "Make a 4-bar trap beat at 140 BPM: 808 on Serum 2, hats in the step sequencer, and a dark bell melody."
- "Put Fruity Reeverb 2 on the lead's mixer track and make it wetter."
- "Drop `C:\Samples\vocal.wav` on playlist track 3 at bar 9."
- "Switch the song to 6/8 and export it as an MP3 to my Desktop."
- "Open the audio settings and raise the buffer length."
## Limitations
- **Some tools click FL's windows.** Changing the time signature (in the settings window) and loading effects (onto a mixer slot) use positions measured on FL Studio 2025's default layout at 100% Windows scaling. If your layout or FL version differs, these tools report an error, and the assistant can still do the step with screenshots and clicks.
- **Export and Save as use FL's shortcuts** (Ctrl+R, Ctrl+Shift+R, Ctrl+Shift+M, Ctrl+Shift+S). If another app has taken one of them, that tool reports that FL did not open its dialog.
- **Export formats** are WAV, MP3 and MIDI. MIDI export follows FL Studio's own rules for what goes into the `.mid` file.
- **The piano roll script must be run once by hand** each time FL Studio starts (see [Before each session](#before-each-session)).
- **The mouse and keyboard move** during UI work, and FL Studio comes to the front.
- **Placing clips needs a screenshot.** FL's API cannot place playlist clips, so the assistant finds the track and bar in a screenshot and clicks or drops there.
- **Plugin parameters** are what each plugin exposes to FL Studio's automation.
- **Windows only.**
## Troubleshooting
**"No loopMIDI port found."** Start loopMIDI and make sure it has a port. If the port has another name, set `FL_MCP_MIDI_PORT` to part of it.
**"FL Studio did not answer."** Check that FL Studio is open, that the loopMIDI port is enabled under Options > MIDI settings > Input, and that its controller type is "FL Studio MCP Controller". View > Script output shows "FL Studio MCP bridge ready" when the script has loaded.
**`fl_notes` says the piano roll script did not answer.** Open a piano roll and run Tools > Scripting > ComposeWithLLM once.
**"FL Studio did not open its save dialog."** Another app may use that shortcut. Close it, or export from FL's File menu by hand.
**A UI tool clicked the wrong place.** Close any extra dialog, take a screenshot to see FL's state, and try again. Detached or resized windows can move the mixer slots that the tools click.
**The left mouse button seems stuck after a drop.** Click once anywhere. The drop releases the button even when it fails, but an interrupted session can leave it down.
## How it works
```
MCP client βββΆ FastMCP server
ββ bridge.run() JSON command file + MIDI note 127 on loopMIDI
β ββΆ FL Studio MCP Controller script (any API call)
ββ bridge.piano_roll() JSON request file + Ctrl+Alt+Y
β ββΆ ComposeWithLLM piano roll script (notes)
ββ desktop FL's command line, keyboard, mouse and drag-and-drop
(plugins, audio clips, export, dialogs, settings)
```
1. **API calls.** The server writes `mcp_command.json` with an id and a list of calls, then sends MIDI note 127 on the loopMIDI port. The controller script runs every call through FL's scripting API and writes `mcp_response.json`. FL's Python cannot delete files, so the server removes the command once it is answered and the id stops a command from running twice.
2. **Notes.** FL only lets piano roll scripts edit notes. The server writes `mcp_request.json`, focuses the piano roll and presses Ctrl+Alt+Y; ComposeWithLLM applies the edits and answers with every note in the pattern.
3. **Desktop.** For what no API can do, the server uses FL Studio like a person: it starts `FL64.exe` with a plugin preset to add an instrument, drags plugin presets and audio files onto the mixer and playlist with real Windows drag-and-drop, presses FL's shortcuts for export and Save as, and clicks in the settings window.
## Development
```powershell
uv sync
```
```powershell
uv run pytest
```
```powershell
uv run ruff check src tests fl_controller
```
The tests run the FL Studio controller script against the [FL Studio API stubs](https://github.com/IL-Group/FL-Studio-API-Stubs) and send commands to it through the real bridge, so they need no FL Studio.
```
fl-studio-mcp/
βββ fl_controller/device_FLStudioMCP.py # runs inside FL Studio: generic API bridge
βββ scripts/ComposeWithLLM.pyscript # runs inside FL Studio: piano roll edits
βββ src/fl_studio_mcp/
β βββ server.py # the MCP tools
β βββ bridge.py # file + MIDI round trips to both FL scripts
β βββ desktop.py # windows, screenshots, mouse, keys, drag-and-drop
βββ tests/test_bridge.py
βββ assets/ # the demo session's GIF, screenshots and MP3
βββ install.ps1
```
Issues and pull requests are welcome.
## Credits
- This project started from [karl-andres/fl-studio-mcp](https://github.com/karl-andres/fl-studio-mcp) (MIT), which first connected an MCP server to FL Studio's MIDI scripting. It has since been rebuilt around a generic API bridge, plugin loading, desktop automation and export.
- [calvinw/fl-studio-mcp](https://github.com/calvinw/fl-studio-mcp) for the piano roll script approach.
- [FL Studio API Stubs](https://github.com/IL-Group/FL-Studio-API-Stubs) for the API documentation.
- [FastMCP](https://github.com/jlowin/fastmcp), [mido](https://github.com/mido/mido), [pynput](https://github.com/moses-palmer/pynput), [Pillow](https://python-pillow.org) and [pywin32](https://github.com/mhammond/pywin32).
- [Image-Line](https://www.image-line.com/) for FL Studio. This project is not affiliated with Image-Line.
## License
MIT. See [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues