Filopastry
Enables AI-powered live coding music generation through Strudel.cc, a web-based environment inspired by TidalCycles, providing tools for pattern generation, music theory operations, audio analysis, and real-time performance across multiple genres including techno, house, drum & bass, ambient, and jazz.
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., "@Filopastry generate a techno pattern with a driving bassline"
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.
Filopastry
AI-powered live coding music generation through Strudel.cc
An MCP (Model Context Protocol) server that enables AI agents to generate, manipulate, and perform algorithmic music using Strudel.cc — a web-based live coding environment inspired by TidalCycles.
Overview
Filopastry bridges the gap between AI and live-coded music. It provides 46+ tools for pattern generation, music theory operations, audio analysis, and AI-powered composition — all accessible through the Model Context Protocol.
The server automates a headless Chromium browser running Strudel.cc, allowing AI agents to write patterns, control playback, analyze audio in real-time, and generate music across multiple genres.
Key Capabilities
Pattern Generation: Create complete tracks in techno, house, drum & bass, ambient, trap, jungle, jazz, and experimental styles
Music Theory Engine: Generate scales, chord progressions, Euclidean rhythms, and polyrhythms
Real-time Audio Analysis: FFT spectrum analysis, tempo detection, key detection
AI Integration: Natural language pattern generation via DeepSeek API (optional)
Session Management: Save, load, and organize patterns with tags
Undo/Redo: Full editing history for pattern manipulation
Related MCP server: Strudel MCP Server
Prerequisites
Node.js 18.0.0 or higher
npm 9.0.0 or higher
Chromium (installed automatically by Playwright)
Installation
# Clone the repository
git clone https://github.com/youwenshao/filopastry.git
cd filopastry
# Install dependencies
npm install
# Install Playwright browsers
npx playwright install chromium
# Build the project
npm run buildConfiguration
config.json
The server reads configuration from config.json in the project root:
{
"headless": false,
"strudel_url": "https://strudel.cc/",
"patterns_dir": "./patterns",
"audio_analysis": {
"fft_size": 2048,
"smoothing": 0.8
},
"deepseek": {
"model": "deepseek-chat",
"max_tokens": 2048,
"temperature": 0.7,
"base_url": "https://api.deepseek.com"
}
}Option | Description | Default |
| Run browser without GUI (set |
|
| Strudel.cc instance URL |
|
| Directory for saved patterns |
|
| FFT window size for audio analysis |
|
| Spectrum smoothing factor (0-1) |
|
DeepSeek API (Optional)
For AI-powered pattern generation, set the DEEPSEEK_API_KEY environment variable:
export DEEPSEEK_API_KEY="your-api-key-here"Get an API key from the DeepSeek Platform.
When the API key is not configured, AI tools fall back to static pattern generation using the built-in PatternGenerator.
Usage
Running the MCP Server
# Start the server
npm start
# Or run in development mode with hot reload
npm run devValidating the Server
Test that the MCP protocol is working:
npm run validateThis sends a tools/list request and displays the available tools.
Integration with Cursor IDE
Add Filopastry to your Cursor MCP configuration:
macOS/Linux: ~/.cursor/mcp.json
Windows: %APPDATA%\Cursor\mcp.json
{
"mcpServers": {
"filopastry": {
"command": "node",
"args": ["/path/to/filopastry/dist/index.js"],
"env": {
"DEEPSEEK_API_KEY": "your-api-key-here"
}
}
}
}Restart Cursor after updating the configuration.
Tool Reference
Filopastry provides 46+ tools organized into categories:
Core Control (10 tools)
Tool | Description |
| Initialize Strudel in browser |
| Write pattern to editor |
| Append code to current pattern |
| Insert code at specific line |
| Replace pattern section |
| Start playing pattern |
| Pause playback |
| Stop playback |
| Clear the editor |
| Get current pattern code |
Pattern Generation (10 tools)
Tool | Description |
| Generate complete pattern from style (techno, house, dnb, ambient, trap, jungle, jazz) |
| Generate drum pattern |
| Generate bassline |
| Generate melody from scale |
| Generate scale notes |
| Generate chord progression |
| Generate Euclidean rhythm |
| Generate polyrhythm |
| Generate drum fill |
| Create pattern variations |
Pattern Manipulation (6 tools)
Tool | Description |
| Transpose notes by semitones |
| Reverse pattern |
| Time stretch pattern |
| Quantize to grid |
| Add human timing variation |
| Apply scale to notes |
Effects & Processing (5 tools)
Tool | Description |
| Add effect to pattern |
| Remove effect |
| Set BPM |
| Add swing to pattern |
| Validate pattern with runtime error checking |
Audio Analysis (5 tools)
Tool | Description |
| Complete audio analysis |
| FFT spectrum analysis |
| Rhythm analysis |
| BPM detection |
| Key detection |
Session Management (5 tools)
Tool | Description |
| Save pattern with metadata |
| Load saved pattern |
| List saved patterns |
| Undo last action |
| Redo action |
AI-Powered Tools (7 tools)
Requires DEEPSEEK_API_KEY environment variable for full functionality.
Tool | Description |
| Generate pattern from natural language description |
| Enhance or modify current pattern |
| Get explanation of what current pattern does |
| Get style detection, complexity assessment, suggestions |
| Generate AI-suggested variations |
| Check if DeepSeek AI is configured |
| Test DeepSeek API connection |
Performance Monitoring (2 tools)
Tool | Description |
| Get performance metrics and bottlenecks |
| Get current memory usage statistics |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ MCP Protocol Layer │
│ EnhancedMCPServerFixed (46+ tools) │
└─────────────────────────────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
▼ ▼ ▼
┌───────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ MusicTheory │ │PatternGenerator │ │ DeepSeekService │
│ (scales, │ │ (genres, drums │ │ (AI patterns, │
│ chords) │ │ bass, melody) │ │ enhancement) │
└───────────────┘ └─────────────────┘ └─────────────────┘
│
┌─────────────────────┼─────────────────────┐
▼ ▼ ▼
┌───────────────┐ ┌─────────────────┐ ┌─────────────────┐
│StrudelController│ │ AudioAnalyzer │ │ PatternStore │
│ (Playwright, │ │ (FFT, tempo, │ │ (JSON storage, │
│ browser) │ │ key detect) │ │ tags, cache) │
└───────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Strudel.cc │
│ (Web Audio, Live Coding) │
└─────────────────────────────────────────────────────────────┘Component Overview
Component | Purpose |
EnhancedMCPServerFixed | MCP protocol handling, tool registration and routing |
StrudelController | Browser automation via Playwright, editor manipulation |
AudioAnalyzer | Real-time FFT analysis, tempo/key detection algorithms |
MusicTheory | Scale generation, chord progressions, music theory calculations |
PatternGenerator | Genre-specific pattern generation, Euclidean rhythms |
DeepSeekService | AI integration for natural language pattern generation |
PatternStore | JSON-based pattern persistence with tagging |
Troubleshooting
Browser won't launch
# Install Playwright browsers
npx playwright install chromiumBuild fails
# Clean and rebuild
npm run clean
npm run build"Browser not initialized" errors
Always run the init tool before using browser-dependent tools:
Use the init tool first, then generate_pattern, then play.Audio analysis not working
Ensure audio is actually playing (
playtool)Wait a moment for the audio context to connect
Try
analyzetool to verify connection
DeepSeek API errors
Verify API key is set: check
ai_statustool outputTest connection: use
ai_test_connectiontoolCheck API key validity at DeepSeek Platform
Pattern validation errors
The server includes safety checks for dangerous patterns (extreme gain values, eval blocks). Use validate_pattern_runtime to test patterns before playing.
Performance issues
Use performance_report to identify bottlenecks. Common optimizations:
Set
headless: truein config.json for faster operationPatterns are cached with 100ms TTL to reduce browser calls
Example Patterns
The patterns/examples/ directory contains genre-specific pattern templates:
patterns/examples/
├── ambient/
│ ├── dark-ambient.json
│ └── drone.json
├── dnb/
│ ├── liquid-dnb.json
│ └── neurofunk.json
├── house/
│ ├── deep-house.json
│ └── tech-house.json
├── jazz/
│ ├── bebop.json
│ └── modal-jazz.json
├── jungle/
│ ├── classic-jungle.json
│ └── ragga-jungle.json
├── techno/
│ ├── hard-techno.json
│ └── minimal-techno.json
└── trap/
├── cloud-trap.json
└── modern-trap.jsonPerformance
Operation | Typical Latency |
Browser initialization | 1.5-2s |
Pattern write | 50-80ms |
Pattern read (cached) | 10-15ms |
Play/Stop | 100-150ms |
Audio analysis | 10-15ms |
Tempo detection | <100ms |
Key detection | <100ms |
AI pattern generation | 2-5s (network dependent) |
Author
Youwen Shao
GitHub: @youwenshao
Email: youwenshao@gmail.com
Acknowledgments
Strudel.cc — The live coding music platform that makes this possible
TidalCycles — The inspiration behind Strudel's pattern language
Model Context Protocol — The protocol enabling AI agent integration
DeepSeek — AI capabilities for natural language pattern generation
Available Tools
50 toolsadd_effectC
Add effect to pattern
Inputs: effect (required), params.
add_swingC
Add swing to pattern
Inputs: amount (required).
ai_analyze_patternB
Get AI analysis of the pattern including style detection, complexity assessment, and improvement suggestions
Inputs: no named parameters.
ai_enhance_patternC
Enhance or modify the current pattern using AI suggestions
Inputs: enhancement_type (required), target_style, intensity.
ai_explain_patternB
Get an AI-generated explanation of what the current pattern does
Inputs: no named parameters.
ai_generate_patternC
Generate a Strudel pattern from natural language description using DeepSeek AI
Inputs: prompt (required), style, key, bpm.
ai_statusB
Check if DeepSeek AI features are available and configured
Inputs: no named parameters.
ai_suggest_variationsC
Generate AI-suggested variations of the current pattern
Inputs: count.
ai_test_connectionA
Test DeepSeek API connection with a simple request to diagnose connection issues
Inputs: no named parameters.
analyzeD
Complete audio analysis
Inputs: no named parameters.
analyze_rhythmD
Rhythm analysis
Inputs: no named parameters.
analyze_spectrumA
FFT spectrum analysis
Inputs: no named parameters.
appendC
Append code to current pattern
Inputs: code (required).
apply_scaleC
Apply scale to notes
Inputs: scale (required), root (required).
clearC
Clear the editor
Inputs: no named parameters.
detect_keyC
Key detection
Inputs: no named parameters.
detect_tempoC
BPM detection
Inputs: no named parameters.
generate_basslineD
Generate bassline
Inputs: key (required), style (required).
generate_chord_progressionD
Generate chord progression
Inputs: key (required), style (required).
generate_drumsC
Generate drum pattern
Inputs: style (required), complexity.
generate_euclideanC
Generate Euclidean rhythm
Inputs: hits (required), steps (required), sound.
generate_fillC
Generate drum fill
Inputs: style (required), bars.
generate_melodyC
Generate melody from scale
Inputs: scale (required), root (required), length.
generate_patternC
Generate complete pattern from style
Inputs: style (required), key, bpm.
generate_polyrhythmD
Generate polyrhythm
Inputs: sounds (required), patterns (required).
generate_scaleC
Generate scale notes
Inputs: root (required), scale (required).
generate_variationC
Create pattern variations
Inputs: type.
get_patternA
Get current pattern code
Inputs: no named parameters.
humanizeB
Add human timing variation
Inputs: amount.
initB
Initialize Strudel in browser
Inputs: no named parameters.
insertC
Insert code at specific line
Inputs: position (required), code (required).
listC
List saved patterns
Inputs: tag.
loadC
Load saved pattern
Inputs: name (required).
memory_usageA
Get current memory usage statistics
Inputs: no named parameters.
pauseA
Pause playback
Inputs: no named parameters.
performance_reportB
Get performance metrics and bottlenecks
Inputs: no named parameters.
playC
Start playing pattern
Inputs: no named parameters.
quantizeC
Quantize to grid
Inputs: grid (required).
redoC
Redo action
Inputs: no named parameters.
remove_effectC
Remove effect
Inputs: effect (required).
replaceC
Replace pattern section
Inputs: search (required), replace (required).
reverseB
Reverse pattern
Inputs: no named parameters.
saveC
Save pattern with metadata
Inputs: name (required), tags.
set_tempoC
Set BPM
Inputs: bpm (required).
stopC
Stop playback
Inputs: no named parameters.
stretchD
Time stretch pattern
Inputs: factor (required).
transposeC
Transpose notes by semitones
Inputs: semitones (required).
undoB
Undo last action
Inputs: no named parameters.
validate_pattern_runtimeB
Validate pattern with runtime error checking (monitors Strudel console for errors)
Inputs: pattern (required), waitMs.
writeC
Write pattern to editor
Inputs: pattern (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 50 tools
Multiple tools have overlapping or unclear boundaries, such as 'analyze' (complete audio analysis) vs. 'analyze_rhythm' and 'analyze_spectrum' (more specific analyses), 'generate_pattern' (complete pattern from style) vs. 'ai_generate_pattern' (pattern from natural language), and 'append', 'insert', 'replace', and 'write' all manipulating pattern code with ambiguous distinctions. This overlap increases the risk of agent misselection.
Most tools follow a consistent verb_noun or verb-only snake_case pattern, such as 'add_effect', 'analyze_rhythm', 'generate_melody', and 'set_tempo'. However, there are minor deviations like 'ai_status' (noun_verb) and 'init' (abbreviated verb), which slightly break the consistency but do not severely impact readability.
With 50 tools, this server is overloaded for a Strudel pattern generation and editing domain. Many tools could be consolidated or omitted without losing functionality, such as the multiple AI-related tools or redundant analysis functions. This high count likely overwhelms agents and complicates tool selection.
The tool set provides comprehensive coverage for Strudel pattern manipulation, including creation (e.g., 'generate_pattern', 'ai_generate_pattern'), editing (e.g., 'append', 'transpose'), analysis (e.g., 'analyze', 'detect_tempo'), playback control (e.g., 'play', 'pause'), and utility functions (e.g., 'save', 'undo'). There are no obvious gaps that would hinder agent workflows in this domain.
Related MCP Connectors
Autonomous music production for AI agents with MIDI generation, QC and provenance.
Score video, make music as an agent: 100+ AI instruments play your MIDI, audio, stems, Logic/Ableton
ABC sheet music + Strudel live coding: songs, videos and live jam sessions in ext-apps widgets.
Browser DAW for AI assistants: build multitrack songs with MIDI, effects, stems and generation.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables AI-powered music generation and live coding by providing direct control over Strudel.cc through browser automation. Supports pattern creation, audio analysis, and pattern storage for TidalCycles/Strudel music patterns.2875 npm249AGPL 3.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to work with Strudel live coding patterns for music creation, including parsing mini notation, generating rhythmic patterns, accessing music theory (scales/chords), and applying pattern transformations.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to generate MIDI clips from natural language descriptions and export them for import into digital audio workstations. Wraps Scribbletune to provide music composition tools for creating riffs, chords, and arpeggios with scale-aware progressions, rhythmic patterns, and genre-specific parameters.MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to interact with Strudel, a JavaScript live coding music environment, by executing patterns, retrieving states, and accessing documentation.2AGPL 3.0