本项目借助模型上下文协议(MCP),实现了Claude AI与Pure Data的集成。通过自然语言处理,Claude能够动态创建、修改和控制Pure Data补丁。
git clone https://github.com/nikmaniatis/Pd-MCP-Server.git
Claude > 设置 > 开发者 > 编辑配置 > claude_desktop_config.json{
"mcpServers": {
"Pure Data MCP Server": {
"command": "uv",
"args": [
"--directory",
"PATH_TO_PD_MCP_SERVER",
"run",
"main.py"
],
"env": {
"PD_OSC_HOST": "127.0.0.1",
"PD_OSC_PORT": "5000",
"PD_FEEDBACK_PORT": "5001"
}
}
}
}
⚠️ 重要提示
如果
uv命令未找到,请运行which uv(Unix)或Get-Command uv(PowerShell),并在"command"字段中使用完整路径。
python-oscfastmcpjsonschemauv 包管理器uvcurl -LsSf https://astral.sh/uv/install.sh | sh
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
了解更多:astral-sh/uv
该系统由三个核心组件组成:
mcp_server.py):实现Claude的模型上下文协议接口。osc_daemon.py):处理与Pure Data的OSC通信。absolute_final_solution.pd):一个动态补丁解决方案,接收OSC消息。create_object返回的完全一致。pd-schema.json 提供了一个全面的数据模型,用于Pure Data补丁,支持验证和序列化补丁。尽管在当前的MCP工具中未使用,但它是实现AI工具的关键协议。
示例补丁 (example patch.pd) 当前无法正常工作。