mcp-3d-printer-server 1.2.5 → 1.2.11

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/CONTRIBUTORS.md +49 -0
  3. package/README.md +529 -739
  4. package/dist/3mf_parser.js +8 -8
  5. package/dist/blender-mcp-bridge.d.ts +11 -0
  6. package/dist/blender-mcp-bridge.js +661 -0
  7. package/dist/fulu-orca.js +29 -5
  8. package/dist/index.js +752 -212
  9. package/dist/printers/bambu-node-guard.d.ts +2 -0
  10. package/dist/printers/bambu-node-guard.js +38 -0
  11. package/dist/printers/bambu.d.ts +53 -7
  12. package/dist/printers/bambu.js +420 -120
  13. package/dist/printers/creality.d.ts +15 -6
  14. package/dist/printers/creality.js +42 -9
  15. package/dist/printers/duet.d.ts +11 -6
  16. package/dist/printers/duet.js +57 -34
  17. package/dist/printers/generic-base.d.ts +69 -0
  18. package/dist/printers/generic-base.js +209 -0
  19. package/dist/printers/klipper.d.ts +17 -6
  20. package/dist/printers/klipper.js +63 -16
  21. package/dist/printers/octoprint.d.ts +18 -6
  22. package/dist/printers/octoprint.js +64 -9
  23. package/dist/printers/printer-factory.d.ts +11 -2
  24. package/dist/printers/printer-factory.js +9 -8
  25. package/dist/printers/prusa.d.ts +14 -6
  26. package/dist/printers/prusa.js +56 -9
  27. package/dist/printers/repetier.d.ts +18 -6
  28. package/dist/printers/repetier.js +48 -6
  29. package/dist/safety/archive.d.ts +11 -0
  30. package/dist/safety/archive.js +214 -0
  31. package/dist/safety/artifact.d.ts +6 -0
  32. package/dist/safety/artifact.js +66 -0
  33. package/dist/safety/confirmation.d.ts +22 -0
  34. package/dist/safety/confirmation.js +43 -0
  35. package/dist/safety/expected-peaks.d.ts +24 -0
  36. package/dist/safety/expected-peaks.js +24 -0
  37. package/dist/safety/gcode-thermal.d.ts +64 -0
  38. package/dist/safety/gcode-thermal.js +382 -0
  39. package/dist/safety/limits.d.ts +31 -0
  40. package/dist/safety/limits.js +105 -0
  41. package/dist/safety/print-file.d.ts +25 -0
  42. package/dist/safety/print-file.js +517 -0
  43. package/dist/safety/printer-state.d.ts +51 -0
  44. package/dist/safety/printer-state.js +365 -0
  45. package/dist/slicer/bambu-cli.d.ts +110 -0
  46. package/dist/slicer/bambu-cli.js +547 -0
  47. package/dist/slicer/profile-flatten.d.ts +104 -0
  48. package/dist/slicer/profile-flatten.js +676 -0
  49. package/dist/slicer/run-slicer.d.ts +18 -0
  50. package/dist/slicer/run-slicer.js +102 -0
  51. package/dist/slicer/slicer-error.d.ts +27 -0
  52. package/dist/slicer/slicer-error.js +53 -0
  53. package/dist/slicer/templates.d.ts +126 -0
  54. package/dist/slicer/templates.js +255 -0
  55. package/dist/stl/stl-manipulator.d.ts +25 -3
  56. package/dist/stl/stl-manipulator.js +214 -232
  57. package/package.json +30 -14
  58. package/server.json +29 -0
  59. package/src/3mf_parser.ts +8 -8
  60. package/src/blender-mcp-bridge.ts +611 -0
  61. package/src/fulu-orca.ts +36 -6
  62. package/src/index.ts +888 -255
  63. package/src/printers/bambu-node-guard.ts +44 -0
  64. package/src/printers/bambu.ts +458 -158
  65. package/src/printers/creality.ts +40 -9
  66. package/src/printers/duet.ts +64 -53
  67. package/src/printers/generic-base.ts +286 -0
  68. package/src/printers/klipper.ts +83 -28
  69. package/src/printers/octoprint.ts +74 -21
  70. package/src/printers/printer-factory.ts +21 -11
  71. package/src/printers/prusa.ts +53 -10
  72. package/src/printers/repetier.ts +55 -17
  73. package/src/safety/archive.ts +181 -0
  74. package/src/safety/artifact.ts +58 -0
  75. package/src/safety/confirmation.ts +56 -0
  76. package/src/safety/expected-peaks.ts +47 -0
  77. package/src/safety/gcode-thermal.ts +404 -0
  78. package/src/safety/limits.ts +98 -0
  79. package/src/safety/print-file.ts +354 -0
  80. package/src/safety/printer-state.ts +339 -0
  81. package/src/slicer/bambu-cli.ts +633 -0
  82. package/src/slicer/profile-flatten.ts +830 -0
  83. package/src/slicer/run-slicer.ts +126 -0
  84. package/src/slicer/slicer-error.ts +72 -0
  85. package/src/slicer/templates.ts +288 -0
  86. package/src/stl/stl-manipulator.ts +247 -275
  87. package/dist/index.js.map +0 -1
