Music21 Composer MCP
Enables generation and export of musical compositions to MIDI format, including melody generation, musical transformations, chord realization, and voice addition using the music21 library.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Music21 Composer MCPgenerate a melody in C major with 8 measures"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Music21 Composer MCP
A composition-focused MCP server built on music21, designed for generative workflows.
Features
generate_melody - Constraint-based melody generation
transform_phrase - Musical transformations (sequence, inversion, retrograde, etc.)
reharmonize - Generate alternative chord progressions
add_voice - Counterpoint and voice generation
realize_chord - Chord symbol to voicing
export_midi - Export to MIDI format
Installation
# Clone the repository
git clone <repo-url>
cd music21-composer-mcp
# Install with dev dependencies
pip install -e ".[dev]"Quick Start
Start the HTTP server
composer-mcp --mode http --port 8000API Usage
# Export notes to MIDI
curl -X POST http://localhost:8000/export_midi \
-H "Content-Type: application/json" \
-d '{"stream": "C4, D4, E4, G4", "tempo": 120}'API Documentation
With the server running, visit http://localhost:8000/docs for interactive API documentation.
Input Formats
The API accepts three input formats:
1. Note List (simplest)
C4, D4, E4, G4 # Quarter notes (default)
C4:h, D4:q, E4:e # With durations (h=half, q=quarter, e=eighth)
C#4:qd, Bb3:h # Accidentals and dotted notes2. ABC Notation
X:1
M:4/4
K:C
CDEF|GABc|3. MusicXML
Standard MusicXML format.
Development
# Run tests
pytest
# Run with coverage
pytest --cov=composer_mcp
# Format code
black src tests
ruff check src testsImplementation Status
Tool | Status |
| Implemented |
| Phase 2 |
| Phase 2 |
| Phase 3 |
| Phase 4 |
| Phase 5 |
MCP adapter | Phase 6 |
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/viktorkelemen/music21-composer-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server