MuseScore MCP server

Provides control of MuseScore music notation software through WebSocket communication, enabling composition, editing, and analysis of musical scores with note insertion, cursor navigation, tuplet creation, lyrics addition, and time signature modifications.
Back to servers
Setup instructions
Provider
George Chen
Release date
Jul 02, 2025
Stats
4 stars

This MCP server provides programmatic control over MuseScore through a WebSocket-based plugin system, allowing AI assistants like Claude to compose music, add lyrics, navigate scores, and control MuseScore directly. You'll be able to automate music creation and manipulation tasks through a simple API.

Prerequisites

  • MuseScore 3.x or 4.x
  • Python 3.8+
  • Claude Desktop or compatible MCP client

Installation

Installing the MuseScore Plugin

  1. Save the QML plugin code to your MuseScore plugins directory:

    • macOS: ~/Documents/MuseScore4/Plugins/musescore-mcp-websocket.qml
    • Windows: %USERPROFILE%\Documents\MuseScore4\Plugins\musescore-mcp-websocket.qml
    • Linux: ~/Documents/MuseScore4/Plugins/musescore-mcp-websocket.qml
  2. Enable the plugin in MuseScore:

    • Open MuseScore
    • Go to Plugins → Plugin Manager
    • Find "MuseScore API Server" and check the box to enable it
    • Click OK

Setting Up the Python Environment

git clone <your-repo>
cd mcp-agents-demo
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install fastmcp websockets

Configuring Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "musescore": {
      "command": "/path/to/your/project/.venv/bin/python",
      "args": [
        "/path/to/your/project/server.py"
      ]
    }
  }
}

Note: Update the paths to match your actual project location.

Usage

Starting the System

The order of operations is important:

  1. Start MuseScore first with a score open
  2. Run the MuseScore plugin: Go to Plugins → MuseScore API Server
    • You should see console output: "Starting MuseScore API Server on port 8765"
  3. Then start the Python MCP server or restart Claude Desktop

Testing Your Setup

For development and testing:

# Install MCP dev tools
pip install mcp

# Test your server
mcp dev server.py

# Check connection status
mcp dev server.py --inspect

Viewing Console Output

To see MuseScore plugin console output, run MuseScore from terminal:

macOS:

/Applications/MuseScore\ 4.app/Contents/MacOS/mscore

Windows:

cd "C:\Program Files\MuseScore 4\bin"
MuseScore.exe

Linux:

musescore4

Features

Navigation & Cursor Control

await get_cursor_info()  # Get current cursor position and selection info
await go_to_measure(5)   # Navigate to measure 5
await go_to_beginning_of_score()  # Go to start
await go_to_final_measure()       # Go to end
await next_element()    # Move to next element
await prev_element()    # Move to previous element
await next_staff()      # Move to staff below
await prev_staff()      # Move to staff above
await select_current_measure()  # Select entire current measure

Note & Rest Creation

# Add a quarter note C (MIDI pitch 60)
await add_note(60, {"numerator": 1, "denominator": 4}, True)

# Add a quarter rest
await add_rest({"numerator": 1, "denominator": 4}, True)

# Add a triplet
await add_tuplet({"numerator": 1, "denominator": 8}, {"numerator": 3, "denominator": 2}, True)

Measure Management

await insert_measure()      # Insert measure at cursor
await append_measure(4)     # Add 4 measures to end of score
await delete_selection()    # Delete current selection

Lyrics & Text

# Add lyrics to current note
await add_lyrics_to_current_note("Hello")

# Batch add lyrics to multiple notes
await add_lyrics(["Twin-", "kle", "twin-", "kle", "lit-", "tle", "star"])

# Set score title
await set_title("My Composition")

Score Information

await get_score()  # Get complete score analysis
await ping_musescore()  # Test connection
await connect_to_musescore()  # Establish WebSocket connection

Usage Examples

Creating a Simple Melody

# Set up the score
await set_title("My First Song")
await go_to_beginning_of_score()

# Add notes (MIDI pitch: 60=C, 62=D, 64=E, etc.)
await add_note(60, {"numerator": 1, "denominator": 4}, True)  # Quarter note C
await add_note(64, {"numerator": 1, "denominator": 4}, True)  # Quarter note E
await add_note(67, {"numerator": 1, "denominator": 4}, True)  # Quarter note G
await add_note(72, {"numerator": 1, "denominator": 2}, True)  # Half note C

# Add lyrics
await go_to_beginning_of_score()
await add_lyrics_to_current_note("Do")
await next_element()
await add_lyrics_to_current_note("Mi")
await next_element()
await add_lyrics_to_current_note("Sol")
await next_element()
await add_lyrics_to_current_note("Do")

Batch Operations

# Add multiple lyrics at once
await add_lyrics(["Twin-", "kle", "twin-", "kle", "lit-", "tle", "star"])

# Use sequence processing for complex operations
sequence = [
    {"action": "goToBeginningOfScore", "params": {}},
    {"action": "addNote", "params": {"pitch": 60, "duration": {"numerator": 1, "denominator": 4}, "advanceCursorAfterAction": True}},
    {"action": "addNote", "params": {"pitch": 64, "duration": {"numerator": 1, "denominator": 4}, "advanceCursorAfterAction": True}},
    {"action": "addRest", "params": {"duration": {"numerator": 1, "denominator": 4}, "advanceCursorAfterAction": True}}
]
await processSequence(sequence)

Troubleshooting

Connection Issues

  • "Not connected to MuseScore":
    • Ensure MuseScore is running with a score open
    • Run the MuseScore plugin (Plugins → MuseScore API Server)
    • Check that port 8765 isn't blocked by firewall

Plugin Issues

  • Plugin not appearing: Check the .qml file is in the correct plugins directory
  • Plugin won't enable: Restart MuseScore after placing the plugin file
  • No console output: Run MuseScore from terminal to see debug messages

Python Server Issues

  • "No server object found": The server object must be named mcp, server, or app at module level
  • WebSocket errors: Make sure MuseScore plugin is running before starting Python server
  • Connection timeout: The MuseScore plugin must be actively running, not just enabled

Reference

MIDI Pitch Reference

Common MIDI pitch values:

  • Middle C: 60
  • C Major Scale: 60, 62, 64, 65, 67, 69, 71, 72
  • Chromatic: C=60, C#=61, D=62, D#=63, E=64, F=65, F#=66, G=67, G#=68, A=69, A#=70, B=71

Duration Reference

Duration format: {"numerator": int, "denominator": int}

  • Whole note: {"numerator": 1, "denominator": 1}
  • Half note: {"numerator": 1, "denominator": 2}
  • Quarter note: {"numerator": 1, "denominator": 4}
  • Eighth note: {"numerator": 1, "denominator": 8}
  • Dotted quarter: {"numerator": 3, "denominator": 8}

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 "musescore" '{"command":"/path/to/your/project/.venv/bin/python","args":["/path/to/your/project/server.py"]}'

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": {
        "musescore": {
            "command": "/path/to/your/project/.venv/bin/python",
            "args": [
                "/path/to/your/project/server.py"
            ]
        }
    }
}

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": {
        "musescore": {
            "command": "/path/to/your/project/.venv/bin/python",
            "args": [
                "/path/to/your/project/server.py"
            ]
        }
    }
}

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