Bambu/OrcaSlicker MCP代理
充当3D打印制造顾问的模型上下文协议(MCP)服务器。克劳德可以分析 .3mf 打印文件,使用不同的预设配置文件运行切片器,并推荐速度与强度权衡的最佳设置。
特性
- 读取.3mf元数据:从任意位置提取当前打印设置
.3mf文件 - 分析当前设置:在现有文件上运行slicer以获取基线指标
- 比较配置文件:测试快速/平衡/强大的配置文件并获得建议
- 批量生产:计算生产多个单元的总时间/成本
先决条件
- Python 3.10+
- OrcaSlicer已安装并可在PATH(CLI模式)中使用
- 支持MCP的Claude桌面
安装
- 克隆此存储库:
git clone
cd bambu-mcp-agent- 安装依赖项:
pip install -r requirements.txt- 验证OrcaSlicer CLI是否可用:
orcaslicer --version如果找不到,请安装OrcaSlicer并确保它在您的PATH中。
配置
Claude桌面MCP设置
将此添加到您的Claude Desktop MCP配置文件中(位置因操作系统而异):
{
"mcpServers": {
"bambu-mcp": {
"command": "python",
"args": ["-m", "bambu_mcp"],
"cwd": "/path/to/bambu-mcp-agent/src"
}
}
}或者使用直接路径:
{
"mcpServers": {
"bambu-mcp": {
"command": "python",
"args": ["/path/to/bambu-mcp-agent/src/bambu_mcp/__main__.py"]
}
}
}macOS: ~/Library/Application Support/Claude/claude_desktop_config.json\ 视窗: %APPDATA%\Claude\claude_desktop_config.json\ Linux: ~/.config/Claude/claude_desktop_config.json
用法
对话示例
User: "Analyze bracket.3mf"
Claude: [calls 3mf://bracket.3mf/metadata]
[calls analyze_current_print]
Your bracket is currently set to:
- 20% infill, 0.20mm layers
- Estimated time: 1h 15m per part
- Material: 12.4g PLA ($0.37)
User: "I need to print 50 for a trade show. Minimize time."
Claude: [calls compare_print_profiles]
[calls calculate_batch_metrics with quantity=50]
Here are your options:
Profile | Per Unit | 50 Units | Savings | Trade-off
-----------|----------|-----------|-----------|----------
Current | 1h 15m | 62.5 hrs | baseline | -
Fast | 45m | 37.5 hrs | -25 hrs | Visible layers
Balanced | 58m | 48.3 hrs | -14 hrs | Slight texture
Strong | 1h 32m | 76.7 hrs | +14 hrs | Overkill
Recommendation: Use Fast profile. You'll save a full day
of print time. The layer lines will be visible but acceptable
for trade show giveaways.
To apply: In Bambu Studio, set layer height to 0.28mm
and infill to 10%.MCP工具
资源: 3mf://{file_path}/metadata
从读取当前打印设置 .3mf 文件。
退货:
- 灯丝类型
- 喷嘴直径
- 层高
- 填充密度
- 墙环
- 支持设置
- 以前的切片信息(如果可用)
工具: analyze_current_print
按原样对现有文件运行切片器以获取基线指标。
论据:
file_path(string):.3mf文件的路径
退货:
- 预计时间(分钟和格式)
- 长丝重量(克)
- 灯丝长度(米)
- 预计成本(美元)
- 警告(如有)
工具: compare_print_profiles
使用3个硬编码配置文件(快速/平衡/强)对文件进行切片,并返回比较结果。
论据:
file_path(string):.3mf文件的路径
退货:
- 当前、快速、平衡和强大配置文件的比较结果
- 基于节省时间的建议
工具: calculate_batch_metrics
计算生产具有特定配置文件的N个单元的总时间/成本。
论据:
file_path(string):.3mf文件的路径quantity(整数):要生产的单位数profile_name(string):“当前”、“快速”、“平衡”或“强”
退货:
- 总时间(小时和格式)
- 总长丝(kg)
- 总成本(美元)
- 单位时间
- 与当前设置的比较
配置文件预设
快速简介
- 层高:0.28mm
- 填充:10%
- 墙环:2
- 用例:原型、内部零件
平衡剖面
- 层高:0.20mm
- 填充:15%
- 墙环:3
- 用例:大多数生产零件
强大的个人资料
- 层高:0.16mm
- 填充:25%
- 墙环:4
- 用例:承重,面向客户
建筑
bambu-mcp-agent/
├── src/bambu_mcp/
│ ├── __init__.py
│ ├── server.py # MCP server with tools/resources
│ ├── parser.py # .3mf file parsing
│ └── slicer.py # OrcaSlicer CLI wrapper
├── mcp_workspace/
│ ├── slice_output/ # Temporary slicer outputs
│ ├── fast_profile.ini
│ ├── balanced_profile.ini
│ └── strong_profile.ini
├── requirements.txt
├── pyproject.toml
└── README.md错误处理
服务器优雅地处理常见错误:
- 未找到CLI:清除安装OrcaSlicer的消息
- .3mf文件无效:验证错误,上下文有帮助
- 切片器超时:120秒超时,并显示信息性消息
- 缺少打印机配置文件:记录警告,如果可能,操作将继续
日志记录
日志被写入 debug.log (不是stdout)以避免中断MCP stdio通信。
局限性
- 不修改
.3mf文件(只读分析) - 不处理多板场景
- 不验证几何约束
- 假设串行打印(无多打印机逻辑)
发展
运行测试
# Install dev dependencies
pip install -e ".[dev]"
# Run tests (when implemented)
pytest项目理念
仅提供分析和建议。无文件修改。 用户根据建议在Bambu Studio中手动应用设置。
许可证
\[在此处添加您的许可证\]
贡献
\[在此处添加贡献指南\]
