克劳德DJ MCP
一个MCP服务器,让Claude使用 果馅饼 现场编码音乐。
特性
- 🎵 现场编码音乐 --Claude实时生成Strudel模式
- 🎙️ DJ公告 --文本转语音评论(macOS)
- 🎚️ 动态节奏控制 --调整BPM会话中期
- 📻 观众请求 --从浏览器UI接收歌曲/氛围请求
- 🔄 自主DJ循环 --播放→ 宣布→ wait → 适应→ 重复
安全通知
⚠️ 该项目仅供当地开发和个人使用。
重要的安全注意事项:
- 仅限本地使用 --HTTP服务器绑定到localhost,但有打开的CORS标头(
Access-Control-Allow-Origin: *) - 代码执行 --Claude发送在浏览器中评估的任意Strudel代码,而无需沙盒
- 命令执行 --The
dj_speak工具执行shell命令(macOSsay)用户控制输入 - 无身份验证 --任何有权访问localhost的人都可以与活动会话进行交互
- 无速率限制 --请求队列和端点未受到保护,无法防止滥用
建议:
- 仅在具有可信Claude实例的可信计算机上运行
- 不要将HTTP服务器暴露给本地主机以外的网络接口
- 在没有额外安全强化的情况下,不要在多用户环境中运行
- 如果您有安全问题,请在使用前查看代码
建筑
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 + 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)
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安装
1.构建MCP服务器
npm install
npm run build2.在克劳德代码/克劳德桌面中配置
添加到您的MCP设置中(例如。, ~/.config/claude-code/mcp.json):
{
"mcpServers": {
"claude-dj": {
"command": "node",
"args": ["~/claude-dj-mcp/dist/index.js"]
}
}
}用法
快速开始
在克劳德代码或克劳德桌面中:
Use the claude-dj skill to start a DJ session或者直接调用工具:
Call start_session, then tell me when audio is readyDJ循环
一旦会话开始并且音频处于活动状态:
- 克劳德扮演一个模式 --电话
play_pattern使用Strudel代码 - 克劳德宣布 --电话
dj_speakDJ解说 - 克劳德等待着 --电话
wait(30-90)让音乐播放 - 克劳德检查请求 --等待工具返回所有待处理的受众请求
- 克劳德适应 --根据请求、情绪、流程创建下一个模式
- 重复
观众请求
用户可以在浏览器UI中键入请求:
- “时髦的东西”
- “冷lo-fi节拍”
- “90年代技术”
- “更多牛铃”
Claude将确认请求并将其合并到下一个模式中。
MCP工具(共9个)
| 工具 | 说明 |
|---|---|
start_session | 启动HTTP服务器并使用Strudel REPL打开浏览器 |
play_pattern | 将Strudel代码发送到浏览器进行评估 |
stop_music | 停止当前模式 |
get_session_state | 返回浏览器状态(已启动、activeCode、错误、cps) |
set_tempo | 设置BPM或CPS |
dj_speak | macOS文本到速度公告(即发即弃) |
check_requests | 从浏览器UI中清空用户请求队列 |
wait | 阻塞N秒,然后返回待处理的请求(核心DJ循环工具) |
get_available_sounds | 按类别返回策划的声音列表 |
Strudel示例
基本节拍
s("bd sd:1 hh sd:2").gain(0.8)分层图案
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)
)低温
stack(
s("bd ~ [~ bd] ~, ~ sd ~ sd").gain(0.7),
note("/4").sound("piano").room(0.7).gain(0.3),
s("hh*4").gain(0.2).pan(sine)
).lpf(2000)科技舞曲
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)
)可用声音
- 鼓:bd、sd、hh、oh、cp、rm、cb、lt、mt、ht、cr、rd、perc、tabla
- 合成器:正弦、方形、锯齿形、三角形、超弦、超正方形
- 仪器:钢琴,贝斯1,贝斯2,gtr,长笛,爵士,金属,东方,拨弦,卡西欧
- 效果:.lpf().hpf().delay().room().gain().pan().crush().vowel().phaser().speed()
使用 get_available_sounds 用于完整分类列表和示例的工具。
迷你符号参考
*N--每个循环重复N次/N--在N个周期内分散(减速)~--休息/沉默- `` --交替每个循环
[a b]--分组成一步?--随机游戏机会,--并行播放
发展
# Install dependencies
npm install
# Development mode (with hot reload)
npm run dev
# Build
npm run build
# Run manually (stdio mode)
node dist/index.js文件结构
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代理技能支持
该项目包括 代理技能 定义在 claude-dj/SKILL.md兼容的代理可以发现并使用 claude-dj 技能自动。
许可证
AGPL-3.0
学分
- 果馅饼 --算法模式的实时编码环境
- 内置于 @模型上下文协议/sdk
