MIDI Files MCP server

Parse and manipulate MIDI files based on Tone.js
Back to servers
Setup instructions
Provider
xiaolaa2
Release date
Apr 02, 2025
Language
TypeScript
Package
Stats
420 downloads
3 stars

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.

Prerequisites

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.

Installation

Via Smithery

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

For Cursor

To configure midi-file-mcp in Cursor, add the following to your configuration:

"midi-file-mcp": {
    "command": "npx",
    "args": [
        "-y",
        "midi-file-mcp"
    ]
}

Using MIDI Parser MCP

All operations require the absolute path to your MIDI files to ensure they can be located correctly regardless of the current working directory.

Example Prompts

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.
    

Available Operations

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

Important Note

When working with Windows paths, always use double backslashes (\\) or forward slashes (/) to avoid path parsing errors.

How to install this MCP server

For Claude Code

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.

For 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 > 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"
            ]
        }
    }
}

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

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