|
| 1 | +# 3d-printer MCP Server |
| 2 | + |
| 3 | +Connects MCP to major 3D printer APIs (Orca, Bambu, OctoPrint, Klipper, Duet, Repetier, Prusa, Creality). Control prints, monitor status, and perform advanced STL operations like scaling, rotation, sectional editing, and base extension. Includes slicing and visualization. |
| 4 | + |
| 5 | +[What is an MCP Server?](https://www.anthropic.com/news/model-context-protocol) |
| 6 | + |
| 7 | +|<!-- -->|<!-- -->| |
| 8 | +|-|-| |
| 9 | +**Image Source**|Official Image |
| 10 | +|**Author**|[DMontgomery40](https://github.com/DMontgomery40) |
| 11 | +**Repository**|https://github.com/DMontgomery40/mcp-3D-printer-server |
| 12 | +**Dockerfile**|https://github.com/DMontgomery40/mcp-3D-printer-server/blob/refs/pull/3/merge/Dockerfile |
| 13 | +**Docker Image built by**|Docker Inc. |
| 14 | +**Licence**|GNU General Public License v2.0 |
| 15 | + |
| 16 | +## Summary |
| 17 | +1. `center_model` Translate the model so its geometric center is at the origin (0,0,0). |
| 18 | +1. `confirm_temperatures` Confirm temperature settings in a G-code file |
| 19 | +1. `extend_stl_base` Extend the base of an STL file by a specified amount |
| 20 | +1. `generate_stl_visualization` Generate an SVG visualization of an STL file from multiple angles |
| 21 | +1. `get_printer_status` Get the current status of the 3D printer |
| 22 | +1. `get_stl_info` Get detailed information about an STL file |
| 23 | +1. `lay_flat` Attempt to rotate the model so its largest flat face lies on the XY plane (Z=0). |
| 24 | +1. `merge_vertices` Merge vertices in an STL file that are closer than the specified tolerance. |
| 25 | +1. `modify_stl_section` Apply a specific transformation to a selected section of an STL file |
| 26 | +1. `print_3mf` Print a 3MF file on a Bambu Lab printer, potentially overriding settings. |
| 27 | +1. `process_and_print_stl` Process an STL file (extend base), slice it, confirm temperatures, and start printing |
| 28 | +1. `rotate_stl` Rotate an STL model around specific axes |
| 29 | +1. `scale_stl` Scale an STL model uniformly or along specific axes |
| 30 | +1. `slice_stl` Slice an STL file to generate G-code |
| 31 | +1. `translate_stl` Move an STL model along specific axes |
| 32 | + |
| 33 | +## Tools |
| 34 | + |
| 35 | +### Tool `center_model` |
| 36 | +Translate the model so its geometric center is at the origin (0,0,0). |
| 37 | + |
| 38 | +Parameter|Type|Description |
| 39 | +-|-|- |
| 40 | +`stl_path`|`string`|Path to the STL file to center. |
| 41 | + |
| 42 | +### Tool `confirm_temperatures` |
| 43 | +Confirm temperature settings in a G-code file |
| 44 | + |
| 45 | +Parameter|Type|Description |
| 46 | +-|-|- |
| 47 | +`gcode_path`|`string`|Path to the G-code file |
| 48 | +`bed_temp`|`number` *optional*|Expected bed temperature |
| 49 | +`extruder_temp`|`number` *optional*|Expected extruder temperature |
| 50 | + |
| 51 | +### Tool `extend_stl_base` |
| 52 | +Extend the base of an STL file by a specified amount |
| 53 | + |
| 54 | +Parameter|Type|Description |
| 55 | +-|-|- |
| 56 | +`extension_inches`|`number`|Amount to extend the base in inches |
| 57 | +`stl_path`|`string`|Path to the STL file to modify |
| 58 | + |
| 59 | +### Tool `generate_stl_visualization` |
| 60 | +Generate an SVG visualization of an STL file from multiple angles |
| 61 | + |
| 62 | +Parameter|Type|Description |
| 63 | +-|-|- |
| 64 | +`stl_path`|`string`|Path to the STL file |
| 65 | +`height`|`number` *optional*|Height of each view in pixels (default: 300) |
| 66 | +`width`|`number` *optional*|Width of each view in pixels (default: 300) |
| 67 | + |
| 68 | +### Tool `get_printer_status` |
| 69 | +Get the current status of the 3D printer |
| 70 | + |
| 71 | +Parameter|Type|Description |
| 72 | +-|-|- |
| 73 | +`api_key`|`string` *optional*|API key for authentication (default: value from env) |
| 74 | +`bambu_serial`|`string` *optional*|Serial number for Bambu Lab printers (default: value from env) |
| 75 | +`bambu_token`|`string` *optional*|Access token for Bambu Lab printers (default: value from env) |
| 76 | +`host`|`string` *optional*|Hostname or IP address of the printer (default: value from env) |
| 77 | +`port`|`string` *optional*|Port of the printer API (default: value from env) |
| 78 | +`type`|`string` *optional*|Type of printer management system (octoprint, klipper, duet, repetier, bambu, prusa, creality) (default: value from env) |
| 79 | + |
| 80 | +### Tool `get_stl_info` |
| 81 | +Get detailed information about an STL file |
| 82 | + |
| 83 | +Parameter|Type|Description |
| 84 | +-|-|- |
| 85 | +`stl_path`|`string`|Path to the STL file |
| 86 | + |
| 87 | +### Tool `lay_flat` |
| 88 | +Attempt to rotate the model so its largest flat face lies on the XY plane (Z=0). |
| 89 | + |
| 90 | +Parameter|Type|Description |
| 91 | +-|-|- |
| 92 | +`stl_path`|`string`|Path to the STL file to lay flat. |
| 93 | + |
| 94 | +### Tool `merge_vertices` |
| 95 | +Merge vertices in an STL file that are closer than the specified tolerance. |
| 96 | + |
| 97 | +Parameter|Type|Description |
| 98 | +-|-|- |
| 99 | +`stl_path`|`string`|Path to the STL file to modify. |
| 100 | +`tolerance`|`number` *optional*|Maximum distance between vertices to merge (in mm, default: 0.01). |
| 101 | + |
| 102 | +### Tool `modify_stl_section` |
| 103 | +Apply a specific transformation to a selected section of an STL file |
| 104 | + |
| 105 | +Parameter|Type|Description |
| 106 | +-|-|- |
| 107 | +`section`|`string`|Section to modify: 'top', 'bottom', 'center', or custom bounds |
| 108 | +`stl_path`|`string`|Path to the STL file |
| 109 | +`transformation_type`|`string`|Type of transformation to apply |
| 110 | +`custom_max_x`|`number` *optional*|Maximum X for custom section bounds |
| 111 | +`custom_max_y`|`number` *optional*|Maximum Y for custom section bounds |
| 112 | +`custom_max_z`|`number` *optional*|Maximum Z for custom section bounds |
| 113 | +`custom_min_x`|`number` *optional*|Minimum X for custom section bounds |
| 114 | +`custom_min_y`|`number` *optional*|Minimum Y for custom section bounds |
| 115 | +`custom_min_z`|`number` *optional*|Minimum Z for custom section bounds |
| 116 | +`value_x`|`number` *optional*|Transformation value for X axis |
| 117 | +`value_y`|`number` *optional*|Transformation value for Y axis |
| 118 | +`value_z`|`number` *optional*|Transformation value for Z axis |
| 119 | + |
| 120 | +### Tool `print_3mf` |
| 121 | +Print a 3MF file on a Bambu Lab printer, potentially overriding settings. |
| 122 | + |
| 123 | +Parameter|Type|Description |
| 124 | +-|-|- |
| 125 | +`three_mf_path`|`string`|Path to the 3MF file to print. |
| 126 | +`ams_mapping`|`object` *optional*|Override AMS filament mapping (e.g., {"Generic PLA": 0, "Generic PETG": 1}). |
| 127 | +`bambu_serial`|`string` *optional*|Serial number for the Bambu Lab printer (default: value from env) |
| 128 | +`bambu_token`|`string` *optional*|Access token for the Bambu Lab printer (default: value from env) |
| 129 | +`bed_temperature`|`number` *optional*|Override bed temperature (°C). |
| 130 | +`host`|`string` *optional*|Hostname or IP address of the Bambu printer (default: value from env) |
| 131 | +`layer_height`|`number` *optional*|Override layer height (mm). |
| 132 | +`nozzle_temperature`|`number` *optional*|Override nozzle temperature (°C). |
| 133 | +`support_enabled`|`boolean` *optional*|Override support generation. |
| 134 | + |
| 135 | +### Tool `process_and_print_stl` |
| 136 | +Process an STL file (extend base), slice it, confirm temperatures, and start printing |
| 137 | + |
| 138 | +Parameter|Type|Description |
| 139 | +-|-|- |
| 140 | +`extension_inches`|`number`|Amount to extend the base in inches |
| 141 | +`stl_path`|`string`|Path to the STL file to process |
| 142 | +`api_key`|`string` *optional*|API key for authentication (default: value from env) |
| 143 | +`bed_temp`|`number` *optional*|Expected bed temperature |
| 144 | +`extruder_temp`|`number` *optional*|Expected extruder temperature |
| 145 | +`host`|`string` *optional*|Hostname or IP address of the printer (default: value from env) |
| 146 | +`port`|`string` *optional*|Port of the printer API (default: value from env) |
| 147 | +`type`|`string` *optional*|Type of printer management system (default: value from env) |
| 148 | + |
| 149 | +### Tool `rotate_stl` |
| 150 | +Rotate an STL model around specific axes |
| 151 | + |
| 152 | +Parameter|Type|Description |
| 153 | +-|-|- |
| 154 | +`stl_path`|`string`|Path to the STL file |
| 155 | +`rotate_x`|`number` *optional*|Rotation around X-axis in degrees |
| 156 | +`rotate_y`|`number` *optional*|Rotation around Y-axis in degrees |
| 157 | +`rotate_z`|`number` *optional*|Rotation around Z-axis in degrees |
| 158 | + |
| 159 | +### Tool `scale_stl` |
| 160 | +Scale an STL model uniformly or along specific axes |
| 161 | + |
| 162 | +Parameter|Type|Description |
| 163 | +-|-|- |
| 164 | +`stl_path`|`string`|Path to the STL file |
| 165 | +`scale_factor`|`number` *optional*|Uniform scaling factor to apply |
| 166 | +`scale_x`|`number` *optional*|X-axis scaling factor (overrides scale_factor for X axis) |
| 167 | +`scale_y`|`number` *optional*|Y-axis scaling factor (overrides scale_factor for Y axis) |
| 168 | +`scale_z`|`number` *optional*|Z-axis scaling factor (overrides scale_factor for Z axis) |
| 169 | + |
| 170 | +### Tool `slice_stl` |
| 171 | +Slice an STL file to generate G-code |
| 172 | + |
| 173 | +Parameter|Type|Description |
| 174 | +-|-|- |
| 175 | +`stl_path`|`string`|Path to the STL file to slice |
| 176 | +`slicer_path`|`string` *optional*|Path to the slicer executable (default: value from env) |
| 177 | +`slicer_profile`|`string` *optional*|Profile to use for slicing (default: value from env) |
| 178 | +`slicer_type`|`string` *optional*|Type of slicer to use (prusaslicer, cura, slic3r, orcaslicer) (default: value from env) |
| 179 | + |
| 180 | +### Tool `translate_stl` |
| 181 | +Move an STL model along specific axes |
| 182 | + |
| 183 | +Parameter|Type|Description |
| 184 | +-|-|- |
| 185 | +`stl_path`|`string`|Path to the STL file |
| 186 | +`translate_x`|`number` *optional*|Translation along X-axis in millimeters |
| 187 | +`translate_y`|`number` *optional*|Translation along Y-axis in millimeters |
| 188 | +`translate_z`|`number` *optional*|Translation along Z-axis in millimeters |
| 189 | + |
| 190 | +## Use this MCP Server |
| 191 | + |
| 192 | +```json |
| 193 | +{ |
| 194 | + "mcpServers": { |
| 195 | + "3d-printer": { |
| 196 | + "command": "docker", |
| 197 | + "args": [ |
| 198 | + "run", |
| 199 | + "-i", |
| 200 | + "--rm", |
| 201 | + "-e", |
| 202 | + "BAMBU_SERIAL", |
| 203 | + "-e", |
| 204 | + "PRINTER_HOST", |
| 205 | + "-e", |
| 206 | + "PRINTER_TYPE", |
| 207 | + "-e", |
| 208 | + "BAMBU_TOKEN", |
| 209 | + "mcp/3d-printer" |
| 210 | + ], |
| 211 | + "env": { |
| 212 | + "BAMBU_SERIAL": "YOUR_BAMBU_SERIAL", |
| 213 | + "PRINTER_HOST": "REAL", |
| 214 | + "PRINTER_TYPE": "bambu", |
| 215 | + "BAMBU_TOKEN": "YOUR_BAMBU_TOKEN" |
| 216 | + } |
| 217 | + } |
| 218 | + } |
| 219 | +} |
| 220 | +``` |
| 221 | + |
| 222 | +[Why is it safer to run MCP Servers with Docker?](https://www.docker.com/blog/the-model-context-protocol-simplifying-building-ai-apps-with-anthropic-claude-desktop-and-docker/) |
0 commit comments