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 分