MCP MIDI Server

by sandst1
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Enables configuration of the MCP server through environment variables stored in a .env file, allowing users to specify settings like the server port.

  • Provides installation instructions that utilize Git for cloning the repository to set up the MCP MIDI server.

  • Creates a virtual MIDI output port that can send MIDI Note On/Off messages and Control Change (CC) messages with precise timing to any software that supports MIDI input, such as digital audio workstations (DAWs), hardware synthesizers, and other MIDI-compatible applications.

MCP MIDI 服务器

FastMCP 服务器允许 LLM 将 MIDI 序列发送到任何支持 MIDI 输入的软件。

特征

  • 创建虚拟 MIDI 输出端口
  • 发送 MIDI 音符开/关消息
  • 发送控制变更 (CC) 消息
  • 以精确的时间对 MIDI 事件进行排序
  • 可在任何支持 MIDI 的应用程序中用作 MIDI 输入设备

要求

  • Python 3.7+
  • rtmidi
  • fastmcp
  • python-dotenv
  • 异步

安装

  1. 克隆存储库:
    git clone <repository-url> cd mcp-server-midi
  2. 创建虚拟环境,激活它并安装依赖项:
    python -m venv .venv source .venv/bin/activate pip install -r requirements.txt
  3. 使用您的配置创建一个.env文件:
    PORT=8123

用法

运行服务器:

python mcp_midi_server.py

服务器会创建一个名为“MCP MIDI Out”的虚拟 MIDI 端口,可在其他应用程序中用作 MIDI 输入设备。这意味着您可以:

  • 连接数字音频工作站 (DAW),如 Ableton Live、Logic Pro 或 FL Studio,以从此服务器接收 MIDI
  • 使用服务器通过计算机的 MIDI 接口控制硬件合成器
  • 连接到任何其他接受 MIDI 输入的软件(虚拟乐器、照明控制器等)

只需在您首选的 MIDI 兼容应用程序中选择“MCP MIDI Out”作为 MIDI 输入设备。

MCP 配置

服务器使用服务器发送事件(SSE),这是在 Cursor 中配置它的方法:

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

API 方法

发送注释

发送 MIDI Note On 消息。

参数:

  • note :MIDI 音符编号(0-127)
  • velocity :音符速度(0-127,默认127)
  • channel :MIDI 通道(0-15,默认 0)

发送注释关闭

发送 MIDI 音符关闭消息。

参数:

  • note :MIDI 音符编号(0-127)
  • velocity :音符关闭速度(0-127,默认64)
  • channel :MIDI 通道(0-15,默认 0)

发送控制变更

发送 MIDI 控制变化 (CC) 消息。

参数:

  • controller :CC控制器编号(0-127)
  • value :CC值(0-127)
  • channel :MIDI 通道(0-15,默认 0)

发送 MIDI 序列

发送具有指定持续时间的一系列 MIDI 音符开/关消息。

参数:

  • events :事件字典列表。每个字典必须包含:
    • note :MIDI 音符编号(0-127)
    • velocity :音符速度(0-127,默认127)
    • channel :MIDI 通道(0-15,默认 0)
    • duration :发送 Note Off 之前保持音符的时间(秒)
    • start_time :相对于序列开始的时间(以秒为单位)(默认值为 0)

例子

使用 API 弹奏 C 大调和弦:

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

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

创建虚拟 MIDI 输出端口的 FastMCP 服务器,允许 LLM 生成 MIDI 数据并将其发送到任何接受 MIDI 输入的软件。

  1. Features
    1. Requirements
      1. Installation
        1. Usage
          1. MCP Config
            1. API Methods
              1. Send Note On
              2. Send Note Off
              3. Send Control Change
              4. Send MIDI Sequence
            2. Example
              1. License
                ID: z2mandv3yv