agentleFS
raulkiviraulkivi/sheet-music-mcp/CLAUDE.md

sheet-music-mcp

CLAUDE.md4 starsChanged 2 months agoMITView on GitHub

Last changed: 2026-11-26 · Source: https://github.com/raulkivi/sheet-music-mcp Project-level instructions for Claude Code. Read this before doing any work in this repository. Six independent MCP servers for choir practice. Each server lives in its own directory, has its own Python venv, and can be deployed standalone. Shared code (errors, part selection, deprecated parameter names, tool annotations, result content, handler wiring, score paths, describe_score, measure ranges, MCP Apps UI resources, artifact handles, expiring handle tables and health reports) lives in the library sheet-music-mcp-core/,…

  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are 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.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All error responses: must use {"error": "...", "error_code": "..."} — see docs/conventions.md for the full code list

    line 84
  2. Very specific:

    Integration tests: must be marked @pytest.mark.integration and must not run in the default pytest invocation

    line 85
  3. Very specific:

    Use mcp.server.stdio.stdio_server() — run_server() does not exist in the current SDK:

    line 119
  4. Distinctive:

    When you finish work or reach a milestone, update:

    line 160

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md — Choir Music Assistant

Last changed: 2026-11-26 · Source: https://github.com/raulkivi/sheet-music-mcp

Project-level instructions for Claude Code. Read this before doing any work in this repository.


What this project is

Six independent MCP servers for choir practice. Each server lives in its own directory, has its own Python venv, and can be deployed standalone.

ServerDirectoryInput → OutputGoal
omr-mcpomr-mcp/Sheet music image → MusicXMLDigitize scores
render-mcprender-mcp/MusicXML → PDF / PNGPrint / display
synth-mcpsynth-mcp/MusicXML + voice → WAVPractice audio
musicxml-abc-mcpmusicxml-abc-mcp/MusicXML ↔ ABCLLM editing bridge
pitch-mcppitch-mcp/Mic audio + score → position + accuracySing-along feedback
comparer-mcpcomparer-mcp/Two MusicXML → structured diffScore comparison

Shared code (errors, part selection, deprecated parameter names, tool annotations, result content, handler wiring, score paths, describe_score, measure ranges, MCP Apps UI resources, artifact handles, expiring handle tables and health reports) lives in the library sheet-music-mcp-core/, which every server depends on. It is not an MCP server; its tests run from its own directory like a server's.

See README.md for the full vision and data flow.


Working on a specific server

Each server has its own local instruction files — read these first:

ServerClaude CodeCopilot
omr-mcpomr-mcp/CLAUDE.mdomr-mcp/.github/copilot-instructions.md
synth-mcpsynth-mcp/CLAUDE.mdsynth-mcp/.github/copilot-instructions.md
comparer-mcpcomparer-mcp/CLAUDE.mdcomparer-mcp/.github/copilot-instructions.md
render-mcprender-mcp/CLAUDE.mdrender-mcp/.github/copilot-instructions.md
musicxml-abc-mcpmusicxml-abc-mcp/CLAUDE.mdmusicxml-abc-mcp/.github/copilot-instructions.md
pitch-mcppitch-mcp/CLAUDE.mdpitch-mcp/.github/copilot-instructions.md

Also read the server's docs/HANDOVER.md, docs/PLAN.md, docs/requirements.md, and docs/architecture.md (HANDOVER.md and PLAN.md are local and gitignored; pitch-mcp also has docs/todo.md) before writing any code.


Server status

