Claude DJ MCP
Enables Claude to act as an autonomous radio DJ, generating live-coded music with Strudel, making text-to-speech announcements, and responding to audience requests through a browser UI.
README
Claude DJ MCP
An MCP server that lets Claude act as an autonomous radio DJ using Strudel live-coded music.
Features
- 🎵 Live-coded music — Claude generates Strudel patterns in real-time
- 🎙️ DJ announcements — Text-to-speech commentary (macOS)
- 🎚️ Dynamic tempo control — Adjust BPM mid-session
- 📻 Audience requests — Take song/vibe requests from browser UI
- 🔄 Autonomous DJ loop — Play → announce → wait → adapt → repeat
Security Notice
⚠️ This project is designed for local development and personal use only.
Important security considerations:
- Local use only — The HTTP server binds to localhost but has open CORS headers (
Access-Control-Allow-Origin: *) - Code execution — Claude sends arbitrary Strudel code that is evaluated in the browser without sandboxing
- Command execution — The
dj_speaktool executes shell commands (macOSsay) with user-controlled input - No authentication — Anyone with access to localhost can interact with active sessions
- No rate limiting — Request queue and endpoints are not protected against abuse
Recommendations:
- Only run on trusted machines with trusted Claude instances
- Do not expose the HTTP server to network interfaces beyond localhost
- Do not run in multi-user environments without additional security hardening
- Review the code before use if you have security concerns
Architecture
Claude (MCP client)
│ stdio (JSON-RPC)
▼
MCP Server (Node.js)
│ In-memory state: pendingCode, pendingAction, browserState, requestQueue
│
├─ HTTP Server (port 6002, auto-increment if busy)
│ GET / → HTML page with <strudel-editor> + request bar
│ GET /api/poll → Browser polls: returns pending code/action
│ POST /api/state → Browser posts: started, activeCode, error, cps
│ POST /api/request → User submits song/vibe request from browser UI
│ GET /api/health → Health check
│
└─ Browser (opened via `open` package)
<strudel-editor> web component (loaded from unpkg CDN)
Polls /api/poll every 1s, executes pending actions
Posts state back via /api/state after each action
Request bar at bottom for user input
Installation
1. Build the MCP server
npm install
npm run build
2. Configure in Claude Code / Claude Desktop
Add to your MCP settings (e.g., ~/.config/claude-code/mcp.json):
{
"mcpServers": {
"claude-dj": {
"command": "node",
"args": ["~/claude-dj-mcp/dist/index.js"]
}
}
}
Usage
Quick start
In Claude Code or Claude Desktop:
Use the claude-dj skill to start a DJ session
Or call tools directly:
Call start_session, then tell me when audio is ready
The DJ Loop
Once the session is started and audio is active:
- Claude plays a pattern — Calls
play_patternwith Strudel code - Claude announces — Calls
dj_speakwith DJ commentary - Claude waits — Calls
wait(30-90)to let the music play - Claude checks requests — The wait tool returns any pending audience requests
- Claude adapts — Creates the next pattern based on requests, mood, flow
- Repeat
Audience requests
Users can type requests in the browser UI:
- "something funky"
- "chill lo-fi beats"
- "90s techno"
- "more cowbell"
Claude will acknowledge and incorporate requests into the next patterns.
MCP Tools (9 total)
| Tool | Description |
|---|---|
start_session |
Starts HTTP server and opens browser with Strudel REPL |
play_pattern |
Sends Strudel code to browser for evaluation |
stop_music |
Stops the current pattern |
get_session_state |
Returns browser state (started, activeCode, error, cps) |
set_tempo |
Sets BPM or CPS |
dj_speak |
macOS text-to-speech announcement (fire-and-forget) |
check_requests |
Drains user request queue from browser UI |
wait |
Blocks N seconds, then returns pending requests (core DJ loop tool) |
get_available_sounds |
Returns curated sound list by category |
Strudel Examples
Basic beat
s("bd sd:1 hh sd:2").gain(0.8)
Layered pattern
stack(
s("bd:1 ~ bd:1 ~").gain(0.9),
s("~ sd ~ sd:3").gain(0.7),
s("hh*8").gain(0.4),
note("c2 ~ e2 ~ g2 ~ e2 ~").sound("bass1").gain(0.6)
)
Lo-fi chill
stack(
s("bd ~ [~ bd] ~, ~ sd ~ sd").gain(0.7),
note("<c3 e3 g3 b3>/4").sound("piano").room(0.7).gain(0.3),
s("hh*4").gain(0.2).pan(sine)
).lpf(2000)
Techno
stack(
s("bd*4").gain(0.9),
s("~ hh:2 ~ hh:3").gain(0.5),
s("~ ~ cp ~").room(0.5).gain(0.6),
note("c2 c2 [c2 c3] c2").sound("sawtooth").lpf(400).gain(0.5)
)
Available Sounds
- Drums: bd, sd, hh, oh, cp, rm, cb, lt, mt, ht, cr, rd, perc, tabla
- Synths: sine, square, sawtooth, triangle, supersaw, supersquare
- Instruments: piano, bass1, bass2, gtr, flute, jazz, metal, east, pluck, casio
- Effects: .lpf() .hpf() .delay() .room() .gain() .pan() .crush() .vowel() .phaser() .speed()
Use get_available_sounds tool for the full categorized list with examples.
Mini-Notation Reference
*N— repeat N times per cycle/N— spread over N cycles (slow down)~— rest / silence<a b c>— alternate each cycle[a b]— group into one step?— random chance of playing,— play in parallel
Development
# Install dependencies
npm install
# Development mode (with hot reload)
npm run dev
# Build
npm run build
# Run manually (stdio mode)
node dist/index.js
File Structure
claude-dj-mcp/
├── src/
│ ├── index.ts # MCP server entry: tool registrations, main()
│ ├── http-server.ts # HTTP server, state stores, endpoints
│ ├── html-page.ts # HTML template with Strudel REPL
│ ├── logger.ts # stderr-only logger
│ ├── prompts.ts # MCP prompt for DJ workflow
│ └── sounds.ts # Curated Strudel sound list
├── claude-dj/
│ └── SKILL.md # Agent skill definition
├── package.json
├── tsconfig.json
└── README.md
Agent Skills Support
This project includes an Agent Skills definition at claude-dj/SKILL.md. Compatible agents can discover and use the claude-dj skill automatically.
License
AGPL-3.0
Credits
- Strudel — The live coding environment for algorithmic patterns
- Built with @modelcontextprotocol/sdk
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。