Music21 Composer MCP
A composition-focused server built on music21 for generative music workflows, enabling melody generation, musical transformations, chord reharmonization, counterpoint creation, and MIDI export through constraint-based algorithmic composition tools.
README
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 8000
API 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 notes
2. 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 tests
Implementation Status
| Tool | Status |
|---|---|
export_midi |
Implemented |
realize_chord |
Phase 2 |
generate_melody |
Phase 2 |
reharmonize |
Phase 3 |
add_voice |
Phase 4 |
transform_phrase |
Phase 5 |
| MCP adapter | Phase 6 |
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.