MCP 3D Printer Server

MCP 3D Printer Server

Mirror of

MCP-Mirror

研究与数据
访问服务器

README

MCP 3D Printer Server

npm version License: GPL-2.0 TypeScript Maintenance PRs Welcome Node.js Version Downloads GitHub stars

<a href="https://glama.ai/mcp/servers/7f6v2enbgk"> <img width="380" height="200" src="https://glama.ai/mcp/servers/7f6v2enbgk/badge" alt="3D Printer Server MCP server" /> </a>

Description

This is a server that allows MCP users to connect with the API endpoints of these 3D Printers:

  • OctoPrint
  • Klipper (Moonraker)
  • Duet
  • Repetier
  • Bambu Labs
  • Prusa Connect
  • Creality/Ender

This server is a Model Context Protocol (MCP) server for connecting Claude with 3D printer management systems. It allows Claude to interact with 3D printers through the APIs of various printer management systems such as OctoPrint, Klipper (via Moonraker), Duet, Repetier, and Bambu Labs printers.

Note on Resource Usage: This MCP server includes advanced 3D model manipulation features that can be memory-intensive when working with large STL files. Please see the "Limitations and Considerations" section for important information about memory usage and performance.

Features

  • Get printer status (temperatures, print progress, etc.)
  • List files on the printer
  • Upload G-code files to the printer
  • Start, cancel, and monitor print jobs
  • Set printer temperatures
  • Advanced STL file manipulation:
    • Extend base for better adhesion
    • Scale models uniformly or along specific axes
    • Rotate models around any axis
    • Translate (move) models
    • Modify specific sections of STL files (top, bottom, center, or custom)
  • Comprehensive STL analysis with detailed model information
  • Generate multi-angle SVG visualizations of STL files
  • Real-time progress reporting for long operations
  • Error handling with detailed diagnostics
  • Slice STL files to generate G-code
  • Confirm temperature settings in G-code files
  • Complete end-to-end workflow from STL modification to printing

Installation

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Install from npm

npm install -g mcp-3d-printer-server

Install from source

git clone https://github.com/yourusername/mcp-3d-printer-server.git
cd mcp-3d-printer-server
npm install
npm link  # Makes the command available globally

Configuration

Create a .env file in the directory where you'll run the server or set environment variables:

# Required for authentication with your printer management system
API_KEY=your_api_key_here

# Default printer connection settings
PRINTER_HOST=localhost
PRINTER_PORT=80
PRINTER_TYPE=octoprint  # Options: octoprint, klipper, duet, repetier, bambu

# Optional: Directory for temporary files
TEMP_DIR=/path/to/temp/dir

# Bambu Labs specific configuration
BAMBU_SERIAL=your_printer_serial
BAMBU_TOKEN=your_access_token

# Slicer configuration
SLICER_TYPE=prusaslicer  # Options: prusaslicer, cura, slic3r
SLICER_PATH=/path/to/slicer/executable
SLICER_PROFILE=/path/to/slicer/profile

Usage with Claude Desktop

  1. Edit your Claude Desktop configuration file:
{
  "mcpServers": {
    "3dprint": {
      "command": "mcp-3d-printer-server",
      "env": {
        "API_KEY": "your_api_key_here",
        "PRINTER_HOST": "your_printer_ip",
        "PRINTER_TYPE": "octoprint"
      }
    }
  }
}
  1. For Bambu Labs printers:
{
  "mcpServers": {
    "3dprint": {
      "command": "mcp-3d-printer-server",
      "env": {
        "PRINTER_HOST": "your_printer_ip",
        "PRINTER_TYPE": "bambu",
        "BAMBU_SERIAL": "your_printer_serial",
        "BAMBU_TOKEN": "your_access_token"
      }
    }
  }
}
  1. Restart Claude Desktop
  2. Connect to your printer through Claude

Supported Printer Management Systems

OctoPrint

OctoPrint is a popular web interface for 3D printers. It provides a REST API for controlling the printer.

  • Default port: 80 (http) or 443 (https)
  • Authentication: API key required

Klipper (via Moonraker)

Klipper is a firmware for 3D printers that works with the Moonraker API server.

  • Default port: 7125
  • Authentication: Depends on your Moonraker configuration

Duet

Duet is a control board for 3D printers with its own web interface (DuetWebControl).

  • Default port: 80 (http) or 443 (https)
  • Authentication: Depends on your Duet configuration

