sheet-music-mcp / comparer-mcp
CLAUDE.md4 starsChanged 2 months agoMITView on GitHub
Last changed: 2026-11-26 · Source: https://github.com/raulkivi/sheet-music-mcp Music-aware comparison of two MusicXML files. Provides structured, multi-level diffs from global similarity score down to individual note differences. Primary use cases: version/arrangement comparison, OMR quality evaluation, round-trip fidelity testing. Status: Phase 4 (Advanced features) complete — all originally-scoped phases done. UX Wave 2 (score references) complete. UX Wave 3: options.measure_range renamed to options.measures (and list_changes's measure_range to measures), old names kept as deprecated aliases. MCP Apps Diff Viewer done (ui://comparer/diff-viewer, structuredContent, output schemas,…
- Installs packages
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- musicxml-abc-mcp/CLAUDE.mdCLAUDE.md
- omr-mcp/CLAUDE.mdCLAUDE.md
- pitch-mcp/CLAUDE.mdCLAUDE.md
- render-mcp/CLAUDE.mdCLAUDE.md
- synth-mcp/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 97
Remove the aliases in the release after 0.3.0.
- Very specific: line 115
Integration tests: must be @pytest.mark.integration
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
comparer-mcp — Claude Code Instructions
Last changed: 2026-11-26 · Source: https://github.com/raulkivi/sheet-music-mcp
What This Server Does
Music-aware comparison of two MusicXML files. Provides structured, multi-level diffs from global similarity score down to individual note differences. Primary use cases: version/arrangement comparison, OMR quality evaluation, round-trip fidelity testing.
Status: Phase 4 (Advanced features) complete — all originally-scoped phases done. UX Wave 2
(score references) complete. UX Wave 3: options.measure_range renamed to options.measures
(and list_changes's measure_range to measures), old names kept as deprecated aliases.
MCP Apps Diff Viewer done (ui://comparer/diff-viewer, structuredContent, output schemas, diff_id and two app-only tools; page in ui/apps/diff-viewer/).
compare_scores (C24) consolidates the five compare tools (detail: summary, changes, report, full);
the old names are deprecated aliases for one minor release.
413 unit tests pass (+7 integration, which need the omr-mcp .mxl samples). server.py exposes
all 12 tools (two app-only); engine.py/models.py/part_matcher.py/note_aligner.py/measure_comparator.py/report.py/
annotator.py/utils.py are all implemented and independently usable.
Running Tests
# From this directory
VIRTUAL_ENV= .venv/bin/pytest tests/ -v # unit tests
VIRTUAL_ENV= .venv/bin/pytest tests/ -v -m integration # integration testsInstall dependencies: uv sync --extra dev (pytest is in the dev extra; plain uv sync removes it)
Key Files
| File | Purpose |
src/comparer_mcp/server.py | MCP tool definitions and handlers |
src/comparer_mcp/score_inputs.py | Reference/target pair: schema and loading (inline or path) |
src/comparer_mcp/engine.py | Comparison orchestration (no MCP imports) |
src/comparer_mcp/models.py | Dataclasses: ComparisonResult, NoteDiff, etc. |
src/comparer_mcp/comparison_view.py | compare_scores: detail levels, view_of(), filter folding, output schema (no MCP) |
src/comparer_mcp/presenter.py | content (unchanged JSON text) + structuredContent and output schemas for the Diff Viewer |
src/comparer_mcp/diff_book.py | DiffBook: the scores of each compare_scores result under an opaque diff_id (no MCP) |
src/comparer_mcp/result_schema.py | JSON Schema generated from the models.py dataclasses |
src/comparer_mcp/part_matcher.py | Part matching logic (name, instrument, range) |
src/comparer_mcp/note_aligner.py | Edit-distance note alignment |
src/comparer_mcp/measure_comparator.py | Measure-level structural comparison |
src/comparer_mcp/report.py | Human-readable comparison report (pure ComparisonResult -> str) |
src/comparer_mcp/annotator.py | Colored MusicXML diff export |
src/comparer_mcp/utils.py | Validation, pitch names, duration formatting |
docs/HANDOVER.md | Status, remaining work, definition of done |
docs/PLAN.md | Implementation plan and technology decisions |
docs/requirements.md | Functional/non-functional requirements |
docs/architecture.md | Full vision, pipeline design, data model |
Implemented Tools
| Tool | Description |
compare_scores | The comparison tool: detail summary/changes/report/full, parts, measures, options; structuredContent + output_schema |
compare_musicxml | Deprecated alias (detail="full"): full diff of two scores (inline or by path) |
compare_musicxml_files | Deprecated alias (detail="full"): Full diff of two MusicXML file paths (read roots apply) |
quick_similarity | Deprecated alias (detail="summary"): Similarity score (0.0–1.0) + summary |
list_changes | Deprecated alias (detail="changes"): Filtered note-level diffs (part, measures) |
generate_comparison_report | Deprecated alias (detail="report"): Human-readable version comparison report |
export_annotated_musicxml | Colored MusicXML diff export; paths for large results (return), feed them to render-mcp's musicxml_path |
get_diff_scores | App-only (Diff Viewer): both scores of a diff_id with the differences colored |
export_diff_scores | App-only (Diff Viewer): writes the annotated pair of a diff_id, returns paths |
describe_score | Shared core tool: parts (IDs), key, time, range, measures — cheap, no music21 |
health_check | Server status and music21 version |
list_capabilities | Server metadata per conventions |
MCP Apps Diff Viewer (ui://comparer/diff-viewer, server.DIFF_VIEWER): compare_scores, compare_musicxml,
compare_musicxml_files and generate_comparison_report link it (_meta.ui.resourceUri) only when
comparer_mcp/ui/assets/diff-viewer.html is packaged (hatch artifacts; gitignored build output).
They return structuredContent (the full ComparisonResult, or {report, similarity_score}) and
declare an output_schema; content stays byte-identical (tests/test_content_golden.py).
Errors set isError and carry no structuredContent. When the HTML is packaged compare_scores
adds a diff_id (the pair is kept in DiffBook); the app-only get_diff_scores and
export_diff_scores take it, never a path.
Score references (UX Wave 2): every tool that took reference_xml / target_xml also takes
reference_path / target_path, exactly one of each pair (score_inputs.py, built on
sheet_music_mcp_core.references). Paths are confined to the read roots (SHEET_MUSIC_OUTPUT_ROOT,
client roots, SHEET_MUSIC_INPUT_ROOTS) — compare_musicxml_files too, so tests that read files
must set one of those to their tmp dir. Never open a score path yourself; use load_pair().
Measure ranges (UX Wave 3): options.measures and list_changes's measures are [start, end]
inclusive measure numbers (schema sheet_music_mcp_core.measures.MEASURES_PROPERTY, validated with
parse_range). Unlike the other servers they filter the differences, they do not cut the
scores. measure_range is a deprecated alias in both places (params.aliased): equal values are
accepted, different values are INVALID_PARAMETER, the old name alone logs one warning per process.
Remove the aliases in the release after 0.3.0.
Environment
- Core library:
music21— MusicXML parsing, score model, stream alignment - No system dependencies required
- music21 import is slow (~2s first time) — this is expected
Hard Rules
- Never
pip install— useuv syncoruv add engine.pymust not import frommcp— keeps it unit-testable- All tool handlers must be
async def - All errors →
{"error": "...", "error_code": "..."}(codes:FILE_NOT_FOUND,FILE_TOO_LARGE,INVALID_INPUT,UNSUPPORTED_FORMAT,PROCESSING_FAILED,INVALID_PARAMETER) - Integration tests must be
@pytest.mark.integration
MCP Server Startup Pattern
import asyncio
import mcp.server.stdio
async def _run():
async with mcp.server.stdio.stdio_server() as (read_stream, write_stream):
await app.run(read_stream, write_stream, app.create_initialization_options())
asyncio.run(_run())run_server() does not exist in the installed MCP SDK — use the context manager above.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

