Skip to main content

A FastMCP Server which allows an LLM to send MIDI sequences into any software that supports MIDI input

Project description

MCP MIDI Server

A FastMCP Server which allows an LLM to send MIDI sequences into any software that supports MIDI input.

Features

  • Creates a virtual MIDI output port
  • Sends MIDI Note On/Off messages
  • Sends Control Change (CC) messages
  • Sequences MIDI events with precise timing
  • Can be used as a MIDI input device in any application that supports MIDI

Requirements

  • Python 3.7+
  • rtmidi
  • fastmcp
  • python-dotenv
  • asyncio

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd mcp-server-midi
    
  2. Create a virtual env, activate it and install dependencies:

    python -m venv .venv
    source .venv/bin/activate
    
    pip install -r requirements.txt
    
  3. Create a .env file with your configuration:

    PORT=8123
    

Usage

Run the server:

python mcp_midi_server.py

The server creates a virtual MIDI port named "MCP MIDI Out" that can be used as a MIDI input device in other applications. This means you can:

  • Connect digital audio workstations (DAWs) like Ableton Live, Logic Pro, or FL Studio to receive MIDI from this server
  • Use the server to control hardware synthesizers through your computer's MIDI interface
  • Connect to any other software that accepts MIDI input (virtual instruments, lighting controllers, etc.)

Simply select "MCP MIDI Out" as a MIDI input device in your preferred MIDI-compatible application.

MCP Config

The server uses Server-Sent Events (SSE), this is how to config it in Cursor:

{
  "mcpServers": {
      "midi": {
          "url": "http://localhost:8123/sse"
      }
   }
}

API Methods

Send Note On

Sends a MIDI Note On message.

Parameters:

  • note: MIDI note number (0-127)
  • velocity: Note velocity (0-127, default 127)
  • channel: MIDI channel (0-15, default 0)

Send Note Off

Sends a MIDI Note Off message.

Parameters:

  • note: MIDI note number (0-127)
  • velocity: Note off velocity (0-127, default 64)
  • channel: MIDI channel (0-15, default 0)

Send Control Change

Sends a MIDI Control Change (CC) message.

Parameters:

  • controller: CC controller number (0-127)
  • value: CC value (0-127)
  • channel: MIDI channel (0-15, default 0)

Send MIDI Sequence

Sends a sequence of MIDI Note On/Off messages with specified durations.

Parameters:

  • events: A list of event dictionaries. Each dictionary must contain:
    • note: MIDI note number (0-127)
    • velocity: Note velocity (0-127, default 127)
    • channel: MIDI channel (0-15, default 0)
    • duration: Time in seconds to hold the note before sending Note Off
    • start_time: Time in seconds when to start the note, relative to sequence start (default 0)

Example

Using the API to play a C major chord:

events = [
    {"note": 60, "velocity": 100, "duration": 1.0, "start_time": 0.0},  # C4
    {"note": 64, "velocity": 100, "duration": 1.0, "start_time": 0.0},  # E4
    {"note": 67, "velocity": 100, "duration": 1.0, "start_time": 0.0},  # G4
]
# Send to the MCP MIDI Server API

License

MIT

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

iflow_mcp_sandst1_mcp_server_midi-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file iflow_mcp_sandst1_mcp_server_midi-1.0.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_sandst1_mcp_server_midi-1.0.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_sandst1_mcp_server_midi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 836ff776b834c0010b4f2c50cbabef6d9ea040503427f2901dd17acc16131609
MD5 e13b0f91a228016ca6f5b5c13a065ff1
BLAKE2b-256 b1143ee38b869a239032c8dc0ef70589e8a48bf77ef3a91b091731b0b758f5db

See more details on using hashes here.

File details

Details for the file iflow_mcp_sandst1_mcp_server_midi-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_sandst1_mcp_server_midi-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_sandst1_mcp_server_midi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a00b1daaf96bbe78a66a1951a0c55512ec4fb637e3d098b0e30f5db1de00ca2
MD5 238938e29607074cf1c4c86cd946bba7
BLAKE2b-256 a55b8a27256d6d1737dde3dbaab3d9cdc4d17b9ea3fac43c36f9fec73a777b83

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