Skip to main content

MCP server for FL Studio (Fruity Loops) Python API integration via Flapi

Project description

๐ŸŽน FL Studio MCP Server

CI codecov Python 3.10+ License: MIT

A Model Context Protocol (MCP) server for FL Studio (Fruity Loops), enabling AI assistants like Claude to compose music and control FL Studio through natural language.

โœจ Features

  • FL Studio API Integration via Flapi: Control transport, mixer, channels, patterns, and more
  • MIDI Interface: Send MIDI notes and messages to FL Studio via loopMIDI
  • MCP Protocol: Standard interface for AI assistants (Claude, etc.)
  • Dual Communication: Uses both Flapi (for API calls) and MIDI (for notes/CC)
  • Type Safe: Full type hints and validation

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Claude Desktop โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚   MCP Server    โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚    FL Studio    โ”‚
โ”‚  (AI Assistant) โ”‚     โ”‚   (External)    โ”‚     โ”‚   (Internal)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚                        โ–ฒ
                               โ”‚                        โ”‚
                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”                 โ”‚
                        โ”‚             โ”‚                 โ”‚
                        โ–ผ             โ–ผ                 โ”‚
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”‚
                  โ”‚  Flapi   โ”‚ โ”‚    MIDI    โ”‚          โ”‚
                  โ”‚  Bridge  โ”‚ โ”‚  Interface โ”‚          โ”‚
                  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ”‚
                       โ”‚             โ”‚                  โ”‚
                       โ”‚    MIDI     โ”‚                  โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • Flapi Bridge: Forwards FL Studio API calls (transport, mixer, channels) via MIDI to FL Studio's internal Python
  • MIDI Interface: Sends MIDI notes, CC, program changes directly to FL Studio

๐Ÿ“ฆ Installation

Prerequisites

  1. Python 3.10+
  2. FL Studio (version 20.7+ for MIDI scripting support)
  3. loopMIDI (Windows) - Download

Quick Start

# Install the MCP server
pip install fruityloops-mcp

# Install Flapi for FL Studio API access
pip install flapi
flapi install

Virtual MIDI Port Setup (Windows)

  1. Install loopMIDI
  2. Create these virtual MIDI ports:
    • FLStudio_MIDI - For sending MIDI notes/CC to FL Studio
    • Flapi Request - For Flapi API requests
    • Flapi Response - For Flapi API responses

FL Studio Configuration

For MIDI Control:

  1. Open FL Studio โ†’ Options โ†’ MIDI Settings
  2. Enable the FLStudio_MIDI port as an input
  3. Route the MIDI input to your desired channel/instrument

For Flapi (API Access):

  1. Run flapi install to install the Flapi script
  2. Restart FL Studio
  3. Go to Options โ†’ MIDI Settings
  4. In the Output section, assign unique port numbers to Flapi Request and Flapi Response
  5. In the Input section, set the same port numbers for the corresponding inputs
  6. Assign Flapi Request input to the "Flapi Request" script
  7. Assign Flapi Response input to the "Flapi Response" script

๐Ÿš€ Usage

With Claude Desktop

Add to your Claude Desktop configuration (%APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "fruityloops": {
      "command": "uvx",
      "args": ["fruityloops-mcp"]
    }
  }
}

Or using pip:

{
  "mcpServers": {
    "fruityloops": {
      "command": "fruityloops-mcp"
    }
  }
}

First Steps in Claude

  1. Connect to FL Studio:

    "Connect to FL Studio via Flapi"
    
  2. Check connection:

    "What's the Flapi connection status?"
    
  3. Start composing:

    "Start playback in FL Studio"
    "Set the tempo to 120 BPM"
    "Play a C major chord"
    

๐ŸŽ›๏ธ Available Tools

Flapi Connection

  • flapi_connect - Connect to FL Studio via Flapi
  • flapi_disconnect - Disconnect from Flapi
  • flapi_status - Check connection status