Repetier

Repetier-Server is a host software for 3D printers.

  • Default port: 3344
  • Authentication: API key required

Bambu Labs

Bambu Lab printers use MQTT for status and control and FTP for file operations.

  • Authentication: Serial number and access token required
  • Requirements: Printer must be on the same network or have cloud connection enabled
  • Compatible with: X1C, P1S, P1P, A1, and other Bambu Lab printers

Finding Your Bambu Printer's Serial Number and Access Token

To connect to your Bambu Lab printer, you need two things:

  1. Printer Serial Number:

    • Look on the back or bottom of your printer for a sticker with a serial number (typically starts with "01P" or "01A" followed by numbers/letters)
    • Alternatively, open Bambu Studio, connect to your printer, go to Device > Device Management, and view your printer's information
  2. Access Token:

    • The access token is a security code needed to connect directly to your printer
    • For P1 Series printers: Go to the touchscreen, select Settings > Network > LAN Mode, and you'll see the access code
    • For X1 Series printers: Go to the touchscreen, select Settings > Network > LAN Mode, and enable LAN Mode to see the access code
    • For A1 Mini: Use the Bambu Handy app to connect to your printer, then go to Settings > Network > LAN Mode

Note: If your printer is not on the same local network or you can't find the access token, you may need to update your printer's firmware to the latest version to enable LAN Mode.

Prusa Connect

Prusa Connect is Prusa's own cloud-based solution for managing their printers.

  • Default port: 80 (http) or 443 (https)
  • Authentication: API key required
  • Compatible with: Prusa MK4, Prusa Mini, Prusa XL, and other Prusa printers with Prusa Connect

Setting up Prusa Connect

  1. Make sure your Prusa printer is updated to the latest firmware
  2. Connect your printer to your Wi-Fi network
  3. Create a Prusa Connect account and register your printer
  4. Generate an API key from the Prusa Connect web interface under Settings > API Access

Creality Cloud

Creality Cloud is Creality's management system for their printers.

  • Default port: 80 (http) or 443 (https)
  • Authentication: Bearer token required
  • Compatible with: Ender series, CR series, and other Creality printers with network capabilities

Setting up Creality Cloud

  1. Install the Creality Cloud app on your mobile device
  2. Create an account and add your printer
  3. Enable local network access for your printer
  4. Generate a token from the Creality Cloud app under Settings > Developer Options

Available Tools

STL Manipulation Tools

Memory Usage Warning: The following STL manipulation tools load entire 3D models into memory. For large or complex STL files (>10MB), these operations can consume significant memory. When using these tools within the MCP environment, be mindful of memory constraints.

get_stl_info

Get detailed information about an STL file, including dimensions, vertex count, and bounding box.

{
  "stl_path": "/path/to/file.stl"
}

extend_stl_base

Extend the base of an STL file by a specified amount.

{
  "stl_path": "/path/to/file.stl",
  "extension_inches": 2
}

scale_stl

Scale an STL model uniformly or along specific axes.

{
  "stl_path": "/path/to/file.stl",
  "scale_factor": 1.5
}

Or for non-uniform scaling:

{
  "stl_path": "/path/to/file.stl",
  "scale_x": 1.2,
  "scale_y": 1.0,
  "scale_z": 1.5
}

rotate_stl

Rotate an STL model around specific axes (in degrees).

{
  "stl_path": "/path/to/file.stl",
  "rotate_x": 45,
  "rotate_y": 0,
  "rotate_z": 90
}

translate_stl

Move an STL model along specific axes (in millimeters).

{
  "stl_path": "/path/to/file.stl",
  "translate_x": 10,
  "translate_y": 5,
  "translate_z": 0
}

modify_stl_section

Apply a specific transformation to a selected section of an STL file. This allows for detailed modifications of specific parts of a model.

{
  "stl_path": "/path/to/file.stl",
  "section": "top",
  "transformation_type": "scale",
  "value_x": 1.5,
  "value_y": 1.5, 
  "value_z": 1.5
}

For custom section bounds:

{
  "stl_path": "/path/to/file.stl",
  "section": "custom",
  "transformation_type": "rotate",
  "value_x": 0,
  "value_y": 0, 
  "value_z": 45,
  "custom_min_x": -10,
  "custom_min_y": 0,
  "custom_min_z": -10,
  "custom_max_x": 10,
  "custom_max_y": 20,
  "custom_max_z": 10
}

