Skip to content

About

MCP server that lets an AI assistant analyze, edit, master, mix and compose audio and MIDI through libsonare

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

libsonare-mcp

CI License Python Platform

libsonare-mcp is an MCP server for analyzing, editing, mastering, mixing and composing audio and MIDI with an AI assistant. Its 34 tools process files locally with libsonare and use libcantus for music theory. It returns measurements, text and images in the client and writes audio or MIDI files for playback and editing.

📖 Documentation  ·  Getting started  ·  Tool reference

Install the alpha from a source checkout with libsonare 2.x and libcantus from PyPI. Tool names, arguments and the project file format may change between releases.

What it does

  • Analysis — BPM with alternatives, beats, meter, key candidates, chords with bar and beat, sections, melody, pitch and intonation. Tools and how to choose
  • Loudness and diagnosis — LUFS, true peak, LRA, streaming-platform previews, and detection of clipping, clicks, hum, noise and band limits. Tools and how to choose
  • Conversion and editing — WAV, FLAC, Ogg, Opus, MP3, AIFF and M4A; trim, cut, fade, normalize, pitch shift, time stretch, split. Audio formats
  • Effects, mastering and repair — processor chains from the catalog, mastering to a LUFS target, platform or reference, denoise, declick and dehum. Tools and how to choose
  • Seeing and hearing — spectrograms, chroma, piano rolls and other PNGs for the agent; playback on the local speakers for the person. Tool reference
  • MIDI and projects — read, write, transpose, quantize, humanize, transcribe from audio, arrange tracks and clips in a project file, mix them with a mixer scene, render with General MIDI, synth presets or a SoundFont. Project files
  • Theory and generation — key and Roman-numeral analysis, cadences, part-writing and playability checks, and seeded generation of progressions, bass, drums and melodies. Tools and how to choose
  • Safe file handling — outputs are new, atomically written files; nothing is overwritten without overwrite: true, and dry_run shows the plan first. Files and the output directory

Installation

Use Python 3.11 or later on macOS 26 or later (Apple silicon) or Linux (x86-64 or arm64 with glibc 2.27 or later). Install the server from a checkout. pip installs libsonare 2.x and libcantus from PyPI.

git clone https://github.com/libraz/libsonare-mcp && cd libsonare-mcp
python -m venv .venv && .venv/bin/pip install .
.venv/bin/python -m libsonare_mcp init     # register with Claude Code, Claude Desktop and Codex

init writes the absolute path of .venv/bin/python with -m libsonare_mcp into every client configuration it finds; --client claude-code|claude-desktop|codex picks one, and uninstall removes the entry. To run the stdio server without a checkout, use uvx --from git+https://github.com/libraz/libsonare-mcp libsonare-mcp. Optional: ffmpeg on PATH reads M4A, AAC and other formats and writes M4A.

Getting started

Restart the client and ask in plain words:

Ask Tool
"What tempo and key is ~/Music/song.wav?" audio_analyze
"Is it ready for Spotify?" audio_loudness
"Master it to −14 LUFS with a −1 dBTP ceiling." audio_master
"Convert it to MP3 and fade out the last 3 seconds." audio_edit
"Show me a spectrogram of the chorus." audio_visualize
"Make an 8-bar backing in A minor and play it." midi_compose, project_render, audio_play

Written files land in ./sonare-out/ under the client's working directory, or in $SONARE_MCP_OUTPUT_DIR; SONARE_MCP_MAX_SECONDS and the other limits are in Configuration. → Getting started

Build from source

Development uses uv; uv sync installs the server with libsonare and libcantus from PyPI.

make format         # ruff format and safe lint fixes
make lint           # ruff check and pyright
make test           # pytest
make docs           # regenerate the tool reference from the tool definitions
make ci             # format-check, lint, test and docs-check

The environment variables that change limits and the output directory are listed in Configuration.

Documentation

The guides are available in English and Japanese, with a generated tool reference in English.

Non-goals

The server measures, edits and generates; it does not judge mood or genre, separate vocals or instruments with learned models, align lyrics, synthesize speech or singing, keep real-time sessions open, hold a DAW session between calls, read or write notation (MusicXML, ABC, LilyPond), handle MP3 ID3 tags or cover art, or fetch audio from URLs. audio_device refuses every operation with an explanation until libsonare has a device backend. See the Introduction for the reasons.

License

MIT

About

MCP server that lets an AI assistant analyze, edit, master, mix and compose audio and MIDI through libsonare

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages