MuseScore MCP Server
MuseScore MCPサーバー
WebSocketベースのプラグインシステムを介してMuseScoreをプログラムで制御するModel Context Protocol (MCP) サーバーです。これにより、ClaudeのようなAIアシスタントが直接MuseScoreを操作し、作曲、歌詞の追加、楽譜のナビゲーションなどを行えるようになります。

前提条件
MuseScore 3.x または 4.x
Python 3.8+
Claude Desktop または互換性のあるMCPクライアント
Related MCP server: Ableton Copilot MCP
セットアップ
1. MuseScoreプラグインのインストール
まず、QMLプラグインコードをMuseScoreのプラグインディレクトリに保存します:
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. MuseScoreでプラグインを有効にする
MuseScoreを開く
プラグイン → プラグインマネージャー に移動
「MuseScore API Server」を見つけてチェックボックスをオンにする
OK をクリック
3. Python環境のセットアップ
git clone <your-repo>
cd mcp-agents-demo
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install fastmcp websockets4. Claude Desktopの設定
Claude Desktopの設定ファイルに以下を追加します:
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"
]
}
}
}注意: パスは実際のプロジェクトの場所に合わせて更新してください。
システムの実行
操作手順
まずMuseScoreを起動し、楽譜を開く
MuseScoreプラグインを実行: プラグイン → MuseScore API Server に移動
コンソールに
"Starting MuseScore API Server on port 8765"と表示されるはずです
次にPython MCPサーバーを起動するか、Claude Desktopを再起動する
[insert screenshot of different functionality, harmonisation, melodywriting, as zoomed in GIFs]
開発とテスト
開発にはMCP開発ツールを使用してください:
# Install MCP dev tools
pip install mcp
# Test your server
mcp dev server.py
# Check connection status
mcp dev server.py --inspectコンソール出力の確認
MuseScoreプラグインのコンソール出力を確認するには、ターミナルからMuseScoreを実行します:
macOS:
/Applications/MuseScore\ 4.app/Contents/MacOS/mscoreWindows:
cd "C:\Program Files\MuseScore 4\bin"
MuseScore.exeLinux:
musescore4機能
このMCPサーバーは、包括的なMuseScore制御を提供します。
🌟 このフォークの新機能: 自動的かつ完璧な多声ポリフォニーと、LilyPondへの時間的レイアウトマッピングを内蔵!
ナビゲーションとカーソル制御
get_cursor_info()- 現在のカーソル位置と選択情報を取得go_to_measure(measure)- 指定した小節へ移動go_to_beginning_of_score()/go_to_final_measure()- 楽譜の最初/最後に移動next_element()/prev_element()- カーソルを要素ごとに移動next_staff()/prev_staff()- 五線間を移動select_current_measure()- 現在の小節全体を選択select_custom_range(start_tick, end_tick, start_staff, end_staff)- 小節をまたぐ、または複数五線にわたるフレーズを抽出するためのスライスツール
ポリフォニーとLilyPond統合
時間的リズムパディング: ギャップや休符がある声部には、数学的な位置を正確に保持するためにLilyPondのスペーサーシーケンス (
s4.) が自動的に適用されます。同時声部レンダリング: 高度なエージェント処理のために、4声部 (
\voiceOne,\voiceTwoなど) の配列が五線ごとに正しく構造化および分割されます。
音符と休符の作成
add_note(pitch, duration, advance_cursor_after_action)- MIDIピッチで音符を追加add_rest(duration, advance_cursor_after_action)- 休符を追加add_tuplet(duration, ratio, advance_cursor_after_action)- 連符(3連符など)を追加
小節管理
insert_measure()- 現在位置に小節を挿入append_measure(count)- 楽譜の末尾に小節を追加delete_selection(measure)- 現在の選択範囲または指定した小節を削除
歌詞とテキスト
add_lyrics_to_current_note(text)- 現在の音符に歌詞を追加add_lyrics(lyrics_list)- 複数の音符に歌詞を一括追加set_title(title)- 楽譜のタイトルを設定
楽譜情報
get_score()- 楽譜全体の解析と構造を取得ping_musescore()- MuseScoreへの接続をテストconnect_to_musescore()- WebSocket接続を確立
ユーティリティ
undo()- 最後のアクションを取り消しset_time_signature(numerator, denominator)- 拍子記号を変更processSequence(sequence)- 複数のコマンドを一括実行
サンプル楽曲
/examples フォルダには、さまざまな音楽スタイルを示すMuseScoreファイルのサンプルがあります:
Asian Instrumental - アジアの伝統音楽にインスパイアされたインストゥルメンタル曲
String Quartet - クラシックの弦楽四重奏アレンジ
各サンプルには以下が含まれます:
.mscz- MuseScoreファイル(編集可能).pdf- 楽譜.mp3- オーディオプレビュー
使用例
シンプルなメロディの作成
# 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")一括操作
# 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)スターの履歴
トラブルシューティング
接続の問題
"Not connected to MuseScore":
MuseScoreが起動しており、楽譜が開かれていることを確認してください
MuseScoreプラグインを実行してください (プラグイン → MuseScore API Server)
ポート8765がファイアウォールでブロックされていないことを確認してください
プラグインの問題
プラグインが表示されない:
.qmlファイルが正しいプラグインディレクトリにあるか確認してくださいプラグインが有効にならない: プラグインファイルを配置した後、MuseScoreを再起動してください
コンソール出力がない: ターミナルからMuseScoreを実行してデバッグメッセージを確認してください
Pythonサーバーの問題
"No server object found": サーバーオブジェクトはモジュールレベルで
mcp、server、またはappという名前である必要がありますWebSocketエラー: Pythonサーバーを起動する前にMuseScoreプラグインが実行されていることを確認してください
接続タイムアウト: MuseScoreプラグインは単に有効にするだけでなく、アクティブに実行されている必要があります
APIの制限
歌詞: MuseScore 3.xのプラグインAPIでは第1番のみサポートされています
タイトルの設定: フレームアクセスの制限により、複数のフォールバックメソッドを使用しています
選択の永続性: 一部の操作は現在の選択範囲に影響を与える可能性があります
ファイル構造
mcp-agents-demo/
├── .venv/
├── server.py # Python MCP server entry point
├── musescore-mcp-websocket.qml # MuseScore plugin
├── requirements.txt
├── README.md
└── src/ # Source code modules
├── __init__.py
├── client/ # WebSocket client functionality
│ ├── __init__.py
│ └── websocket_client.py
├── tools/ # MCP tool implementations
│ ├── __init__.py
│ ├── connection.py # Connection management tools
│ ├── navigation.py # Score navigation tools
│ ├── notes_measures.py # Note and measure manipulation
│ ├── sequences.py # Batch operation tools
│ ├── staff_instruments.py # Staff and instrument tools
│ └── time_tempo.py # Timing and tempo tools
└── types/ # Type definitions
├── __init__.py
└── action_types.py # WebSocket action type definitionsMIDIピッチリファレンス
参考用の一般的なMIDIピッチ値:
中央ハ (Middle C): 60
ハ長調音階: 60, 62, 64, 65, 67, 69, 71, 72
半音階: C=60, C#=61, D=62, D#=63, E=64, F=65, F#=66, G=67, G#=68, A=69, A#=70, B=71
音価リファレンス
音価フォーマット: {"numerator": int, "denominator": int}
全音符:
{"numerator": 1, "denominator": 1}2分音符:
{"numerator": 1, "denominator": 2}4分音符:
{"numerator": 1, "denominator": 4}8分音符:
{"numerator": 1, "denominator": 8}付点4分音符:
{"numerator": 3, "denominator": 8}
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseDqualityDmaintenanceA Model Context Protocol server that allows AI assistants like Claude and Cursor to create music and control Sonic Pi programmatically through OSC messages.23915MIT
- AlicenseCqualityBmaintenanceA Model Context Protocol server that enables real-time interaction with Ableton Live, allowing AI assistants to control song creation, track management, clip operations, and audio recording workflows.237992MIT
- AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that enables AI assistants like Claude to generate lyrics, songs, and background music through Mureka's APIs.109MIT
- AlicenseBqualityBmaintenanceA Model Context Protocol server that enables AI agents to create fully mixed and mastered tracks in REAPER DAW, supporting project management, MIDI composition, audio recording, and mixing automation.58124MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
A Model Context Protocol server for Wix AI tools
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ghchen99/mcp-musescore'
If you have feedback or need assistance with the MCP directory API, please join our Discord server