mcp-3d-printer-server 0.1.0 → 0.2.2

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 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
@@ -1,5 +1,14 @@
1
1
  # MCP 3D Printer Server
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/mcp-3d-printer-server.svg)](https://www.npmjs.com/package/mcp-3d-printer-server)
4
+ [![License: GPL-2.0](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-4.9%2B-blue)](https://www.typescriptlang.org/)
6
+ [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/yourusername/mcp-3d-printer-server/graphs/commit-activity)
7
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)
8
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D%2018.0.0-green.svg)](https://nodejs.org/en/download/)
9
+ [![Downloads](https://img.shields.io/npm/dm/mcp-3d-printer-server.svg)](https://www.npmjs.com/package/mcp-3d-printer-server)
10
+ [![GitHub stars](https://img.shields.io/github/stars/yourusername/mcp-3d-printer-server.svg?style=social&label=Star)](https://github.com/yourusername/mcp-3d-printer-server)
11
+
3
12
  ## Description
4
13
 
5
14
  This is a server that allows MCP users to connect with the API endpoints of these 3D Printers:
@@ -14,6 +23,8 @@ This is a server that allows MCP users to connect with the API endpoints of thes
14
23
 
15
24
  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
25
 
26
+ **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.
27
+
17
28
  ## Features
18
29
 
19
30
  - Get printer status (temperatures, print progress, etc.)
@@ -21,6 +32,19 @@ This server is a Model Context Protocol (MCP) server for connecting Claude with
21
32
  - Upload G-code files to the printer
22
33
  - Start, cancel, and monitor print jobs
23
34
  - Set printer temperatures
35
+ - Advanced STL file manipulation:
36
+ - Extend base for better adhesion
37
+ - Scale models uniformly or along specific axes
38
+ - Rotate models around any axis
39
+ - Translate (move) models
40
+ - Modify specific sections of STL files (top, bottom, center, or custom)
41
+ - Comprehensive STL analysis with detailed model information
42
+ - Generate multi-angle SVG visualizations of STL files
43
+ - Real-time progress reporting for long operations
44
+ - Error handling with detailed diagnostics
45
+ - Slice STL files to generate G-code
46
+ - Confirm temperature settings in G-code files
47
+ - Complete end-to-end workflow from STL modification to printing
24
48
 
25
49
  ## Installation
26
50
 
@@ -63,6 +87,11 @@ TEMP_DIR=/path/to/temp/dir
63
87
  # Bambu Labs specific configuration
64
88
  BAMBU_SERIAL=your_printer_serial
65
89
  BAMBU_TOKEN=your_access_token
90
+
91
+ # Slicer configuration
92
+ SLICER_TYPE=prusaslicer # Options: prusaslicer, cura, slic3r
93
+ SLICER_PATH=/path/to/slicer/executable
94
+ SLICER_PROFILE=/path/to/slicer/profile
66
95
  ```
67
96
 
68
97
  ## Usage with Claude Desktop
@@ -191,7 +220,169 @@ Creality Cloud is Creality's management system for their printers.
191
220
 
192
221
  ## Available Tools
193
222
 
194
- ### get_printer_status
223
+ ### STL Manipulation Tools
224
+
225
+ > **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.
226
+
227
+ #### get_stl_info
228
+
229
+ Get detailed information about an STL file, including dimensions, vertex count, and bounding box.
230
+
231
+ ```json
232
+ {
233
+ "stl_path": "/path/to/file.stl"
234
+ }
235
+ ```
236
+
237
+ #### extend_stl_base
238
+
239
+ Extend the base of an STL file by a specified amount.
240
+
241
+ ```json
242
+ {
243
+ "stl_path": "/path/to/file.stl",
244
+ "extension_inches": 2
245
+ }
246
+ ```
247
+
248
+ #### scale_stl
249
+
250
+ Scale an STL model uniformly or along specific axes.
251
+
252
+ ```json
253
+ {
254
+ "stl_path": "/path/to/file.stl",
255
+ "scale_factor": 1.5
256
+ }
257
+ ```
258
+
259
+ Or for non-uniform scaling:
260
+
261
+ ```json
262
+ {
263
+ "stl_path": "/path/to/file.stl",
264
+ "scale_x": 1.2,
265
+ "scale_y": 1.0,
266
+ "scale_z": 1.5
267
+ }
268
+ ```
269
+
270
+ #### rotate_stl
271
+
272
+ Rotate an STL model around specific axes (in degrees).
273
+
274
+ ```json
275
+ {
276
+ "stl_path": "/path/to/file.stl",
277
+ "rotate_x": 45,
278
+ "rotate_y": 0,
279
+ "rotate_z": 90
280
+ }
281
+ ```
282
+
283
+ #### translate_stl
284
+
285
+ Move an STL model along specific axes (in millimeters).
286
+
287
+ ```json
288
+ {
289
+ "stl_path": "/path/to/file.stl",
290
+ "translate_x": 10,
291
+ "translate_y": 5,
292
+ "translate_z": 0
293
+ }
294
+ ```
295
+
296
+ #### modify_stl_section
297
+
298
+ Apply a specific transformation to a selected section of an STL file. This allows for detailed modifications of specific parts of a model.
299
+
300
+ ```json
301
+ {
302
+ "stl_path": "/path/to/file.stl",
303
+ "section": "top",
304
+ "transformation_type": "scale",
305
+ "value_x": 1.5,
306
+ "value_y": 1.5,
307
+ "value_z": 1.5
308
+ }
309
+ ```
310
+
311
+ For custom section bounds:
312
+
313
+ ```json
314
+ {
315
+ "stl_path": "/path/to/file.stl",
316
+ "section": "custom",
317
+ "transformation_type": "rotate",
318
+ "value_x": 0,
319
+ "value_y": 0,
320
+ "value_z": 45,
321
+ "custom_min_x": -10,
322
+ "custom_min_y": 0,
323
+ "custom_min_z": -10,
324
+ "custom_max_x": 10,
325
+ "custom_max_y": 20,
326
+ "custom_max_z": 10
327
+ }
328
+ ```
329
+
330
+ #### generate_stl_visualization
331
+
332
+ Generate an SVG visualization of an STL file from multiple angles (front, side, top, and isometric views).
333
+
334
+ ```json
335
+ {
336
+ "stl_path": "/path/to/file.stl",
337
+ "width": 400,
338
+ "height": 400
339
+ }
340
+ ```
341
+
342
+ #### slice_stl
343
+
344
+ Slice an STL file to generate G-code.
345
+
346
+ ```json
347
+ {
348
+ "stl_path": "/path/to/file.stl",
349
+ "slicer_type": "prusaslicer",
350
+ "slicer_path": "/path/to/prusaslicer",
351
+ "slicer_profile": "/path/to/profile.ini"
352
+ }
353
+ ```
354
+
355
+ #### confirm_temperatures
356
+
357
+ Confirm temperature settings in a G-code file.
358
+
359
+ ```json
360
+ {
361
+ "gcode_path": "/path/to/file.gcode",
362
+ "extruder_temp": 200,
363
+ "bed_temp": 60
364
+ }
365
+ ```
366
+
367
+ #### process_and_print_stl
368
+
369
+ Process an STL file (extend base), slice it, confirm temperatures, and start printing.
370
+
371
+ ```json
372
+ {
373
+ "stl_path": "/path/to/file.stl",
374
+ "extension_inches": 2,
375
+ "extruder_temp": 200,
376
+ "bed_temp": 60,
377
+ "host": "192.168.1.100",
378
+ "type": "octoprint",
379
+ "api_key": "YOUR_API_KEY"
380
+ }
381
+ ```
382
+
383
+ ### Printer Control Tools
384
+
385
+ #### get_printer_status
195
386
 
196
387
  Get the current status of the 3D printer.
197
388
 
@@ -290,6 +481,7 @@ Set the temperature of a printer component.
290
481
 
291
482
  Here are some example commands you can give to Claude after connecting the MCP server:
292
483
 
484
+ ### Printer Control
293
485
  - "What's the current status of my 3D printer?"
294
486
  - "Show me the list of files on my printer."
295
487
  - "Upload this G-code to my printer: [G-code content]"
@@ -298,6 +490,22 @@ Here are some example commands you can give to Claude after connecting the MCP s
298
490
  - "Set the extruder temperature to 200°C."
299
491
  - "Set the bed temperature to 60°C."
300
492
 
493
+ ### STL Manipulation and Printing
494
+ - "Take this STL file and extend the base by 2 inches, then send to slicer and queue up in my printer."
495
+ - "Extend the base of model.stl by 1.5 inches."
496
+ - "Scale this STL file by 150% uniformly."
497
+ - "Scale model.stl to be twice as wide but keep the same height."
498
+ - "Rotate this model 90 degrees around the Z axis."
499
+ - "Move this STL model up by 5mm to create a gap underneath."
500
+ - "Can you modify just the top part of this model to make it 20% larger?"
501
+ - "Analyze this STL file and tell me its dimensions and details."
502
+ - "Generate a visualization of this STL file so I can see what it looks like."
503
+ - "Create SVG visualizations of my model from different angles."
504
+ - "Make the base of this model wider without changing its height."
505
+ - "Slice the modified STL file using PrusaSlicer."
506
+ - "Confirm that the temperatures in the G-code are 200°C for the extruder and 60°C for the bed."
507
+ - "Process this STL file, make the base 2 inches longer, slice it, and start printing, but confirm the temperatures first."
508
+
301
509
  ## Bambu Lab Printer Limitations
302
510
 
303
511
  Due to the nature of the Bambu Lab printer API, there are some limitations:
@@ -308,6 +516,45 @@ Due to the nature of the Bambu Lab printer API, there are some limitations:
308
516
 
309
517
  3. **File management**: Files must be uploaded to the "gcodes" directory on the printer.
310
518
 
519
+ ## Limitations and Considerations
520
+
521
+ ### Memory Usage
522
+ - **Large STL Files**: Processing large or complex STL files can consume significant memory. The entire STL geometry is loaded into memory during operations.
523
+ - **Multiple Operations**: Running multiple STL operations in sequence (especially on large files) may cause memory to accumulate if garbage collection doesn't keep up.
524
+ - **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.
525
+
526
+ ### STL Manipulation Limitations
527
+ - **Section Modification**: The section-specific modification feature works best on simpler geometries. Complex or non-manifold meshes may produce unexpected results.
528
+ - **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.
529
+ - **Error Handling**: While we've added robust error handling, some edge cases in complex STL files might still cause issues.
530
+
531
+ ### Visualization Limitations
532
+ - **SVG Representation**: The SVG visualization is a simplified schematic representation, not a true 3D render.
533
+ - **Complex Models**: For very complex models, the visualization may not accurately represent all details.
534
+
535
+ ### Performance Considerations
536
+ - **Slicing Operations**: External slicer processes can be CPU-intensive and may take considerable time for complex models.
537
+ - **Progress Reporting**: For large files, progress updates may appear to stall at certain processing stages.
538
+
539
+ ### Testing Recommendations
540
+ - Start with smaller STL files (< 10MB) to test functionality
541
+ - Monitor memory usage when processing large files
542
+ - Test modifications on simple geometries before attempting complex ones
543
+ - Consider running on a system with at least 4GB of available RAM for larger operations
544
+
545
+ ## Badges
546
+
547
+ | Badge | Description |
548
+ |-------|-------------|
549
+ | [![npm version](https://img.shields.io/npm/v/mcp-3d-printer-server.svg)](https://www.npmjs.com/package/mcp-3d-printer-server) | The current version of the package on npm |
550
+ | [![License: GPL-2.0](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) | This project is licensed under GPL-2.0 |
551
+ | [![TypeScript](https://img.shields.io/badge/TypeScript-4.9%2B-blue)](https://www.typescriptlang.org/) | This project is written in TypeScript 4.9+ |
552
+ | [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/yourusername/mcp-3d-printer-server/graphs/commit-activity) | This project is actively maintained |
553
+ | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com) | We welcome contributions via Pull Requests |
554
+ | [![Node.js Version](https://img.shields.io/badge/node-%3E%3D%2018.0.0-green.svg)](https://nodejs.org/en/download/) | Requires Node.js 18.0.0 or higher |
555
+ | [![Downloads](https://img.shields.io/npm/dm/mcp-3d-printer-server.svg)](https://www.npmjs.com/package/mcp-3d-printer-server) | Number of downloads per month from npm |
556
+ | [![GitHub stars](https://img.shields.io/github/stars/yourusername/mcp-3d-printer-server.svg?style=social&label=Star)](https://github.com/yourusername/mcp-3d-printer-server) | Number of GitHub stars this project has received |
557
+
311
558
  ## License
312
559
 
313
560
  GPL-2.0
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "mcp-3d-printer-server",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "MCP server for connecting Claude with 3D printer management systems",
5
5
  "main": "src/index.js",
6
+ "repository": "https://github.com/DMontgomery40/mcp-3d-printer-server",
6
7
  "type": "module",
7
8
  "scripts": {
8
- "start": "node src/index.js",
9
- "dev": "nodemon src/index.js",
10
- "test": "echo \"Error: no test specified\" && exit 1"
9
+ "start": "node dist/index.js",
10
+ "dev": "nodemon src/index.ts --exec \"npm run build && npm start\"",
11
+ "build": "tsc",
12
+ "test": "npm run build && node dist/test/stl-manipulator-test.js"
11
13
  },
12
14
  "bin": {
13
15
  "mcp-3d-printer-server": "./src/index.js"
@@ -31,10 +33,12 @@
31
33
  "axios": "^1.6.2",
32
34
  "bambu-js": "^2.2.2",
33
35
  "dotenv": "^16.3.1",
34
- "form-data": "^4.0.0"
36
+ "form-data": "^4.0.0",
37
+ "three": "^0.173.0"
35
38
  },
36
39
  "devDependencies": {
37
40
  "@types/node": "^18.0.0",
41
+ "@types/three": "^0.173.0",
38
42
  "nodemon": "^2.0.22"
39
43
  }
40
44
  }