MCP 3D Printer Server

MCP 3D Printer Server

site icon
2025.03.23 0
TypeScript3D打印服务打印机管理其它
MCP 3D Printer Server 是一个用于连接和管理多种3D打印机的服务器,支持通过API与OctoPrint、Klipper (Moonraker)、Duet、Repetier、Bambu Labs等打印机管理系统交互。它提供了丰富的功能,包括打印机状态监控、文件管理、打印任务控制、STL文件操作(如缩放、旋转、平移等)、STL文件分析、可视化生成以及切片功能。
View on GitHub

Overview

基本能力

产品定位

MCP 3D Printer Server 是一个用于连接和管理多种3D打印机的服务器,支持通过API与多种打印机管理系统交互。

核心功能

  • 获取打印机状态(温度、打印进度等)
  • 列出打印机上的文件
  • 上传G-code文件到打印机
  • 开始、取消和监控打印任务
  • 设置打印机温度
  • 高级STL文件操作(扩展底座、缩放、旋转、平移等)
  • 全面的STL分析,包括详细模型信息
  • 生成多角度SVG可视化
  • 实时进度报告
  • 错误处理和详细诊断
  • 切片STL文件生成G-code
  • 确认G-code文件中的温度设置
  • 完整的从STL修改到打印的工作流程

适用场景

  • 远程监控和管理3D打印机
  • 自动化3D打印流程
  • 批量处理STL文件
  • 教育和研究环境中的3D打印教学

工具列表

  1. STL Manipulation Tools:
  2. get_stl_info: 获取STL文件的详细信息
  3. extend_stl_base: 扩展STL文件的底座
  4. scale_stl: 缩放STL模型
  5. rotate_stl: 旋转STL模型
  6. translate_stl: 平移STL模型
  7. modify_stl_section: 修改STL文件的特定部分
  8. generate_stl_visualization: 生成STL文件的可视化
  9. slice_stl: 切片STL文件生成G-code
  10. confirm_temperatures: 确认G-code文件中的温度设置
  11. process_and_print_stl: 处理STL文件并打印

  12. Printer Control Tools:

  13. get_printer_status: 获取打印机状态
  14. list_printer_files: 列出打印机上的文件
  15. upload_gcode: 上传G-code文件
  16. start_print: 开始打印
  17. cancel_print: 取消打印
  18. set_printer_temperature: 设置打印机温度

常见问题解答

  • 内存使用: 处理大型或复杂的STL文件可能会消耗大量内存。
  • STL操作限制: 部分操作在复杂几何体上可能产生意外结果。
  • 可视化限制: SVG可视化是简化的示意图,不是真正的3D渲染。
  • 性能考虑: 切片操作可能占用大量CPU资源。

使用教程

使用依赖

  • Node.js 18或更高版本
  • npm或yarn

安装教程

  1. 从npm安装:
npm install -g mcp-3d-printer-server
  1. 从源代码安装:
git clone https://github.com/yourusername/mcp-3d-printer-server.git
cd mcp-3d-printer-server
npm install
npm link

配置

创建.env文件或设置环境变量:

API_KEY=your_api_key_here
PRINTER_HOST=localhost
PRINTER_PORT=80
PRINTER_TYPE=octoprint
TEMP_DIR=/path/to/temp/dir

调试方式

  1. 确保环境变量正确设置
  2. 运行服务器并检查日志输出
  3. 使用提供的工具进行测试

示例命令

  • "What's the current status of my 3D printer?"
  • "Show me the list of files on my printer."
  • "Upload this G-code to my printer: [G-code content]"
  • "Start printing the file named 'benchy.gcode'."
  • "Cancel the current print job."
  • "Set the extruder temperature to 200°C."
  • "Set the bed temperature to 60°C."

许可证

该项目遵循 GPL-2.0 开源许可条款,请参阅 GPL-2.0 了解完整条款。