ServerStatusTests
omr-mcp⚠️ Phase 1-4 complete; default (oemer) engine loses SATB voice structure — fixed via opt-in engine="audiveris", not yet the default (see omr-mcp/docs/HANDOVER.md, local and gitignored)344 unit (+150 skipped) + 41 integration; staff estimate (staves per system) checked on 60 real pages, 60/60 (omr-mcp/docs/staff-estimate-evidence.md); MCP Apps Recognition Review page built (PR #225; app-only get_recognized_score / get_source_preview)
synth-mcp✅ Phase 1 + UX complete; MCP Apps Practice Player page built (PR #221; app-only read_audio_chunk / get_score_xml); audio content tests, practice-timing tests, part_gains 1.0 = CC7 100, reverb and chorus set explicitly (same audio on FluidSynth 2.3 and 2.4)501 unit + 14 integration (with a soundfont; CI job synth-integration)
render-mcp✅ Phase 1 + UX complete; Score Viewer (app-only render_page_svg; Kannel chrome, SVG and PDF download via app-only get_pdf / read_pdf_chunk, part filter and highlight, PR #226) awaiting manual host checks284 unit + 13 integration
musicxml-abc-mcp✅ Phase 1 + UX complete; MCP Apps ABC Workbench page built (PR #218; app-only get_abc); apply_abc_edit (C16) replaces bars of one part, other parts byte-identical313 unit + 6 integration
pitch-mcp✅ Phase A+B + UX complete (audio-driven position tracking, DTW via dtaidistance); MCP Apps Practice Coach server side done (structuredContent, app-only get_score_for_session, browser-mic mode: start_monitoring source: "pushed" + app-only push_audio_chunk); Practice Coach page built (PR #220, server mic only; browser mic is T1.6); simulated-singer grading tests and the synth-to-pitch round trip; the three simulated-singer grading defects fixed (octave slips, vibrato on a held final note, a long voiced tail hiding the final note; pitch-mcp/docs/todo.md); releases gated on real-mic evidence509 unit (+2 skipped) + 16 integration
comparer-mcp✅ Phase 4 (Advanced features) complete — all originally-scoped phases done; compare_scores(detail=…) consolidates the five compare tools (old names are deprecated aliases); MCP Apps Diff Viewer page built (PR #219; app-only get_diff_scores / export_diff_scores)413 unit + 7 integration

| sheet-music-mcp-core | ✅ 0.3.1 shared library published on PyPI: Wave 1 helpers, score references (paths, scores, references), measure ranges (measures), MCP Apps UI resources and app-only tool visibility (ui, wiring), opaque artifact handles read in chunks (artifacts), UI resource permissions/CSP, the ExpiringTable (expiring) and the standard health report with the Setup Doctor resource (health) | 658 unit | | ui | ✅ Seven pages: Score Viewer, Setup Doctor (all six servers), Diff Viewer, Practice Coach (with Ask Claude for tips), ABC Workbench, Practice Player, Recognition Review; one registry (ui/apps.config.mjs) drives build, copy and mock host; mock host on ext-apps AppBridge plus the real render-mcp over stdio; axe, 360 px, fullscreen, keyboard and Claude light/dark contrast checks; perf budget (CI warning only). Each new page ships its spec file (ui/README.md). See docs/research/ui-and-sound-testing-plan.md | 882 unit + 367 e2e | | tools/release-evidence | ✅ Records manual runs (pitch-mcp real mic, Claude Desktop host checklist) as git notes; publish.yml gates pitch-mcp and render-mcp releases on them | 156 unit |

Unit counts are the default pytest run (-m "not integration"). UX Wave 1 (all servers): tool titles and annotations, server instructions, part selection by ID/name/voice, inline PNG and file links, pitch idle timeout, Audiveris pre-check — see docs/research/ux-wave1-plan.md. UX Wave 2 (all servers): score references — musicxml_path inputs (.mxl too) confined to the read roots, return: auto|path|inline on score producers, and the shared describe_score tool — see docs/research/ux-wave2-plan.md. UX Wave 3 (practice): measures: [start, end] (printed bar numbers) on render, synth, abc and pitch (comparer's measure_range renamed); synth learning tracks (part_gains, preset, focus_part), repeat, count-in/metronome, timbre and the starting_pitches tool; pitch start_practice and plain-language highlights — see docs/research/ux-wave3-plan.md.

UX deliverables (all servers): PyPI packaging, install.sh, SETUP.md, examples/ client configs, health_check tool, TROUBLESHOOTING.md. See docs/SETUP_UX_PLAN.md.


Hard rules (apply to all servers)

  • Never use pip install — always uv sync or uv add
  • Never share venvs between servers; each has its own .venv
  • engine.py must not import from mcp — keeps it unit-testable without the MCP stack
  • All tool handlers must be async def
  • All error responses must use {"error": "...", "error_code": "..."} — see docs/conventions.md for the full code list
  • Integration tests must be marked @pytest.mark.integration and must not run in the default pytest invocation
  • Shared code lives in sheet-music-mcp-core/. Use it for errors, part selection, deprecated parameter names, tool annotations, result content, handler wiring, expiring id tables (expiring.ExpiringTable) and health_check reports (health); don't copy that code into a server. Engines may import only its MCP-free modules (errors, parts, params, annotations, paths, scores, measures, artifacts, expiring, health). See docs/conventions.md
  • Every tool sets a title and an annotation preset; every part parameter uses the shared resolver (see docs/conventions.md)
  • UI behavior is automated first. New UI checks go in ui/ Playwright or Vitest specs (mock host, or real render-mcp over stdio); a manual host check is added only for behavior that needs a real host (its CSP, iframe sandbox, device timing). See findings §4
  • Every score input has a path sibling (musicxml / musicxml_path, exactly one required) loaded with references.load_score(); never open a score path yourself. Score producers take return: auto|path|inline via references.deliver_score() (see docs/conventions.md)
  • Spelling: US English (behavior, digitize, color) in README and docs, docstrings, comments, tool descriptions and commit messages, matching code identifiers and open-source norms. CI (Spelling job, .codespellrc) checks commit messages and added lines. Keep proper names as they are; convert British spellings in passages you edit

Running tests

From inside each *-mcp/ directory:

# Unit tests (fast, no external dependencies)
VIRTUAL_ENV= .venv/bin/pytest tests/ -v

# Integration tests
VIRTUAL_ENV= .venv/bin/pytest tests/ -v -m integration

# synth-mcp integration (needs soundfont)
VIRTUAL_ENV= SYNTH_SOUNDFONT_PATH=/usr/share/sounds/sf2/TimGM6mb.sf2 \
  .venv/bin/pytest tests/ -v -m integration

# pitch-mcp manual tests (real microphone, skip in CI)
VIRTUAL_ENV= .venv/bin/pytest tests/ -v -m manual

Install dev dependencies: uv sync (or uv sync --extra dev for musicxml-abc-mcp).


MCP stdio pattern (applies to all servers)

Use mcp.server.stdio.stdio_server() — run_server() does not exist in the current SDK:

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())

mcp 2.x has no @app.list_tools()/@app.call_tool() decorators. Wire the handlers at the end of server.py with the shared helper, which validates arguments against the tool's input_schema and returns validation failures and unhandled exceptions as isError results in the {"error", "error_code"} envelope (2.x no longer does either itself):

from sheet_music_mcp_core.wiring import make_handlers

_on_list_tools, _on_call_tool = make_handlers(list_tools, call_tool, logger=logger)
app = Server(name, on_list_tools=_on_list_tools, on_call_tool=_on_call_tool)

Tools needing the request context (progress) take it as a ctx argument; pass pass_context=True (as omr-mcp does). app.request_context no longer exists.


System libraries (already installed on this machine)

LibraryPathUsed by
libfluidsynth.so.3/usr/lib/x86_64-linux-gnu/synth-mcp
libcairo.so.2system-widerender-mcp
libportaudio2system-widepitch-mcp (real-time)

Soundfonts available at /usr/share/sounds/sf2/ — TimGM6mb.sf2 and default-GM.sf2.


Document update policy

When you finish work or reach a milestone, update:

  1. <server>/docs/HANDOVER.md — check off done items, add new gotchas (local, gitignored)
  2. <server>/docs/PLAN.md — check off phase items, note any changed decisions (local, gitignored)
  3. <server>/docs/requirements.md — update if behavior or interfaces changed
  4. <server>/docs/architecture.md — update diagrams/algorithms if implementation changed
  5. .github/copilot-instructions.md — update status markers
  6. This file (CLAUDE.md) — update status table if needed

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.