MusicXML to ABC

io.github.raulkivi由 GitHub 帳號 raulkivi 發布v0.2.2更新於 Oct 24, 2026

Converts between MusicXML and ABC notation, so LLMs can read and edit scores

已驗證STDIO僅桌面開發者工具媒體與設計

概覽

AI 產生的概覽

本機 MCP 伺服器,在 MusicXML 與 ABC 記譜法之間互轉,讓助理能讀取、摘要並編輯樂譜。

可以做什麼
  • 把 MusicXML 文字或檔案路徑轉成 ABC 記譜,可依單一聲部與小節範圍篩選
  • 把 ABC 記譜轉回 MusicXML,小樂譜直接回傳,大樂譜寫入檔案
  • 驗證 ABC 字串並回報解析錯誤或警告
  • 以低成本摘要樂譜:聲部、調號、拍號、速度、音域與小節
  • 回傳伺服器中繼資料並執行往返轉換健康檢查
適用情境
適合讓助理編輯合唱等樂譜:先把 MusicXML 轉成精簡的 ABC,由模型編輯文字,再轉回 MusicXML。也適合在動手前檢視樂譜的聲部與結構。
執行需求
以 PyPI 套件 musicxml-abc-mcp 透過 uvx 在本機以 stdio 執行,需要 Python 3.11 以上版本。不需環境變數,選用變數可設定輸出目錄、額外輸入資料夾與內嵌大小上限。僅支援桌面用戶端。
安裝前請注意
轉換會寫入檔案:大樂譜會存到輸出目錄,檔案路徑只能從允許的資料夾讀取。往返轉換音符誤差約 2% 以內,但力度與複雜奏法不會保留,編輯可能遺失表情記號。使用前請檢查轉換結果。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 MusicXML to ABC,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

musicxml-abc-mcp

MCP server that converts between MusicXML and ABC notation.

What it does

Bridges MusicXML (the standard but verbose XML format) and ABC notation (a compact, human-readable text format). The primary use case is enabling LLM-assisted score editing: MusicXML → ABC → Claude edits → ABC → MusicXML.

ABC is ideal for LLM editing because it is concise enough to fit in a context window and expressive enough to represent most choral music.

Tools

ToolDescription
musicxml_to_abcConvert MusicXML (musicxml text or musicxml_path) to ABC notation; optionally filter to a single part and a range of printed bars (measures)
abc_to_musicxmlConvert ABC notation back to MusicXML; large scores are written to a file (return: auto / path / inline)
validate_abcParse an ABC string and return errors or warnings
list_capabilitiesReturn server metadata: backend version, ABC standard
health_checkRun a MusicXML → ABC → MusicXML round-trip smoke test and report status
describe_scoreSummarize a score cheaply: parts (IDs P1…), key, time, tempo, ranges, measures

Installation

bash
cd musicxml-abc-mcpuv sync --extra dev

Note: use --extra dev (not --group dev) to install pytest.

For a guided setup (installs uv if needed, then syncs dependencies), run ./install.sh — see SETUP.md for step-by-step instructions. Ready-made client configs (Claude Desktop, Cursor, Windsurf, Continue, Zed) are in examples/. If something doesn't work, check TROUBLESHOOTING.md.

Running

bash
uv run musicxml-abc-mcp

No environment variables required. Optional: SHEET_MUSIC_OUTPUT_ROOT (where large scores are written and paths are read; default the working directory), SHEET_MUSIC_INPUT_ROOTS (extra folders to read scores from) and SHEET_MUSIC_INLINE_MAX_BYTES (default 8192). See Score References.

Usage examples

Scores can be passed as text (musicxml) or as a file path (musicxml_path: .musicxml, .xml or .mxl inside the allowed folders). abc_to_musicxml returns small scores as text and writes large ones to <output root>/scores/, returning musicxml_path plus a short score_summary; pass "return": "inline" to always get the text.

json
// Convert full score to ABC{  "tool": "musicxml_to_abc",  "arguments": {"musicxml": "<score-partwise>...</score-partwise>"}}// → {"abc": "X:1\nT:...\n...", "parts_included": ["P1", "P2", "P3", "P4"], "warnings": []}
// Extract just the Soprano part{  "tool": "musicxml_to_abc",  "arguments": {"musicxml": "<score-partwise>...</score-partwise>", "part": "Soprano"}}// `part` takes a part ID ("P1"), name ("soprano", any case) or voice ("S"); an unknown part// returns the valid choices. `part_id` is a deprecated alias for one minor release.
// Just bars 17–24 of the Alto part{  "tool": "musicxml_to_abc",  "arguments": {"musicxml_path": "scores/anthem.musicxml", "part": "Alto", "measures": [17, 24]}}// `measures` are the printed bar numbers, inclusive (a pickup bar is 0). The ABC headers (K:, M:,// Q:) are the key, time and tempo in force at bar 17. A range outside the score returns// INVALID_PARAMETER with a hint such as "This score has measures 1–32."
// Convert edited ABC back to MusicXML{  "tool": "abc_to_musicxml",  "arguments": {"abc": "X:1\nT:My Song\n..."}}// → {"musicxml": "<?xml version=\"1.0\"?>...", "warnings": []}
// Validate ABC before converting{  "tool": "validate_abc",  "arguments": {"abc": "X:1\nT:My Song\n..."}}

ABC notation basics

This server uses ABC standard v2.1:

  • C (uppercase) = C4 (middle C)
  • c (lowercase) = C5 (one octave above middle C)
  • Apostrophe raises an octave: c' = C6
  • Comma lowers an octave: C, = C3

Round-trips preserve notes within ±2%. Dynamics and complex articulations are not preserved.

Testing

bash
# All tests including integration (round-trip SATB conversion)VIRTUAL_ENV= .venv/bin/pytest tests/ -v

Dependencies

  • music21 — score parsing; ABC output uses a custom serializer (music21 9.x has no ABC writer)
  • mcp — MCP protocol

System requirements

  • Python 3.11+
  • No system libraries required

來源:musicxml-abc-mcp/README.md,提交 5fcea5d

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v0.2.2最新Oct 12, 2026
  2. v0.2.1Sep 26, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分