mcp-3d-printer-server 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +17 -0
- package/README.md +226 -1
- package/dist/index.js +487 -0
- package/dist/stl/stl-manipulator.d.ts +127 -0
- package/dist/stl/stl-manipulator.js +870 -0
- package/dist/test/stl-manipulator-test.d.ts +2 -0
- package/dist/test/stl-manipulator-test.js +91 -0
- package/package.json +8 -5
- package/src/index.ts +585 -0
- package/src/stl/stl-manipulator.ts +1119 -0
- package/src/test/stl-manipulator-test.js +114 -0
- package/src/test/stl-manipulator-test.ts +124 -0
- package/src/test/tsconfig.json +13 -0
- package/test/sample_cube.stl +86 -0
- package/test/sample_cube_extended.stl +172 -0
- package/test/sample_cube_modified.stl +86 -0
- package/test/sample_cube_rotated.stl +86 -0
- package/test/sample_cube_scaled.stl +86 -0
- package/test/sample_cube_translated.stl +86 -0
- package/test/sample_cube_visualization.svg +52 -0
package/.env.example
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Printer configuration
|
|
2
|
+
PRINTER_HOST=localhost
|
|
3
|
+
PRINTER_PORT=80
|
|
4
|
+
PRINTER_TYPE=octoprint
|
|
5
|
+
API_KEY=your_api_key_here
|
|
6
|
+
|
|
7
|
+
# Bambu-specific configuration
|
|
8
|
+
BAMBU_SERIAL=your_bambu_serial_here
|
|
9
|
+
BAMBU_TOKEN=your_bambu_token_here
|
|
10
|
+
|
|
11
|
+
# Temp directory for file processing
|
|
12
|
+
TEMP_DIR=./temp
|
|
13
|
+
|
|
14
|
+
# Slicer configuration
|
|
15
|
+
SLICER_TYPE=prusaslicer
|
|
16
|
+
SLICER_PATH=/path/to/slicer/executable
|
|
17
|
+
SLICER_PROFILE=/path/to/slicer/profile
|
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ This is a server that allows MCP users to connect with the API endpoints of thes
|
|
|
14
14
|
|
|
15
15
|
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.
|
|
16
16
|
|
|
17
|
+
**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.
|
|
18
|
+
|
|
17
19
|
## Features
|
|
18
20
|
|
|
19
21
|
- Get printer status (temperatures, print progress, etc.)
|
|
@@ -21,6 +23,19 @@ This server is a Model Context Protocol (MCP) server for connecting Claude with
|
|
|
21
23
|
- Upload G-code files to the printer
|
|
22
24
|
- Start, cancel, and monitor print jobs
|
|
23
25
|
- Set printer temperatures
|
|
26
|
+
- Advanced STL file manipulation:
|
|
27
|
+
- Extend base for better adhesion
|
|
28
|
+
- Scale models uniformly or along specific axes
|
|
29
|
+
- Rotate models around any axis
|
|
30
|
+
- Translate (move) models
|
|
31
|
+
- Modify specific sections of STL files (top, bottom, center, or custom)
|
|
32
|
+
- Comprehensive STL analysis with detailed model information
|
|
33
|
+
- Generate multi-angle SVG visualizations of STL files
|
|
34
|
+
- Real-time progress reporting for long operations
|
|
35
|
+
- Error handling with detailed diagnostics
|
|
36
|
+
- Slice STL files to generate G-code
|
|
37
|
+
- Confirm temperature settings in G-code files
|
|
38
|
+
- Complete end-to-end workflow from STL modification to printing
|
|
24
39
|
|
|
25
40
|
## Installation
|
|
26
41
|
|
|
@@ -63,6 +78,11 @@ TEMP_DIR=/path/to/temp/dir
|
|
|
63
78
|
# Bambu Labs specific configuration
|
|
64
79
|
BAMBU_SERIAL=your_printer_serial
|
|
65
80
|
BAMBU_TOKEN=your_access_token
|
|
81
|
+
|
|
82
|
+
# Slicer configuration
|
|
83
|
+
SLICER_TYPE=prusaslicer # Options: prusaslicer, cura, slic3r
|
|
84
|
+
SLICER_PATH=/path/to/slicer/executable
|
|
85
|
+
SLICER_PROFILE=/path/to/slicer/profile
|
|
66
86
|
```
|
|
67
87
|
|
|
68
88
|
## Usage with Claude Desktop
|
|
@@ -191,7 +211,169 @@ Creality Cloud is Creality's management system for their printers.
|
|
|
191
211
|
|
|
192
212
|
## Available Tools
|
|
193
213
|
|
|
194
|
-
###
|
|
214
|
+
### STL Manipulation Tools
|
|
215
|
+
|
|
216
|
+
> **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.
|
|
217
|
+
|
|
218
|
+
#### get_stl_info
|
|
219
|
+
|
|
220
|
+
Get detailed information about an STL file, including dimensions, vertex count, and bounding box.
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"stl_path": "/path/to/file.stl"
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### extend_stl_base
|
|
229
|
+
|
|
230
|
+
Extend the base of an STL file by a specified amount.
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"stl_path": "/path/to/file.stl",
|
|
235
|
+
"extension_inches": 2
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### scale_stl
|
|
240
|
+
|
|
241
|
+
Scale an STL model uniformly or along specific axes.
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"stl_path": "/path/to/file.stl",
|
|
246
|
+
"scale_factor": 1.5
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Or for non-uniform scaling:
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"stl_path": "/path/to/file.stl",
|
|
255
|
+
"scale_x": 1.2,
|
|
256
|
+
"scale_y": 1.0,
|
|
257
|
+
"scale_z": 1.5
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### rotate_stl
|
|
262
|
+
|
|
263
|
+
Rotate an STL model around specific axes (in degrees).
|
|
264
|
+
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"stl_path": "/path/to/file.stl",
|
|
268
|
+
"rotate_x": 45,
|
|
269
|
+
"rotate_y": 0,
|
|
270
|
+
"rotate_z": 90
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
#### translate_stl
|
|
275
|
+
|
|
276
|
+
Move an STL model along specific axes (in millimeters).
|
|
277
|
+
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"stl_path": "/path/to/file.stl",
|
|
281
|
+
"translate_x": 10,
|
|
282
|
+
"translate_y": 5,
|
|
283
|
+
"translate_z": 0
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### modify_stl_section
|
|
288
|
+
|
|
289
|
+
Apply a specific transformation to a selected section of an STL file. This allows for detailed modifications of specific parts of a model.
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
{
|
|
293
|
+
"stl_path": "/path/to/file.stl",
|
|
294
|
+
"section": "top",
|
|
295
|
+
"transformation_type": "scale",
|
|
296
|
+
"value_x": 1.5,
|
|
297
|
+
"value_y": 1.5,
|
|
298
|
+
"value_z": 1.5
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
For custom section bounds:
|
|
303
|
+
|
|
304
|
+
```json
|
|
305
|
+
{
|
|
306
|
+
"stl_path": "/path/to/file.stl",
|
|
307
|
+
"section": "custom",
|
|
308
|
+
"transformation_type": "rotate",
|
|
309
|
+
"value_x": 0,
|
|
310
|
+
"value_y": 0,
|
|
311
|
+
"value_z": 45,
|
|
312
|
+
"custom_min_x": -10,
|
|
313
|
+
"custom_min_y": 0,
|
|
314
|
+
"custom_min_z": -10,
|
|
315
|
+
"custom_max_x": 10,
|
|
316
|
+
"custom_max_y": 20,
|
|
317
|
+
"custom_max_z": 10
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### generate_stl_visualization
|
|
322
|
+
|
|
323
|
+
Generate an SVG visualization of an STL file from multiple angles (front, side, top, and isometric views).
|
|
324
|
+
|
|
325
|
+
```json
|
|
326
|
+
{
|
|
327
|
+
"stl_path": "/path/to/file.stl",
|
|
328
|
+
"width": 400,
|
|
329
|
+
"height": 400
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
#### slice_stl
|
|
334
|
+
|
|
335
|
+
Slice an STL file to generate G-code.
|
|
336
|
+
|
|
337
|
+
```json
|
|
338
|
+
{
|
|
339
|
+
"stl_path": "/path/to/file.stl",
|
|
340
|
+
"slicer_type": "prusaslicer",
|
|
341
|
+
"slicer_path": "/path/to/prusaslicer",
|
|
342
|
+
"slicer_profile": "/path/to/profile.ini"
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
#### confirm_temperatures
|
|
347
|
+
|
|
348
|
+
Confirm temperature settings in a G-code file.
|
|
349
|
+
|
|
350
|
+
```json
|
|
351
|
+
{
|
|
352
|
+
"gcode_path": "/path/to/file.gcode",
|
|
353
|
+
"extruder_temp": 200,
|
|
354
|
+
"bed_temp": 60
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### process_and_print_stl
|
|
359
|
+
|
|
360
|
+
Process an STL file (extend base), slice it, confirm temperatures, and start printing.
|
|
361
|
+
|
|
362
|
+
```json
|
|
363
|
+
{
|
|
364
|
+
"stl_path": "/path/to/file.stl",
|
|
365
|
+
"extension_inches": 2,
|
|
366
|
+
"extruder_temp": 200,
|
|
367
|
+
"bed_temp": 60,
|
|
368
|
+
"host": "192.168.1.100",
|
|
369
|
+
"type": "octoprint",
|
|
370
|
+
"api_key": "YOUR_API_KEY"
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Printer Control Tools
|
|
375
|
+
|
|
376
|
+
#### get_printer_status
|
|
195
377
|
|
|
196
378
|
Get the current status of the 3D printer.
|
|
197
379
|
|
|
@@ -290,6 +472,7 @@ Set the temperature of a printer component.
|
|
|
290
472
|
|
|
291
473
|
Here are some example commands you can give to Claude after connecting the MCP server:
|
|
292
474
|
|
|
475
|
+
### Printer Control
|
|
293
476
|
- "What's the current status of my 3D printer?"
|
|
294
477
|
- "Show me the list of files on my printer."
|
|
295
478
|
- "Upload this G-code to my printer: [G-code content]"
|
|
@@ -298,6 +481,22 @@ Here are some example commands you can give to Claude after connecting the MCP s
|
|
|
298
481
|
- "Set the extruder temperature to 200°C."
|
|
299
482
|
- "Set the bed temperature to 60°C."
|
|
300
483
|
|
|
484
|
+
### STL Manipulation and Printing
|
|
485
|
+
- "Take this STL file and extend the base by 2 inches, then send to slicer and queue up in my printer."
|
|
486
|
+
- "Extend the base of model.stl by 1.5 inches."
|
|
487
|
+
- "Scale this STL file by 150% uniformly."
|
|
488
|
+
- "Scale model.stl to be twice as wide but keep the same height."
|
|
489
|
+
- "Rotate this model 90 degrees around the Z axis."
|
|
490
|
+
- "Move this STL model up by 5mm to create a gap underneath."
|
|
491
|
+
- "Can you modify just the top part of this model to make it 20% larger?"
|
|
492
|
+
- "Analyze this STL file and tell me its dimensions and details."
|
|
493
|
+
- "Generate a visualization of this STL file so I can see what it looks like."
|
|
494
|
+
- "Create SVG visualizations of my model from different angles."
|
|
495
|
+
- "Make the base of this model wider without changing its height."
|
|
496
|
+
- "Slice the modified STL file using PrusaSlicer."
|
|
497
|
+
- "Confirm that the temperatures in the G-code are 200°C for the extruder and 60°C for the bed."
|
|
498
|
+
- "Process this STL file, make the base 2 inches longer, slice it, and start printing, but confirm the temperatures first."
|
|
499
|
+
|
|
301
500
|
## Bambu Lab Printer Limitations
|
|
302
501
|
|
|
303
502
|
Due to the nature of the Bambu Lab printer API, there are some limitations:
|
|
@@ -308,6 +507,32 @@ Due to the nature of the Bambu Lab printer API, there are some limitations:
|
|
|
308
507
|
|
|
309
508
|
3. **File management**: Files must be uploaded to the "gcodes" directory on the printer.
|
|
310
509
|
|
|
510
|
+
## Limitations and Considerations
|
|
511
|
+
|
|
512
|
+
### Memory Usage
|
|
513
|
+
- **Large STL Files**: Processing large or complex STL files can consume significant memory. The entire STL geometry is loaded into memory during operations.
|
|
514
|
+
- **Multiple Operations**: Running multiple STL operations in sequence (especially on large files) may cause memory to accumulate if garbage collection doesn't keep up.
|
|
515
|
+
- **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.
|
|
516
|
+
|
|
517
|
+
### STL Manipulation Limitations
|
|
518
|
+
- **Section Modification**: The section-specific modification feature works best on simpler geometries. Complex or non-manifold meshes may produce unexpected results.
|
|
519
|
+
- **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.
|
|
520
|
+
- **Error Handling**: While we've added robust error handling, some edge cases in complex STL files might still cause issues.
|
|
521
|
+
|
|
522
|
+
### Visualization Limitations
|
|
523
|
+
- **SVG Representation**: The SVG visualization is a simplified schematic representation, not a true 3D render.
|
|
524
|
+
- **Complex Models**: For very complex models, the visualization may not accurately represent all details.
|
|
525
|
+
|
|
526
|
+
### Performance Considerations
|
|
527
|
+
- **Slicing Operations**: External slicer processes can be CPU-intensive and may take considerable time for complex models.
|
|
528
|
+
- **Progress Reporting**: For large files, progress updates may appear to stall at certain processing stages.
|
|
529
|
+
|
|
530
|
+
### Testing Recommendations
|
|
531
|
+
- Start with smaller STL files (< 10MB) to test functionality
|
|
532
|
+
- Monitor memory usage when processing large files
|
|
533
|
+
- Test modifications on simple geometries before attempting complex ones
|
|
534
|
+
- Consider running on a system with at least 4GB of available RAM for larger operations
|
|
535
|
+
|
|
311
536
|
## License
|
|
312
537
|
|
|
313
538
|
GPL-2.0
|