Local MCP server + Claude Skill that lets Claude compose real music (chords, bass, melody, drums) via musicpy, without hand-writing musicpy's operator syntax.
Project description
leadsheet
Compose real music with Claude, without either of you writing a line of
musicpy. leadsheet installs a local MCP server (built on
musicpy) and a Claude Skill
that together let Claude turn a chord-symbol-based description of a piece
("Am7-Dm7-G7-Cmaj7 progression, lo-fi piano, 85 BPM") into a real MIDI file
and an audio preview, with a musicology cross-check on every chord.
Install
uv tool install leadsheet # recommended
leadsheet setup
or, without uv:
pip install leadsheet
leadsheet setup
leadsheet setup is a required, one-time follow-up step -- pip/wheel
installs have no reliable post-install hook, so this is what actually:
- registers the MCP server with Claude Code globally (
claude mcp add leadsheet -s user) - installs the Skill into
~/.claude/skills/leadsheet/ - checks for
fluidsynth(needed for the audio preview -- MIDI output works either way) and prints an install hint if it's missing - downloads and caches a General MIDI soundfont for rendering
uv tool install is preferred because it keeps leadsheet in a stable,
persistent, isolated environment outside any project venv -- claude mcp add stores an absolute path to the Python interpreter that must keep
working long after this install command finishes, so it shouldn't live in
a venv you might later delete.
Re-run leadsheet setup any time after upgrading (pip install -U leadsheet / uv tool upgrade leadsheet) to refresh the registered server
and the installed skill.
After setup, restart Claude Code and ask it to compose something.
Audio previews (optional but recommended)
Audio rendering needs the fluidsynth binary on PATH:
brew install fluidsynth # macOS
apt-get install fluidsynth # Debian/Ubuntu
Without it, leadsheet still returns a fully valid MIDI file for every
composition -- you just won't get an inline audio preview until
fluidsynth is installed and leadsheet setup is re-run.
Other commands
leadsheet status # what's currently configured
leadsheet uninstall # remove the MCP registration and skill
leadsheet uninstall --purge-cache # also delete the cached soundfont
How it works
- Skill (
~/.claude/skills/leadsheet/SKILL.md): teaches Claude a small, explicit JSON schema built around chord symbols ("Am7","G7sus4") -- not musicpy's@/%/^operator syntax, and not musicpy's own verbose internal JSON. - MCP server (
leadsheet.server, stdio transport, registered locally): exposes four tools --list_capabilities-- valid chord types, GM instruments, drum kits/tokens, event styles, and guardrail limits, computed live from musicpy's own registries.validate-- structural + music-theory validation (cross-checks every chord against musicpy's own chord-type detector), no compiling.compose-- validates, deterministically compiles the schema into a musicpypiece, renders MIDI + an mp3 preview, returns both inline.revise-- applies a small JSON Merge Patch (RFC 7386) to a previous composition and recomposes, cheaper than resending the whole piece.
Everything is local and stateless: no database, no server-side file storage, no network calls except the one-time soundfont download.
Roadmap
v1 (this) is entirely local. A planned v1.1 hosts the same MCP server on Cloudflare and records input/output pairs to disk or an S3-like store (no database) purely so they can be used as future fine-tuning data -- not built yet.
Development
uv sync
uv run pytest
Audio-pipeline tests that need fluidsynth are skipped automatically if
it isn't installed in the dev environment.
License
AGPL-3.0-or-later -- see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file leadsheet-0.1.1.tar.gz.
File metadata
- Download URL: leadsheet-0.1.1.tar.gz
- Upload date:
- Size: 38.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38c79e5ea3f9e787fd2c92b87119280ed3994a8676f7ff4375b2a474e388d4e4
|
|
| MD5 |
00929d012b14caf59e70b4074b4fb804
|
|
| BLAKE2b-256 |
b428f7946f972e2b0dd93feaa8cf2abf2817ae42c39cc3330c8445d75f48d6cc
|
File details
Details for the file leadsheet-0.1.1-py3-none-any.whl.
File metadata
- Download URL: leadsheet-0.1.1-py3-none-any.whl
- Upload date:
- Size: 45.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aee26903642897564f533d11c28bd4e53eae63b301f97c0c96d40a090c8d8a4
|
|
| MD5 |
d9a0eee2ef50724de35f3aebf2c15649
|
|
| BLAKE2b-256 |
ea05501e6be279bffce07eb7068196884ead5fa70fed78ad10f8d6c5563df490
|