cyber-band-mcp
# cyber-band-mcp
**An MCP & Multi-Agent Collaborative Cyber Band MIDI Arrangement Engine**
> **English** | [中文文档](README_CN.md)
`cyber-band-mcp` turns AI coding/agent clients (such as Antigravity, Claude Desktop, or Cursor) into a four-piece cyber band—**Drummer**, **Bassist**, **Synth**, and a **Sharp-Tongued Producer**—collaborating via the Model Context Protocol (MCP) to compose, audit, argue, revise, and export multi-track Standard MIDI files with an instant browser-based Piano Roll & Tone.js synthesizer workbench.

---
## Key Features
- **Structured Score JSON Protocol**: Agents never emit raw binary MIDI bytes; all notes are validated through Pydantic v2 (`pitch`, `start_beat`, `duration_beats`, `velocity`) and compiled into Type 1 SMF `.mid` files via `pretty_midi`.
- **Music-Theory & Mix Auditor (`audit_arrangement`)**: Detects low-frequency masking between Bass and Chords/Melody, register overflow, kick-bass pocket alignment, flat velocity dynamics, and out-of-key notes.
- **Band Room Chat (`post_band_chat`)**: Captures the Producer's harsh critiques and musicians' responses directly inside the project state so you can watch the band argue and iterate in real time.
- **Zero-External-Sample Web Workbench (`web_preview/`)**: Pure HTML/CSS/JS + Canvas Piano Roll + native **Tone.js** synthesizers (`MembraneSynth`, `NoiseSynth`, `MetalSynth`, `MonoSynth`, `PolySynth`)—works completely offline without external `.mp3`/`.wav` samples.
---
## 3-Step Quick Start
```bash
# 1. Install dependencies with uv
uv sync
# 2. Run the end-to-end multi-agent demo (generates output/cyberpunk_midnight_drive.mid)
uv run python scripts/run_demo_session.py
# 3. Start the CORS-free local preview server
uv run python scripts/dev_preview.py --open
```
Run unit tests anytime:
```bash
uv run pytest -v
```
---
## Connecting to Antigravity (MCP Configuration)
Add the following server entry to your Antigravity MCP configuration (replace `/path/to/cyber-band-mcp` with your local repository path):
```json
{
"mcpServers": {
"cyber-band-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/cyber-band-mcp",
"run",
"cyber-band-mcp"
]
}
}
}
```
### Exposed MCP Tools
| Tool | Owner | Purpose |
| :--- | :--- | :--- |
| `init_project` | Coordinator / Producer | Initialize BPM, time signature, key signature, and total bars. |
| `write_track_notes` | Drummer / Bassist / Synth | Submit validated structured JSON notes to `drums`, `bass`, `chords`, or `melody`. |
| `audit_arrangement` | Producer | Run quantitative mix, pocket, dynamics, and key-signature checks. |
| `post_band_chat` | All Band Roles | Post Producer feedback, rework orders, or musician replies to the Band Room. |
| `export_midi` | Producer | Compile multi-track `.mid` and `.preview.json` (blocked if audit fails). |
---
## Copy-Paste Prompt: Wake Up the Cyber Band
Paste this prompt into Antigravity after connecting `cyber-band-mcp`:
```text
You are now the Cyber Band Studio! Use the `cyber-band-mcp` tools to collaborate in 4 roles:
1. Producer: Call `init_project` for an 8-bar, 124 BPM, F# minor cyberpunk synthwave track.
2. Drummer, Bassist, and Synth: Each write your own track (`drums`, `bass`, `chords`, `melody`) via `write_track_notes`, and announce your take in `post_band_chat`.
3. Producer: You MUST call `audit_arrangement` first. Post a sharp, constructive critique via `post_band_chat` pointing out any frequency clashes, flat dynamics, or pocket issues, and order the responsible musician(s) to rewrite.
4. Once `audit_arrangement` returns `passed: true`, call `export_midi` and tell me the exported `.mid` path.
```
---
## License
[MIT](LICENSE)
TDQS
Scored across 5 tools
Each tool maps to a distinct stage of the band workflow: init, write notes, audit, chat, and export. There is no practical overlap between arrangement auditing, note writing, and MIDI export.
All names follow a clear verb_noun snake_case pattern: init_project, write_track_notes, audit_arrangement, post_band_chat, export_midi. The convention is predictable and readable.
Five tools is well-scoped for a focused music-production workflow. Each tool covers a necessary step without obvious filler or redundancy.
The core lifecycle is covered: create project, write notes, audit, communicate, and export MIDI. However, there is no explicit read/get operation for project state, track notes, or chat history, which limits inspection workflows.