package/src/fulu-orca.ts CHANGED
@@ -78,6 +78,23 @@ const FULU_PRINT_RPC_METHODS = new Set([
78
78
  "net.start_sdcard_print",
79
79
  ]);
80
80
 
81
+ /**
82
+ * Agent/session/account bootstrap methods. They do not address a printer, so
83
+ * they remain available with allow_mutating_method=true. Every other method
84
+ * outside the read-only allowlist is refused: raw print starts, raw MQTT
85
+ * messages, file transfers and unknown methods would bypass the inspected
86
+ * print, heating and printer-state gate.
87
+ */
88
+ const SESSION_MUTATING_METHODS = new Set([
89
+ "net.create_agent",
90
+ "net.start",
91
+ "net.init_log",
92
+ "net.set_config_dir",
93
+ "net.set_country_code",
94
+ "net.connect_server",
95
+ "net.change_user",
96
+ ]);
97
+
81
98
  export function isFuluPrintRpcMethod(method: string): boolean {
82
99
  return FULU_PRINT_RPC_METHODS.has(method.trim());
83
100
  }
@@ -501,15 +518,25 @@ export async function invokeFuluBridgeRpc(options: FuluBridgeRpcOptions): Promis
501
518
  const readOnly = isReadOnlyBridgeMethod(method);
502
519
  const printMethod = isFuluPrintRpcMethod(method);
503
520
 
504
- if (!readOnly && !options.allowMutatingMethod) {
521
+ if (printMethod) {
505
522
  throw new Error(
506
- `FULU bridge method "${method}" may mutate printer, account, or cloud state. ` +
507
- "Pass allow_mutating_method=true only when you intend to perform that action."
523
+ `Print safety: raw FULU bridge print method "${method}" is disabled because it would start an uninspected job ` +
524
+ "without the thermal, model, nozzle, printer-state and human-confirmation checks. Use print_3mf for a checked LAN print."
525
+ );
526
+ }
527
+
528
+ if (!readOnly && !SESSION_MUTATING_METHODS.has(method)) {
529
+ throw new Error(
530
+ `Print safety: raw FULU bridge method "${method}" is not in the verified allowlist. Raw printer messages, ` +
531
+ "file transfers and unknown methods could bypass the print and heating safety gate. Use the dedicated printer tools instead."
508
532
  );
509
533
  }
510
534
 
511
- if (printMethod && !options.bambuModel?.trim()) {
512
- throw new Error("bambu_model is required for FULU BambuNetwork print RPC methods.");
535
+ if (!readOnly && !options.allowMutatingMethod) {
536
+ throw new Error(
537
+ `FULU bridge method "${method}" may mutate account, session, or cloud state. ` +
538
+ "Pass allow_mutating_method=true only when you intend to perform that action."
539
+ );
513
540
  }
514
541
 
515
542
  const command = options.bridgeCommand || process.env.FULU_BAMBU_BRIDGE_COMMAND || "";
@@ -590,11 +617,14 @@ export async function inspectFuluOrcaSetup(options: FuluOrcaSetupOptions): Promi
590
617
  safeByDefault: true,
591
618
  readOnlyMethods: Array.from(READ_ONLY_BRIDGE_METHODS),
592
619
  readOnlyNetPrefixes: READ_ONLY_NET_PREFIXES,
593
- printMethodsRequireBambuModel: Array.from(FULU_PRINT_RPC_METHODS),
620
+ sessionMethodsRequireAllowMutating: Array.from(SESSION_MUTATING_METHODS),
621
+ disabledPrintMethods: Array.from(FULU_PRINT_RPC_METHODS),
622
+ otherMethods: "disabled: raw printer messages, file transfers and unknown methods bypass the safety gate",
594
623
  },
595
624
  notes: [
596
625
  "Slicing support uses FULU OrcaSlicer-bambulab CLI output as a sliced 3MF.",
597
626
  "Bambu print start still enforces BAMBU_MODEL before generating or sending project G-code.",
627
+ "Raw bridge print methods are disabled; print_3mf inspects the exact plate, checks the live printer and asks for human confirmation.",
598
628
  "The FULU BambuNetwork bridge is a separate runtime from the LAN MQTT/FTPS path; use bridge probing to verify that runtime before relying on cloud behavior.",
599
629
  "FULU macOS release bundles may ship the bridge dylib and host shims before the Linux plugin .so payload is present; missing linux-plugin entries mean the slicer can still be tested, but the BambuNetwork bridge is not fully ready.",
600
630
  ],