MIDI Tools

  • midi_connect - Connect to MIDI port
  • midi_disconnect - Disconnect from MIDI port
  • midi_list_ports - List available MIDI ports
  • midi_send_note - Send note with duration
  • midi_send_note_on / midi_send_note_off - Note messages
  • midi_send_cc - Control change messages
  • midi_send_program_change - Program change
  • midi_send_pitch_bend - Pitch bend

Transport Controls

  • transport_start / transport_stop - Playback control
  • transport_record - Toggle recording
  • transport_get_bpm / transport_set_bpm - Tempo control
  • transport_get_song_pos / transport_set_song_pos - Position control

Mixer Controls

  • mixer_get_track_volume / mixer_set_track_volume
  • mixer_get_track_name / mixer_set_track_name
  • mixer_get_track_pan / mixer_set_track_pan
  • mixer_mute_track / mixer_solo_track

Channel Controls

  • channels_channel_count - Get number of channels
  • channels_get_channel_name - Get channel name
  • channels_set_channel_volume - Set volume
  • channels_mute_channel - Mute/unmute
  • channels_get_channel_color / channels_set_channel_color

Pattern Controls

  • patterns_pattern_count - Get number of patterns
  • patterns_get_pattern_name / patterns_set_pattern_name
  • patterns_get_pattern_length
  • patterns_jump_to_pattern

Playlist Controls

  • playlist_get_track_name / playlist_set_track_name

General Controls

  • general_get_version - FL Studio version
  • general_get_project_title
  • general_save_project
  • general_undo

UI Controls

  • ui_show_window - Show FL Studio windows (Mixer, Channel Rack, Piano Roll, etc.)
  • ui_get_visible - Check window visibility

๐Ÿ› ๏ธ Development

Setup

# Clone repository
git clone https://github.com/quinnjr/fruityloops-mcp.git
cd fruityloops-mcp

# Install dependencies
uv sync --all-extras

# Install git hooks
./install-hooks.ps1  # On Windows
./install-hooks.sh   # On Unix/macOS

Testing

# Run tests
uv run pytest

# Run with coverage
uv run pytest --cov

# Run linting
uv run ruff check .

# Run formatting
uv run ruff format .

๐Ÿ› Troubleshooting

Flapi Connection Issues

  1. "Flapi not available": Run pip install flapi
  2. "Failed to connect":
    • Ensure loopMIDI ports Flapi Request and Flapi Response exist
    • Restart FL Studio after installing Flapi
    • Check FL Studio MIDI settings are configured correctly
  3. "FL Studio connection test failed":
    • Verify FL Studio is running
    • Check the Flapi script is loaded (look for it in the MIDI scripts panel)

MIDI Issues

  1. "MIDI port not found": Create FLStudio_MIDI port in loopMIDI
  2. "Failed to send MIDI": Ensure MIDI port is connected first using midi_connect
  3. No sound: Check FL Studio has the MIDI port enabled and routed to an instrument

๐Ÿ“– Documentation

๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2025 Joseph Quinn

๐Ÿ™ Acknowledgments


Made with โค๏ธ for the FL Studio and AI community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fruityloops_mcp-1.1.0.tar.gz (168.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fruityloops_mcp-1.1.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file fruityloops_mcp-1.1.0.tar.gz.

File metadata

  • Download URL: fruityloops_mcp-1.1.0.tar.gz
  • Upload date:
  • Size: 168.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fruityloops_mcp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 25e9d36b6f69b8a495a21eb066fa65236dfe09910e1aee3f34e9e9b15bd6c1b6
MD5 e7d40c1ec4ff666b2552422c4395db35
BLAKE2b-256 763e31a9a1b5c91e4314be8588f63d1e16b6f9d95dc8b94c2b93e7b563746767

See more details on using hashes here.

File details

Details for the file fruityloops_mcp-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: fruityloops_mcp-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fruityloops_mcp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65354f14e8a403b3c1d6ee6b89d1567d0ae917f39a4fbd701399350de94d9ab7
MD5 e1ef5d52de92d93d78861b2369a831ed
BLAKE2b-256 b4b8d451b898815c26c4f7e8d6e7425921b46af0fd5a5c8d902149e6b3661d0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page