musicxml-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
musicxml-mcp
An MCP server that lets an LLM write fully notated instrumental music and export valid MusicXML 4.0.
Instead of asking a model to hand-write raw MusicXML (divisions, <backup>, beam states, accidental bookkeeping, transposition, strict element order), the server gives it a compact JSON music model and compiles that to MusicXML with xmlbuilder2. The output is checked against the official W3C XSD in the test suite.
// one measure of a clarinet part (written in concert pitch; transposed automatically)
{ "notes": [
{ "pitch": "C#5", "dur": "q", "dir": { "dynamics": "p" }, "slur": "start" },
"E5/8", "D5/8",
{ "tuplet": "3:2", "notes": ["C#5/8", "B4/8", "A4/8"] },
{ "pitch": "B4", "dur": "q", "slur": "stop", "articulations": ["tenuto"], "fermata": true }
]}What the server handles for you
Timing: durations like
q.,16,h+8(auto-tied), nested tuplets, grace/cue notes, pickups, whole-measure rests. It computesdivisions,<duration>, and<backup>/<forward>between voices.Spelling: accidentals are computed from the key and earlier notes in the bar (per staff and octave, and ties across barlines don't repeat them). Courtesy, editorial, and microtonal accidentals are supported.
Beaming: notes are beamed by beat, including compound and additive meters (
3+2/8), with hooks for dotted rhythms. Manual beams can override this.Transposition: transposing instruments (Bb/A/Eb/F, octave instruments) get their written pitches and keys, with enharmonic respelling past 7 accidentals.
Numbering: slur, hairpin, 8va, bracket, glissando, and trill-line numbers are assigned automatically. Stem directions for multiple voices are set, and voice/staff numbers are handled.
Checking: the checker reports overfull or underfull voices, ties with no target, unclosed lines, and notes outside an instrument's range. Invalid input gets precise paths and "did you mean" hints.
Related MCP server: MIDI MCP Server
Notation coverage
The typed model covers the notation that MusicXML supports:
Notes: chords, cross-staff notes, noteheads, stems, colors, and hidden notes.
Articulations and ornaments: all articulations, all ornaments (trills with wavy lines, turns, mordents, tremolos), and fermata shapes.
Arpeggios and lines: arpeggios, glissandi, and slides.
String, wind, and guitar technique: bowings, harmonics, fingering, string/fret, hammer-on/pull-off, bends, and so on.
Directions: dynamics, hairpins, tempo and metric modulation, text, rehearsal marks, segno/coda/D.S./Fine, pedals, octave shifts, dashes and brackets, harp pedals, string mutes, principal voice, percussion pictograms, accordion registration, scordatura, and playback
<sound>.Harmony: chord symbols (parsed from
"F#m7b5/C"), Roman numerals, figured bass, and fretboard diagrams ("x32010").Lyrics: multiple verses, automatic syllabic hyphenation, melisma extenders, and elisions.
Structure: time and key signatures (including additive, senza misura, and non-traditional keys), clefs, repeats, voltas, barlines, breaks, multi-measure rests, beat and rhythmic slash notation, and measure-repeat styles.
Percussion and tablature: named drum maps (
"kick,hihat/8") and TAB with automatic string/fret choice.Parts: groups, brackets, and braces.
Escape hatch: for anything else, raw MusicXML fragments (
rawXml,rawNotations) are checked for well-formedness and inserted verbatim.
Tools
Tool | Purpose |
| Parts (instrument presets), time, key, tempo, pickup, groups |
| Score-wide per-measure marks: meter/key changes, tempo, rehearsal, repeats, endings, jumps, breaks |
| Write consecutive measures of one part and get problems back |
| Change single events (a pitch, a dynamic, an articulation) or measure fields without resending the measure |
| Summary, or stored JSON for a measure range |
| Structural editing |
| Score setup |
| Full diagnostics, plus the play order through repeats/endings/D.S./coda, performed length, and extreme-range notes |
| Engraved PNG via Verovio (optionally concert pitch), so the model can see its work |
|
|
| 76 presets with drum maps and tunings, plus the full syntax reference (also exposed as MCP resources) |
| Project management |
Setup
npm installnpm run buildAdd it to Claude Code:
claude mcp add musicxml -- node /absolute/path/to/MusXMLMCP/dist/index.jsOr add it to any MCP client config:
{ "mcpServers": { "musicxml": { "command": "node", "args": ["/absolute/path/to/MusXMLMCP/dist/index.js"] } } }Scores are saved as JSON under ~/.musicxml-mcp/scores (override with MUSICXML_MCP_HOME), so they survive restarts. Exports go to ~/.musicxml-mcp/exports unless you pass a path.
Development
npm testThe tests include XSD validation with the system xmllint against test/schema/musicxml.xsd, plus end-to-end MCP calls.
npx tsx examples/demo.tsThe demo composes a string quartet over stdio and writes examples/out/.
Project layout: src/music (pitch, duration, harmony, instruments), src/model (input schema, store), src/compile (resolve → IR → emit via xmlbuilder2, .mxl zip), src/render (Verovio + resvg), src/tools.ts (MCP tools), src/docs/reference.ts (LLM-facing reference).
Preview caveats: Verovio's MusicXML import hides empty staves, may draw a concert key on transposing staves after a key change, and doesn't draw some marks (dashes, harp pedals, bends). These affect only the preview; the exported MusicXML is unaffected.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Score video, make music as an agent: 100+ AI instruments play your MIDI, audio, stems, Logic/Ableton
Write lyrics in 100+ styles, score them, generate full songs with 4 engines, split stems. OAuth.
Score video as an agent: cue sheet from the cut, 100+ AI instruments play your MIDI, mix to picture
ScoreStarling is an all-in-one AI sheet music assistant. Ask for anything to do with sheet music: transcribe a song from audio, video or a link, read a PDF or photo, add chords, change the key, make it easier, turn it into guitar TAB or jianpu, or arrange it for another instrument. Every change lands on a real score you can hear, fix and download (PDF, MIDI, MusicXML, guitar TAB, jianpu, audio). Hosted remote server with OAuth sign-in. Free accounts get monthly credits and free previews; prices are at scorestarling.com/pricing. Setup: https://scorestarling.com/mcp
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables LLMs to compose and play multi-track MIDI music through natural language prompts. Supports outputting to software or hardware synthesizers for enhanced audio quality.226MIT
- AlicenseAqualityDmaintenanceEnables AI-driven MIDI composition with chord name support, interactive piano-roll preview, and multiple deployment modes.261MIT
- AlicenseBqualityDmaintenanceEnables LLMs to compose music by describing musical intent using high-level operations like notes, chords, dynamics, and tempo, then renders the composition into standard MIDI files.47MIT
- AlicenseNot gradedqualityBmaintenanceEnables an AI assistant to control a live MuseScore Studio 4.6.x score over MCP, adding and reading notes, rests, tuplets and lyrics alongside a notation layer of slurs, dynamics, articulations, hairpins, ties, clefs, key signatures and tempo marks. It also offers a compact passage format that reads and writes whole sections of music with validation and verification, making large scores far cheaper to inspect and edit.MIT