TidalCycles MCP Server
Enables conversational live coding with Claude AI and TidalCycles, allowing users to create and manipulate algorithmic music patterns through natural language.
README
π TidalCycles MCP Server
Conversational live coding with Claude AI + TidalCycles
This MCP (Model Context Protocol) server enables Claude to control TidalCycles through natural conversation, creating a powerful AI-assisted live coding experience for algorithmic music composition.
β¨ Features
- π΅ Evaluate TidalCycles patterns through conversational AI
- π State awareness - Claude knows what's currently playing
- π°οΈ Pattern history - Track and recall previous patterns
- ποΈ Channel management - Solo, silence, or hush specific channels
- π¬ Natural conversation - Talk to Claude about your music in plain English
- π Real-time feedback - Immediate pattern evaluation
- π Dual transport modes: stdio for Claude Desktop + WebSocket for external clients
- π Network accessible - Web UIs and remote clients can connect via WebSocket
- π Auto-recovery - Robust GHCi process management with automatic reconnection
π Prerequisites
Before installing, ensure you have:
-
TidalCycles - Install from tidalcycles.org
- Includes GHCi (Glasgow Haskell Compiler Interactive)
- Haskell Stack or Cabal
-
SuperCollider + SuperDirt - Required for audio output
- Download from supercollider.github.io
- Install SuperDirt: In SuperCollider, run
Quarks.install("SuperDirt") - Install samples:
Quarks.install("Dirt-Samples")
-
Claude Desktop - Get from claude.ai
-
Node.js 18+ - For running the MCP server
- Download from nodejs.org
- Verify:
node --version
π Quick Start
1. Installation
# Clone the repository
git clone https://github.com/yourusername/tidal-mcp-server.git
cd tidal-mcp-server
# Install dependencies
npm install
# Build the server
npm run build
2. Start SuperCollider
Open SuperCollider and run:
// Start SuperDirt
SuperDirt.start;
// Verify it's listening
// Should see: "SuperDirt: listening to Tidal on port 57120"
3. Configure Claude Desktop
Add this to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
File-based Mode (Recommended for stability):
{
"mcpServers": {
"tidal": {
"command": "node",
"args": [
"/absolute/path/to/tidal-mcp-server/dist/index.js"
],
"env": {
"TIDAL_FILE": "/absolute/path/to/tidal-mcp-server/tidal-mcp-output.tidal"
}
}
}
}
Direct GHCi Mode (Experimental - no restarts):
{
"mcpServers": {
"tidal": {
"command": "node",
"args": [
"/absolute/path/to/tidal-mcp-server/dist/index.js"
],
"env": {
"TIDAL_FILE": "/absolute/path/to/tidal-mcp-server/tidal-mcp-output.tidal",
"TIDAL_USE_GHCI": "true",
"TIDAL_BOOT_PATH": "/absolute/path/to/tidal-mcp-server/BootTidal.hs",
"GHCI_PATH": "/usr/local/bin/ghci"
}
}
}
}
Finding your ghci path:
which ghci
# Use this path for GHCI_PATH
Replace /absolute/path/to/ with the actual path to your installation.
4. File Watching Setup (File-based mode only)
For file-based mode, you need to watch the output file and evaluate it in TidalCycles:
Option A: Using watchexec (recommended)
# Install watchexec
brew install watchexec # macOS
# or
cargo install watchexec-cli # Any OS with Rust
# Watch and auto-reload patterns
cd /path/to/tidal-mcp-server
watchexec --restart -w tidal-mcp-output.tidal \
"ghci -ghci-script BootTidal.hs -ghci-script tidal-mcp-output.tidal"
Option B: Using your editor
Open tidal-mcp-output.tidal in your preferred editor with TidalCycles support and manually evaluate patterns when Claude writes them.
5. Start Using
- Restart Claude Desktop to load the MCP server
- Start a new conversation
- Make music!
You: Create a funky drum pattern
Claude: [calls tidal_eval]
I'll create a syncopated funk groove:
d1 $ sound "bd ~ bd ~ bd ~ ~ ~"
You: Add a bassline
Claude: [calls tidal_eval on d2]
Added a groovy bassline:
d2 $ sound "bass2*8" # n "0 3 5 7"
πΉ Usage Examples
Basic Patterns
You: Play a simple drum beat
You: Make it faster
You: Add some hi-hats
You: What's playing right now?
Advanced Composition
You: Create a glitchy breakbeat with euclidean rhythms
You: Add a wobbling bassline with filter sweeps
You: Layer some atmospheric pads over the top
You: Make the whole thing more sparse
Live Performance
You: Solo channel d2
You: Bring back everything
You: Hush
You: Show me the last 5 patterns I evaluated
π οΈ Available Tools
The MCP server exposes these tools to Claude:
tidal_eval
Evaluate a TidalCycles pattern on a specific channel (d1-d9).
Parameters:
channel: String (d1-d9)pattern: String (TidalCycles code without thed1 $prefix)
Example:
{
"channel": "d1",
"pattern": "sound \"bd sd bd sd\" # gain \"1.2\""
}
tidal_hush
Stop all currently playing patterns immediately.
tidal_silence
Stop a specific channel gracefully.
Parameters:
channel: String (d1-d9)
tidal_get_state
Get current state of all channels - what's playing and when it started.
tidal_solo
Solo a specific channel, muting all others.
Parameters:
channel: String (d1-d9)
tidal_unsolo
Restore all channels after soloing.
tidal_get_history
Get pattern history from the current session.
Parameters:
limit: Number (optional, default: 10)
π Project Structure
tidal-mcp-server/
βββ src/
β βββ index.ts # Main MCP server implementation
β βββ websocket-transport.ts # WebSocket transport layer
βββ dist/ # Compiled JavaScript output
βββ BootTidal.hs # TidalCycles initialization
βββ tidal-mcp-output.tidal # Generated pattern output file
βββ start-websocket.sh # WebSocket server startup script
βββ test-websocket-client.js # WebSocket connection test
βββ examples.tidal # Example patterns
βββ WEBSOCKET-USAGE.md # WebSocket setup and usage guide
βββ package.json # Node.js dependencies
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
βββ QUICKSTART.md # Quick reference guide
βββ CONTRIBUTING.md # Contribution guidelines
βββ LICENSE # MIT License
π¨ Use Cases
Live Performance
- Generate patterns on the fly during algoraves
- Quick iterations and experimentation
- Emergency pattern generation when stuck
- AI-assisted improvisation
Learning & Exploration
- Ask Claude to explain TidalCycles concepts
- Generate example patterns for specific techniques
- Explore new rhythmic and harmonic ideas
- Learn by conversation
Composition
- Rapid prototyping of musical ideas
- Generate pattern variations
- Collaborative composition with AI
- Build complex layered arrangements
π§ Architecture
βββββββββββ ββββββββββββββββ ββββββββββββββββ
β Claude β ββMCPββΊ β MCP Server β βββββββΊ β TidalCycles β
β AI β β (Node.js) β β (GHCi) β
βββββββββββ ββββββββββββββββ ββββββββββββββββ
β β
β (File mode) β
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β .tidal file β β SuperColliderβ
β (watch) β β SuperDirt β
ββββββββββββββββ ββββββββββββββββ
Flow:
- You talk to Claude in natural language
- Claude uses MCP tools to generate Tidal code
- MCP server either:
- File mode: Writes code to
.tidalfile β File watcher evaluates it - Direct mode: Sends directly to running GHCi process
- File mode: Writes code to
- TidalCycles/GHCi sends OSC messages to SuperDirt
- SuperCollider/SuperDirt plays the audio
π Troubleshooting
"MCP server not connecting"
- Check the path in
claude_desktop_config.jsonis absolute - Restart Claude Desktop after config changes
- Check Node.js version:
node --version(need 18+) - Check MCP server logs in Claude Desktop
"Patterns not playing" (File mode)
- Ensure SuperCollider is running:
SuperDirt.start - Verify file watcher (watchexec) is running
- Check the TIDAL_FILE path is correct
- Try manually evaluating the file in your editor
"Patterns not playing" (Direct GHCi mode)
- Check ghci is in PATH:
which ghci - Verify GHCI_PATH in config matches
which ghci - Check MCP server logs for "GHCi/TidalCycles started and connected"
- Ensure only one GHCi instance is running
"spawn ghci ENOENT"
- GHCi not found in PATH
- Set GHCI_PATH environment variable with full path
- On macOS with ghcup: usually
/Users/username/.ghcup/bin/ghci
"No samples found" / Empty sound library
- Install Dirt-Samples in SuperCollider:
Quarks.install("Dirt-Samples"); // Recompile (Cmd+K) SuperDirt.start; - Verify:
~dirt.soundLibrary.buffers.keys.do({|x| x.postln});
"Late" messages in SuperCollider
- Normal at fast tempos (jungle/DnB)
- If severe (>1 second), restart SuperDirt
- Check system audio settings
- Reduce pattern complexity
Music continues after stopping MCP server
- Patterns run in SuperCollider, independent of MCP server
- Stop in SuperCollider:
s.freeAll; - Or in any GHCi/Tidal session:
hush - Kill all ghci processes:
pkill -9 ghci
π§ Known Limitations
- File mode: Restarts GHCi on every change (causes brief audio dropout)
- Direct GHCi mode: Experimental, may have edge cases
- No visual feedback: Pattern changes aren't visible in editor (file mode)
- Single instance: Can't run multiple MCP servers simultaneously
- No undo: Pattern changes are immediate and can't be undone
πΊοΈ Roadmap
β Completed Features
- Direct GHCi integration - Real-time pattern evaluation without file watching
- WebSocket transport - Network-accessible server for web UIs and collaboration
- Robust error handling - GHCi process recovery and connection monitoring
- Session logging - Complete pattern history with timestamps
π Next Up (Priority Features)
-
MIDI Controller Input - Physical knobs/faders control Tidal parameters
- MIDI learn mode for easy mapping
- Support for popular controllers (Push, Launchpad, etc.)
- Macro controls for complex parameter automation
-
Pattern Version Control - Git-like history for your patterns
- Undo/redo system with branching
- Save/restore snapshots
- Compare pattern versions
-
Browser-based UI - Real-time pattern visualization
- Live waveform display
- Channel timeline view
- WebSocket integration for multiple UIs
π Advanced Features
-
Real-time Audio Analysis - AI gets audio feedback
- Frequency analysis to inform pattern choices
- Beat detection for tempo sync
- Amplitude monitoring for mix balance
-
AI Pattern Suggestions - Context-aware recommendations
- ML-based pattern generation
- Style-specific suggestions (techno, ambient, breaks)
- Automatic complementary pattern creation
-
Multi-user Collaboration - Live coding sessions
- Multiple users control different channels
- Turn-based jamming modes
- Shared pattern library
π¨ Creative Integrations
-
Hydra Visual Integration - Reactive visuals
- Auto-generate visuals from audio patterns
- Synchronized visual effects with beat events
- Live visual coding alongside audio
-
DAW Integration - Professional workflow
- MIDI output to hardware synths
- Audio recording of Tidal sessions
- Timeline sync with Ableton Live/Logic
-
AI Composition Tools - Advanced creativity
- Generate full track structures
- Style transfer between genres
- Harmony analysis and suggestions
π€ Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Quick start for contributors:
# Clone and setup
git clone https://github.com/yourusername/tidal-mcp-server.git
cd tidal-mcp-server
npm install
# Development mode (with auto-rebuild)
npm run dev
# Run tests
npm test
# Build for production
npm run build
π Resources
- TidalCycles Documentation
- Model Context Protocol
- SuperCollider Documentation
- Algorave Community
- TOPLAP - Live Coding
π License
MIT License - see LICENSE file for details.
π Acknowledgments
- Alex McLean (yaxu) for creating TidalCycles
- The TOPLAP and algorave communities for live coding culture
- Anthropic for the Model Context Protocol and Claude
- Everyone who live codes and makes weird music with computers
π Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- TidalCycles Community: Discord
Made with π for the live coding community
Go forth and make some algorithmic noise!
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.