- Home
- MCP servers
- Music21 Composer
Music21 Composer
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You run Music21 Composer MCP to generate, transform, and realize musical ideas programmatically through a dedicated API server. It focuses on composing workflows, enabling constraint-based melody generation, phrase transformations, reharmonization, counterpoint, chord realization, and MIDI export, all from a lightweight HTTP interface.
How to use
Start the MCP HTTP server to expose a stable API you can call from your music tooling or custom clients.
Your typical workflow is to start the server, then use the exposed endpoints to generate melodies, apply transformations, reharmonize progressions, add voices, realize chords, and export MIDI. You can initiate HTTP requests to the server’s endpoints and supply musical data in supported formats to obtain the desired output.
How to install
Prerequisites you need on your system: Python 3.8+ and a working Python package manager.
Clone and install the MCP package with development dependencies enabled.
git clone <repo-url>
cd music21-composer-mcp
pip install -e ".[dev]"
Run the server and use the API
Launch the HTTP server on a port of your choice. The server binds to an HTTP endpoint you can reach from clients.
composer-mcp --mode http --port 8000
Interact with the API
Once the server is running, you can send requests to perform music generation and export tasks. For example, export a MIDI file based on a simple note sequence.
POST http://localhost:8000/export_midi
Content-Type: application/json
{"stream": "C4, D4, E4, G4", "tempo": 120}
Available tools
generate_melody
Constraint-based melody generation to produce melodies that satisfy given musical constraints.
transform_phrase
Apply musical transformations such as sequence, inversion, retrograde, and other phrase-level edits.
reharmonize
Generate alternative chord progressions to explore harmonic options.
add_voice
Counterpoint and voice generation to create multiple independent lines.
realize_chord
Convert chord symbols into voiced piano/ensemble arrangements.
export_midi
Export generated music to the MIDI format for playback and further processing.