generate_stl_visualization

Generate an SVG visualization of an STL file from multiple angles (front, side, top, and isometric views).

{
  "stl_path": "/path/to/file.stl",
  "width": 400,
  "height": 400
}

slice_stl

Slice an STL file to generate G-code.

{
  "stl_path": "/path/to/file.stl",
  "slicer_type": "prusaslicer",
  "slicer_path": "/path/to/prusaslicer",
  "slicer_profile": "/path/to/profile.ini"
}

confirm_temperatures

Confirm temperature settings in a G-code file.

{
  "gcode_path": "/path/to/file.gcode",
  "extruder_temp": 200,
  "bed_temp": 60
}

process_and_print_stl

Process an STL file (extend base), slice it, confirm temperatures, and start printing.

{
  "stl_path": "/path/to/file.stl",
  "extension_inches": 2,
  "extruder_temp": 200,
  "bed_temp": 60,
  "host": "192.168.1.100",
  "type": "octoprint",
  "api_key": "YOUR_API_KEY"
}

Printer Control Tools

get_printer_status

Get the current status of the 3D printer.

{
  "host": "192.168.1.100",
  "type": "octoprint",
  "api_key": "YOUR_API_KEY"
}

For Bambu printers:

{
  "host": "192.168.1.100",
  "type": "bambu",
  "bambu_serial": "YOUR_PRINTER_SERIAL",
  "bambu_token": "YOUR_ACCESS_TOKEN"
}

list_printer_files

List files available on the printer.

{
  "host": "192.168.1.100",
  "type": "octoprint",
  "api_key": "YOUR_API_KEY"
}

upload_gcode

Upload a G-code file to the printer.

{
  "host": "192.168.1.100",
  "type": "octoprint",
  "api_key": "YOUR_API_KEY",
  "filename": "my_print.gcode",
  "gcode": "G28\nG1 X100 Y100 Z10 F3000\n...",
  "print": true
}

start_print

Start printing a file that is already on the printer.

{
  "host": "192.168.1.100",
  "type": "octoprint",
  "api_key": "YOUR_API_KEY",
  "filename": "my_print.gcode"
}

cancel_print

Cancel the current print job.

{
  "host": "192.168.1.100",
  "type": "octoprint",
  "api_key": "YOUR_API_KEY"
}

set_printer_temperature

Set the temperature of a printer component.

{
  "host": "192.168.1.100",
  "type": "octoprint",
  "api_key": "YOUR_API_KEY",
  "component": "extruder",
  "temperature": 200
}

Available Resources

  • printer://{host}/status - Current status of the 3D printer
  • printer://{host}/files - List of files available on the 3D printer
  • printer://{host}/file/{filename} - Content of a specific file on the 3D printer

Example Commands for Claude

Here are some example commands you can give to Claude after connecting the MCP server:

Printer Control

  • "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."

STL Manipulation and Printing

  • "Take this STL file and extend the base by 2 inches, then send to slicer and queue up in my printer."
  • "Extend the base of model.stl by 1.5 inches."
  • "Scale this STL file by 150% uniformly."
  • "Scale model.stl to be twice as wide but keep the same height."
  • "Rotate this model 90 degrees around the Z axis."
  • "Move this STL model up by 5mm to create a gap underneath."
  • "Can you modify just the top part of this model to make it 20% larger?"
  • "Analyze this STL file and tell me its dimensions and details."
  • "Generate a visualization of this STL file so I can see what it looks like."
  • "Create SVG visualizations of my model from different angles."
  • "Make the base of this model wider without changing its height."
  • "Slice the modified STL file using PrusaSlicer."
  • "Confirm that the temperatures in the G-code are 200°C for the extruder and 60°C for the bed."
  • "Process this STL file, make the base 2 inches longer, slice it, and start printing, but confirm the temperatures first."

Bambu Lab Printer Limitations

Due to the nature of the Bambu Lab printer API, there are some limitations:

  1. Starting prints: Starting a print requires the 3MF project file path, gcode file name, print name, and MD5 hash. The simplified API in this server doesn't support this fully yet.

  2. Temperature control: The Bambu API doesn't provide direct methods to set temperatures. This would require custom G-code commands.

  3. File management: Files must be uploaded to the "gcodes" directory on the printer.

