Strudel MCP服务器
  ](https://nodejs.org/)
韩语 |英语
MCP(模型上下文协议)服务器,使LLM能够与 果馅饼 -音乐模式的实时编码环境。该服务器允许AI助手解析、分析、生成和转换Strudel模式。
Strudel是什么?
果馅饼 是的JavaScript端口 潮汐周期,一个通过代码创建音乐的实时编码环境。它使用简洁的“迷你符号”来表达复杂的节奏模式:
s("bd sd [hh hh] cp") // kick, snare, two hi-hats, clap什么是MCP?
模型上下文协议(MCP) 是一种开放协议,使人工智能助手能够与外部工具和服务进行交互。此服务器将Strudel的模式引擎暴露给任何兼容MCP的客户端。
特性
- 模式分析 -解析迷你符号、查询模式事件、验证语法
- 音乐理论 -访问音阶、和弦和语音
- 代码生成 -按风格(鼓、贝斯、旋律、和弦、环境)生成模式
- 模式转换 -应用以下转换
fast,slow,rev,jux - 参考 -列出可用功能、声音和示例
安装
先决条件
- Node.js 18或更高版本
- npm或pnpm
设置
# Clone the repository
git clone https://github.com/YOUR_USERNAME/strudel-mcp.git
cd strudel-mcp
# Install dependencies
npm install
# Build the project
npm run build用法
使用克劳德桌面
添加到您的Claude Desktop配置中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"strudel": {
"command": "node",
"args": ["/absolute/path/to/strudel-mcp/dist/index.js"]
}
}
}然后重新启动Claude Desktop。
使用克劳德代码
claude mcp add strudel node /absolute/path/to/strudel-mcp/dist/index.js与MCP检查员一起
以交互方式测试服务器:
npm run inspect可用工具
模式分析
| 工具 | 描述 | 示例输入 |
|---|---|---|
strudel_parse_mini | 将迷你符号解析为AST | {"notation": "bd sd [hh hh] cp"} |
strudel_query_pattern | 查询时间范围内的事件 | {"code": "bd sd", "startCycle": 0, "endCycle": 2} |
strudel_validate_code | 验证语法 | {"code": "bd sd [hh hh]"} |
strudel_explain_pattern | 人类可读的解释 | {"notation": "bd(3,8)"} |
音乐理论
| 工具 | 描述 | 示例输入 |
|---|---|---|
strudel_list_scales | 列出可用比例 | {"filter": "minor"} |
strudel_get_scale | 在磅秤上记笔记 | {"scale": "pentatonic minor", "root": "A"} |
strudel_list_chords | 列出和弦类型 | {} |
strudel_get_voicing | 获得和弦发声 | {"chord": "Cmaj7"} |
代码生成
| 工具 | 描述 | 示例输入 |
|---|---|---|
strudel_generate_pattern | 按样式生成图案 | {"style": "drums", "complexity": "medium"} |
strudel_transform_pattern | 应用转换 | {"code": "bd sd", "transformations": ["fast(2)", "rev"]} |
参考
| 工具 | 描述 | 示例输入 |
|---|---|---|
strudel_list_functions | 列表模式函数 | {"category": "timing"} |
strudel_list_sounds | 列出内置声音 | {"category": "drums"} |
例子
解析模式
User: Parse the pattern "bd sd [hh hh] cp"
Tool: strudel_parse_mini
Input: {"notation": "bd sd [hh hh] cp"}输出:
{
"notation": "bd sd [hh hh] cp",
"eventCount": 5,
"events": [
{"value": "bd", "whole": "0 -> 0.25"},
{"value": "sd", "whole": "0.25 -> 0.5"},
{"value": "hh", "whole": "0.5 -> 0.625"},
{"value": "hh", "whole": "0.625 -> 0.75"},
{"value": "cp", "whole": "0.75 -> 1"}
]
}生成鼓图案
User: Generate a complex drum pattern
Tool: strudel_generate_pattern
Input: {"style": "drums", "complexity": "complex"}输出:
{
"style": "drums",
"complexity": "complex",
"code": "s(\"bd(3,8), sd(2,8,1), hh*16?0.3, cp(1,4,2)\")",
"explanation": "Complex polyrhythmic drums using Euclidean patterns"
}获取刻度注释
User: What notes are in A minor pentatonic?
Tool: strudel_get_scale
Input: {"scale": "pentatonic minor", "root": "A"}输出:
{
"name": "A pentatonic minor",
"notes": ["A", "C", "D", "E", "G"],
"usage": "n(\"0 1 2 3 4\").scale(\"A:pentatonic_minor\")"
}发展
# Build
npm run build
# Run directly
npm start
# Watch mode (rebuild on changes)
npm run dev
# Test with MCP Inspector
npm run inspect项目结构
strudel-mcp/
├── src/
│ ├── index.ts # Main server with all tools
│ └── types.d.ts # TypeScript declarations for Strudel
├── dist/ # Compiled output
├── package.json
├── tsconfig.json
└── README.md依赖项
贡献
欢迎投稿!请随时提交拉取请求。
许可证
MIT许可证-请参阅 许可证 了解详情。
