music21-mcp
Click on "Deploy 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-mcpAnalyze the key of bach_prelude.mid"
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 MCP Server
Servidor MCP de análise musical usando music21 + FastMCP + Pydantic.
Complementa o seu MIDI-compostion-tools-MCP focado em construção: enquanto o toolkit constrói composições, este servidor analisa arquivos existentes.
🛠 Tools disponíveis (8)
Tool | O que faz |
| Visão geral: título, compositor, partes, assinaturas, duração |
| Detecta tonalidade (algoritmo Krumhansl-Schmuckler) com confiança |
| Extrai acordes, numerais romanos, cadências, progressão resumida |
| Contorno, âmbito, intervalos, clímax, lista de notas |
| Fórmula de compasso, tempo, densidade, síncope, padrões rítmicos |
| Detecta seções (A, B, A'…), repetições, forma geral (ABA, Rondó…) |
| Erros de voice-leading: quintas paralelas, cruzamentos, saltos |
| Motivos recorrentes e suas transformações (inversão, retrogrado…) |
Related MCP server: musescore-mcp
📦 Instalação
# 1. Clonar / copiar a pasta music21-mcp
cd music21-mcp
# 2. Criar ambiente virtual (recomendado)
python -m venv .venv
source .venv/bin/activate # Linux/macOS
.venv\Scripts\activate # Windows
# 3. Instalar dependências
pip install -r requirements.txt▶️ Executar
python server.pyO servidor roda via stdio — padrão para integração local com Claude Desktop, Cursor, etc.
⚙️ Configuração no Claude Desktop
Adicione ao seu claude_desktop_config.json:
{
"mcpServers": {
"music21": {
"command": "python",
"args": ["/caminho/absoluto/para/music21-mcp/server.py"],
"env": {}
}
}
}Dica: se usar virtualenv, use o Python do venv:
"/caminho/para/music21-mcp/.venv/bin/python"
🔗 Integração com seu MCP Music Toolkit
Pipeline típico:
music21 MCP (analyze_harmony)
→ detecta progressão do arquivo
→ passa para seu toolkit (comp_set_progression)
→ gera variação ou arranjo
music21 MCP (check_counterpoint)
→ aponta erros no MIDI gerado
→ seu toolkit (theory_voice_lead_sequence)
→ corrige o voice leading📁 Estrutura
music21-mcp/
├── server.py # FastMCP — 8 tools registradas
├── models.py # Pydantic schemas input/output
├── requirements.txt
├── analyzers/
│ ├── harmony.py # Acordes + numerais romanos + cadências
│ ├── melody.py # Contorno, âmbito, intervalos
│ ├── rhythm.py # Tempo, densidade, síncope
│ ├── form.py # Seções e forma musical
│ ├── counterpoint.py # Erros de contraponto/voice-leading
│ ├── score_info.py # Metadados e visão geral
│ └── motifs.py # Padrões motívicos recorrentes
└── utils/
└── loader.py # Carregar arquivos + helpers music21💡 Exemplo de uso
# analyze_key
{
"file_path": "/home/user/bach_prelude.mid",
"response_format": "json"
}
# analyze_harmony com recorte de compasses
{
"file_path": "/home/user/sonata.xml",
"measures": [1, 16],
"response_format": "markdown"
}
# analyze_motifs customizado
{
"file_path": "/home/user/symphony.mid",
"motif_length": 5,
"min_occurrences": 3
}This server cannot be deployed
Maintenance
Related MCP Connectors
Deterministic music theory for agents: analyze, voice, reharmonize, conduct — computed, not guessed
Audio features + harmonic set-building for tracks by name/ISRC. Spotify audio-features replacement.
Convert projects between Logic, Ableton, FL Studio and REAPER; generate, separate, transcribe
Write lyrics in 100+ styles, score them, generate full songs with 4 engines, split stems. OAuth.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables AI models to analyze audio files through numerical fingerprints, pitch tracking, and visual spectrograms without requiring direct audio playback. It provides tools for comparing audio iterations and detecting patterns using token-efficient analysis operations.13-
- FlicenseAqualityDmaintenanceEnables Claude AI to convert, edit, and analyze MuseScore files (.mscz, .musicxml, MIDI) through natural language commands, supporting format conversion, transposition, harmony analysis, and more.201-
- AlicenseAqualityDmaintenanceProvides atomic music-theory and MIDI tools for composing, enabling LLMs to chain deterministic steps like scale/chord lookups, degree resolution, rhythm generation, and MIDI rendering.131MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI-assisted MIDI music generation and composition through natural language, supporting style, tempo, key, and instrument selection.MIT