Limitations and Considerations

Memory Usage

  • Large STL Files: Processing large or complex STL files can consume significant memory. The entire STL geometry is loaded into memory during operations.
  • Multiple Operations: Running multiple STL operations in sequence (especially on large files) may cause memory to accumulate if garbage collection doesn't keep up.
  • MCP Environment: Since this runs as an MCP server, be aware that Claude's MCP environment has memory constraints. Complex operations on very large STL files may cause out-of-memory issues.

STL Manipulation Limitations

  • Section Modification: The section-specific modification feature works best on simpler geometries. Complex or non-manifold meshes may produce unexpected results.
  • Base Extension: The base extension algorithm works by adding a new geometry underneath the model. For models with complex undersides, results may not be perfect.
  • Error Handling: While we've added robust error handling, some edge cases in complex STL files might still cause issues.

Visualization Limitations

  • SVG Representation: The SVG visualization is a simplified schematic representation, not a true 3D render.
  • Complex Models: For very complex models, the visualization may not accurately represent all details.

Performance Considerations

  • Slicing Operations: External slicer processes can be CPU-intensive and may take considerable time for complex models.
  • Progress Reporting: For large files, progress updates may appear to stall at certain processing stages.

Testing Recommendations

  • Start with smaller STL files (< 10MB) to test functionality
  • Monitor memory usage when processing large files
  • Test modifications on simple geometries before attempting complex ones
  • Consider running on a system with at least 4GB of available RAM for larger operations

Badges

Badge Description
npm version The current version of the package on npm
License: GPL-2.0 This project is licensed under GPL-2.0
TypeScript This project is written in TypeScript 4.9+
Maintenance This project is actively maintained
PRs Welcome We welcome contributions via Pull Requests
Node.js Version Requires Node.js 18.0.0 or higher
Downloads Number of downloads per month from npm
GitHub stars Number of GitHub stars this project has received

License

GPL-2.0

推荐服务器

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

一个模型上下文协议 (MCP) 服务器,它使用 CoinCap API 提供全面的加密货币分析。该服务器通过一个易于使用的界面提供实时价格数据、市场分析和历史趋势。 (Alternative, slightly more formal and technical translation): 一个模型上下文协议 (MCP) 服务器,利用 CoinCap API 提供全面的加密货币分析服务。该服务器通过用户友好的界面,提供实时价格数据、市场分析以及历史趋势数据。

精选
TypeScript
MCP PubMed Search

MCP PubMed Search

用于搜索 PubMed 的服务器(PubMed 是一个免费的在线数据库,用户可以在其中搜索生物医学和生命科学文献)。 我是在 MCP 发布当天创建的,但当时正在度假。 我看到有人在您的数据库中发布了类似的服务器,但还是决定发布我的。

精选
Python
mixpanel

mixpanel

连接到您的 Mixpanel 数据。从 Mixpanel 分析查询事件、留存和漏斗数据。

精选
TypeScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。

精选
Python
Nefino MCP Server

Nefino MCP Server

为大型语言模型提供访问德国可再生能源项目新闻和信息的能力,允许按地点、主题(太阳能、风能、氢能)和日期范围进行筛选。

官方
Python
Vectorize

Vectorize

将 MCP 服务器向量化以实现高级检索、私有深度研究、Anything-to-Markdown 文件提取和文本分块。

官方
JavaScript
Mathematica Documentation MCP server

Mathematica Documentation MCP server

一个服务器,通过 FastMCP 提供对 Mathematica 文档的访问,使用户能够从 Wolfram Mathematica 检索函数文档和列出软件包符号。

本地
Python
kb-mcp-server

kb-mcp-server

一个 MCP 服务器,旨在实现便携性、本地化、简易性和便利性,以支持对 txtai “all in one” 嵌入数据库进行基于语义/图的检索。任何 tar.gz 格式的 txtai 嵌入数据库都可以被加载。

本地
Python
Research MCP Server

Research MCP Server

这个服务器用作 MCP 服务器,与 Notion 交互以检索和创建调查数据,并与 Claude Desktop Client 集成以进行和审查调查。

本地
Python
Cryo MCP Server

Cryo MCP Server

一个API服务器,实现了模型补全协议(MCP),用于Cryo区块链数据提取。它允许用户通过任何兼容MCP的客户端查询以太坊区块链数据。

本地
Python