mcp 3D printer server
Enables interaction with 3D printer management systems through an MCP server, supporting STL file manipulation, slicing, and control of printers like OctoPrint, Klipper, Duet, and more.
Enables interaction with 3D printer management systems through an MCP server, supporting STL file manipulation, slicing, and control of printers like OctoPrint, Klipper, Duet, and more.
This is a server that allows MCP users to connect with the API endpoints of these 3D Printers:
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.
npm install -g mcp-3d-printer-server
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
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
{
"mcpServers": {
"3dprint": {
"command": "mcp-3d-printer-server",
"env": {
"API_KEY": "your_api_key_here",
"PRINTER_HOST": "your_printer_ip",
"PRINTER_TYPE": "octoprint"
}
}
}
}
{
"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"
}
}
}
}
OctoPrint is a popular web interface for 3D printers. It provides a REST API for controlling the printer.
Klipper is a firmware for 3D printers that works with the Moonraker API server.
Duet is a control board for 3D printers with its own web interface (DuetWebControl).
Repetier-Server is a host software for 3D printers.
Bambu Lab printers use MQTT for status and control and FTP for file operations.
To connect to your Bambu Lab printer, you need two things:
Alternatively, open Bambu Studio, connect to your printer, go to Device > Device Management, and view your printer's information
Access Token:
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 is Prusa's own cloud-based solution for managing their printers.
Creality Cloud is Creality's management system for their printers.
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 detailed information about an STL file, including dimensions, vertex count, and bounding box.
{
"stl_path": "/path/to/file.stl"
}
Extend the base of an STL file by a specified amount.
{
"stl_path": "/path/to/file.stl",
"extension_inches": 2
}
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 an STL model around specific axes (in degrees).
{
"stl_path": "/path/to/file.stl",
"rotate_x": 45,
"rotate_y": 0,
"rotate_z": 90
}
Move an STL model along specific axes (in millimeters).
{
"stl_path": "/path/to/file.stl",
"translate_x": 10,
"translate_y": 5,
"translate_z": 0
}
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 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 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 temperature settings in a G-code file.
{
"gcode_path": "/path/to/file.gcode",
"extruder_temp": 200,
"bed_temp": 60
}
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"
}
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 files available on the printer.
{
"host": "192.168.1.100",
"type": "octoprint",
"api_key": "YOUR_API_KEY"
}
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
G1 X100 Y100 Z10 F3000
...",
"print": true
}
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 the current print job.
{
"host": "192.168.1.100",
"type": "octoprint",
"api_key": "YOUR_API_KEY"
}
Set the temperature of a printer component.
{
"host": "192.168.1.100",
"type": "octoprint",
"api_key": "YOUR_API_KEY",
"component": "extruder",
"temperature": 200
}
printer://{host}/status
- Current status of the 3D printerprinter://{host}/files
- List of files available on the 3D printerprinter://{host}/file/{filename}
- Content of a specific file on the 3D printerHere are some example commands you can give to Claude after connecting the MCP server:
Due to the nature of the Bambu Lab printer API, there are some limitations:
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.
Temperature control: The Bambu API doesn't provide direct methods to set temperatures. This would require custom G-code commands.
File management: Files must be uploaded to the "gcodes" directory on the printer.
GPL-2.0
[
{
"description": "Get the current status of the 3D printer",
"inputSchema": {
"properties": {
"api_key": {
"description": "API key for authentication (default: value from env)",
"type": "string"
},
"bambu_serial": {
"description": "Serial number for Bambu Lab printers (default: value from env)",
"type": "string"
},
"bambu_token": {
"description": "Access token for Bambu Lab printers (default: value from env)",
"type": "string"
},
"host": {
"description": "Hostname or IP address of the printer (default: value from env)",
"type": "string"
},
"port": {
"description": "Port of the printer API (default: value from env)",
"type": "string"
},
"type": {
"description": "Type of printer management system (octoprint, klipper, duet, repetier, bambu, prusa, creality) (default: value from env)",
"type": "string"
}
},
"type": "object"
},
"name": "get_printer_status"
},
{
"description": "Extend the base of an STL file by a specified amount",
"inputSchema": {
"properties": {
"extension_inches": {
"description": "Amount to extend the base in inches",
"type": "number"
},
"stl_path": {
"description": "Path to the STL file to modify",
"type": "string"
}
},
"required": [
"stl_path",
"extension_inches"
],
"type": "object"
},
"name": "extend_stl_base"
},
{
"description": "Slice an STL file to generate G-code",
"inputSchema": {
"properties": {
"slicer_path": {
"description": "Path to the slicer executable (default: value from env)",
"type": "string"
},
"slicer_profile": {
"description": "Profile to use for slicing (default: value from env)",
"type": "string"
},
"slicer_type": {
"description": "Type of slicer to use (prusaslicer, cura, slic3r) (default: value from env)",
"type": "string"
},
"stl_path": {
"description": "Path to the STL file to slice",
"type": "string"
}
},
"required": [
"stl_path"
],
"type": "object"
},
"name": "slice_stl"
},
{
"description": "Confirm temperature settings in a G-code file",
"inputSchema": {
"properties": {
"bed_temp": {
"description": "Expected bed temperature",
"type": "number"
},
"extruder_temp": {
"description": "Expected extruder temperature",
"type": "number"
},
"gcode_path": {
"description": "Path to the G-code file",
"type": "string"
}
},
"required": [
"gcode_path"
],
"type": "object"
},
"name": "confirm_temperatures"
},
{
"description": "Process an STL file (extend base), slice it, confirm temperatures, and start printing",
"inputSchema": {
"properties": {
"api_key": {
"description": "API key for authentication (default: value from env)",
"type": "string"
},
"bed_temp": {
"description": "Expected bed temperature",
"type": "number"
},
"extension_inches": {
"description": "Amount to extend the base in inches",
"type": "number"
},
"extruder_temp": {
"description": "Expected extruder temperature",
"type": "number"
},
"host": {
"description": "Hostname or IP address of the printer (default: value from env)",
"type": "string"
},
"port": {
"description": "Port of the printer API (default: value from env)",
"type": "string"
},
"stl_path": {
"description": "Path to the STL file to process",
"type": "string"
},
"type": {
"description": "Type of printer management system (default: value from env)",
"type": "string"
}
},
"required": [
"stl_path",
"extension_inches"
],
"type": "object"
},
"name": "process_and_print_stl"
},
{
"description": "Get detailed information about an STL file",
"inputSchema": {
"properties": {
"stl_path": {
"description": "Path to the STL file",
"type": "string"
}
},
"required": [
"stl_path"
],
"type": "object"
},
"name": "get_stl_info"
},
{
"description": "Scale an STL model uniformly or along specific axes",
"inputSchema": {
"properties": {
"scale_factor": {
"description": "Uniform scaling factor to apply",
"type": "number"
},
"scale_x": {
"description": "X-axis scaling factor (overrides scale_factor for X axis)",
"type": "number"
},
"scale_y": {
"description": "Y-axis scaling factor (overrides scale_factor for Y axis)",
"type": "number"
},
"scale_z": {
"description": "Z-axis scaling factor (overrides scale_factor for Z axis)",
"type": "number"
},
"stl_path": {
"description": "Path to the STL file",
"type": "string"
}
},
"required": [
"stl_path"
],
"type": "object"
},
"name": "scale_stl"
},
{
"description": "Rotate an STL model around specific axes",
"inputSchema": {
"properties": {
"rotate_x": {
"description": "Rotation around X-axis in degrees",
"type": "number"
},
"rotate_y": {
"description": "Rotation around Y-axis in degrees",
"type": "number"
},
"rotate_z": {
"description": "Rotation around Z-axis in degrees",
"type": "number"
},
"stl_path": {
"description": "Path to the STL file",
"type": "string"
}
},
"required": [
"stl_path"
],
"type": "object"
},
"name": "rotate_stl"
},
{
"description": "Move an STL model along specific axes",
"inputSchema": {
"properties": {
"stl_path": {
"description": "Path to the STL file",
"type": "string"
},
"translate_x": {
"description": "Translation along X-axis in millimeters",
"type": "number"
},
"translate_y": {
"description": "Translation along Y-axis in millimeters",
"type": "number"
},
"translate_z": {
"description": "Translation along Z-axis in millimeters",
"type": "number"
}
},
"required": [
"stl_path"
],
"type": "object"
},
"name": "translate_stl"
},
{
"description": "Apply a specific transformation to a selected section of an STL file",
"inputSchema": {
"properties": {
"custom_max_x": {
"description": "Maximum X for custom section bounds",
"type": "number"
},
"custom_max_y": {
"description": "Maximum Y for custom section bounds",
"type": "number"
},
"custom_max_z": {
"description": "Maximum Z for custom section bounds",
"type": "number"
},
"custom_min_x": {
"description": "Minimum X for custom section bounds",
"type": "number"
},
"custom_min_y": {
"description": "Minimum Y for custom section bounds",
"type": "number"
},
"custom_min_z": {
"description": "Minimum Z for custom section bounds",
"type": "number"
},
"section": {
"description": "Section to modify: 'top', 'bottom', 'center', or custom bounds",
"enum": [
"top",
"bottom",
"center",
"custom"
],
"type": "string"
},
"stl_path": {
"description": "Path to the STL file",
"type": "string"
},
"transformation_type": {
"description": "Type of transformation to apply",
"enum": [
"scale",
"rotate",
"translate"
],
"type": "string"
},
"value_x": {
"description": "Transformation value for X axis",
"type": "number"
},
"value_y": {
"description": "Transformation value for Y axis",
"type": "number"
},
"value_z": {
"description": "Transformation value for Z axis",
"type": "number"
}
},
"required": [
"stl_path",
"section",
"transformation_type"
],
"type": "object"
},
"name": "modify_stl_section"
},
{
"description": "Generate an SVG visualization of an STL file from multiple angles",
"inputSchema": {
"properties": {
"height": {
"description": "Height of each view in pixels (default: 300)",
"type": "number"
},
"stl_path": {
"description": "Path to the STL file",
"type": "string"
},
"width": {
"description": "Width of each view in pixels (default: 300)",
"type": "number"
}
},
"required": [
"stl_path"
],
"type": "object"
},
"name": "generate_stl_visualization"
}
]