MIDI Output MCP server

Creates a virtual MIDI output port for sending notes, control changes, and timed sequences to any compatible software or hardware synthesizer.
Back to servers
Provider
sandst1
Release date
Apr 16, 2025
Language
Python
Stats
4 stars

A FastMCP Server that allows an LLM to send MIDI sequences into any software that supports MIDI input. It creates a virtual MIDI output port that can be used to send Note On/Off messages, Control Change messages, and sequence MIDI events with precise timing.

Requirements

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

Installation

  1. Clone the repository and navigate to the project directory:

    git clone <repository-url>
    cd mcp-server-midi
    
  2. Create and activate a virtual environment, then 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

Starting the Server

Run the server with the following command:

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.

Connecting to Other Applications

You can connect the MCP MIDI Server to:

  • Digital audio workstations (DAWs) like Ableton Live, Logic Pro, or FL Studio
  • Hardware synthesizers through your computer's MIDI interface
  • Any 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 Configuration

The server uses Server-Sent Events (SSE). Configure it in Cursor with:

{
  "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

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later