Skip to main content
Glama
se02-mcp

se02-mcp

by cafeTechne
README.md
# se02-mcp: an MCP server for the Roland Boutique SE-02

A **Model Context Protocol** server that lets an AI assistant (any MCP client) read and program a **Roland Boutique SE-02** (Studio Electronics) 3-VCO monophonic analog synthesizer over
USB.

Roland never published the SE-02's System Exclusive format; the MIDI Implementation Chart only says SysEx is
"transmitted and received". This project mapped it on real hardware: every patch parameter, the whole step
sequencer (patterns and songs), the system settings and the stored memories. With that, an assistant can design
patches, write sequences and change settings by name, and save them straight into the unit's memory.

> Status: works on a real SE-02 (firmware 1.10) on Linux. Issues and pull requests are welcome, especially macOS /
> Windows transport support.

## What an assistant can do with it

- **Design sounds:** set any of the 60 patch parameters by name, e.g. `{"cutoff": 90, "emphasis": 140, "osc1_wave":
  "saw", "osc1_range": "8'", "glide_type": "LIN"}`. Knobs are 0-255 (finer than the 7-bit CCs), switches take their
  panel labels. Patch names up to 16 characters.
- **Write sequences:** the 16-step pattern sequencer in full: notes, gates in % or a tie, glide, per-step parameter
  locks (PRM: one knob value stored on a step), tempo, sync source, scale (1/16 ... 1/4T), first / last step,
  direction (forward, backward, ping-pong, random), shuffle, destination, key trigger, and the patch the pattern
  recalls.
- **Chain songs:** up to 16 parts per song, each with its pattern, patch (banks A, B, C, D, USER) and repeat count.
- **Save directly:** every edit tool takes `number`. `0` edits what is loaded (heard immediately, nothing saved);
  `1-128` (songs `1-16`) writes that stored memory directly, without the panel's Write procedure. It persists
  through a power cycle.
- **Clear** a patch, pattern or song the way the v1.10 firmware's own clear does.
- **Change system settings** over USB (MIDI channel including omni, CC / PC out, MIDI thru, chain, auto off, sync)
  without the system setup screen, which on the SE-02 saves and exits on every [VALUE] push.
- **Listen** to what the unit sends (knob CCs, SysEx) and **select patches** by bank select + program change.
- **Walk the user through auto-tune** (pitch calibration), which can only be started from the panel.

## Tools

| Tool | What it does |
|---|---|
| `se02_about` | The unit, the USB MIDI port found, a short description. |
| `se02_listen(seconds)` | Capture what the SE-02 sends (turn a knob: its CC; Roland SysEx). Read-only. |
| `se02_program_change(program, channel, bank)` | Select a patch: bank "A" / "B" / "C" / "USER" / "D", program 1-128. |
| `se02_read(what, number)` | Decode a `patch`, `pattern`, `song` or the `system` settings. Number 0 = loaded, 1-128 = stored. |
| `se02_set_patch(values, number, name)` | Set patch parameters by name (knobs 0-255, switches by label). |
| `se02_set_pattern(...)` | Edit a pattern's header and steps. |
| `se02_set_song(...)` | Edit a song's header and parts. |
| `se02_set_system(values)` | Set system settings (saved directly). |
| `se02_clear(what, number)` | Clear a patch, pattern or song. |
| `se02_tune()` | The panel steps for automatic tuning (pitch calibration). |

## Install

Linux, Python 3.10+, the SE-02 connected by USB. It is USB-MIDI class compliant on Linux: `amidi -l` shows
"SE-02 MIDI 1". The server finds the port by name in `/proc/asound` and talks to `/dev/snd/midiC*D0` directly (no
extra MIDI libraries).

```bash
git clone https://github.com/cafeTechne/se02-mcp.git
cd se02-mcp
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"
scripts/check.sh            # offline tests; never touches the hardware
```

Your user needs access to `/dev/snd/*` (the `audio` group on most distributions).

## Connect an MCP client

It is a stdio MCP server: the command is `/path/to/se02-mcp/.venv/bin/se02-mcp`, with no arguments and no
environment variables. In a client that uses the common `mcpServers` JSON format:

```json
{
  "mcpServers": {
    "se02": { "command": "/path/to/se02-mcp/.venv/bin/se02-mcp" }
  }
}
```

Try: *"Read the SE-02's current patch and make it a darker, plucky bass"*, *"Write a 16-step acid line in A minor
into pattern 12 with glides on the off-beats, synced to MIDI clock"*, *"Set every pattern's sync to MIDI"*.

## Safety

- **Back up first.** `tools/backup.py` reads all 128 patches, 128 patterns, 16 songs and the system areas into one
  JSON file (`~/.local/share/se02-mcp/backups/`). Read-only, about a minute. Writes to stored numbers save
  immediately and there is no undo on the unit.
- `number=0` (the default for every edit tool) only touches what is loaded. Nothing is stored until the panel's
  Write, or until you pass a stored number.
- The server sends only Roland RQ1 (read) / DT1 (write) messages for model ID `00 00 00 44`, bank select and
  program change. No firmware or factory-reset messages exist in the code.
- The SE-02's own **USB drive backup** is a panel procedure: hold [2] while powering on (backup) or [3] (restore);
  see the owner's manual.

## Known quirks (found the hard way)

- **The keys lag while USB is connected.** The K-25m keyboard felt sluggish on every patch with the USB cable in,
  even with no program holding the port open; unplugging USB fixed it. Plug it in for programming sessions, unplug to
  play.
