freshcrate
Home > MCP Servers > live-coding-music-mcp

live-coding-music-mcp

A Model Context Protocol (MCP) server that gives Claude direct control over Strudel.cc for AI-assisted music generation and live coding.

Description

A Model Context Protocol (MCP) server that gives Claude direct control over Strudel.cc for AI-assisted music generation and live coding.

README

live-coding-music-mcp

🎡 MCP server for AI-assisted live-coding music via strudel.cc

Unofficial fan project. Not affiliated with, or endorsed by, the Strudel project. This adapter exists to make live-coding music accessible to beginners who want to try pattern-based music without learning the whole ecosystem first.

Status: Beta | 77% test coverage | Published to npm | Actively developed

live-coding-music-mcp server

CI npm version Nerq Trust Tools License

A Model Context Protocol (MCP) server that drives Strudel.cc from Claude for AI-assisted live-coding music, pattern generation, and algorithmic composition.

Current State: Beta. The core workflow (init β†’ generate β†’ write β†’ play β†’ analyze) works reliably with real audio output and has 1470 passing tests covering 77% of statements. CI is hardened with OpenSSF Scorecard, SHA-pinned actions, CODEOWNERS, and Dependabot. Known coverage gaps exist (notably AudioCaptureService at 33% and AudioAnalyzer branch coverage at 48%) β€” see open issues for the full list.

What "Beta" means here:

  • Tool schemas are stable within minor versions; breaking changes require a major bump
  • Single-browser-session limitation (multi-session tracked in #108)
  • Upstream @strudel/* dependencies pinned to known-good versions; Dependabot bumps gated on CI
  • Expect hands-on iteration for non-standard patterns β€” report rough edges, they get fixed

Table of Contents

Features

🎹 Complete Music Control

  • 65 MCP Tools: Comprehensive suite for music creation and manipulation
  • Real Browser Automation: Direct control of Strudel.cc through Playwright
  • Live Audio Analysis: Real-time frequency analysis via Web Audio API
  • Pattern Generation: AI-powered creation across 8+ music genres
  • Music Theory Engine: Scales, chords, progressions, euclidean rhythms
  • Session Management: Save, load, undo/redo with pattern storage

πŸ”§ Testing & Development Status

  • βœ… Test Suite: Comprehensive test coverage across unit, integration, and validation tests
  • βœ… Code Coverage: Actively tracked via CI
  • βœ… Browser Integration: Works with live Strudel.cc website
  • βœ… Audio Analysis: Real-time FFT analysis functional
  • βœ… Pattern Generation: Core music generation features working
  • βœ… OIDC Publishing: Secure npm publishing with provenance attestation

Not Production-Ready: This is experimental software under active development. Use for exploration and experimentation. Expect breaking changes, bugs, and incomplete features. See CONTRIBUTING.md to help improve it.

🎼 Example Patterns

Explore 17 curated example patterns across 10 genres in patterns/examples/:

  • Techno: Hard techno, minimal techno
  • House: Deep house, tech house
  • Drum & Bass: Liquid, neurofunk
  • Ambient: Dark ambient, drone
  • Trap: Modern trap, cloud trap
  • Jungle: Classic jungle, ragga jungle
  • Jazz: Bebop, modal jazz
  • Intelligent DnB: Atmospheric, liquid, LTJ Bukem style
  • Trip Hop: Portishead, Massive Attack, Flying Lotus style
  • Boom Bap: DJ Premier, Alchemist, golden era hip hop

Each example includes pattern code, BPM, key, and description. See patterns/examples/README.md for details.

Migrating from @williamzujkowski/strudel-mcp-server

This project was renamed from @williamzujkowski/strudel-mcp-server to @williamzujkowski/live-coding-music-mcp to make the unofficial fan-project status unambiguous (see #97). The old package is deprecated on npm.

If you were using the old package:

# Remove old
npm uninstall -g @williamzujkowski/strudel-mcp-server

# Install new
npm install -g @williamzujkowski/live-coding-music-mcp

Update your MCP client config. The bin name changed from strudel-mcp to live-coding-music-mcp:

// BEFORE
{
  "mcpServers": {
    "strudel": { "command": "strudel-mcp" }
  }
}

// AFTER
{
  "mcpServers": {
    "live-coding-music": { "command": "live-coding-music-mcp" }
  }
}

The MCP server's internal identity string also changed from strudel-mcp-enhanced to live-coding-music-mcp. If you have a client that keys on that string (logs, allowlists, permission policies), update it accordingly.

All tool names and schemas are unchanged.

Installation

Prerequisites

Requirement Version Notes
Node.js 22.x+ LTS required
npm 10+ Comes with Node.js
Chromium Latest Auto-installed by Playwright
Audio output Any Required for playback (speakers/headphones)

Optional: Docker for containerized deployment.

From npm

npm install -g @williamzujkowski/live-coding-music-mcp

# Install browser (required once)
npx playwright install chromium

From Source

# Clone repository
git clone https://github.com/williamzujkowski/live-coding-music-mcp.git
cd live-coding-music-mcp

# Install dependencies
npm install

# Install Chromium for browser automation
npx playwright install chromium

# Build the project
npm run build

Quick Reference

Common commands for immediate use:

Action Command
Initialize browser init
Create techno beat generate_pattern with style: "techno"
Play pattern play
Stop playback stop
Get current pattern get_pattern
Analyze audio analyze
Save pattern save with name: "my-pattern"
Undo last change undo

One-shot workflow:

compose with style: "dnb", key: "Am", bpm: 174, auto_play: true

Quick Start

1. Add to Claude

# If installed globally
claude mcp add strudel live-coding-music-mcp

# If built from source
claude mcp add strudel node /path/to/live-coding-music-mcp/dist/index.js

2. Start Using

claude chat

Then ask Claude:

  • "Initialize Strudel and create a techno beat"
  • "Generate a jazz chord progression in F major"
  • "Create a drum & bass pattern at 174 BPM"

Available Tools

66 tools across 15 categories:

Setup (1)
Tool Description
init Initialize Strudel in browser
Pattern Editing (5)
Tool Description
write Write pattern to editor with optional auto-play and validation
append Append code to current pattern
insert Insert code at specific line
replace Replace pattern section
get_pattern Get current pattern code
Playback (6)
Tool Description
status Get current browser and playback status (quick state check)
clear Clear the editor
play Start playing pattern
pause Pause playback
stop Stop playback
set_tempo Set BPM
Storage (3)
Tool Description
save Save pattern with metadata
load Load saved pattern
list List saved patterns
History (4)
Tool Description
undo Undo last action
redo Redo action
list_history List recent pattern history with timestamps and previews
restore_history Restore a previous pattern from history by ID
Generation (8)
Tool Description
compose Generate, write, and play a complete pattern in one step. Auto-initializes browser if needed.
generate_pattern Generate complete pattern from style with optional auto-play
generate_drums Generate drum pattern
generate_bassline Generate bassline
generate_melody Generate melody from scale
generate_polyrhythm Generate polyrhythm
generate_fill Generate drum fill
generate_variation Create pattern variations
Music Theory (4)
Tool Description
generate_scale Generate scale notes
generate_chord_progression Generate chord progression
generate_euclidean Generate Euclidean rhythm
apply_scale Apply scale to notes
Transform (9)
Tool Description
transpose Transpose notes by semitones
reverse Reverse pattern
stretch Time stretch pattern
quantize Quantize to grid
humanize Add human timing variation
add_effect Add effect to pattern
remove_effect Remove effect
add_swing Add swing to pattern
set_energy Adjust the overall energy level of the current pattern on a 0-10 scale. 0: minimal/ambient, 1-2: sparse, 3-4: light/relaxed, 5-6: normal/moderate, 7-8: driving/intense, 9-10: maximum. Auto-plays after applying energy level.
AI (4)
Tool Description
get_pattern_feedback Get AI-powered creative feedback on the current pattern using Google Gemini. Analyzes pattern structure and optionally audio.
jam_with AI generates a complementary layer to jam with your pattern. Analyzes current pattern to detect tempo, key, and existing layers, then generates a matching layer that fits musically.
shift_mood Transform current pattern to match a different emotional mood by adjusting tempo, effects, and note choices. Moods: dark, euphoric, melancholic, aggressive, dreamy, peaceful, energetic.
refine Incrementally refine the current pattern with simple directional commands. Supports: faster/slower (tempo), louder/quieter (gain), brighter/darker (filter cutoff), "more reverb"/drier (reverb). Auto-plays after applying refinement.
Analysis (7)
Tool Description
analyze Complete audio analysis
analyze_spectrum FFT spectrum analysis
analyze_rhythm Rhythm analysis
detect_tempo BPM detection
detect_key Key detection
validate_pattern_runtime Validate pattern with runtime error checking (monitors Strudel console for errors)
compare_patterns Compare two patterns from history showing differences
Session (4)
Tool Description
create_session Create a new isolated Strudel browser session. Sessions share one browser but have isolated contexts.
destroy_session Close and destroy a Strudel session, releasing its resources.
list_sessions List all active Strudel sessions with their metadata.
switch_session Change the default session used by other tools.
Export (2)
Tool Description
export_midi Export current pattern to MIDI file. Parses note(), n(), and chord() functions.
screenshot Take a screenshot of the current Strudel editor state
Audio (3)
Tool Description
start_audio_capture Start capturing audio from Strudel output. Audio must be playing for capture to work.
stop_audio_capture Stop audio capture and return the recorded audio as base64-encoded data.
capture_audio_sample Capture a fixed-duration audio sample from Strudel output. Audio must be playing.
Debug (5)
Tool Description
show_browser Bring browser window to foreground for visual feedback
performance_report Get performance metrics and bottlenecks
memory_usage Get current memory usage statistics
diagnostics Get detailed browser diagnostics including cache, errors, and performance
show_errors Display captured console errors and warnings from Strudel
Other (1)
Tool Description
suggest_pattern_from_audio Analyze the currently playing audio and suggest a complementary Strudel pattern using Gemini AI. Extracts tempo, key, and spectral features locally, then uses AI to generate a matching pattern. Returns pattern text (not auto-executed).

Auto-generated from source. 66 tools registered.

Usage Examples

Basic Pattern Creation

Create a Simple Beat

You: Initialize Strudel and create a simple techno beat

Claude: [Initializes browser]
        [Generates and writes pattern]
        [Starts playback]

Pattern created:
setcpm(130)
stack(
  s("bd*4"),
  s("~ cp ~ cp"),
  s("hh*8").gain(0.4)
).gain(0.8)

Generate a Bassline

You: Add a techno bassline in C

Claude: [Generates bassline]
        [Appends to current pattern]

Added: note("c2 c2 c2 c2").s("sawtooth").cutoff(800)

Advanced Music Generation

Jazz Composition

You: Create a jazz progression in F major with a walking bass

Claude: Generated progression: "Gm7" "C7" "Fmaj7"

Pattern:
stack(
  note("Gm7" "C7" "Fmaj7").struct("1 ~ ~ ~").s("piano"),
  note("g2 c2 f2").s("sine").gain(0.7)
)

Drum & Bass Track

You: Generate a complete drum & bass track at 174 BPM

Claude: [Creates multi-layer pattern with drums, bass, and pads]

// dnb pattern in C at 174 BPM
setcpm(174)
stack(
  // Drums
  s("bd ~ ~ [bd bd] ~ ~ bd ~, ~ ~ cp ~ ~ cp ~ ~").fast(2),

  // Bass
  note("c1 ~ ~ c2 ~ c1 ~ ~").s("square").cutoff(400),

  // Pads (atmospheric)
  note("c3 eb3 g3 bb3").s("sawtooth")
    .attack(2).release(4).room(0.8).gain(0.6)
)

Real-Time Manipulation

Live Audio Analysis

You: Analyze what's playing and show me the frequency breakdown

Claude: Audio Analysis Results:
{
  "connected": true,
  "features": {
    "average": 78.5,
    "peak": 180,
    "peakFrequency": 120,
    "bass": 145,
    "mid": 82,
    "treble": 45,
    "isPlaying": true,
    "brightness": "balanced"
  }
}

Strong bass presence detected - typical for techno/house patterns.

Pattern Variations

You: Create a glitchy variation of the current pattern

Claude: [Applies glitch transformation]

Added: .sometimes(x => x.chop(8).rev).rarely(x => x.speed(-1))

Multi-Track Composition

Layered Ambient Track

You: Create an ambient soundscape with multiple layers

Claude: [Generates complex multi-layer pattern]

setcpm(90)
stack(
  // Deep bass drone
  note("c1").s("sine").attack(4).release(8).gain(0.5),

  // Texture pad
  note("c3 eb3 g3").s("sawtooth")
    .attack(2).release(6).room(0.9).gain(0.4),

  // Sparse percussion
  s("bd ~ ~ ~, ~ ~ ~ hh:8").room(0.9).gain(0.3),

  // Melodic sparkles
  note("c5 g5 eb5 bb5").struct("~ 1 ~ 1 ~ ~ 1 ~")
    .s("triangle").delay(0.5).room(0.8).gain(0.3)
)

Session Management

Save and Load Patterns

You: Save this pattern as "techno-groove-1" with tags "techno" and "experimental"

Claude: Pattern saved as "techno-groove-1"

---

You: List all my techno patterns

Claude: Saved patterns with tag "techno":
β€’ techno-groove-1 [techno, experimental] - 2025-10-23T19:30:00.000Z
β€’ acid-bassline [techno, acid] - 2025-10-23T18:15:00.000Z

---

You: Load "acid-bassline"

Claude: Loaded pattern "acid-bassline"
[Pattern written to editor]

Music Theory Applications

Generate Euclidean Rhythms

You: Create a 5/8 euclidean rhythm with kick drum

Claude: Generated Euclidean rhythm (5/8)

Pattern: s("bd").struct("1 ~ 1 ~ 1 1 ~ 1")

Complex Polyrhythms

You: Generate a polyrhythm with kick (4/16), snare (7/16), and hi-hat (3/16)

Claude: Generated polyrhythm

stack(
  s("bd").euclid(4, 16),
  s("cp").euclid(7, 16),
  s("hh").euclid(3, 16)
)

Integration with LLM Agents

AI-Assisted Composition

You: Analyze the mood of my current pattern and suggest complementary elements

Claude: [Analyzes pattern structure and audio features]

Your pattern has:
- Energetic rhythm (130 BPM)
- Strong bass presence
- Minimal melodic content

Suggestions:
1. Add arpeggiated synth for movement
2. Include occasional breaks/fills
3. Layer atmospheric pad for depth

Would you like me to add any of these?

You: Add an arpeggiated synth in C minor

Claude: [Generates and adds]

note("c4 eb4 g4 bb4 c5").struct("1 1 1 1 1 1 1 1")
  .s("triangle").delay(0.25).room(0.3).gain(0.5)

Testing

All tools have been tested with real Strudel.cc interaction:

# Run integration tests
npm run test:integration

# Run browser tests
node tests/strudel-integration.js

# Run npm test to see current pass/fail/skip counts

Configuration

config.json

{
  "headless": false,        // Set true for background operation
  "strudel_url": "https://strudel.cc/",
  "patterns_dir": "./patterns",
  "audio_analysis": {
    "fft_size": 2048,
    "smoothing": 0.8
  }
}

Architecture

System Overview

The Strudel MCP Server is built with a modular architecture that separates concerns and enables robust music generation:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       Claude AI                              β”‚
β”‚                  (MCP Client)                                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚ MCP Protocol (stdio)
                        β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              StrudelMCPServer                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Tool Request Handler                                  β”‚ β”‚
β”‚  β”‚  - Validates inputs                                    β”‚ β”‚
β”‚  β”‚  - Routes to appropriate service                       β”‚ β”‚
β”‚  β”‚  - Handles errors gracefully                           β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚            β”‚            β”‚           β”‚
   β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”  β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”  β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”  β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
   β”‚ Strudel β”‚  β”‚ Music  β”‚  β”‚Pattern β”‚  β”‚ Pattern β”‚
   β”‚Controllerβ”‚  β”‚ Theory β”‚  β”‚Generatorβ”‚  β”‚  Store  β”‚
   β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚
   β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   Playwright Browser            β”‚
   β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
   β”‚  β”‚   Strudel.cc Website     β”‚   β”‚
   β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚   β”‚
   β”‚  β”‚  β”‚  CodeMirror Editor β”‚  β”‚   β”‚
   β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚   β”‚
   β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚   β”‚
   β”‚  β”‚  β”‚  Audio Context     β”‚  β”‚   β”‚
   β”‚  β”‚  β”‚  + Web Audio API   β”‚  β”‚   β”‚
   β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚   β”‚
   β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚ Audio Analyzer β”‚
          β”‚  - FFT Analysisβ”‚
          β”‚  - Frequency   β”‚
          β”‚  - Spectral    β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Components

1. StrudelMCPServer (src/server/server.ts)

Main MCP server implementation handling:

  • 65 Tool Definitions: Complete API surface for music control
  • Request Routing: Directs tool calls to appropriate handlers
  • State Management: Tracks initialization, undo/redo stacks, pattern cache
  • Error Handling: Graceful degradation and informative error messages
  • Lazy Initialization: Browser starts only when needed

Key Features:

- Pattern caching before browser init
- Undo/redo stack management
- Session history tracking
- Generated pattern storage
- Safe fallback mechanisms

2. StrudelController (src/StrudelController.ts)

Browser automation layer using Playwright:

  • Browser Management: Chromium instance lifecycle
  • Editor Control: CodeMirror manipulation via DOM
  • Playback Control: Keyboard shortcuts for play/stop
  • Performance Optimizations:
    • Editor content caching (100ms TTL)
    • Direct CodeMirror API access
    • Resource blocking (images, fonts)
    • Fast DOM content loading
// Example: Optimized pattern writing
async writePattern(pattern: string) {
  await this.page.evaluate((newPattern) => {
    const editor = document.querySelector('.cm-content');
    const view = editor.__view;
    view.dispatch({
      changes: { from: 0, to: view.state.doc.length, insert: newPattern }
    });
  }, pattern);
}

3. AudioAnalyzer (src/AudioAnalyzer.ts)

Real-time audio analysis via Web Audio API injection:

  • FFT Analysis: 1024-point FFT for spectral data
  • Frequency Bands: Bass, low-mid, mid, high-mid, treble
  • Analysis Caching: 50ms TTL for performance
  • Features Extracted:
    • Average amplitude
    • Peak frequency
    • Spectral centroid
    • Playing state detection
    • Frequency distribution
Features provided:
- average: Overall amplitude (0-255)
- peak: Maximum amplitude
- peakFrequency: Dominant frequency in Hz
- bass/mid/treble: Band-specific amplitudes
- brightness: Timbral classification
- isPlaying: Boolean playback state

4. MusicTheory (src/services/MusicTheory.ts)

Music theory engine providing:

  • 15+ Scales: Major, minor, modes, pentatonic, blues, whole-tone
  • Chord Progressions: Pop, jazz, blues, rock, folk, EDM
  • Euclidean Rhythms: Mathematical rhythm generation
  • Arpeggio Generation: Multiple patterns (up, down, random)
  • Note Transposition: Semitone-based pitch shifting

Supported scales:

major, minor, dorian, phrygian, lydian, mixolydian,
aeolian, locrian, pentatonic, blues, chromatic,
wholetone, harmonic_minor, melodic_minor

5. PatternGenerator (src/services/PatternGenerator.ts)

AI-powered pattern creation:

  • Genre Templates: Techno, house, DnB, trap, ambient, jazz, intelligent_dnb, trip_hop, boom_bap
  • Drum Patterns: 4 complexity levels per genre
  • Basslines: 8 different styles
  • Melody Generation: Scale-based with musical intervals
  • Variations: Subtle, moderate, extreme, glitch, evolving
  • Fills: 1-4 bar drum fills

Example generation:

generateCompletePattern('techno', 'C', 130)
β†’ Multi-layer pattern with drums, bass, chords, melody

6. PatternStore (src/PatternStore.ts)

Persistent pattern storage:

  • JSON-based: Simple file storage
  • Metadata: Name, tags, timestamp, audio features
  • Tag Filtering: Organize by genre, mood, project
  • Sorted Retrieval: Most recent first

Directory Structure

live-coding-music-mcp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ server/
β”‚   β”‚   └── server.ts                    # MCP server
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ MusicTheory.ts                # Theory engine
β”‚   β”‚   └── PatternGenerator.ts           # Pattern creation
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── Logger.ts                     # Logging utility
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── index.ts                      # TypeScript types
β”‚   β”œβ”€β”€ StrudelController.ts              # Browser automation
β”‚   β”œβ”€β”€ AudioAnalyzer.ts                  # Audio analysis
β”‚   β”œβ”€β”€ PatternStore.ts                   # Pattern persistence
β”‚   └── index.ts                          # Entry point
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ browser-test.js                   # Browser integration
β”‚   β”œβ”€β”€ integration.test.js               # Integration tests
β”‚   β”œβ”€β”€ manual-test.js                    # Manual testing
β”‚   β”œβ”€β”€ mcp-tools.test.ts                 # MCP tool tests
β”‚   └── strudel-integration.js            # Full integration
β”œβ”€β”€ patterns/                             # Saved patterns
β”œβ”€β”€ config.json                           # Server configuration
β”œβ”€β”€ package.json                          # Dependencies
└── tsconfig.json                         # TypeScript config

Data Flow

  1. Tool Invocation

    Claude β†’ MCP Protocol β†’ StrudelMCPServer
    
  2. Pattern Generation (without browser)

    Server β†’ PatternGenerator β†’ MusicTheory β†’ Pattern String
    
  3. Pattern Execution (with browser)

    Server β†’ StrudelController β†’ Playwright β†’ Strudel.cc
    
  4. Audio Analysis

    Strudel.cc β†’ Web Audio API β†’ AudioAnalyzer β†’ Feature Data
    

Performance Characteristics

Operation Latency Notes
Pattern Generation <100ms Pure computation
Browser Init ~3s One-time cost
Pattern Write ~50ms With caching
Play/Stop ~100ms Keyboard shortcuts
Audio Analysis ~20ms With 50ms cache
Pattern Save ~10ms File I/O

Optimization Strategies

  1. Caching

    • Editor content: 100ms TTL
    • Audio analysis: 50ms TTL
    • Generated patterns: Until browser init
  2. Resource Blocking

    • Images, fonts, media blocked
    • Only load essential JavaScript/CSS
  3. Direct API Access

    • CodeMirror view manipulation
    • Keyboard shortcuts over button clicks
  4. Lazy Loading

    • Browser starts only when needed
    • Services initialized on-demand

Pattern Examples

Minimal Techno (Verified Working)

setcpm(130)
stack(
  s("bd*4").gain(0.9),
  s("~ cp ~ cp").room(0.2),
  s("hh*16").gain(0.4).pan(sine.range(-0.5, 0.5)),
  note("c2 c2 eb2 c2").s("sawtooth").cutoff(800)
).swing(0.05)

Drum & Bass (Verified Working)

setcpm(174)
stack(
  s("bd ~ ~ [bd bd] ~ ~ bd ~, ~ ~ sn:3 ~ ~ sn:3 ~ ~").fast(2),
  s("hh*16").gain(0.5),
  note("e1 ~ ~ e2 ~ e1 ~ ~").s("sine:2").lpf(200)
)
Release History
VersionChangesUrgencyDate
v2.0.0## Why This project imports `@strudel/core`, `@strudel/mini`, `@strudel/tonal`, and `@strudel/transpiler`, all AGPL-3.0 licensed by the upstream [Strudel project](https://codeberg.org/uzu/strudel). Shipping the combined work under MIT (as v1.0.0 and the previous `@williamzujkowski/strudel-mcp-server` package did) was incorrect β€” AGPL Β§5 propagates copyleft to anything that combines with AGPL code, and ESM `import` of npm-redistributed packages qualifies as combining. v2.0.0 fixes the license. High4/20/2026
v2.4.1## Bug Fixes - **MCP Protocol**: Fixed stdout pollution from @strudel imports breaking JSON-RPC communication (#85) - **Chord Generation**: Fixed `generateChordProgression()` to produce valid Strudel syntax - `note("<C G Am F>")` instead of invalid `note("C" "G" "Am" "F")` (#85) - **Documentation**: Corrected tool count from 66 to 65, updated test statistics ## Security - Bump hono 4.11.4 β†’ 4.11.7 (CVE fixes) (#84) ## Installation ```bash npm install -g @williamzujkowski/strudel-mcp-server@Low2/1/2026
v2.4.0## What's New in v2.4.0 ### New Features #### Multi-Session Browser Support (#75) - `SessionManager` for concurrent Strudel sessions with browser context isolation - Max 5 concurrent sessions with 30-minute auto-cleanup timeout - New MCP tools: `create_session`, `destroy_session`, `list_sessions`, `switch_session` - Optional `session_id` parameter on existing tools for session targeting #### MIDI Export (#74) - `MIDIExportService` for exporting Strudel patterns to standard MIDI files - `exporLow1/25/2026
v2.3.0## What's New in v2.3.0 ### Pattern History Tools (#41) Browse, restore, and compare pattern versions: - `list_history` - View pattern history with timestamps - `restore_history` - Restore a previous pattern by ID - `compare_patterns` - Line-by-line diff between patterns ### UX & Browser Tools (#43) Better workflow for music creation: - `compose` - One-shot pattern generation with auto-play - `status` - Quick browser/playback state check - `diagnostics` - Detailed system diagnostics - `show_brLow12/14/2025
v2.2.0# Strudel MCP Server v2.2.0 ## πŸŽ‰ Production-Ready Release This release marks the Strudel MCP Server as **fully production-ready** with comprehensive testing, enhanced features, and verified functionality with real Strudel.cc interaction. ## ✨ Highlights ### πŸ† 100% Test Coverage - All 40+ tools tested with real Strudel.cc website - 19 integration tests passing (100% success rate) - Browser automation verified working - Audio analysis confirmed functional ### πŸš€ Enhanced Features - **PatterLow8/18/2025
v1.0.0## πŸŽ‰ Initial Release ### ✨ Features - **MCP Server Implementation**: Complete Model Context Protocol server for Strudel.cc - **Browser Automation**: Control Strudel.cc through Playwright - **Pattern Management**: Write, play, stop, and save patterns - **Audio Analysis**: Real-time frequency analysis and audio feature extraction - **Local Storage**: Save and load patterns with tagging system - **Claude CLI Integration**: Seamless integration with Claude CLI ### πŸ› οΈ Tools Available - `init` - ILow8/18/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

stigixStigix is a lab platform to validate SD‑WAN and SASE. ​ It unifies SaaS traffic generation, security tests, convergence probes, and voice/IoT/VyOS simulations in one web UIv1.2.2-patch.81
kibiRepo-local, per-git-branch, queryable knowledge base for LLM Agents.kibi-opencode@0.8.0
claw-pilotMulti-agent orchestration runtime with task board, flow engine, budget control, MCP integration and real-time dashboard. Self-hosted on Linux/macOS.v0.81.1
trace-mcpMCP server for Claude Code and Codex. One tool call replaces ~42 minutes of agent explorationv1.28.0
@baseplate-dev/plugin-aiAI agent integration plugin for Baseplate β€” generates AGENTS.md, CLAUDE.md, .mcp.json, and .agents/ configuration files0.6.8