bambu-printer-mcp 1.1.47 → 1.1.49

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 (45) hide show
  1. package/README.md +117 -3
  2. package/dist/blender-mcp-bridge.d.ts +15 -0
  3. package/dist/blender-mcp-bridge.js +21 -3
  4. package/dist/counterpart/info.d.ts +10 -0
  5. package/dist/counterpart/info.js +34 -0
  6. package/dist/counterpart/make-3mf.d.ts +16 -0
  7. package/dist/counterpart/make-3mf.js +219 -0
  8. package/dist/counterpart/progress.d.ts +28 -0
  9. package/dist/counterpart/progress.js +254 -0
  10. package/dist/counterpart/schemas.d.ts +322 -0
  11. package/dist/counterpart/schemas.js +124 -0
  12. package/dist/fusion-mcp-bridge.d.ts +182 -0
  13. package/dist/fusion-mcp-bridge.js +557 -0
  14. package/dist/index.js +192 -12
  15. package/dist/printers/bambu-stages.d.ts +7 -0
  16. package/dist/printers/bambu-stages.js +89 -0
  17. package/dist/printers/bambu.d.ts +76 -4
  18. package/dist/printers/bambu.js +298 -38
  19. package/dist/printers/camera-models.d.ts +7 -0
  20. package/dist/printers/camera-models.js +18 -0
  21. package/dist/safety/hms-messages.d.ts +42 -0
  22. package/dist/safety/hms-messages.js +6194 -0
  23. package/dist/safety/printer-state.d.ts +18 -0
  24. package/dist/safety/printer-state.js +3 -3
  25. package/dist/slicer/process-overrides.d.ts +12 -0
  26. package/dist/slicer/process-overrides.js +33 -0
  27. package/dist/slicer/remote-slicer.js +2 -0
  28. package/dist/stl/stl-manipulator.d.ts +2 -0
  29. package/dist/stl/stl-manipulator.js +19 -0
  30. package/package.json +1 -1
  31. package/src/blender-mcp-bridge.ts +22 -3
  32. package/src/counterpart/info.ts +36 -0
  33. package/src/counterpart/make-3mf.ts +220 -0
  34. package/src/counterpart/progress.ts +254 -0
  35. package/src/counterpart/schemas.ts +154 -0
  36. package/src/fusion-mcp-bridge.ts +545 -0
  37. package/src/index.ts +199 -12
  38. package/src/printers/bambu-stages.ts +90 -0
  39. package/src/printers/bambu.ts +316 -38
  40. package/src/printers/camera-models.ts +18 -0
  41. package/src/safety/hms-messages.ts +6198 -0
  42. package/src/safety/printer-state.ts +4 -4
  43. package/src/slicer/process-overrides.ts +42 -0
  44. package/src/slicer/remote-slicer.ts +2 -0
  45. package/src/stl/stl-manipulator.ts +22 -0
