music21-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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
}Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
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 MusicXML, MIDI, ABC, MEI and Humdrum, print sheet music, and verify every note survived.
Autonomous music production for AI agents with MIDI generation, QC and provenance.
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.14-
- 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-
- AlicenseAqualityBmaintenanceProvides 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 gradedqualityDmaintenanceExposes 16 music21 MIDI analysis and editing tools to AI agents, enabling them to read, edit, generate, and analyze MIDI files through natural language.MIT