MIDI File MCP
🎵 MIDI 文件 MCP
📖 简介
这是一款基于 Tone.js 和 @tonejs/midi 库的 MIDI 文件解析和操作工具,通过 MCP(模型上下文协议)服务提供功能。此工具可让您轻松读取、分析和修改 MIDI 文件,而无需深入研究 MIDI 文件格式的复杂性。
Related MCP server: music21-mcp
✨ 特点
读取 MIDI 文件信息
获取并修改音轨、音符、控制变化和弯音信息
设置 MIDI 文件速度 (BPM)
向特定音轨添加新音符、控制变化和弯音
添加新曲目
全面的错误处理
📥 先决条件
安装Node.js :确保 npx 命令可以正常运行,建议从Node.js 官网安装最新稳定版本
🔧 使用方法
与 MCP 客户端一起使用,支持的客户端包括但不限于:
游标配置示例
在 Cursor 中配置 midi-file-mcp:
"midi-file-mcp": {
"command": "npx",
"args": [
"-y",
"midi-file-mcp"
]
}🎹 使用 MIDI 解析器 MCP 和绝对路径
MIDI Parser MCP 中的所有操作都需要 MIDI 文件的绝对路径。这确保了无论当前工作目录如何,该工具都能正确定位和操作您的 MIDI 文件。
示例提示
以下是一些您可以与 AI 助手一起使用的示例提示:
获取 MIDI 文件信息:
Can you show me information about the MIDI file at D:\path\to\your\file.mid?分析曲目:
Please analyze all tracks in D:\path\to\your\file.mid and tell me how many notes are in each track.设置节奏:
Change the tempo of D:\path\to\your\file.mid to 120 BPM.使用注释:
Show me all notes in track 1 of D:\path\to\your\file.mid.添加注释:
Add a C4 note at position 0 with a duration of 1 beat to track 0 in D:\path\to\your\file.mid.
可用操作
手术 | 描述 | 参数 |
获取midi信息 | 获取常规 MIDI 文件信息 | 文件路径 |
设置节奏 | 设置 MIDI 文件的节奏 (BPM) | 文件路径,bpm |
获取轨迹信息 | 获取有关所有曲目的信息 | 文件路径 |
通过索引获取轨迹信息 | 获取有关特定曲目的信息 | 文件路径、轨道索引 |
通过索引获取笔记 | 获取特定曲目的所有音符 | 文件路径、轨道索引 |
通过索引获取弯音 | 获取特定音轨的所有弯音 | 文件路径、轨道索引 |
通过索引获取控制更改 | 获取特定轨道的所有控制变化 | 文件路径、轨道索引 |
按索引添加注释 | 向特定轨道添加注释 | 文件路径、曲目索引、注释 |
通过索引添加控制更改 | 将控制更改添加到特定轨道 | 文件路径、轨道索引、控制变化 |
按索引添加弯音 | 为特定音轨添加弯音 | 文件路径、音轨索引、弯音 |
添加轨道 | 向 MIDI 文件添加新音轨 | 文件路径 |
注意:使用 Windows 路径时,请始终在文件路径中使用双反斜杠 ( \\ ) 或正斜杠 ( / ),以避免出现错误。
📄 许可证
本项目遵循 MIT 许可证。详情请参阅 LICENSE 文件。
🙏 致谢
感谢以下项目和库,如果没有它们,这个工具就不可能实现:
Tone.js - Web 音频框架
@tonejs/midi - MIDI 文件解析和操作库
MCP(模型上下文协议) ——使工具集成到人工智能助手中成为可能
Available Tools
11 toolsadd_controlchanges_by_indexC
Add controlchanges to midi file by track index
Inputs: filePath (required), trackIndex (required), controlchanges (required).
add_notes_by_indexB
Add notes to midi file by track index
Inputs: filePath (required), trackIndex (required), notes (required).
add_pitchbends_by_indexC
Add pitchbends to midi file by track index
Inputs: filePath (required), trackIndex (required), pitchbends (required).
add_trackB
Add a new track to midi file and return the new track info
Inputs: filePath (required).
get_controlchanges_by_indexC
Get controlchanges from midi file by track index
Inputs: filePath (required), trackIndex (required).
get_midi_infoC
Get midi file info
Inputs: filePath (required).
get_notes_by_indexB
Get notes from midi file by track index
Inputs: filePath (required), trackIndex (required).
get_pitchbends_by_indexB
Get pitchbends from midi file by track index
Inputs: filePath (required), trackIndex (required).
get_track_info_by_indexB
Get track info from midi file by track index. name, instrument, channel, endOfTrackTicks, duration, durationTicks, noteCount
Inputs: filePath (required), trackIndex (required).
get_tracks_infoC
Get tracks info from midi file
Inputs: filePath (required).
set_tempoC
Set tempo for midi file
Inputs: filePath (required), bpm (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a distinct resource (notes, controlchanges, pitchbends, tracks, tempo, info) with clear operations (get, add, set), making them easily distinguishable.
All tool names follow a consistent verb_noun pattern with snake_case, e.g., add_notes_by_index, get_midi_info, set_tempo. No mixed conventions.
11 tools is well-scoped for MIDI file manipulation, covering essential read and write operations without being excessive or thin.
The tool set covers adding and getting notes, control changes, and pitch bends, but lacks update and delete operations for those events, as well as removing tracks or clearing data.
Maintenance
Related MCP Connectors
Create, co-edit, analyze, publish, and export collaborative step-sequencer sessions through MCP.
ScoreStarling is an all-in-one AI sheet music assistant. Ask for anything to do with sheet music: transcribe a song from audio, video or a link, read a PDF or photo, add chords, change the key, make it easier, turn it into guitar TAB or jianpu, or arrange it for another instrument. Every change lands on a real score you can hear, fix and download (PDF, MIDI, MusicXML, guitar TAB, jianpu, audio). Hosted remote server with OAuth sign-in. Free accounts get monthly credits and free previews; prices are at scorestarling.com/pricing. Setup: https://scorestarling.com/mcp
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Audio, music, video, image, PDF, speech, text and web-check tools callable from any MCP client.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables comprehensive analysis of MIDI SMF files including loading, parsing, track analysis, event extraction with filtering, and detailed file summaries. Supports memory management for efficient repeated access to loaded MIDI files.5MIT
- AlicenseNot gradedqualityDmaintenanceExposes 16 music21 MIDI analysis and editing tools to AI agents, enabling them to read, edit, generate, and analyze MIDI files through natural language.MIT
- AlicenseAqualityDmaintenanceA game-agnostic MCP toolkit for composing chiptune/retro MIDI and rendering game audio, enabling AI agents to generate multi-track MIDI files and render them to OGG/WAV.7MIT
- FlicenseNot gradedqualityCmaintenanceAn MCP server that transcribes audio files into MIDI and MusicXML scores, converts MIDI to notation, and extracts playable note data for DAWs. It enables Claude to turn raw recordings into editable, shareable music scores via three simple tools.1-