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.
- package/CHANGELOG.md +228 -0
- package/CONTRIBUTORS.md +49 -0
- package/README.md +529 -739
- package/dist/3mf_parser.js +8 -8
- package/dist/blender-mcp-bridge.d.ts +11 -0
- package/dist/blender-mcp-bridge.js +661 -0
- package/dist/fulu-orca.js +29 -5
- package/dist/index.js +752 -212
- package/dist/printers/bambu-node-guard.d.ts +2 -0
- package/dist/printers/bambu-node-guard.js +38 -0
- package/dist/printers/bambu.d.ts +53 -7
- package/dist/printers/bambu.js +420 -120
- package/dist/printers/creality.d.ts +15 -6
- package/dist/printers/creality.js +42 -9
- package/dist/printers/duet.d.ts +11 -6
- package/dist/printers/duet.js +57 -34
- package/dist/printers/generic-base.d.ts +69 -0
- package/dist/printers/generic-base.js +209 -0
- package/dist/printers/klipper.d.ts +17 -6
- package/dist/printers/klipper.js +63 -16
- package/dist/printers/octoprint.d.ts +18 -6
- package/dist/printers/octoprint.js +64 -9
- package/dist/printers/printer-factory.d.ts +11 -2
- package/dist/printers/printer-factory.js +9 -8
- package/dist/printers/prusa.d.ts +14 -6
- package/dist/printers/prusa.js +56 -9
- package/dist/printers/repetier.d.ts +18 -6
- package/dist/printers/repetier.js +48 -6
- package/dist/safety/archive.d.ts +11 -0
- package/dist/safety/archive.js +214 -0
- package/dist/safety/artifact.d.ts +6 -0
- package/dist/safety/artifact.js +66 -0
- package/dist/safety/confirmation.d.ts +22 -0
- package/dist/safety/confirmation.js +43 -0
- package/dist/safety/expected-peaks.d.ts +24 -0
- package/dist/safety/expected-peaks.js +24 -0
- package/dist/safety/gcode-thermal.d.ts +64 -0
- package/dist/safety/gcode-thermal.js +382 -0
- package/dist/safety/limits.d.ts +31 -0
- package/dist/safety/limits.js +105 -0
- package/dist/safety/print-file.d.ts +25 -0
- package/dist/safety/print-file.js +517 -0
- package/dist/safety/printer-state.d.ts +51 -0
- package/dist/safety/printer-state.js +365 -0
- package/dist/slicer/bambu-cli.d.ts +110 -0
- package/dist/slicer/bambu-cli.js +547 -0
- package/dist/slicer/profile-flatten.d.ts +104 -0
- package/dist/slicer/profile-flatten.js +676 -0
- package/dist/slicer/run-slicer.d.ts +18 -0
- package/dist/slicer/run-slicer.js +102 -0
- package/dist/slicer/slicer-error.d.ts +27 -0
- package/dist/slicer/slicer-error.js +53 -0
- package/dist/slicer/templates.d.ts +126 -0
- package/dist/slicer/templates.js +255 -0
- package/dist/stl/stl-manipulator.d.ts +25 -3
- package/dist/stl/stl-manipulator.js +214 -232
- package/package.json +30 -14
- package/server.json +29 -0
- package/src/3mf_parser.ts +8 -8
- package/src/blender-mcp-bridge.ts +611 -0
- package/src/fulu-orca.ts +36 -6
- package/src/index.ts +888 -255
- package/src/printers/bambu-node-guard.ts +44 -0
- package/src/printers/bambu.ts +458 -158
- package/src/printers/creality.ts +40 -9
- package/src/printers/duet.ts +64 -53
- package/src/printers/generic-base.ts +286 -0
- package/src/printers/klipper.ts +83 -28
- package/src/printers/octoprint.ts +74 -21
- package/src/printers/printer-factory.ts +21 -11
- package/src/printers/prusa.ts +53 -10
- package/src/printers/repetier.ts +55 -17
- package/src/safety/archive.ts +181 -0
- package/src/safety/artifact.ts +58 -0
- package/src/safety/confirmation.ts +56 -0
- package/src/safety/expected-peaks.ts +47 -0
- package/src/safety/gcode-thermal.ts +404 -0
- package/src/safety/limits.ts +98 -0
- package/src/safety/print-file.ts +354 -0
- package/src/safety/printer-state.ts +339 -0
- package/src/slicer/bambu-cli.ts +633 -0
- package/src/slicer/profile-flatten.ts +830 -0
- package/src/slicer/run-slicer.ts +126 -0
- package/src/slicer/slicer-error.ts +72 -0
- package/src/slicer/templates.ts +288 -0
- package/src/stl/stl-manipulator.ts +247 -275
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unpatched bambu-node 3.22.21 parses every MQTT report in an async listener and
|
|
3
|
+
* throws from it for printers or state transitions it does not model: H2S/H2D/
|
|
4
|
+
* H2C/H2D Pro/P2S serial prefixes, a get_version reply without an ota module, and
|
|
5
|
+
* transitions such as PAUSE -> IDLE after a cancel. Those throws become unhandled
|
|
6
|
+
* promise rejections, which terminate Node by default. bambu-printer-mcp avoids
|
|
7
|
+
* this with a postinstall patch; this package does not install one.
|
|
8
|
+
*
|
|
9
|
+
* Safety checks here never rely on bambu-node's model or job tracking: they read
|
|
10
|
+
* fresh raw MQTT reports. Only these exact internal errors originating inside
|
|
11
|
+
* bambu-node are logged and ignored. Every other unhandled rejection is rethrown,
|
|
12
|
+
* preserving Node's default crash behavior.
|
|
13
|
+
*/
|
|
14
|
+
const KNOWN_INTERNAL_ERRORS = new Set([
|
|
15
|
+
"Printer model not supported!",
|
|
16
|
+
"OTA module version data not found, unable to determine printer model!",
|
|
17
|
+
"Edge case detected while updating printer status!",
|
|
18
|
+
]);
|
|
19
|
+
let installed = false;
|
|
20
|
+
export function isKnownBambuNodeInternalError(reason) {
|
|
21
|
+
return (reason instanceof Error &&
|
|
22
|
+
KNOWN_INTERNAL_ERRORS.has(reason.message) &&
|
|
23
|
+
typeof reason.stack === "string" &&
|
|
24
|
+
/[\\/]bambu-node[\\/]/.test(reason.stack));
|
|
25
|
+
}
|
|
26
|
+
export function installBambuNodeRejectionGuard() {
|
|
27
|
+
if (installed)
|
|
28
|
+
return;
|
|
29
|
+
installed = true;
|
|
30
|
+
process.on("unhandledRejection", (reason) => {
|
|
31
|
+
if (isKnownBambuNodeInternalError(reason)) {
|
|
32
|
+
console.error(`[bambu-node] Ignored internal status-tracking error: ${reason.message} ` +
|
|
33
|
+
"Safety checks use fresh raw MQTT reports instead.");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
throw reason;
|
|
37
|
+
});
|
|
38
|
+
}
|
package/dist/printers/bambu.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { PrinterImplementation } from "../types.js";
|
|
2
|
-
|
|
2
|
+
import { type PrintFileInspection } from "../safety/print-file.js";
|
|
3
|
+
import { type ConfirmHardware } from "../safety/confirmation.js";
|
|
4
|
+
import { type ExpectedPeakTemperatures, type PrintSafetyOptions } from "../safety/expected-peaks.js";
|
|
5
|
+
export interface BambuPrintOptionsInternal {
|
|
3
6
|
projectName: string;
|
|
4
7
|
filePath: string;
|
|
8
|
+
bambuModel?: string;
|
|
9
|
+
/** Requested nozzle diameters; compared with the sliced file when supplied. */
|
|
10
|
+
nozzleDiameters?: number[];
|
|
5
11
|
useAMS?: boolean;
|
|
6
12
|
plateIndex?: number;
|
|
7
13
|
bedType?: string;
|
|
@@ -10,18 +16,39 @@ interface BambuPrintOptionsInternal {
|
|
|
10
16
|
vibrationCalibration?: boolean;
|
|
11
17
|
layerInspect?: boolean;
|
|
12
18
|
timelapse?: boolean;
|
|
19
|
+
/** Positional mapping: project filament position -> absolute AMS tray (254 = external spool). */
|
|
13
20
|
amsMapping?: number[];
|
|
14
21
|
md5?: string;
|
|
22
|
+
expectedPeaks?: ExpectedPeakTemperatures;
|
|
15
23
|
}
|
|
24
|
+
export type BambuSafetyOptions = PrintSafetyOptions;
|
|
16
25
|
export declare class BambuImplementation extends PrinterImplementation {
|
|
26
|
+
private readonly confirm?;
|
|
17
27
|
private printerStore;
|
|
18
|
-
constructor(apiClient: any);
|
|
28
|
+
constructor(apiClient: any, confirm?: ConfirmHardware | undefined);
|
|
29
|
+
confirmHardwareAction(message: string, physicalCheck?: boolean): Promise<void>;
|
|
30
|
+
private finishedJobIdentity;
|
|
31
|
+
confirmPrintPreflight(serial: string, status: any, inspection: PrintFileInspection): Promise<string | undefined>;
|
|
32
|
+
assertBedClearance(status: any, confirmedFinishedJob: string | undefined): void;
|
|
19
33
|
private getPrinter;
|
|
34
|
+
/** Safety reads never use the display cache or configured-serial model inference. */
|
|
35
|
+
getSafetyStatus(host: string, serial: string, token: string): Promise<any>;
|
|
36
|
+
/** Raw gcode_file printing cannot remap spools: verify the material already at the nozzle. */
|
|
37
|
+
private validateLoadedGcodeState;
|
|
20
38
|
private resolveProjectFileMetadata;
|
|
21
39
|
getStatus(host: string, port: string, apiKey: string): Promise<any>;
|
|
22
40
|
print3mf(host: string, serial: string, token: string, options: BambuPrintOptionsInternal): Promise<any>;
|
|
41
|
+
private print3mfPrepared;
|
|
42
|
+
/**
|
|
43
|
+
* A published print command is not proof the printer took it. Listen to the
|
|
44
|
+
* reports the printer pushes anyway (no extra pushall polling on weak P1
|
|
45
|
+
* boards): a new command-verification HMS means the firmware refused the
|
|
46
|
+
* command; PREPARE/SLICING/RUNNING means it started. Attach before publishing.
|
|
47
|
+
*/
|
|
48
|
+
private watchDispatch;
|
|
49
|
+
/** Stop is never gated or queued behind pending checked operations. */
|
|
23
50
|
cancelJob(host: string, port: string, apiKey: string): Promise<any>;
|
|
24
|
-
setTemperature(host: string, port: string, apiKey: string, component: string, temperature:
|
|
51
|
+
setTemperature(host: string, port: string, apiKey: string, component: string, temperature: unknown, options?: BambuSafetyOptions): Promise<{
|
|
25
52
|
status: string;
|
|
26
53
|
message: string;
|
|
27
54
|
command: string;
|
|
@@ -34,12 +61,32 @@ export declare class BambuImplementation extends PrinterImplementation {
|
|
|
34
61
|
name: string;
|
|
35
62
|
exists: boolean;
|
|
36
63
|
}>;
|
|
37
|
-
uploadFile(host: string, port: string, apiKey: string, filePath: string, filename: string, print: boolean): Promise<
|
|
38
|
-
|
|
64
|
+
uploadFile(host: string, port: string, apiKey: string, filePath: string, filename: string, print: boolean, options?: BambuSafetyOptions): Promise<{
|
|
65
|
+
status: string;
|
|
66
|
+
uploaded: boolean;
|
|
67
|
+
printRequested: boolean;
|
|
68
|
+
dispatch: "started" | "unconfirmed";
|
|
69
|
+
remotePath: string;
|
|
70
|
+
sha256: string;
|
|
71
|
+
message: string;
|
|
72
|
+
} | {
|
|
73
|
+
status: string;
|
|
74
|
+
uploaded: boolean;
|
|
75
|
+
remotePath: string;
|
|
76
|
+
printRequested: boolean;
|
|
77
|
+
}>;
|
|
78
|
+
private printRawPrepared;
|
|
79
|
+
startJob(host: string, port: string, apiKey: string, filename: string, options?: BambuSafetyOptions): Promise<{
|
|
39
80
|
status: string;
|
|
81
|
+
uploaded: boolean;
|
|
82
|
+
printRequested: boolean;
|
|
83
|
+
dispatch: "started" | "unconfirmed";
|
|
84
|
+
remotePath: string;
|
|
85
|
+
sha256: string;
|
|
40
86
|
message: string;
|
|
41
|
-
file: string;
|
|
42
87
|
}>;
|
|
88
|
+
private ftpsOptions;
|
|
89
|
+
private ftpDownload;
|
|
43
90
|
/**
|
|
44
91
|
* Upload a file to the printer via FTP using basic-ftp directly.
|
|
45
92
|
* Bypasses bambu-js's sendFile which has a double-path bug (ensureDir CDs
|
|
@@ -50,4 +97,3 @@ export declare class BambuImplementation extends PrinterImplementation {
|
|
|
50
97
|
private extractBambuCredentials;
|
|
51
98
|
disconnectAll(): Promise<void>;
|
|
52
99
|
}
|
|
53
|
-
export {};
|