- **A program change always selects a sound, never a pattern,** even in sequencer mode. No MIDI message selects a
  pattern; pick patterns on the panel.
- **The loaded song is reloaded** from memory when you press [EXIT] or move the mode switch, dropping unsaved edits
  made over USB.
- **The system setup screen** (hold [EXIT] at power-on) doesn't answer reads, and each [VALUE] push saves and leaves
  it; use `se02_set_system` instead.
- **Auto-tune** can't be triggered over MIDI; `se02_tune` returns the panel steps.

## The SysEx map

Roland format: `F0 41 10 00 00 00 44 cmd aa aa aa aa [data | size] checksum F7`, cmd `11` = RQ1 (request), `12` =
DT1 (data), checksum = (128 - sum of address and data bytes % 128) % 128. Device ID `10`. The full map, with every
offset, is in [`src/se02_mcp/memory.py`](src/se02_mcp/memory.py); how each part was found is in
[`docs/notes.md`](docs/notes.md).

| Address | Size | Contents |
|---|---|---|
| `00 00 00 00` | 16 | System: MIDI ch (0 off?, 1-16, 17 = omni), CC out, PC out, MIDI thru, chain, saver, MIDI key trigger, auto off, sync; CV fine tune / key follow |
| `02 00 00 00` | 16 | System, not mapped |
| `05 00 00 00` | 240 | Current patch: values as nibble pairs (hi, lo) = 0-255; name = 16 ASCII bytes at 208 |
| `06 nn 00 00` | 240 | Stored user patch nn + 1 |
| `10 00 00 00` | 144 | Current pattern: 16-byte header, then 16 steps x 8 bytes |
| `11 nn 00 00` | 144 | Stored pattern nn + 1 |
| `20 00 00 00` | 144 | Current song: 16-byte header, then 16 parts x 8 bytes |
| `21 nn 00 00` | 144 | Stored song nn + 1 (0-15) |

Highlights:

- **Patch:** each parameter is a nibble pair at an even offset (cutoff at 110, emphasis 116, ...). Switch positions
  are small integers, some running opposite to the panel (XMOD TO MW 0-2 = C, B, A; NORM/INVERT 0 = INVERT; LFO
  MODE 0-2 = FREE, KEY, 1X). REL has three positions (OFF, "1,2", "2"), not the two in the manual.
- **Pattern header:** tempo = 3 nibbles of BPM x 10; patch bank and number; scale; first / last step; direction;
  shuffle + 50; destination; sync (Int, MIDI, USB, Trigger); key trigger.
- **Steps:** on, note, gate (0-99 = 1-100 %, 100 = tie), glide, PRM on, PRM parameter ((patch offset - 60) / 2),
  PRM value as a nibble pair.
- **Banks** in patterns and songs: 1 A, 2 B, 3 C, 4 USER, 5 D (D, added in firmware 1.10, comes after USER). Over
  MIDI, bank select CC0 0-4 = A, B, C, USER, D.
- **Song part:** pattern number as a nibble pair, bank, patch - 1, repeats - 1.

The map was made by polling the edit buffer while each control was moved one at a time (`tools/watch.py`), then by
writing test values and reading them on the unit's display.

## Repository layout

```
src/se02_mcp/server.py      the MCP tools
src/se02_mcp/memory.py      the SysEx map, encoders / decoders, labels
src/se02_mcp/transport.py   raw MIDI port, RQ1 / DT1
tools/backup.py             back up every stored memory (read-only)
tools/watch.py              print every byte that changes while you move controls (how the map was made)
tools/manual_text.py        PDF manual -> column-ordered text for LLMs
docs/notes.md               the mapping log: what was tested and how
```

## Manuals

Roland's SE-02 Owner's Manual, MIDI Implementation Chart and the v1.10 Additional Functions sheet are free downloads
from the SE-02 support page on [roland.com](https://www.roland.com/global/products/se-02/). They aren't
included here. To give an assistant the manuals as context, convert them to text:

```bash
python3 tools/manual_text.py SE-02_eng02_W.pdf      # writes SE-02_eng02_W.txt (needs poppler's pdftotext)
```

## License

MIT (see [LICENSE](LICENSE)). Roland, BOSS, Boutique and SE-02 are trademarks of Roland Corporation; this project is
not affiliated with or endorsed by Roland or Studio Electronics.

TDQS

A3.5/5.0

Scored across 10 tools

Disambiguation4/5

Each tool targets a distinct action+resource: read (patch/pattern/song/system), set_patch, set_pattern, set_song, set_system, clear, listen, program_change, about, tune. The only mild overlaps are set_patch vs program_change (editing a patch's sound vs selecting which patch is active) and clear vs the set_* writers, but the descriptions make these boundaries clear enough.

Naming Consistency4/5

All names share the se02_ prefix and mostly follow verb_noun (set_patch, set_pattern, set_song, set_system, program_change). A few deviate from a strict pattern (about, tune, clear, listen are bare verbs/nouns), but the convention stays recognizable and readable throughout.

Tool Count5/5

10 tools is well-scoped for a hardware synth editor server: read/write/clear per resource, plus selection, monitoring, and info tools. Nothing appears redundant or padding the surface.

Completeness4/5

The surface covers the full lifecycle for patches, patterns, songs, and system settings (read, write, clear), plus patch selection, MIDI capture, and device info — a coherent domain with no dead ends. Minor gaps exist: no way to list/enumerate stored patch names or bulk-read all memory without issuing many individual reads.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues