strudel-mcp

strudel-mcp

Enables LLMs to interact with Strudel, a JavaScript live coding music environment, by executing patterns, retrieving states, and accessing documentation.

Category
访问服务器

README

Strudel MCP - Model Context Protocol Integration for Strudel

This project provides an MCP (Model Context Protocol) server that enables LLMs to interact with Strudel - a JavaScript port of the Tidal Cycles pattern language for live coding music.

Overview

Strudel MCP allows Large Language Models (LLMs) to:

  • Execute Strudel patterns via natural language commands
  • Retrieve current pattern states
  • Get Strudel documentation through Context7 integration
  • Access browser development tools for debugging

Architecture

┌─────────────┐    MCP     ┌──────────────┐    WebSocket    ┌─────────────┐
│   LLM       │ ◄──────► │ strudel-mcp  │ ◄─────────────► │  Strudel    │
│  (Qwen/     │  Protocol │   Server     │   Communication│  REPL/      │
│  etc.)      │           │ (Node.js ✨) │                │  Frontend   │
└─────────────┘           └──────────────┘                └─────────────┘

Server Options

Node.js Server

cd server-node
npm install
npm run dev

Components

  • strudel-mcp (Node.js): MCP server with WebSocket communication
  • WebSocket Server: Handles bidirectional communication between MCP and Strudel
  • Frontend: Web-based Strudel interface with synchronization capabilities
  • Context7 Integration: External documentation service for Strudel docs

Original Strudel Project

This project is based on and inspired by the original Strudel project:

Note:

  • The source_of_strudel/ directory was cloned from https://codeberg.org/uzu/strudel on 2025-10-12 for development reference.
  • Both directories were local development references and are not included in this GitHub repository.

License

This project follows the AGPL-3.0 license, consistent with the original Strudel project. See LICENSE file for details.

Features

MCP Tools

  • execute_strudel_code - Execute Strudel patterns
  • get_current_pattern - Get current active pattern
  • get_strudel_knowledge - Built-in Strudel documentation and knowledge base

Synchronization Features

  • BroadcastChannel API: Cross-tab pattern synchronization
  • Real-time Updates: Immediate pattern changes across multiple tabs/windows
  • Error Handling: Robust error recovery and fallback mechanisms

Quick Start

Prerequisites

  • Bun (>=1.0) - Recommended runtime
  • Modern browser with WebSocket and Web Audio API support

Note: This project is optimized for Bun. While it works with Node.js, we strongly recommend using Bun for better performance and developer experience.

Installation

  1. Clone the repository:

    git clone https://github.com/utenadev/strudel-mcp.git
    cd strudel-mcp
    
  2. Install server dependencies:

    cd server-node
    bun install
    cd ..
    
  3. Install frontend dependencies:

    cd frontend
    bun install
    cd ..
    
  4. Start the servers:

    # Terminal 1: Start MCP + WebSocket server
    cd server-node
    bun run dev
    
    # Terminal 2: Start frontend
    cd frontend
    bun run dev
    
  5. Run tests:

    cd frontend
    bun run test  # 23 tests
    

Usage with LLM

Qwen3-Coder + Qwen-code (MCP Configuration Required)

Create .qwen/settings.json in your project root:

Production (built version):

{
  "mcpServers": {
    "strudel-mcp": {
      "command": "node",
      "args": ["server-node/dist/index.js"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

Development (npm dev):

{
  "mcpServers": {
    "strudel-mcp": {
      "command": "npm", 
      "args": ["run", "dev"],
      "cwd": "server-node",
      "env": {
        "NODE_ENV": "development",
        "DEBUG": "true"
      }
    }
  }
}

Pre-built settings provided in this repository:

  • .qwen/settings.json - Production ready
  • .qwen/settings.dev.json - Development mode

Build first for production: cd server-node && npm run build

Gemini CLI (MCP Configuration Required)

Configure ~/.gemini/settings.json:

{
  "selectedAuthType": "gemini-api-key",
  "theme": "Dracula",
  "mcpServers": {
    "strudel-mcp": {
      "command": "node",
      "args": ["/path/to/strudel-mcp/server-node/dist/index.js"],
      "cwd": "/path/to/strudel-mcp/server-node"
    }
  }
}

Build first: cd server-node && npm run build

Verify with /mcp command in Gemini CLI

Claude Desktop (MCP Configuration Required)

Configure Claude Desktop settings:

  1. Open Claude Desktop → Settings → Developer → Edit Config
  2. Add to mcpServers:
{
  "mcpServers": {
    "strudel-mcp": {
      "command": "node",
      "args": ["/path/to/strudel-mcp/server-node/dist/index.js"],
      "cwd": "/path/to/strudel-mcp/server-node"
    }
  }
}
  1. Restart Claude Desktop
  2. Verify tools are available in new chat

GitHub Copilot (MCP Configuration Required)

In VS Code with GitHub Copilot (v1.99+):

  1. Open Settings → Extensions → GitHub Copilot
  2. Enable "MCP servers in Copilot" policy
  3. Use GitHub MCP Registry or manual configuration
{
  "mcpServers": {
    "strudel-mcp": {
      "command": "node",
      "args": ["/path/to/strudel-mcp/server-node/dist/index.js"],
      "cwd": "/path/to/strudel-mcp/server-node"
    }
  }
}

Note: Replace /path/to/strudel-mcp with your actual repository path

Development

Project Structure

strudel-mcp/
├── server-node/               # Node.js MCP server
│   ├── src/
│   │   ├── index.ts          # Main server entry
│   │   ├── mcp/              # MCP protocol handlers
│   │   ├── websocket/        # WebSocket manager
│   │   └── utils/            # Utilities (logger, config)
│   ├── test/                 # Server tests
│   ├── package.json          # Dependencies
│   └── tsconfig.json         # TypeScript config
├── frontend/                  # React-based Strudel interface
│   ├── src/
│   │   ├── App.tsx           # Main application component
│   │   ├── hooks/            # React hooks (useStrudel, useWebSocket)
│   │   ├── presets/          # Genre-based pattern presets
│   │   ├── types/            # TypeScript type declarations
│   │   └── test/             # Frontend tests
│   ├── package.json          # Dependencies
│   └── vitest.config.ts      # Test configuration
├── docs/                      # Documentation
├── source_of_strudel/         # Strudel source reference (git submodule)
└── images/                    # Screenshots and assets

Key Technologies

  • Runtime: Bun (recommended)
  • Backend: TypeScript + Express + @modelcontextprotocol/sdk
  • Frontend: React + TypeScript + Vite
  • Audio: Strudel packages (@strudel/core, @strudel/webaudio, @strudel/transpiler)
  • Communication: WebSocket protocol
  • Testing: Vitest + React Testing Library

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style and conventions
  • Add appropriate error handling
  • Update documentation for new features
  • Test cross-browser compatibility

Roadmap

  • [ ] Enhanced pattern synchronization across multiple tabs
  • [ ] Improved error handling and recovery
  • [ ] Additional LLM tools for advanced pattern manipulation
  • [ ] Performance optimizations
  • [ ] Mobile browser support
  • [ ] Plugin system for extensions

API Reference

WebSocket Endpoints

  • ws://localhost:8081/ws?type=mcp - MCP client connection
  • ws://localhost:8081/ws?type=strudel - Strudel frontend connection

MCP Tool Reference

execute_strudel_code

Execute Strudel pattern code

{
  "name": "execute_strudel_code",
  "arguments": {
    "code": "s('bd hh sd oh').fast(2)"
  }
}

get_current_pattern

Get currently executing pattern

{
  "name": "get_current_pattern",
  "arguments": {}
}

get_strudel_knowledge

Built-in Strudel documentation

{
  "name": "get_strudel_knowledge",
  "arguments": {
    "topic": "basics",
    "query": "drum patterns"
  }
}

Available topics: basics, patterns, effects, troubleshooting

Troubleshooting

Common Issues

  1. WebSocket Connection Failed

    • Ensure port 8081 is available
    • Check firewall settings
    • Verify server and frontend are running
  2. Audio Not Playing

    • Check browser audio permissions
    • Ensure user interaction initiated audio context
    • Verify Web Audio API support
  3. MCP Connection Issues

    • Verify MCP server is running
    • Check LLM client configuration
    • Ensure stdio communication is working

Logging

  • Server logs: Console output
  • Frontend logs: Browser developer console
  • WebSocket logs: Server console with verbose mode

Acknowledgments

  • Original Strudel Team: For creating an amazing live coding environment
  • TidalCycles Community: For the pattern language inspiration
  • MCP Contributors: For the Model Context Protocol standard

License

This project is licensed under the AGPL-3.0 License - see the LICENSE file for details, consistent with the original Strudel project.


Note: This is an independent implementation inspired by Strudel. For the official Strudel project, please visit strudel.cc.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选