@@ -0,0 +1,124 @@
1
+ /**
2
+ * The Counterpart tool contract (counterpart/1): output schemas shared by the
3
+ * tool list and the tests. mcp-3D-printer-server declares the same results.
4
+ * Extra properties stay allowed so either server can add fields without
5
+ * breaking clients that validate against an older schema.
6
+ */
7
+ export const COUNTERPART_CONTRACT = "counterpart/1";
8
+ export const PRINTER_KINDS = ["bambu", "octoprint", "klipper", "prusa", "duet", "repetier", "creality"];
9
+ export const PRINT_STATES = ["idle", "preparing", "printing", "paused", "finished", "failed", "cancelled", "offline", "busy"];
10
+ export const PROBLEM_SEVERITIES = ["fatal", "error", "warning", "info"];
11
+ const temperature = {
12
+ type: "object",
13
+ properties: { actual: { type: "number" }, target: { type: "number" } },
14
+ required: ["actual", "target"],
15
+ };
16
+ export const PRINTER_INFO_OUTPUT_SCHEMA = {
17
+ type: "object",
18
+ properties: {
19
+ contract: { type: "string", const: COUNTERPART_CONTRACT },
20
+ server: {
21
+ type: "object",
22
+ properties: { name: { type: "string" }, version: { type: "string" } },
23
+ required: ["name", "version"],
24
+ },
25
+ printer: {
26
+ type: "object",
27
+ properties: {
28
+ kind: { type: "string", enum: [...PRINTER_KINDS] },
29
+ model: { type: "string" },
30
+ serial: { type: "string" },
31
+ host: { type: "string" },
32
+ name: { type: "string" },
33
+ },
34
+ required: ["kind", "host"],
35
+ },
36
+ capabilities: {
37
+ type: "object",
38
+ properties: {
39
+ progress: { type: "boolean" },
40
+ layers: { type: "boolean" },
41
+ camera: { type: "string", enum: ["bambu-tcp", "rtsp", "http-snapshot", "none"] },
42
+ filaments: { type: "string", enum: ["ams", "single", "none"] },
43
+ pause: { type: "boolean" },
44
+ resume: { type: "boolean" },
45
+ cancel: { type: "boolean" },
46
+ print3mf: { type: "boolean" },
47
+ gcode: { type: "boolean" },
48
+ },
49
+ required: ["progress", "layers", "camera", "filaments", "pause", "resume", "cancel", "print3mf", "gcode"],
50
+ },
51
+ },
52
+ required: ["contract", "server", "printer", "capabilities"],
53
+ };
54
+ export const PRINT_PROGRESS_OUTPUT_SCHEMA = {
55
+ type: "object",
56
+ properties: {
57
+ contract: { type: "string", const: COUNTERPART_CONTRACT },
58
+ observedAt: { type: "string", description: "When the printer reported this (MQTT report time), ISO 8601." },
59
+ state: { type: "string", enum: [...PRINT_STATES] },
60
+ job: {
61
+ type: "object",
62
+ properties: {
63
+ name: { type: "string" },
64
+ id: { type: "string" },
65
+ progress: { type: "number", minimum: 0, maximum: 100 },
66
+ elapsedSec: { type: "number", minimum: 0 },
67
+ remainingSec: { type: "number", minimum: 0 },
68
+ layer: { type: "integer", minimum: 0 },
69
+ totalLayers: { type: "integer", minimum: 0 },
70
+ stage: { type: "string" },
71
+ },
72
+ required: ["name"],
73
+ },
74
+ temps: {
75
+ type: "object",
76
+ properties: { nozzle: temperature, bed: temperature, chamber: { type: "number" } },
77
+ },
78
+ activeFilament: {
79
+ type: "object",
80
+ properties: {
81
+ slot: { type: "string" },
82
+ material: { type: "string" },
83
+ color: { type: "string", pattern: "^#[0-9A-Fa-f]{6}$" },
84
+ },
85
+ },
86
+ problems: {
87
+ type: "array",
88
+ items: {
89
+ type: "object",
90
+ properties: {
91
+ code: { type: "string" },
92
+ severity: { type: "string", enum: [...PROBLEM_SEVERITIES] },
93
+ message: { type: "string" },
94
+ url: { type: "string" },
95
+ },
96
+ required: ["code", "severity", "message"],
97
+ },
98
+ },
99
+ },
100
+ required: ["contract", "observedAt", "state", "problems"],
101
+ };
102
+ export const MAKE_3MF_OUTPUT_SCHEMA = {
103
+ type: "object",
104
+ properties: {
105
+ contract: { type: "string", const: COUNTERPART_CONTRACT },
106
+ path: { type: "string", description: "Absolute path of the written 3MF." },
107
+ objects: { type: "integer", minimum: 1, description: "Objects in the 3MF: one assembly." },
108
+ filaments: { type: "integer", minimum: 1, description: "Highest filament number any part uses; pass that many load_filaments to slice_stl." },
109
+ parts: {
110
+ type: "array",
111
+ items: {
112
+ type: "object",
113
+ properties: {
114
+ name: { type: "string" },
115
+ stl_path: { type: "string" },
116
+ filament: { type: "integer", minimum: 1 },
117
+ triangles: { type: "integer", minimum: 1 },
118
+ },
119
+ required: ["name", "stl_path", "filament", "triangles"],
120
+ },
121
+ },
122
+ },
123
+ required: ["contract", "path", "objects", "filaments", "parts"],
124
+ };
@@ -0,0 +1,182 @@
1
+ import { type CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ /** The faust-machines commit the setup installs; move it only after the PRD §8.9 acceptance check passes. */
3
+ export declare const FUSION_MCP_PIN = "19b9f1e95192";
4
+ /** PRD §8.9: Blender's MCP add-on holds the add-in's own default, 9876, so Counterpart's Fusion uses 9877. */
5
+ export declare const FUSION_ADDIN_DEFAULT_PORT = 9877;
6
+ export declare const FUSION_MCP_DEFAULT_ARGS: readonly string[];
7
+ type Arguments = Record<string, unknown>;
8
+ /** The machine-facing seams: tests replace them with fakes. */
9
+ export type FusionSystem = {
10
+ platform: NodeJS.Platform;
11
+ /** Whether the Fusion360MCP add-in answers its ping on host:port within timeoutMs. */
12
+ addinAnswers(host: string, port: number, timeoutMs: number): Promise<boolean>;
13
+ /** Whether an Autodesk Fusion process is running. */
14
+ fusionRunning(): Promise<boolean>;
15
+ /** Start Autodesk Fusion with its add-in listening on port. */
16
+ launch(port: number): Promise<void>;
17
+ sleep(ms: number): Promise<void>;
18
+ launchWaitMs: number;
19
+ };
20
+ /**
21
+ * The add-in reads FUSION_MCP_PORT from Fusion's environment at the pin
22
+ * (addon/Fusion360MCP.py), and an app started from the Dock gets no shell
23
+ * environment, so the launch passes the port the bridge probes. `open --env`
24
+ * applies only when it starts the app, which is the only time this runs.
25
+ */
26
+ export declare function fusionLaunchArguments(port: number): string[];
27
+ export declare const defaultFusionSystem: FusionSystem;
28
+ export declare const FUSION_STATUS_OUTPUT_SCHEMA: {
29
+ type: "object";
30
+ properties: {
31
+ configured: {
32
+ type: string;
33
+ description: string;
34
+ };
35
+ connected: {
36
+ type: string;
37
+ description: string;
38
+ };
39
+ addinReachable: {
40
+ type: string;
41
+ description: string;
42
+ };
43
+ fusionRunning: {
44
+ type: string;
45
+ };
46
+ tools: {
47
+ type: string;
48
+ items: {
49
+ type: string;
50
+ properties: {
51
+ name: {
52
+ type: string;
53
+ };
54
+ };
55
+ required: string[];
56
+ };
57
+ };
58
+ launched: {
59
+ type: string;
60
+ description: string;
61
+ };
62
+ transport: {
63
+ type: string;
64
+ };
65
+ pin: {
66
+ type: string;
67
+ description: string;
68
+ };
69
+ server: {
70
+ type: string;
71
+ };
72
+ error: {
73
+ type: string;
74
+ };
75
+ };
76
+ required: string[];
77
+ };
78
+ /** fusion_mcp_call passes the remote result through: its structuredContent, else an empty object. */
79
+ export declare const FUSION_CALL_OUTPUT_SCHEMA: {
80
+ type: "object";
81
+ };
82
+ export declare const FUSION_NEW_DESIGN_OUTPUT_SCHEMA: {
83
+ type: "object";
84
+ properties: {
85
+ status: {
86
+ type: string;
87
+ const: string;
88
+ };
89
+ document: {
90
+ type: string;
91
+ };
92
+ parametric: {
93
+ type: string;
94
+ };
95
+ };
96
+ required: string[];
97
+ };
98
+ export declare const FUSION_EXPORT_OUTPUT_SCHEMA: {
99
+ type: "object";
100
+ properties: {
101
+ status: {
102
+ type: string;
103
+ const: string;
104
+ };
105
+ stl: {
106
+ type: string;
107
+ description: string;
108
+ };
109
+ f3d: {
110
+ type: string;
111
+ description: string;
112
+ };
113
+ parameters: {
114
+ type: string;
115
+ description: string;
116
+ };
117
+ body: {
118
+ type: string;
119
+ };
120
+ triangles: {
121
+ type: string;
122
+ minimum: number;
123
+ };
124
+ bytes: {
125
+ type: string;
126
+ minimum: number;
127
+ };
128
+ parameterCount: {
129
+ type: string;
130
+ minimum: number;
131
+ };
132
+ boundingBox: {
133
+ type: string;
134
+ description: string;
135
+ };
136
+ stlUnits: {
137
+ type: string;
138
+ enum: string[];
139
+ description: string;
140
+ };
141
+ fusionSizeMm: {
142
+ type: string;
143
+ items: {
144
+ type: string;
145
+ };
146
+ description: string;
147
+ };
148
+ warnings: {
149
+ type: string;
150
+ items: {
151
+ type: string;
152
+ };
153
+ };
154
+ };
155
+ required: string[];
156
+ };
157
+ export declare class FusionMcpBridge {
158
+ private readonly system;
159
+ private live?;
160
+ private connecting?;
161
+ constructor(system?: FusionSystem);
162
+ /** Close the stdio session, if any; the next call reconnects. */
163
+ close(): Promise<void>;
164
+ private open;
165
+ /**
166
+ * The live session, starting one if needed. A start is shared by every caller
167
+ * that arrives while it runs, so it has its own deadline (the longer of the
168
+ * caller's and FUSION_MCP_TIMEOUT_MS) and no caller's signal; each caller
169
+ * waits on it with its own deadline and cancellation.
170
+ */
171
+ private session;
172
+ /** One request with a deadline. An interrupted request is never retried; the session is closed instead. */
173
+ private request;
174
+ private invoke;
175
+ /** A faust tool that must succeed; its failure text is Fusion's own and contains no secrets of ours. */
176
+ private must;
177
+ status(args: Arguments, signal?: AbortSignal): Promise<Record<string, unknown>>;
178
+ call(args: Arguments, signal?: AbortSignal): Promise<CallToolResult>;
179
+ newDesign(args: Arguments, signal?: AbortSignal): Promise<Record<string, unknown>>;
180
+ export(args: Arguments, signal?: AbortSignal): Promise<Record<string, unknown>>;
181
+ }
182
+ export {};