The MIDI File MCP server is a powerful tool for parsing and manipulating MIDI files, built on Tone.js and implementing the Model Context Protocol (MCP). It allows you to analyze, modify, and create MIDI files through AI assistants without dealing with the complexities of the MIDI file format directly.
Ensure you have Node.js installed on your system so that the npx command can run properly. It's recommended to install the latest stable version from the Node.js official website.
The easiest way to install the MIDI File MCP for Claude Desktop is through Smithery:
npx -y @smithery/cli install @xiaolaa2/midi-file-mcp --client claude
To configure midi-file-mcp in Cursor, add the following to your configuration:
"midi-file-mcp": {
"command": "npx",
"args": [
"-y",
"midi-file-mcp"
]
}
All operations require the absolute path to your MIDI files to ensure they can be located correctly regardless of the current working directory.
Here are some example prompts you can use with your AI assistant:
Get MIDI File Information:
Can you show me information about the MIDI file at D:\path\to\your\file.mid?
Analyzing Tracks:
Please analyze all tracks in D:\path\to\your\file.mid and tell me how many notes are in each track.
Setting Tempo:
Change the tempo of D:\path\to\your\file.mid to 120 BPM.
Working with Notes:
Show me all notes in track 1 of D:\path\to\your\file.mid.
Adding Notes:
Add a C4 note at position 0 with a duration of 1 beat to track 0 in D:\path\to\your\file.mid.
Operation | Description | Parameters |
---|---|---|
get_midi_info | Get general MIDI file information | filePath |
set_tempo | Set the tempo (BPM) of a MIDI file | filePath, bpm |
get_tracks_info | Get information about all tracks | filePath |
get_track_info_by_index | Get information about a specific track | filePath, trackIndex |
get_notes_by_index | Get all notes from a specific track | filePath, trackIndex |
get_pitchbends_by_index | Get all pitch bends from a specific track | filePath, trackIndex |
get_controlchanges_by_index | Get all control changes from a specific track | filePath, trackIndex |
add_notes_by_index | Add notes to a specific track | filePath, trackIndex, notes |
add_controlchanges_by_index | Add control changes to a specific track | filePath, trackIndex, controlchanges |
add_pitchbends_by_index | Add pitch bends to a specific track | filePath, trackIndex, pitchbends |
add_track | Add a new track to the MIDI file | filePath |
When working with Windows paths, always use double backslashes (\\
) or forward slashes (/
) to avoid path parsing errors.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "midi-file-mcp" '{"command":"npx","args":["-y","midi-file-mcp"]}'
See the official Claude Code MCP documentation for more details.
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.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"midi-file-mcp": {
"command": "npx",
"args": [
"-y",
"midi-file-mcp"
]
}
}
}
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.
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"midi-file-mcp": {
"command": "npx",
"args": [
"-y",
"midi-file-mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect