bambu-printer-mcp 1.0.8 → 1.1.4

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/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # bambu-printer-mcp
2
2
 
3
- > **Thank you, [FULU Foundation](https://github.com/FULU-Foundation/OrcaSlicer-bambulab) and [Louis Rossmann](https://www.youtube.com/watch?v=1jhRqgHxEP8).** This project stands with printer owners, repair rights, and open-source developers who should be able to build interoperable tools without being bullied out of serving their communities. FULU's OrcaSlicer-bambulab fork is a first-class slicer target here.
4
-
5
3
  [![npm version](https://img.shields.io/npm/v/bambu-printer-mcp.svg)](https://www.npmjs.com/package/bambu-printer-mcp)
6
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)
7
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue)](https://www.typescriptlang.org/)
@@ -13,6 +11,37 @@ A Bambu Lab-focused MCP server for controlling Bambu printers, manipulating STL
13
11
 
14
12
  This is a stripped-down, Bambu-only fork of [mcp-3D-printer-server](https://github.com/DMontgomery40/mcp-3D-printer-server). All OctoPrint, Klipper, Duet, Repetier, Prusa Connect, and Creality Cloud support has been removed. What remains is a focused, lean implementation for Bambu Lab hardware.
15
13
 
14
+ Local handoff note: see [REMOTE-DEPLOYMENT.md](./REMOTE-DEPLOYMENT.md) for the custom H2D/H2S/H2C patches, per-printer MCP split, and remote deployment plan used in this clone.
15
+
16
+ ---
17
+
18
+ ## What's new in bambu-printer-mcp
19
+
20
+ This fork adds a substantial set of printer control tools beyond the upstream `mcp-3D-printer-server`. Everything listed below is unique to this package.
21
+
22
+ ### v1.1.0 — AMS auto-match, camera snapshot, pause/resume, skip objects
23
+
24
+ - **AMS auto-match by RFID** (`auto_match_ams` on `print_3mf`) — resolves sliced 3MF filament requirements against live AMS inventory. Handles same-SKU different-color filaments. Dry-run with `resolve_3mf_ams_slots`.
25
+ - **Structured AMS inventory** (`get_printer_filaments`) — per-tray display names, profile resolution tier (`exact-model-nozzle`/`model`/`generic`/`unresolved`), match confidence, and a summary with recommended auto-slice filament.
26
+ - **AMS settle-time retry** — transparently retries when AMS data hasn't arrived on the first MQTT push from an idle printer.
27
+ - **Camera snapshot** (`camera_snapshot`) — JPEG from the chamber camera. TCP-on-6000 for A1/P1S/P1P, RTSP via ffmpeg for X1/P2S/H2 series.
28
+ - **Pause / resume** (`pause_print`, `resume_print`) — alongside the existing `cancel_print`.
29
+ - **Skip objects** (`skip_objects`) — skip specific object IDs during a running multi-object print. IDs from `list_3mf_plate_objects`.
30
+ - **HMS diagnostics** (`printer://{host}/hms` MCP resource) — read-only error summary with automatic settle retry.
31
+ - **Utility controls** — `set_print_speed` (silent/standard/sport/ludicrous), `clear_hms_errors`, `reread_ams_rfid`, `set_airduct_mode` (cooling/heating for H2/P2).
32
+ - **H2-family-safe print path** — correct `project_file` format with `ams_mapping2` parallel array, H2 firmware quirks handled.
33
+ - **BambuStudio CLI auto-flatten** (`BAMBU_CLI_FLATTEN=true`) — works around upstream profile inheritance bugs.
34
+ - **Print collar charm** (`print_collar_charm`) — specialized two-color wrapper with fixed tray policy.
35
+
36
+ ### v1.1.1 — AMS dryer control (current)
37
+
38
+ - **AMS dryer start/stop** (`set_ams_drying`) — sends `print.ams_control` MQTT command. Works on heated AMS units (AMS Pro / AMS-HT). Action: `start` or `stop`, target by AMS index 0–3.
39
+ - Same-SKU different-color fix for `auto_match_ams`.
40
+ - AMS and HMS settle-time retry for idle printers.
41
+ - Validation script (`scripts/validate-printer.mjs`) for live printer testing.
42
+
43
+ > Full changelog at [CHANGELOG.md](./CHANGELOG.md).
44
+
16
45
  <details>
17
46
  <summary><strong>Click to expand Table of Contents</strong></summary>
18
47
 
@@ -28,12 +57,12 @@ This is a stripped-down, Bambu-only fork of [mcp-3D-printer-server](https://gith
28
57
  - [Configuration](#configuration)
29
58
  - [Environment variables reference](#environment-variables-reference)
30
59
  - [Usage](#usage)
31
- - [FULU OrcaSlicer-bambulab Support](#fulu-orcaslicer-bambulab-support)
32
60
  - [Enabling Developer Mode (Required)](#enabling-developer-mode-required)
33
61
  - [Finding Your Bambu Printer's Serial Number and Access Token](#finding-your-bambu-printers-serial-number-and-access-token)
34
62
  - [AMS (Automatic Material System) Setup](#ams-automatic-material-system-setup)
35
63
  - [Bambu Communication Notes (MQTT and FTP)](#bambu-communication-notes-mqtt-and-ftp)
36
64
  - [What this fork fixes](#what-this-fork-fixes)
65
+ - [Verified print procedure (H2S, LAN-only, no client cert)](#verified-print-procedure-h2s-lan-only-no-client-cert)
37
66
  - [Available Tools](#available-tools)
38
67
  - [STL Manipulation Tools](#stl-manipulation-tools)
39
68
  - [Printer Control Tools](#printer-control-tools)
@@ -41,7 +70,6 @@ This is a stripped-down, Bambu-only fork of [mcp-3D-printer-server](https://gith
41
70
  - [Advanced Tools](#advanced-tools)
42
71
  - [Available Resources](#available-resources)
43
72
  - [Example Commands for Claude](#example-commands-for-claude)
44
- - [Troubleshooting and Tester Reports](#troubleshooting-and-tester-reports)
45
73
  - [Bambu Lab Printer Limitations](#bambu-lab-printer-limitations)
46
74
  - [General Limitations and Considerations](#general-limitations-and-considerations)
47
75
  - [Memory usage](#memory-usage)
@@ -55,9 +83,7 @@ This is a stripped-down, Bambu-only fork of [mcp-3D-printer-server](https://gith
55
83
 
56
84
  ## Description
57
85
 
58
- `bambu-printer-mcp` is a Model Context Protocol server that gives Claude (or any MCP client) control over Bambu Lab 3D printers. It handles the full local workflow: manipulate an STL, auto-slice it with BambuStudio or FULU OrcaSlicer-bambulab if needed, upload the resulting 3MF over FTPS, and start the print via an MQTT `project_file` command -- all without leaving your conversation.
59
-
60
- It also has an optional FULU BambuNetwork bridge path. When pointed at the OrcaSlicer-bambulab Linux host or macOS/WSL wrapper, the MCP can call FULU's restored BambuNetwork methods directly, including cloud/remote printing through `print_3mf_bambu_network`.
86
+ `bambu-printer-mcp` is a Model Context Protocol server that gives Claude (or any MCP client) direct control over Bambu Lab 3D printers. The verified end-to-end path is: **slice in Bambu Studio, export a `.gcode.3mf`, hand the path to `print_3mf`** — the server reads the slicer's metadata out of the 3MF, builds the correct AMS mapping, uploads over FTPS, and starts the print via an MQTT `project_file` command. See [docs/SLICING.md](./docs/SLICING.md) for the full recipe and why in-process slicing is not the recommended path.
61
87
 
62
88
  **What this is not.** This package intentionally supports only Bambu Lab printers. It does not include adapters for OctoPrint, Klipper (Moonraker), Duet, Repetier, Prusa Connect, or Creality Cloud. If you need multi-printer support, use the parent project [mcp-3D-printer-server](https://github.com/DMontgomery40/mcp-3D-printer-server) instead.
63
89
 
@@ -70,16 +96,30 @@ It also has an optional FULU BambuNetwork bridge path. When pointed at the OrcaS
70
96
  ## Features
71
97
 
72
98
  - Get detailed printer status: temperatures (nozzle, bed, chamber), print progress, current layer, time remaining, and live AMS slot data
73
- - List, upload, and manage files on the printer's SD card via FTPS
74
- - Upload and print `.3mf` files with full plate selection and calibration flag control
75
- - Automatic slicing: pass an unsliced 3MF to `print_3mf` and the server will slice it with BambuStudio CLI, OrcaSlicer, or FULU OrcaSlicer-bambulab before uploading
76
- - Parse AMS mapping from the 3MF's embedded slicer config (`Metadata/project_settings.config`) and send it correctly formatted per the OpenBambuAPI spec
77
- - Cancel in-progress print jobs via MQTT
99
+ - Query live AMS inventory with resolved Bambu/Orca filament profile paths via `get_printer_filaments`. Includes per-tray display names, match confidence (`high`/`medium`/`low`/`none`), resolution tier (`exact-model-nozzle`/`model`/`generic`/`unresolved`), and a summary with recommended auto-slice filament. Retries automatically when AMS data hasn't arrived yet (common on first MQTT push from idle printers).
100
+ - List, upload, and delete files on the printer's SD card via FTPS
101
+ - Capture a JPEG snapshot from the chamber camera. Supports A1, A1 mini, P1S, P1P (TCP-on-6000), and X1, X1C, X1E, P2S, H2, H2S, H2D, H2C, H2D Pro (RTSP via ffmpeg). Requires ffmpeg in PATH for the RTSP path.
102
+ - Upload and print pre-sliced `.gcode.3mf` files with full plate selection and calibration flag control (recommended path — see [docs/SLICING.md](./docs/SLICING.md))
103
+ - Optional single-color auto-slice path via BambuStudio CLI. Set `BAMBU_CLI_FLATTEN=true` to enable a workaround that flattens BBL profile inheritance before invoking the CLI — works around upstream bugs in BambuStudio CLI mode ([#9636](https://github.com/bambulab/BambuStudio/issues/9636), [#9968](https://github.com/bambulab/BambuStudio/issues/9968)). Single-color smoke is verified on H2S/H2D/X1C/P1S; H2C requires Bambu Studio 2.4.0 or newer and should use `BAMBU_MODEL=h2c`, not an H2D fallback. H2D two-color CLI slicing is blocked upstream ([#10408](https://github.com/bambulab/BambuStudio/issues/10408)); use a GUI-sliced `.gcode.3mf` for that workflow. Default off; Path A (GUI-slice) remains the recommended workflow for non-BBL profiles, multi-color H2 jobs, or first-time prints. See [docs/SLICING.md](./docs/SLICING.md).
104
+ - Parse AMS mapping from the 3MF's embedded slicer metadata (`Metadata/plate_<n>.json` + gcode filament header) and send it correctly formatted per the OpenBambuAPI spec, with correct H2S/H2D/H2C `ams_mapping2` parallel array format
105
+ - **Auto-match AMS slots by RFID** (`auto_match_ams` flag on `print_3mf`). Resolves required `tray_info_idx` from the sliced 3MF against live AMS inventory. Handles same-SKU different-color filaments by matching on `(tray_info_idx, tray_color)` and tracking already-claimed slots. Dry-run with `resolve_3mf_ams_slots` before printing.
106
+ - Cancel, pause, and resume in-progress print jobs via MQTT
107
+ - Skip specific objects during a running multi-object print via `skip_objects` (use `list_3mf_plate_objects` to find object IDs first)
108
+ - Set print speed mode (`silent`/`standard`/`sport`/`ludicrous`), clear HMS/print errors, trigger AMS RFID re-read, and control H2/P2 airduct mode (`cooling`/`heating`) via MQTT
109
+ - **Start/stop AMS filament drying** (`set_ams_drying`) on heated AMS units (AMS Pro / AMS-HT). Sends `print.ams_control` MQTT command.
78
110
  - Set nozzle and bed temperature via G-code dispatch over MQTT
111
+ - Set fan speed (part, auxiliary, chamber) and chamber light mode (on/off/flashing) via MQTT
112
+ - Read HMS (Health Management System) diagnostics as an MCP resource at `printer://{host}/hms` — read-only error summary from the printer, with automatic settle retry
79
113
  - Start G-code files already stored on the printer
114
+ - **Collar charm print wrapper** (`print_collar_charm`) — specialized two-color workflow with fixed tray policy for inner (black, AMS 1 slot 1) and outer (white, AMS 2 slot 1) charm parts
80
115
  - STL manipulation: scale, rotate, extend base, merge vertices, center at origin, lay flat, and inspect model info
81
- - Slice STL or 3MF files using BambuStudio, FULU OrcaSlicer-bambulab, OrcaSlicer, PrusaSlicer, Cura, or Slic3r
82
- - Optional FULU BambuNetwork bridge support for restored BambuNetwork login/status/raw calls and cloud or LAN 3MF print starts
116
+ - Slice STL or 3MF files using BambuStudio, OrcaSlicer, PrusaSlicer, Cura, or Slic3r
117
+ - Inspect slicer settings from a saved 3MF template or extracted profile via `get_slice_settings`
118
+ - Enumerate saved slicing templates from the local registry via `list_templates`
119
+ - Save templates into the local registry via `save_template`
120
+ - Slice directly from a named template via `slice_with_template`
121
+ - For simple single-material slices, auto-select the printer's current or first loaded AMS filament when no explicit slicer profile or `load_filaments` override is provided
122
+ - Template-driven slicing can reuse a saved 3MF's process settings while still pulling the live printer filament choice over MQTT
83
123
  - Optional Blender MCP bridge for advanced mesh operations
84
124
  - Dual transport: stdio (default, for Claude Desktop / Claude Code) and Streamable HTTP
85
125
 
@@ -91,15 +131,14 @@ It also has an optional FULU BambuNetwork bridge path. When pointed at the OrcaS
91
131
 
92
132
  - Node.js 18 or higher
93
133
  - npm
94
- - **A Bambu-compatible slicer** *(optional -- only needed for slicing)*. Required by `slice_stl` and `print_3mf` auto-slice when a 3MF has no embedded G-code. Use [FULU OrcaSlicer-bambulab](https://github.com/FULU-Foundation/OrcaSlicer-bambulab) with `SLICER_TYPE=orcaslicer-bambulab`, or use [BambuStudio](https://bambulab.com/en/download/studio) with `SLICER_TYPE=bambustudio`. Not needed if you only print pre-sliced 3MF files.
95
- - **FULU BambuNetwork runtime** *(optional -- only needed for restored cloud/BambuNetwork printing)*. Install FULU OrcaSlicer-bambulab, then point `BAMBU_NETWORK_BRIDGE_COMMAND` at its bridge host or platform wrapper. See [FULU OrcaSlicer-bambulab Support](#fulu-orcaslicer-bambulab-support).
134
+ - **BambuStudio** *(optional -- only needed for slicing)* -- [download from bambulab.com](https://bambulab.com/en/download/studio). Required by `slice_stl` and `print_3mf` auto-slice (when a 3MF has no embedded gcode). Not needed if you only print pre-sliced 3MF files. Default path: `/Applications/BambuStudio.app/Contents/MacOS/BambuStudio` (macOS); set `SLICER_PATH` if installed elsewhere.
96
135
 
97
136
  ### Run without installing (npx)
98
137
 
99
138
  The fastest way to get started. No global install required:
100
139
 
101
140
  ```bash
102
- npx bambu-printer-mcp
141
+ npx @rowbotik/bambu-printer-mcp
103
142
  ```
104
143
 
105
144
  Set environment variables inline or via a `.env` file in your working directory (see [Configuration](#configuration)).
@@ -107,7 +146,7 @@ Set environment variables inline or via a `.env` file in your working directory
107
146
  ### Install globally from npm
108
147
 
109
148
  ```bash
110
- npm install -g bambu-printer-mcp
149
+ npm install -g @rowbotik/bambu-printer-mcp
111
150
  ```
112
151
 
113
152
  After installation, the `bambu-printer-mcp` command is available in your PATH.
@@ -115,7 +154,7 @@ After installation, the `bambu-printer-mcp` command is available in your PATH.
115
154
  ### Install from source
116
155
 
117
156
  ```bash
118
- git clone https://github.com/DMontgomery40/bambu-printer-mcp.git
157
+ git clone https://github.com/rowbotik/bambu-printer-mcp.git
119
158
  cd bambu-printer-mcp
120
159
  npm install
121
160
  npm run build
@@ -135,26 +174,22 @@ Create a `.env` file in the directory where you run the server, or pass environm
135
174
  PRINTER_HOST=192.168.1.100 # IP address of your Bambu printer on the local network
136
175
  BAMBU_SERIAL=01P00A123456789 # Printer serial number (see Finding Your Serial Number below)
137
176
  BAMBU_TOKEN=your_access_token # LAN access token from printer touchscreen
177
+ # Compatible aliases also accepted:
178
+ # BAMBU_PRINTER_HOST / BAMBU_PRINTER_SERIAL / BAMBU_PRINTER_ACCESS_TOKEN
138
179
 
139
180
  # --- Printer model (CRITICAL for safe operation) ---
140
- BAMBU_MODEL=p1s # Your printer model: p1s, p1p, x1c, x1e, a1, a1mini, h2d
141
- BED_TYPE=textured_plate # Bed plate type: textured_plate, cool_plate, engineering_plate, hot_plate
181
+ BAMBU_MODEL=p1s # Your printer model: p1s, p1p, p2s, x1c, x1e, a1, a1mini, h2d, h2s, h2c
182
+ # Alias also accepted: BAMBU_PRINTER_MODEL
183
+ BED_TYPE=textured_plate # Bed plate type: textured_plate, cool_plate, engineering_plate, hot_plate, supertack_plate
142
184
  NOZZLE_DIAMETER=0.4 # Nozzle diameter in mm (default: 0.4)
143
185
 
144
186
  # --- Slicer configuration (required for slice_stl and print_3mf auto-slice) ---
145
- SLICER_TYPE=orcaslicer-bambulab # Options: bambustudio, orcaslicer, orcaslicer-bambulab,
146
- # prusaslicer, cura, slic3r. Aliases: fulu-orca, orca-studio.
147
- SLICER_PATH=/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer
148
- # Adjust for your OS and install path. BambuStudio also works.
187
+ SLICER_TYPE=bambustudio # Options: bambustudio, prusaslicer, orcaslicer, cura, slic3r
188
+ SLICER_PATH=/Applications/BambuStudio.app/Contents/MacOS/BambuStudio
189
+ # Default on macOS. Adjust for your OS and install path.
190
+ # Alias also accepted: BAMBU_STUDIO_PATH
149
191
  SLICER_PROFILE= # Optional: path to a slicer profile/config file
150
192
 
151
- # --- FULU BambuNetwork bridge (optional; restores cloud/BambuNetwork printing) ---
152
- BAMBU_DEV_ID=01P00A123456789 # BambuNetwork device id; often the same as serial
153
- BAMBU_NETWORK_BRIDGE_COMMAND= # Full shell command for pjarczak_bambu_linux_host or wrapper
154
- BAMBU_NETWORK_CONFIG_DIR= # Optional; defaults to ~/.config/bambu-printer-mcp/bambu-network
155
- BAMBU_NETWORK_COUNTRY_CODE=US # BambuNetwork region/country code
156
- BAMBU_NETWORK_USER_INFO= # Optional raw user_info JSON if you need net.change_user
157
-
158
193
  # --- Temporary file directory ---
159
194
  TEMP_DIR=/tmp/bambu-mcp-temp # Directory for intermediate files. Created automatically if absent.
160
195
 
@@ -177,21 +212,15 @@ BLENDER_MCP_BRIDGE_COMMAND= # Shell command to invoke your Blender MCP bri
177
212
 
178
213
  | Variable | Default | Required | Description |
179
214
  |---|---|---|---|
180
- | `PRINTER_HOST` | `localhost` | Yes | IP address of the Bambu printer |
181
- | `BAMBU_SERIAL` | | Yes | Printer serial number |
182
- | `BAMBU_TOKEN` | | Yes | LAN access token |
183
- | `BAMBU_MODEL` | | **Yes** | Printer model: `p1s`, `p1p`, `x1c`, `x1e`, `a1`, `a1mini`, `h2d`. **Required for safe operation** -- determines the correct G-code generation. If omitted and the MCP client supports elicitation, the server will ask you interactively. |
184
- | `BED_TYPE` | `textured_plate` | No | Bed plate type: `textured_plate`, `cool_plate`, `engineering_plate`, `hot_plate` |
185
- | `NOZZLE_DIAMETER` | `0.4` | No | Nozzle diameter in mm. Used to select the correct Bambu-compatible machine preset. |
186
- | `SLICER_TYPE` | `bambustudio` | No | Slicer to use for slicing operations: `bambustudio`, `orcaslicer`, `orcaslicer-bambulab`, `prusaslicer`, `cura`, or `slic3r`. Aliases such as `fulu-orca` and `orca-studio` are accepted. |
187
- | `SLICER_PATH` | Platform default for the selected slicer | No | Full path to the slicer executable, or a command name on `PATH` such as `OrcaSlicer` |
215
+ | `PRINTER_HOST` | `localhost` | Yes | IP address of the Bambu printer. Alias: `BAMBU_PRINTER_HOST` |
216
+ | `BAMBU_SERIAL` | | Yes | Printer serial number. Alias: `BAMBU_PRINTER_SERIAL` |
217
+ | `BAMBU_TOKEN` | | Yes | LAN access token. Alias: `BAMBU_PRINTER_ACCESS_TOKEN` |
218
+ | `BAMBU_MODEL` | | **Yes** | Printer model: `p1s`, `p1p`, `p2s`, `x1c`, `x1e`, `a1`, `a1mini`, `h2d`, `h2s`, `h2c`. **Required for safe operation** -- determines the correct G-code generation. Alias: `BAMBU_PRINTER_MODEL`. If omitted and the MCP client supports elicitation, the server will ask you interactively. Use `h2c` for H2C; do not use `h2d` as a fallback. |
219
+ | `BED_TYPE` | `textured_plate` | No | Bed plate type: `textured_plate`, `cool_plate`, `engineering_plate`, `hot_plate`, `supertack_plate` |
220
+ | `NOZZLE_DIAMETER` | `0.4` | No | Nozzle diameter in mm. Used to select the correct BambuStudio machine preset. |
221
+ | `SLICER_TYPE` | `bambustudio` | No | Slicer to use for slicing operations |
222
+ | `SLICER_PATH` | BambuStudio macOS path | No | Full path to the slicer executable. Alias: `BAMBU_STUDIO_PATH` |
188
223
  | `SLICER_PROFILE` | | No | Path to a slicer profile or config file |
189
- | `BAMBU_DEV_ID` | `BAMBU_SERIAL` | No | BambuNetwork device id used by `print_3mf_bambu_network`; often the same value as the printer serial. |
190
- | `BAMBU_NETWORK_BRIDGE_COMMAND` | | No | Full shell command that starts FULU's `pjarczak_bambu_linux_host`, `pjarczak-bambu-linux-host-wrapper`, or WSL wrapper. Required for BambuNetwork tools. |
191
- | `FULU_BAMBU_NETWORK_BRIDGE_COMMAND` | | No | Alternate env name accepted for the same bridge command. |
192
- | `BAMBU_NETWORK_CONFIG_DIR` | `~/.config/bambu-printer-mcp/bambu-network` | No | Config/log directory passed to FULU `net.create_agent` and `net.set_config_dir`. |
193
- | `BAMBU_NETWORK_COUNTRY_CODE` | `US` | No | Country code passed to the FULU BambuNetwork agent. |
194
- | `BAMBU_NETWORK_USER_INFO` | | No | Optional raw `user_info` JSON string passed to FULU `net.change_user`. Usually you can reuse the login/config state from OrcaSlicer-bambulab instead. |
195
224
  | `TEMP_DIR` | `./temp` | No | Directory for intermediate files |
196
225
  | `MCP_TRANSPORT` | `stdio` | No | Transport mode: `stdio` or `streamable-http` |
197
226
  | `MCP_HTTP_HOST` | `127.0.0.1` | No | HTTP bind address (HTTP transport only) |
@@ -201,6 +230,10 @@ BLENDER_MCP_BRIDGE_COMMAND= # Shell command to invoke your Blender MCP bri
201
230
  | `MCP_HTTP_JSON_RESPONSE` | `true` | No | Return structured JSON alongside text responses |
202
231
  | `MCP_HTTP_ALLOWED_ORIGINS` | | No | Comma-separated list of allowed CORS origins |
203
232
  | `BLENDER_MCP_BRIDGE_COMMAND` | | No | Command to invoke Blender MCP bridge |
233
+ | `BAMBU_CLI_FLATTEN` | `false` | No | When `true`, the MCP flattens BBL profile inheritance before invoking the BambuStudio CLI. Workaround for upstream issues [#9636](https://github.com/bambulab/BambuStudio/issues/9636) / [#9968](https://github.com/bambulab/BambuStudio/issues/9968). BBL printers only. Single-color smoke verified on H2S/H2D/X1C/P1S; H2C requires Bambu Studio 2.4.0 or newer. H2D two-color CLI slicing remains blocked by [#10408](https://github.com/bambulab/BambuStudio/issues/10408). See [docs/SLICING.md](./docs/SLICING.md). |
234
+ | `BAMBU_PROFILES_ROOT` | derived from `SLICER_PATH` | No | Override path to the BambuStudio `Resources/profiles` directory used by the CLI flattener. Useful for non-standard installs or dev environments. |
235
+
236
+ SuperTack can be passed for pre-sliced print jobs, but BambuStudio CLI slicing currently fails fast for `supertack_plate` because the accepted CLI bed identifier is not verified. Use a pre-sliced 3MF for SuperTack until this is confirmed.
204
237
 
205
238
  ---
206
239
 
@@ -213,14 +246,14 @@ Add this server to your MCP client's config (Claude Desktop, Claude Code, Cursor
213
246
  "mcpServers": {
214
247
  "bambu-printer": {
215
248
  "command": "npx",
216
- "args": ["-y", "bambu-printer-mcp"],
249
+ "args": ["-y", "@rowbotik/bambu-printer-mcp"],
217
250
  "env": {
218
251
  "PRINTER_HOST": "192.168.1.100",
219
252
  "BAMBU_SERIAL": "01P00A123456789",
220
253
  "BAMBU_TOKEN": "your_access_token",
221
254
  "BAMBU_MODEL": "p1s",
222
- "SLICER_TYPE": "orcaslicer-bambulab",
223
- "SLICER_PATH": "/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer"
255
+ "SLICER_TYPE": "bambustudio",
256
+ "SLICER_PATH": "/Applications/BambuStudio.app/Contents/MacOS/BambuStudio"
224
257
  }
225
258
  }
226
259
  }
@@ -253,279 +286,12 @@ This applies to all MCP servers, not just this one.
253
286
 
254
287
  ---
255
288
 
256
- ## FULU OrcaSlicer-bambulab Support
257
-
258
- FULU's [OrcaSlicer-bambulab](https://github.com/FULU-Foundation/OrcaSlicer-bambulab) restores full BambuNetwork support for Bambu Lab printers. This MCP now supports it in two separate ways:
259
-
260
- 1. **Slicer/exporter mode.** Set `SLICER_TYPE=orcaslicer-bambulab` to slice STL or 3MF inputs with FULU's fork. The aliases `fulu-orca`, `orca-studio`, and `orca-bambulab` are also accepted.
261
- 2. **BambuNetwork bridge mode.** Set `BAMBU_NETWORK_BRIDGE_COMMAND` to FULU's Linux host or platform wrapper. Then use `bambu_network_bridge_status`, `bambu_network_call`, or `print_3mf_bambu_network` to go through FULU's restored BambuNetwork path.
262
-
263
- These modes are intentionally separate. The default `print_3mf` path remains transparent local MQTT/FTPS. The BambuNetwork path is opt-in, because it uses FULU's restored network library and runtime instead of the MCP's direct LAN implementation.
264
-
265
- ### Current status, honestly
266
-
267
- This is an MCP server that people can clone, configure, and run. The repo now contains the FULU bridge client, tool schemas, behavior tests, built `dist/` output, and macOS setup documentation. It is not being presented as magic or as a finished bypass for every Bambu firmware. The point of this release is to make the FULU path available from MCP, keep the old local Bambu flow intact, and collect real printer reports quickly.
268
-
269
- As of 2026-05-13, the validation matrix is:
270
-
271
- | Surface | Status | Notes |
272
- |---|---|---|
273
- | Source checkout | Working | `git clone`, `npm install`, `npm run build`, and `npm test` are the intended maintainer/dev path. |
274
- | MCP stdio transport | Working | Covered by behavior tests: initialize, list tools, success call, structured failure. |
275
- | MCP Streamable HTTP transport | Working | Covered by behavior tests, including origin rejection. |
276
- | FULU slicer aliasing | Working | `orcaslicer-bambulab`, `fulu-orca`, `orca-studio`, and `orca-bambulab` normalize to the Bambu-compatible Orca CLI flow. |
277
- | BambuStudio CLI fallback | Working | The existing `bambustudio` slicer path still works and remains the conservative fallback for slicing. |
278
- | FULU bridge protocol | Working in tests | The MCP speaks FULU's framed JSON protocol, creates an agent, retries ABI detection, and handles non-zero print return codes as failures. |
279
- | macOS bridge launch | Partially working | On Apple Silicon, the FULU runtime can verify and the x86_64 Lima bridge can handshake from this MCP. Real print start still needs iteration. |
280
- | macOS print start | Not proven | Test bench result: FULU LAN print reached the bridge but returned `send msg failed`; direct MQTT/FTPS upload reached the printer but the printer reported HMS `0500050000010007` (`MQTT Command verification failed`). |
281
- | Linux print start | Needs testers | This should be the cleanest FULU runtime because the Linux host and `.so` files run natively, but it needs real printer confirmations. |
282
- | Windows print start | Needs testers | WSL 2 support follows FULU's runtime model, but we need Windows testers with real printers before calling it proven. |
283
-
284
- The older local fallback is still here: `SLICER_TYPE=bambustudio` or `SLICER_TYPE=orcaslicer-bambulab` uses a slicer CLI to produce a Bambu 3MF, then the MCP uses the direct Bambu LAN path (`print_3mf`) with FTPS upload and MQTT status/control. That path remains useful for printers and firmware that still accept third-party local project commands, and it is covered by the repo behavior tests. The new `connection_mode: "bambu_network"` path is the FULU bridge path.
285
-
286
- Important wording detail: when `print_3mf` returns success, it means the file was uploaded and the MQTT `project_file` command was sent. On newer locked-down firmware, the printer can still reject that command after receipt. Check `get_printer_status` for `gcode_state`, HMS messages, and actual motion before declaring that a print started.
287
-
288
- ### Clone-and-run checklist
289
-
290
- For a source checkout, use the same shape on every OS:
291
-
292
- ```bash
293
- git clone https://github.com/DMontgomery40/bambu-printer-mcp.git
294
- cd bambu-printer-mcp
295
- npm install
296
- npm run build
297
- npm test
298
- ```
299
-
300
- Then choose one of the two print paths:
301
-
302
- | Path | Use when | Key env/tool settings |
303
- |---|---|---|
304
- | Direct local Bambu path | You are on the same LAN and your firmware still accepts third-party MQTT `project_file` commands. | `PRINTER_HOST`, `BAMBU_SERIAL`, `BAMBU_TOKEN`, `BAMBU_MODEL`, then call `print_3mf`. |
305
- | FULU BambuNetwork path | You want to test restored BambuNetwork behavior through FULU's runtime. | `BAMBU_NETWORK_BRIDGE_COMMAND`, `BAMBU_DEV_ID`, `BAMBU_MODEL`, then call `print_3mf_bambu_network` or `print_3mf` with `connection_mode: "bambu_network"`. |
306
-
307
- Minimum local direct `.env`:
308
-
309
- ```env
310
- PRINTER_HOST=192.168.1.100
311
- BAMBU_SERIAL=01P00A123456789
312
- BAMBU_TOKEN=your_lan_access_code
313
- BAMBU_MODEL=p1s
314
- SLICER_TYPE=bambustudio
315
- SLICER_PATH=/Applications/BambuStudio.app/Contents/MacOS/BambuStudio
316
- ```
317
-
318
- Minimum FULU bridge `.env`:
319
-
320
- ```env
321
- BAMBU_MODEL=p1s
322
- BAMBU_DEV_ID=01P00A123456789
323
- BAMBU_NETWORK_COUNTRY_CODE=US
324
- BAMBU_NETWORK_BRIDGE_COMMAND=/path/to/pjarczak_bambu_linux_host_or_platform_wrapper
325
- SLICER_TYPE=orcaslicer-bambulab
326
- SLICER_PATH=/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer
327
- ```
328
-
329
- Do not paste access codes, serial numbers, cloud tokens, or account JSON into public issues. Redact them and keep only the last few characters if you need to distinguish devices.
330
-
331
- ### Slicer/exporter mode
332
-
333
- ```env
334
- SLICER_TYPE=orcaslicer-bambulab
335
- SLICER_PATH=/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer
336
- ```
337
-
338
- For Bambu-family slicing, `orcaslicer`, `orcaslicer-bambulab`, and `bambustudio` all use the Bambu-compatible CLI flow: `--slice`, `--export-3mf`, `--load-settings`, `--allow-newer-file`, and the AMS/object/plate flags exposed by `slice_stl`. That produces a sliced 3MF with embedded `Metadata/plate_<n>.gcode`, which either local `print_3mf` or bridge `print_3mf_bambu_network` can use.
339
-
340
- ### BambuNetwork bridge mode
341
-
342
- FULU's bridge host speaks a small binary-framed JSON protocol over stdin/stdout. This MCP implements that protocol directly and initializes the same agent shape FULU uses:
343
-
344
- - `bridge.handshake`
345
- - `net.create_agent`
346
- - `net.set_config_dir`
347
- - `net.init_log`
348
- - `net.set_country_code`
349
- - `net.start`
350
- - `net.connect_server`
351
-
352
- The high-level print tool builds FULU-style `PrintParams` and calls one of these bridge methods:
353
-
354
- | MCP `bambu_network_method` | FULU method | Typical use |
355
- |---|---|---|
356
- | `start_print` | `net.start_print` | Cloud/BambuNetwork print. This is the default when `connection_type` is `cloud`. |
357
- | `start_local_print` | `net.start_local_print` | Local LAN print through FULU without record upload. This is the default when `connection_type` is `lan`. |
358
- | `start_local_print_with_record` | `net.start_local_print_with_record` | Local LAN print plus BambuNetwork task record behavior, matching Orca's preferred LAN path when possible. |
359
- | `start_send_gcode_to_sdcard` | `net.start_send_gcode_to_sdcard` | Send sliced G-code/3MF content to SD card through the bridge. Useful for probing runtime behavior. |
360
- | `start_sdcard_print` | `net.start_sdcard_print` | Start an already-present SD card job through the bridge. |
361
-
362
- Use this probe first:
363
-
364
- ```json
365
- {
366
- "connect": true
367
- }
368
- ```
369
-
370
- with the `bambu_network_bridge_status` tool. The response includes runtime hints, missing macOS files, the resolved config directory, and the suggested macOS wrapper command when it can infer one.
371
-
372
- Healthy bridge status should show:
373
-
374
- ```json
375
- {
376
- "configured": true,
377
- "connected": true,
378
- "agentReady": true,
379
- "handshake": {
380
- "network_loaded": true,
381
- "source_loaded": true,
382
- "network_actual_abi_version": "02.05.02.58"
383
- }
384
- }
385
- ```
386
-
387
- The exact ABI version can change with FULU's bundled BambuNetwork library. This MCP reads `network_actual_abi_version` from `bridge.handshake` and retries with `PJARCZAK_EXPECTED_BAMBU_NETWORK_VERSION` automatically when the bridge reports an expected-version mismatch. You should not need to set that variable manually unless you are debugging the bridge itself.
388
-
389
- ### macOS runtime
390
-
391
- FULU's upstream README currently says "macOS: Work in progress." For this MCP, macOS is wired up enough to install, verify, launch, and probe the FULU bridge runtime when FULU's macOS bridge payload is installed and you point the MCP at the wrapper. Real print-start behavior still needs more Mac tester feedback.
392
-
393
- FULU's macOS runtime uses Lima under:
394
-
395
- ```text
396
- ~/Library/Application Support/OrcaSlicer/macos-bridge/
397
- ```
398
-
399
- The runtime directory should contain files such as `pjarczak_bambu_linux_host`, `libbambu_networking.so`, `libBambuSource.so`, `ca-certificates.crt`, and `slicer_base64.cer`. The plugin/resource directory should contain `pjarczak-bambu-linux-host-wrapper`, `install_runtime_macos.sh`, and `verify_runtime_macos.sh`.
400
-
401
- After installing FULU OrcaSlicer-bambulab, run the bridge status probe. If it finds the wrapper and runtime, it will return a command like this:
402
-
403
- ```bash
404
- export BAMBU_NETWORK_BRIDGE_COMMAND="PJARCZAK_BAMBU_PLUGIN_DIR='$HOME/Library/Application Support/OrcaSlicer/macos-bridge/runtime' '$HOME/Library/Application Support/OrcaSlicer/plugins/pjarczak-bambu-linux-host-wrapper' '$HOME/Library/Application Support/OrcaSlicer/macos-bridge/runtime/pjarczak_bambu_linux_host'"
405
- export BAMBU_NETWORK_COUNTRY_CODE=US
406
- ```
407
-
408
- If the probe reports missing runtime files, launch FULU OrcaSlicer-bambulab once and let it install its macOS bridge runtime. If your package exposes the scripts directly, the install/verify flow is:
409
-
410
- ```bash
411
- "$HOME/Library/Application Support/OrcaSlicer/plugins/install_runtime_macos.sh" -PluginDir "$HOME/Library/Application Support/OrcaSlicer/plugins"
412
- "$HOME/Library/Application Support/OrcaSlicer/plugins/verify_runtime_macos.sh" -PluginDir "$HOME/Library/Application Support/OrcaSlicer/plugins"
413
- ```
414
-
415
- On newer Lima releases, FULU's installed script may need the modern template URL form. If runtime install fails with `template ".yaml" not found`, start the named Lima instance once with:
416
-
417
- ```bash
418
- limactl start --name=orcaslicer-bambu-network --tty=false --mount-writable --vm-type=vz --network=vzNAT --rosetta template://default
419
- ```
420
-
421
- On Apple Silicon, if the default Lima/Rosetta runtime starts but the bridge host crashes with architecture or `Bus error` failures, use an x86_64 Lima instance and point the same wrapper at it:
422
-
423
- ```bash
424
- export BAMBU_NETWORK_BRIDGE_COMMAND="PJARCZAK_MAC_LIMA_INSTANCE=orcaslicer-bambu-network-x86 PJARCZAK_BAMBU_PLUGIN_DIR='$HOME/Library/Application Support/OrcaSlicer/macos-bridge/runtime' '$HOME/Library/Application Support/OrcaSlicer/plugins/pjarczak-bambu-linux-host-wrapper' '$HOME/Library/Application Support/OrcaSlicer/macos-bridge/runtime/pjarczak_bambu_linux_host'"
425
- ```
426
-
427
- The app name and resource path can differ by build, so trust `bambu_network_bridge_status` over hard-coded examples.
428
-
429
- macOS troubleshooting notes:
430
-
431
- | Symptom | Meaning | Next step |
432
- |---|---|---|
433
- | `configured: false` | `BAMBU_NETWORK_BRIDGE_COMMAND` is empty. | Run `bambu_network_bridge_status` without `connect`, copy the suggested command if present, or set it manually. |
434
- | Missing wrapper files | FULU's plugin files were not installed where the MCP expects. | Launch FULU OrcaSlicer-bambulab once, then run `verify_runtime_macos.sh`. |
435
- | Missing runtime `.so` files | The Linux bridge payload did not install into `macos-bridge/runtime`. | Run `install_runtime_macos.sh`, then `verify_runtime_macos.sh`. |
436
- | `template ".yaml" not found` | Lima's template syntax changed. | Use the `template://default` command shown above. |
437
- | `Bus error` or architecture crash | Rosetta/arm64 guest/runtime mismatch. | Try the x86_64 Lima instance command shown above. |
438
- | `send msg failed` during print | The FULU bridge ran, but the printer/network layer rejected the print start. | Report platform, printer model, firmware, method used, and redacted bridge output. |
439
-
440
- ### Linux runtime
441
-
442
- On Linux, point the bridge command at FULU's host binary with access to the bundled Bambu network shared libraries:
443
-
444
- ```bash
445
- export BAMBU_NETWORK_BRIDGE_COMMAND="/path/to/pjarczak_bambu_linux_host"
446
- export PJARCZAK_BAMBU_PLUGIN_DIR="/path/to/fulu-orca-plugin-or-runtime"
447
- export BAMBU_NETWORK_COUNTRY_CODE=US
448
- ```
449
-
450
- Linux testers: please report whether `bambu_network_bridge_status` can create an agent, whether `print_3mf_bambu_network` returns `value: 0`, and whether the printer actually transitions out of `IDLE`. Include distro, CPU architecture, printer model, firmware version, and whether the job was `cloud` or `lan`.
451
-
452
- ### Windows runtime
453
-
454
- Windows support follows FULU's WSL 2 requirement. Enable WSL 2 as FULU documents, restart Windows, then use a `wsl ...` command that starts FULU's bridge host from the Linux environment:
455
-
456
- ```powershell
457
- setx BAMBU_NETWORK_BRIDGE_COMMAND "wsl -- /path/to/pjarczak_bambu_linux_host"
458
- ```
459
-
460
- If your FULU build includes `pjarczak_wsl_run_host.sh`, prefer that wrapper because it prepares the expected WSL runtime layout.
461
-
462
- Windows testers needed. The useful report is:
463
-
464
- - Windows version and CPU architecture.
465
- - WSL distro name and WSL version.
466
- - Whether FULU OrcaSlicer-bambulab itself can print through BambuNetwork.
467
- - Output from `bambu_network_bridge_status` with secrets redacted.
468
- - Which print method was used: `start_print`, `start_local_print`, or `start_local_print_with_record`.
469
- - Printer model, firmware, LAN-only/developer-mode state, and whether the printer moved beyond `IDLE`.
470
-
471
- ### Printing through BambuNetwork
472
-
473
- Cloud/restored internet print:
474
-
475
- ```json
476
- {
477
- "three_mf_path": "/Users/you/Downloads/bracket.3mf",
478
- "bambu_model": "p1s",
479
- "connection_type": "cloud",
480
- "dev_id": "01P00A123456789"
481
- }
482
- ```
483
-
484
- LAN/local print through the FULU bridge:
485
-
486
- ```json
487
- {
488
- "three_mf_path": "/Users/you/Downloads/bracket.3mf",
489
- "bambu_model": "p1s",
490
- "connection_type": "lan",
491
- "dev_id": "01P00A123456789",
492
- "dev_ip": "192.168.1.100",
493
- "bambu_token": "your_access_token"
494
- }
495
- ```
496
-
497
- You can also route the existing `print_3mf` tool through FULU by passing:
498
-
499
- ```json
500
- {
501
- "three_mf_path": "/Users/you/Downloads/bracket.3mf",
502
- "bambu_model": "p1s",
503
- "connection_mode": "bambu_network",
504
- "connection_type": "cloud",
505
- "dev_id": "01P00A123456789"
506
- }
507
- ```
508
-
509
- Force a specific FULU method while testing:
510
-
511
- ```json
512
- {
513
- "three_mf_path": "/Users/you/Downloads/bracket.3mf",
514
- "bambu_model": "p1s",
515
- "connection_type": "lan",
516
- "bambu_network_method": "start_local_print_with_record",
517
- "dev_id": "01P00A123456789",
518
- "dev_ip": "192.168.1.100",
519
- "bambu_token": "your_access_token"
520
- }
521
- ```
522
-
523
- ---
524
-
525
289
  ## Enabling Developer Mode (Required)
526
290
 
527
291
  This MCP server communicates directly with your printer over your local network using MQTT and FTPS. For this to work, **Developer Mode** must be enabled on the printer. Without it, the printer will reject third-party LAN connections even if you have the correct access code.
528
292
 
293
+ On H2D/H2-series firmware, the printer may stream `push_status` data without ever answering the legacy `get_version` handshake used by older libraries. This fork treats the live status stream as authoritative and does not require that extra ACK before considering the connection usable.
294
+
529
295
  Developer Mode is available on the following firmware versions and later:
530
296
 
531
297
  | Series | Minimum Firmware |
@@ -628,7 +394,7 @@ The AMS has 4 slots per unit, numbered 0 through 3. If you have multiple AMS uni
628
394
 
629
395
  ### Automatic AMS mapping from the 3MF
630
396
 
631
- When you slice a model in Bambu Studio or OrcaSlicer, the slicer embeds AMS mapping information inside the 3MF file at `Metadata/project_settings.config`. The `print_3mf` tool reads this file automatically and extracts the correct mapping. In most cases, you do not need to specify `ams_mapping` manually -- the tool handles it.
397
+ When you slice a model in Bambu Studio, the slicer embeds AMS mapping information inside the 3MF file at `Metadata/project_settings.config`. The `print_3mf` tool reads this file automatically and extracts the correct mapping. In most cases, you do not need to specify `ams_mapping` manually -- the tool handles it.
632
398
 
633
399
  ### Manual AMS mapping
634
400
 
@@ -670,16 +436,36 @@ If you are using the direct-feed spool holder (no AMS attached) or want to bypas
670
436
  }
671
437
  ```
672
438
 
439
+ ### Auto-match AMS by RFID
440
+
441
+ For pre-sliced 3MFs that declare filament types, the `auto_match_ams` flag on `print_3mf` (or the standalone `resolve_3mf_ams_slots` dry-run tool) automatically resolves the required filaments against your live AMS inventory. The matcher works as follows:
442
+
443
+ 1. Reads the required `tray_info_idx` values from the 3MF's `Metadata/slice_info.config` and `Metadata/plate_<n>.json`
444
+ 2. Reads your live AMS trays from the printer's MQTT status push
445
+ 3. Matches on `(tray_info_idx, tray_color)` — so two filaments of the same SKU but different colors (e.g. two GFG02 PETG HF spools in black and white) resolve to different slots
446
+ 4. Tracks already-claimed slots so two requirements can't collapse onto the same physical position
447
+ 5. Falls back to SKU-only matching when the 3MF carries no color data or only one tray of that SKU is loaded
448
+
449
+ If resolution fails, returns a structured `missing` report with per-requirement reasons:
450
+ - `no_loaded_match` — no AMS tray of that SKU is loaded
451
+ - `color_mismatch` — the SKU matches but the loaded color differs
452
+ - `exhausted` — all matching trays are already claimed by other requirements
453
+ - `no_sku` — the 3MF doesn't declare a `tray_info_idx` for this filament
454
+
455
+ Dry-run with `resolve_3mf_ams_slots` before printing to preview the match without uploading or starting a job.
456
+
457
+ ### AMS settle-time handling
458
+
459
+ The first MQTT status push from an idle printer is often sparse (model/module info only) — AMS slot data arrives on a second push. The server's filament inventory and HMS handlers both retry after a 1.5-second settle window when the expected data isn't present in the first response. This is transparent to the caller.
460
+
673
461
  ### Checking AMS status
674
462
 
675
- Use `get_printer_status` to see which filaments are currently loaded in each AMS slot, including material type and color data reported by the printer:
463
+ Use `get_printer_filaments` for the parsed, enriched view (profile paths, display names, match confidence) or `get_printer_status` for the raw AMS data from the printer:
676
464
 
677
465
  ```
678
466
  "What filaments are loaded in my AMS right now?"
679
467
  ```
680
468
 
681
- The `ams` field in the status response contains the raw AMS data from the printer, including tray information for each slot.
682
-
683
469
  ---
684
470
 
685
471
  ## Bambu Communication Notes (MQTT and FTP)
@@ -719,24 +505,91 @@ private async ftpUpload(host, token, localPath, remotePath): Promise<void> {
719
505
 
720
506
  The `bambu-js` library's project file command hardcodes `use_ams: true` and does not support the `ams_mapping` field at all. Without the fix, the mapping is a simple array of slot indices (e.g., `[0, 2]`), which does not match the OpenBambuAPI specification.
721
507
 
722
- According to the OpenBambuAPI spec, `ams_mapping` must be a 5-element array where each position corresponds to a filament color slot in the print file. Unused positions must be padded with `-1`. For example, a print using only AMS slot 0 sends `[-1, -1, -1, -1, 0]`.
508
+ According to the OpenBambuAPI spec, P1/A1/X1-series printers use a 5-element `ams_mapping` array where position `i` is the project filament index and the value is the AMS slot feeding that filament. For example, a single-filament print from AMS slot 0 sends `[0, -1, -1, -1, -1]`.
723
509
 
724
- This fork sends the `project_file` command directly via `bambu-node` (bypassing `bambu-js` entirely for print initiation) and constructs the `ams_mapping` array correctly:
510
+ This fork sends the `project_file` command directly via `bambu-node` (bypassing `bambu-js` entirely for print initiation) and constructs the mapping in the format the target firmware expects:
725
511
 
726
512
  ```typescript
727
- // From src/printers/bambu.ts
728
- let amsMapping: number[];
729
- if (options.amsMapping && options.amsMapping.length > 0) {
730
- amsMapping = Array.from({ length: 5 }, (_, i) =>
731
- i < options.amsMapping!.length ? options.amsMapping![i] : -1
732
- );
733
- } else {
734
- amsMapping = [-1, -1, -1, -1, 0]; // default: slot 0 only
735
- }
513
+ // P1/A1/X1-series: 5-element project lookup table
514
+ ams_mapping = [0, -1, -1, -1, -1];
515
+
516
+ // H2S/H2D/H2C: project-length lookup table + parallel ams_mapping2
517
+ ams_mapping = [-1, 1, -1, -1];
518
+ ams_mapping2 = [
519
+ { ams_id: 255, slot_id: 255 },
520
+ { ams_id: 0, slot_id: 1 },
521
+ { ams_id: 255, slot_id: 255 },
522
+ { ams_id: 255, slot_id: 255 }
523
+ ];
736
524
  ```
737
525
 
738
526
  The command payload also includes all required fields per the OpenBambuAPI spec: `param` (the internal gcode path within the 3MF), `url` (the sdcard path), `md5` (computed from the plate's embedded gcode), and all calibration flags.
739
527
 
528
+ ### Verified print procedure (H2S, LAN-only, no client cert)
529
+
530
+ This is the sequence that successfully started a print on an H2S running current (post-Jan 2025) firmware in LAN-only mode. It's documented here because several common approaches fail on this firmware, and this fork's transport is what makes it reliable.
531
+
532
+ **Result:** print started in `RUNNING` state, printer accepted the MQTT `project_file` command, no client certificate was required. Authentication was plain `bblp` + LAN access code over TLS with `rejectUnauthorized: false`.
533
+
534
+ **What doesn't work on stock bambu-cli:**
535
+
536
+ - `bambu-cli print start <file>` and `bambu-cli files upload` both fail with `522 SSL connection failed: session reuse required`. Bambu's FTPS server requires TLS session reuse between the control and data channels, which the Go FTPS client in bambu-cli does not negotiate correctly.
537
+ - `bambu-cli print start --no-upload` still opens an FTPS session (to stat the remote file) and hits the same 522.
538
+
539
+ **What works — two-step upload + MQTT dispatch:**
540
+
541
+ 1. **Upload the `.gcode.3mf` via curl** (curl's OpenSSL backend negotiates FTPS session reuse correctly):
542
+
543
+ ```bash
544
+ curl -k --ftp-pasv --ssl-reqd \
545
+ -u "bblp:<ACCESS_CODE>" \
546
+ -T /path/to/file.gcode.3mf \
547
+ "ftps://<PRINTER_IP>:990/<remote-name>.gcode.3mf"
548
+ ```
549
+
550
+ Keep `<remote-name>` simple ASCII, ending in `.gcode.3mf`. The file lands at the FTP root, which corresponds to `/data/` on the printer's SD card.
551
+
552
+ 2. **Send the `project_file` command over MQTT** to `device/<SERIAL>/request`:
553
+
554
+ ```js
555
+ import mqtt from "mqtt";
556
+ const payload = {
557
+ print: {
558
+ sequence_id: "0",
559
+ command: "project_file",
560
+ param: "Metadata/plate_1.gcode", // path inside the 3MF
561
+ subtask_name: "<remote-name>.gcode.3mf",
562
+ file: "<remote-name>.gcode.3mf",
563
+ url: "ftp:///<remote-name>.gcode.3mf", // three slashes, FTP root
564
+ md5: "",
565
+ project_id: "0", profile_id: "0", task_id: "0", subtask_id: "0",
566
+ timelapse: false,
567
+ bed_type: "auto",
568
+ bed_leveling: true, bed_levelling: true,
569
+ flow_cali: true, vibration_cali: true, layer_inspect: true,
570
+ use_ams: true,
571
+ ams_mapping: [0, -1, -1, -1, -1]
572
+ }
573
+ };
574
+ const client = mqtt.connect(`mqtts://<PRINTER_IP>:8883`, {
575
+ username: "bblp",
576
+ password: "<ACCESS_CODE>",
577
+ rejectUnauthorized: false,
578
+ });
579
+ client.on("connect", () => {
580
+ client.publish(`device/<SERIAL>/request`, JSON.stringify(payload));
581
+ });
582
+ ```
583
+
584
+ **Notes:**
585
+
586
+ - `url` must be `ftp:///<filename>` (three slashes) — the empty host component is required; the printer rejects `ftp://<filename>` as "unsupported print file path or name".
587
+ - `param` uses the internal plate path inside the 3MF (`Metadata/plate_1.gcode` for plate 1), not a filesystem path.
588
+ - `md5: ""` is accepted; populating it is optional.
589
+ - On AMS-equipped H2 printers, `use_ams: false` does not suppress mapping lookup if the sliced file declares filaments. The working H2 path is to send `use_ams: true` plus a valid mapping. For H2, the mapping length must match the project-level filament declaration length, and the populated positions must match `plate_<n>.json.filament_ids`. Prefer `ams_slots` at the tool layer and let the server expand it. If no mapping is provided for an H2 pre-sliced job with declared filaments, the server fails before sending; pass explicit `ams_slots`, raw `ams_mapping`, or `auto_match_ams: true`.
590
+ - No client X.509 certificate was needed. The earlier assumption that post-Jan 2025 firmware mandates mTLS on all models does not hold for the H2S in LAN mode — user/password over TLS is sufficient.
591
+ - The MCP server's `ftpUpload` helper (basic-ftp with `secure: "implicit"` and a short idle timeout) performs the equivalent upload natively and is the preferred path when using the server itself; the curl form is the manual-debug equivalent.
592
+
740
593
  ---
741
594
 
742
595
  ## Available Tools
@@ -852,6 +705,8 @@ Note: this works best on models with a clearly dominant flat face. Results on or
852
705
 
853
706
  All printer tools accept optional `host`, `bambu_serial`, and `bambu_token` arguments. If omitted, values fall back to the environment variables `PRINTER_HOST`, `BAMBU_SERIAL`, and `BAMBU_TOKEN`. Passing them explicitly is useful when working with more than one printer.
854
707
 
708
+ The server also accepts the alias variables `BAMBU_PRINTER_HOST`, `BAMBU_PRINTER_SERIAL`, and `BAMBU_PRINTER_ACCESS_TOKEN`, plus `BAMBU_PRINTER_MODEL` and `BAMBU_STUDIO_PATH`.
709
+
855
710
  #### get_printer_status
856
711
 
857
712
  Retrieve current printer state including temperatures, print progress, layer count, time remaining, and AMS slot data. Internally sends a `push_all` MQTT command to force a fresh status report before reading cached state.
@@ -866,6 +721,35 @@ Retrieve current printer state including temperatures, print progress, layer cou
866
721
 
867
722
  Returns a structured object with fields including `status` (gcode_state string), `temperatures.nozzle`, `temperatures.bed`, `temperatures.chamber`, `print.progress`, `print.currentLayer`, `print.totalLayers`, `print.timeRemaining`, and `ams` (raw AMS data from the printer).
868
723
 
724
+ #### get_printer_filaments
725
+
726
+ Read the live AMS inventory and resolve each loaded tray to Bambu Studio
727
+ filament profile JSON paths when `bambu_model` is known. The result includes a
728
+ summary, per-slot display labels, profile match confidence, and a recommended
729
+ `load_filaments` value for simple single-material CLI slicing.
730
+
731
+ ```json
732
+ {
733
+ "bambu_model": "h2d",
734
+ "nozzle_diameter": "0.4",
735
+ "host": "192.168.1.100",
736
+ "bambu_serial": "094...",
737
+ "bambu_token": "your_access_token"
738
+ }
739
+ ```
740
+
741
+ High-signal fields:
742
+
743
+ - `summary.loaded_slots`, `summary.resolved_profile_slots`,
744
+ `summary.unresolved_loaded_slots`, `summary.empty_slots`
745
+ - `trays[].display_name`, `trays[].tray_color`, `trays[].remain_percent`
746
+ - `trays[].resolved_profile_path`
747
+ - `trays[].profile_resolution`: `exact-model-nozzle`, `model`, `generic`, or
748
+ `unresolved`
749
+ - `trays[].match_confidence`: `high`, `medium`, `low`, or `none`
750
+ - `recommended.load_filaments`: the profile path the MCP will use for
751
+ auto-slicing when no explicit filament override is provided
752
+
869
753
  #### list_printer_files
870
754
 
871
755
  List files stored on the printer's SD card. Scans the `cache/`, `timelapse/`, and `logs/` directories and returns both a flat list and a directory-grouped breakdown.
@@ -878,6 +762,51 @@ List files stored on the printer's SD card. Scans the `cache/`, `timelapse/`, an
878
762
  }
879
763
  ```
880
764
 
765
+ #### camera_snapshot
766
+
767
+ Capture a single JPEG frame from the printer's chamber camera. Read-only.
768
+
769
+ Two transports are wired in, picked by `bambu_model`:
770
+
771
+ - **TCP-on-6000** for **A1, A1 mini, P1S, P1P**. Native protocol per [OpenBambuAPI/video.md](https://github.com/Doridian/OpenBambuAPI/blob/main/video.md): TLS on port 6000, 80-byte auth packet (`bblp` + access token), repeating 16-byte frame header + JPEG payload.
772
+ - **RTSP** for **X1, X1 Carbon, X1E, P2S** and **H2, H2S, H2D, H2C, H2D Pro**. Shells out to ffmpeg with `rtsps://bblp:<token>@<host>:322/streaming/live/1 -frames:v 1`. The H2 series wasn't documented in OpenBambuAPI's `video.md` but its firmware uses the same RTSP endpoint as X1 (verified live against an H2S, 2026-04-27).
773
+
774
+ **Requires ffmpeg in PATH** for the RTSP path. Install with `brew install ffmpeg` on macOS. Override the binary location with the `ffmpeg_path` tool argument if it lives elsewhere. The TCP-on-6000 path uses native Node TLS and does not require ffmpeg.
775
+
776
+ ```json
777
+ {
778
+ "save_path": "/tmp/snap.jpg",
779
+ "timeout_ms": 8000,
780
+ "bambu_model": "h2s",
781
+ "host": "192.168.1.100",
782
+ "bambu_serial": "01P00A123456789",
783
+ "bambu_token": "your_access_token"
784
+ }
785
+ ```
786
+
787
+ Returns `{ status, format: "image/jpeg", sizeBytes, base64, savedTo?, transport }`. `transport` is `"tcp-6000"` or `"rtsps-322"` so callers can tell which path produced the frame. Pass `save_path` to also write the bytes to disk; otherwise only the base64 payload is returned.
788
+
789
+ #### delete_printer_file
790
+
791
+ Delete a single file from the printer's SD card via FTPS. **Destructive.** Requires `confirm: true` — without it the call returns `status: "skipped"` and does not contact the printer. Path traversal segments (`..`) are rejected. Only files under `cache/`, `timelapse/`, and `logs/` can be deleted.
792
+
793
+ ```json
794
+ {
795
+ "filename": "old_print.gcode.3mf",
796
+ "confirm": true,
797
+ "host": "192.168.1.100",
798
+ "bambu_serial": "01P00A123456789",
799
+ "bambu_token": "your_access_token"
800
+ }
801
+ ```
802
+
803
+ A bare filename defaults to `cache/<filename>`. To target other directories pass a relative path:
804
+
805
+ ```json
806
+ { "filename": "timelapse/2026-04-26_12-00.mp4", "confirm": true }
807
+ { "filename": "logs/printer.log", "confirm": true }
808
+ ```
809
+
881
810
  #### upload_gcode
882
811
 
883
812
  Write G-code content from a string directly to the printer's `cache/` directory. The content is written to a temporary file and uploaded via FTPS.
@@ -924,7 +853,31 @@ If `filename` does not include a directory prefix, the server prepends `cache/`
924
853
 
925
854
  #### cancel_print
926
855
 
927
- Cancel the currently running print job. Sends an `UpdateState` MQTT command with `state: "stop"`.
856
+ Cancel the currently running print job. Sends an `UpdateState` MQTT command with `state: "stop"`. Not resumable — use `pause_print` if you may want to continue.
857
+
858
+ ```json
859
+ {
860
+ "host": "192.168.1.100",
861
+ "bambu_serial": "01P00A123456789",
862
+ "bambu_token": "your_access_token"
863
+ }
864
+ ```
865
+
866
+ #### pause_print
867
+
868
+ Pause the currently running print job. Sends an `UpdateState` MQTT command with `state: "pause"`. Resumable via `resume_print`.
869
+
870
+ ```json
871
+ {
872
+ "host": "192.168.1.100",
873
+ "bambu_serial": "01P00A123456789",
874
+ "bambu_token": "your_access_token"
875
+ }
876
+ ```
877
+
878
+ #### resume_print
879
+
880
+ Resume a paused print job. Sends an `UpdateState` MQTT command with `state: "resume"`.
928
881
 
929
882
  ```json
930
883
  {
@@ -934,6 +887,58 @@ Cancel the currently running print job. Sends an `UpdateState` MQTT command with
934
887
  }
935
888
  ```
936
889
 
890
+ #### clear_hms_errors
891
+
892
+ Clear HMS or print error state on the printer. Sends Bambu's `clean_print_error` MQTT command.
893
+
894
+ ```json
895
+ {
896
+ "host": "192.168.1.100",
897
+ "bambu_serial": "01P00A123456789",
898
+ "bambu_token": "your_access_token"
899
+ }
900
+ ```
901
+
902
+ #### set_print_speed
903
+
904
+ Set the active print speed mode. Accepted `mode` values are `silent`, `standard`, `sport`, `ludicrous`, or their numeric equivalents `1`, `2`, `3`, and `4`.
905
+
906
+ ```json
907
+ {
908
+ "mode": "sport",
909
+ "host": "192.168.1.100",
910
+ "bambu_serial": "01P00A123456789",
911
+ "bambu_token": "your_access_token"
912
+ }
913
+ ```
914
+
915
+ #### set_airduct_mode
916
+
917
+ Set H2/P2 airduct mode to `cooling` or `heating`. This is intended for supported printers only.
918
+
919
+ ```json
920
+ {
921
+ "mode": "cooling",
922
+ "host": "192.168.1.100",
923
+ "bambu_serial": "01P00A123456789",
924
+ "bambu_token": "your_access_token"
925
+ }
926
+ ```
927
+
928
+ #### reread_ams_rfid
929
+
930
+ Trigger a Bambu AMS RFID re-read for one AMS slot. This can move AMS filament; use it only when the printer is idle and unloaded.
931
+
932
+ ```json
933
+ {
934
+ "ams_id": 0,
935
+ "slot_id": 1,
936
+ "host": "192.168.1.100",
937
+ "bambu_serial": "01P00A123456789",
938
+ "bambu_token": "your_access_token"
939
+ }
940
+ ```
941
+
937
942
  #### set_temperature
938
943
 
939
944
  Set the target temperature for the bed or nozzle. Dispatches an M140 (bed) or M104 (nozzle) G-code command via MQTT. Valid range is 0 to 300 degrees Celsius. Accepted values for `component` are `bed`, `nozzle`, `extruder`, `tool`, and `tool0`.
@@ -948,18 +953,80 @@ Set the target temperature for the bed or nozzle. Dispatches an M140 (bed) or M1
948
953
  }
949
954
  ```
950
955
 
956
+ #### set_fan_speed
957
+
958
+ Set a printer fan speed from 0 to 100 percent. Accepted `fan` values are `part`, `auxiliary`, `chamber`, `1`, `2`, and `3`.
959
+
960
+ ```json
961
+ {
962
+ "fan": "chamber",
963
+ "speed": 40,
964
+ "host": "192.168.1.100",
965
+ "bambu_serial": "01P00A123456789",
966
+ "bambu_token": "your_access_token"
967
+ }
968
+ ```
969
+
970
+ #### set_light
971
+
972
+ Set a printer light node mode. Common Bambu firmware reports the chamber light as `chamber_light`; valid modes are `on`, `off`, and `flashing`.
973
+
974
+ ```json
975
+ {
976
+ "light": "chamber_light",
977
+ "mode": "on",
978
+ "host": "192.168.1.100",
979
+ "bambu_serial": "01P00A123456789",
980
+ "bambu_token": "your_access_token"
981
+ }
982
+ ```
983
+
984
+ #### skip_objects
985
+
986
+ Skip specific object IDs during a running multi-object print. Use `list_3mf_plate_objects` on the sliced 3MF to find the IDs first.
987
+
988
+ ```json
989
+ {
990
+ "object_ids": [6495, 6496],
991
+ "host": "192.168.1.100",
992
+ "bambu_serial": "01P00A123456789",
993
+ "bambu_token": "your_access_token"
994
+ }
995
+ ```
996
+
997
+ #### set_ams_drying
998
+
999
+ Start or stop the AMS filament drying cycle on heated AMS units (AMS Pro / AMS-HT). The `action` parameter accepts `start` or `stop`. The `ams_id` must be an integer from 0 to 3.
1000
+
1001
+ ```json
1002
+ {
1003
+ "action": "start",
1004
+ "ams_id": 0,
1005
+ "host": "192.168.1.100",
1006
+ "bambu_serial": "01P00A123456789",
1007
+ "bambu_token": "your_access_token"
1008
+ }
1009
+ ```
1010
+
1011
+ To stop drying:
1012
+
1013
+ ```json
1014
+ {
1015
+ "action": "stop",
1016
+ "ams_id": 0
1017
+ }
1018
+ ```
1019
+
951
1020
  #### print_3mf
952
1021
 
953
- The primary tool for the direct local Bambu path. This tool handles the complete workflow:
1022
+ The primary tool for starting a Bambu print. **Recommended input: a pre-sliced `.gcode.3mf` exported from Bambu Studio** — see [docs/SLICING.md](./docs/SLICING.md). This tool handles the complete workflow:
954
1023
 
955
1024
  1. Checks whether the 3MF contains embedded G-code (`Metadata/plate_<n>.gcode` entries).
956
- 2. If no G-code is found, automatically slices the file using the configured slicer before proceeding.
1025
+ 2. If no G-code is found, attempts to auto-slice via the configured slicer. This fallback is unreliable in practice (stale profiles, leftover multi-filament declarations) — prefer pre-slicing in Bambu Studio.
957
1026
  3. Parses the sliced 3MF to extract the correct plate file and compute its MD5 hash.
958
- 4. Also parses `Metadata/project_settings.config` to read AMS mapping embedded by Bambu Studio or OrcaSlicer.
1027
+ 4. Also parses `Metadata/project_settings.config` to read AMS mapping embedded by Bambu Studio.
959
1028
  5. Uploads the 3MF to the printer's `cache/` directory via FTPS using `basic-ftp` directly (avoiding the bambu-js double-path bug).
960
- 6. Sends a `project_file` MQTT command with the plate path, MD5, AMS mapping (formatted as a 5-element array per the OpenBambuAPI spec), and calibration flags.
961
-
962
- This path uses BambuStudio/Orca/FULU as a slicer CLI only. It does not use FULU's BambuNetwork runtime unless you explicitly set `connection_mode: "bambu_network"`.
1029
+ 6. Sends the correct MQTT print command for the target printer family. For H2S/H2D/H2C that means `project_file` with project-length `ams_mapping`, parallel `ams_mapping2`, and H2-compatible calibration flags.
963
1030
 
964
1031
  ```json
965
1032
  {
@@ -969,9 +1036,6 @@ This path uses BambuStudio/Orca/FULU as a slicer CLI only. It does not use FULU'
969
1036
  "host": "192.168.1.100",
970
1037
  "bambu_serial": "01P00A123456789",
971
1038
  "bambu_token": "your_access_token",
972
- "slicer_type": "orcaslicer-bambulab",
973
- "slicer_path": "/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer",
974
- "plate_index": 0,
975
1039
  "bed_leveling": true,
976
1040
  "flow_calibration": true,
977
1041
  "vibration_calibration": true,
@@ -983,152 +1047,163 @@ This path uses BambuStudio/Orca/FULU as a slicer CLI only. It does not use FULU'
983
1047
 
984
1048
  `bambu_model` is **required** -- it ensures the slicer generates G-code for the correct printer. Using the wrong model can cause the bed to crash into the nozzle. If `bambu_model` is not provided in the tool call and `BAMBU_MODEL` is not set in the environment, the server will ask you interactively via MCP elicitation (if your client supports it) or return a clear error.
985
1049
 
986
- `bed_type` defaults to `textured_plate` if omitted. AMS mapping from the 3MF's slicer config is used automatically when present; the `ams_mapping` argument overrides it. Setting `use_ams: false` disables AMS entirely regardless of other mapping values.
1050
+ `bed_type` defaults to `textured_plate` if omitted. `ams_slots` is the preferred override input; `ams_mapping` remains the raw escape hatch. On AMS-equipped H2 printers, `use_ams: false` does not suppress mapping lookup if the sliced file declares filaments. If no mapping is provided for an H2 pre-sliced job with declared filaments, the server fails before sending; pass explicit `ams_slots`, raw `ams_mapping`, or `auto_match_ams: true`.
987
1051
 
988
- `slicer_type`, `slicer_path`, and `slicer_profile` only matter when `print_3mf` receives an unsliced 3MF and needs to auto-slice it. Use `orcaslicer-bambulab` for FULU's fork, `orcaslicer` for upstream OrcaSlicer, or `bambustudio` for BambuStudio. `plate_index` is zero-based and selects which embedded `Metadata/plate_<n>.gcode` file to print.
1052
+ Set `auto_match_ams: true` to match the sliced 3MF's `tray_info_idx` values against the live AMS inventory and use the matching `ams_slots`. The matcher joins on `(tray_info_idx, tray_color)` and tracks already-claimed slots, so prints with two filaments of the same SKU but different colors (e.g. two GFG02 PETG HF in black and white) resolve correctly. Falls back to SKU-only when the 3MF's filament has no color set or only one tray of that SKU is loaded. Returns a structured `missing` report (`reason: "no_loaded_match" | "color_mismatch" | "exhausted" | "no_sku"`) when a filament can't be resolved. Ignored when you provide `ams_slots` or `ams_mapping` explicitly.
989
1053
 
990
1054
  Layer height, nozzle temperature, and other slicer parameters cannot be overridden via this tool -- they are baked into the 3MF's G-code at slice time. Apply those settings in your slicer before generating the 3MF.
991
1055
 
992
- On firmware that enforces Bambu's newer command verification, this direct path can upload the 3MF and still be rejected when the printer receives the MQTT `project_file` command. In that case, `get_printer_status` may show HMS `0500050000010007`, which BambuStudio's own HMS table describes as `MQTT Command verification failed`. That is the exact situation the FULU bridge path is meant to keep iterating on.
1056
+ #### resolve_3mf_ams_slots
993
1057
 
994
- To use FULU's restored BambuNetwork path from the same tool, pass `connection_mode: "bambu_network"`. In that mode, local `BAMBU_SERIAL`/`BAMBU_TOKEN` are not required for cloud print starts, but `dev_id` is required.
1058
+ Dry-run the AMS match without uploading or starting a print. The tool reads `Metadata/plate_<n>.json` and `Metadata/slice_info.config`, then compares required `tray_info_idx` values against live AMS trays.
995
1059
 
996
1060
  ```json
997
1061
  {
998
- "three_mf_path": "/Users/yourname/Downloads/bracket.3mf",
999
- "bambu_model": "p1s",
1000
- "connection_mode": "bambu_network",
1001
- "connection_type": "cloud",
1002
- "dev_id": "01P00A123456789"
1062
+ "three_mf_path": "/Users/yourname/Downloads/bracket.gcode.3mf",
1063
+ "bambu_model": "h2d",
1064
+ "host": "192.168.1.100",
1065
+ "bambu_serial": "094...",
1066
+ "bambu_token": "your_access_token"
1003
1067
  }
1004
1068
  ```
1005
1069
 
1006
- #### print_3mf_bambu_network
1070
+ #### list_3mf_plate_objects
1007
1071
 
1008
- Start a 3MF print through FULU OrcaSlicer-bambulab's restored BambuNetwork runtime. This tool builds FULU-compatible `PrintParams`, converts `plate_index` from MCP zero-based to FULU one-based indexing, preserves slicer auto-slice behavior for unsliced 3MFs, and sends the job through the bridge.
1072
+ List object IDs from a sliced 3MF plate. Use this before `skip_objects` so you pass real Bambu object IDs instead of display-order guesses.
1009
1073
 
1010
1074
  ```json
1011
1075
  {
1012
- "three_mf_path": "/Users/yourname/Downloads/bracket.3mf",
1013
- "bambu_model": "p1s",
1014
- "connection_type": "cloud",
1015
- "dev_id": "01P00A123456789",
1016
- "bed_type": "textured_plate",
1017
- "plate_index": 0,
1018
- "use_ams": true,
1019
- "ams_mapping": [0, 1]
1076
+ "three_mf_path": "/Users/yourname/Downloads/bracket.gcode.3mf",
1077
+ "plate_index": 0
1020
1078
  }
1021
1079
  ```
1022
1080
 
1023
- The tool treats any non-zero numeric return from FULU's print method as a failure, even if the bridge response itself says `ok: true`. This matters because the bridge can successfully load and call the network library while the library returns a BambuNetwork print error such as `-4030`.
1081
+ #### print_collar_charm
1024
1082
 
1025
- When debugging, start with the defaults:
1083
+ High-level wrapper for a prepared two-part dog-collar-charm workflow. This tool is intentionally specialized: it expects a prepared two-part charm project and applies a fixed tray policy.
1026
1084
 
1027
- - `connection_type: "cloud"` uses `start_print`.
1028
- - `connection_type: "lan"` uses `start_local_print`.
1029
- - Add `bambu_network_method: "start_local_print_with_record"` to mimic Orca's richer LAN path.
1085
+ - Smaller inner object -> black -> AMS 1 slot 1
1086
+ - Larger outer object -> white -> AMS 2 slot 1
1030
1087
 
1031
- For LAN/local bridge printing, include `dev_ip` and the printer access code:
1088
+ The tool will:
1089
+
1090
+ 1. Resolve a local `.3mf` or `template_name`.
1091
+ 2. Auto-slice if the 3MF is still an unsliced project.
1092
+ 3. Inspect `Metadata/plate_1.json` to identify the smaller inner part and larger outer part.
1093
+ 4. Preflight the required AMS trays on the printer.
1094
+ 5. Dispatch the print through the existing H2-safe `print3mf` path using `ams_slots`.
1032
1095
 
1033
1096
  ```json
1034
1097
  {
1035
- "three_mf_path": "/Users/yourname/Downloads/bracket.3mf",
1036
- "bambu_model": "p1s",
1037
- "connection_type": "lan",
1038
- "dev_id": "01P00A123456789",
1039
- "dev_ip": "192.168.1.100",
1040
- "bambu_token": "your_access_token"
1098
+ "template_name": "collars/letter_charm_a",
1099
+ "bambu_model": "h2d",
1100
+ "host": "192.168.1.100",
1101
+ "bambu_serial": "03W09C123456789",
1102
+ "bambu_token": "your_access_token",
1103
+ "bed_leveling": true,
1104
+ "flow_calibration": true,
1105
+ "vibration_calibration": true,
1106
+ "timelapse": false
1041
1107
  }
1042
1108
  ```
1043
1109
 
1044
- #### bambu_network_bridge_status
1110
+ You can also pass `source_path` directly instead of `template_name`.
1045
1111
 
1046
- Inspect the configured FULU bridge command and runtime. Pass `connect: true` to start the bridge, run `bridge.handshake`, create a BambuNetwork agent, and return the handshake plus macOS runtime hints.
1112
+ This wrapper currently assumes:
1047
1113
 
1048
- ```json
1049
- {
1050
- "connect": true,
1051
- "country_code": "US"
1052
- }
1053
- ```
1114
+ - the input is a prepared two-part charm `.3mf`, not a bare STL that needs color-region generation
1115
+ - the selected plate has exactly 2 objects
1116
+ - the selected plate has exactly 2 used filament positions
1117
+ - the smaller object is the inner insert/letter and the larger object is the outer body
1118
+
1119
+ If the project does not match those assumptions, the tool fails fast with a structured error instead of guessing. The role-to-color and color-to-tray mapping is isolated in code so the next version can evolve toward customer-requested colors without replacing the whole wrapper.
1120
+
1121
+ </details>
1122
+
1123
+ <details>
1124
+ <summary><strong>Click to expand Slicing Tools</strong></summary>
1054
1125
 
1055
- Use this before every print debugging session. Useful fields:
1126
+ ### Slicing Tools
1056
1127
 
1057
- | Field | What it means |
1058
- |---|---|
1059
- | `configured` | Whether `BAMBU_NETWORK_BRIDGE_COMMAND` or an equivalent env var is set. |
1060
- | `connected` | Whether the bridge process started and agent initialization completed for this probe. |
1061
- | `agentReady` | Whether the MCP has an initialized BambuNetwork agent handle. |
1062
- | `handshake.network_loaded` | Whether FULU's BambuNetwork library loaded. |
1063
- | `handshake.source_loaded` | Whether FULU's BambuSource library loaded. |
1064
- | `handshake.network_actual_abi_version` | The ABI version reported by the loaded network library. The MCP can auto-retry with this value. |
1065
- | `runtime.macosMissingRuntimeFiles` | Missing macOS runtime files under `~/Library/Application Support/OrcaSlicer/macos-bridge/runtime`. |
1066
- | `runtime.macosMissingPluginFiles` | Missing macOS wrapper/install/verify files under the FULU plugin directory. |
1128
+ > **Note:** the verified workflow is to slice in Bambu Studio (GUI) and feed the resulting `.gcode.3mf` to `print_3mf`. The CLI-driven slicing tools below (`slice_stl`, `slice_with_template`) work but are sensitive to profile drift and are not the recommended path for production prints. See [docs/SLICING.md](./docs/SLICING.md).
1067
1129
 
1068
- #### bambu_network_call
1130
+ #### list_templates
1069
1131
 
1070
- Call a raw FULU bridge method. By default the tool initializes an agent and injects its `agent` id into the payload. Set `with_agent: false` for methods such as `bridge.handshake`.
1132
+ List saved templates from the local registry directory. You can override the registry root with `BAMBU_TEMPLATE_DIR`.
1071
1133
 
1072
1134
  ```json
1073
- {
1074
- "method": "net.is_user_login",
1075
- "payload": {}
1076
- }
1135
+ {}
1077
1136
  ```
1078
1137
 
1079
- Examples:
1138
+ Each result includes the template `name`, absolute `path`, source type, and relative path inside the registry. You can then pass `template_name` to `get_slice_settings`, `slice_stl`, or `print_3mf` instead of a raw path.
1139
+
1140
+ #### save_template
1141
+
1142
+ Copy a local `3mf`, `json`, or `.config` file into the template registry and register it under a reusable template name.
1080
1143
 
1081
1144
  ```json
1082
1145
  {
1083
- "method": "bridge.handshake",
1084
- "payload": {},
1085
- "with_agent": false
1146
+ "source_path": "/path/to/sliced_project.3mf",
1147
+ "template_name": "collars/p1p_petg_default"
1086
1148
  }
1087
1149
  ```
1088
1150
 
1151
+ This creates the destination under the template registry directory and makes it available immediately to `list_templates`, `get_slice_settings`, `slice_with_template`, `slice_stl`, and `print_3mf`.
1152
+
1153
+ #### get_slice_settings
1154
+
1155
+ Inspect the slicer settings embedded in a saved 3MF template or in an extracted JSON/config profile without slicing anything.
1156
+
1089
1157
  ```json
1090
1158
  {
1091
- "method": "net.get_user_selected_machine",
1092
- "payload": {}
1159
+ "template_name": "h2s_template"
1093
1160
  }
1094
1161
  ```
1095
1162
 
1096
- Raw bridge calls are for diagnostics and compatibility testing. Do not paste account `user_info` JSON or access tokens into issue reports.
1163
+ This returns a compact summary of the high-signal settings such as printer preset, default print profile, filament profiles, layer height, infill density, shell counts, support mode, and bed type. It accepts either `source_path` or `template_name`. For 3MF inputs it also writes the extracted settings blob to a temp path so the result can be reused directly.
1097
1164
 
1098
- </details>
1165
+ #### slice_with_template
1099
1166
 
1100
- <details>
1101
- <summary><strong>Click to expand Slicing Tools</strong></summary>
1167
+ Slice an STL or 3MF using a named template from the local registry. This is a higher-level wrapper over `slice_stl` for template-based workflows.
1102
1168
 
1103
- ### Slicing Tools
1169
+ ```json
1170
+ {
1171
+ "stl_path": "/path/to/model.stl",
1172
+ "template_name": "collars/p1p_petg_default",
1173
+ "bambu_model": "p1p"
1174
+ }
1175
+ ```
1176
+
1177
+ This uses the named template as the slicing profile source and still supports live printer filament selection unless you explicitly override `load_filaments`. The template settings are applied at slice time, and the later `print_3mf` step computes H2-safe AMS mapping from the newly sliced output.
1104
1178
 
1105
1179
  #### slice_stl
1106
1180
 
1107
- Slice an STL or 3MF file using an external slicer and return the path to the output file. The output is a sliced 3MF for Bambu-compatible slicers (`bambustudio`, `orcaslicer`, `orcaslicer-bambulab`) or a G-code file for PrusaSlicer, Cura, and Slic3r.
1181
+ Slice an STL or 3MF file using an external slicer and return the path to the output file. The output is a sliced 3MF (for BambuStudio and OrcaSlicer) or a G-code file (for PrusaSlicer, Cura, Slic3r).
1108
1182
 
1109
1183
  ```json
1110
1184
  {
1111
1185
  "stl_path": "/path/to/model.stl",
1112
- "bambu_model": "p1s",
1113
- "slicer_type": "orcaslicer-bambulab",
1114
- "slicer_path": "/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer",
1186
+ "slicer_type": "bambustudio",
1187
+ "slicer_path": "/Applications/BambuStudio.app/Contents/MacOS/BambuStudio",
1115
1188
  "slicer_profile": "/path/to/profile.ini"
1116
1189
  }
1117
1190
  ```
1118
1191
 
1119
- `slicer_type` options: `bambustudio`, `orcaslicer`, `orcaslicer-bambulab`, `prusaslicer`, `cura`, `slic3r`. Aliases such as `fulu-orca`, `orca-studio`, and `orca-bambulab` are accepted. When omitted, the value from the `SLICER_TYPE` environment variable is used (default: `bambustudio`).
1192
+ `slicer_type` options: `bambustudio`, `orcaslicer`, `prusaslicer`, `cura`, `slic3r`. When omitted, the value from the `SLICER_TYPE` environment variable is used (default: `bambustudio`).
1120
1193
 
1121
1194
  `slicer_path` and `slicer_profile` fall back to the `SLICER_PATH` and `SLICER_PROFILE` environment variables when omitted.
1122
1195
 
1123
- For printing on a Bambu printer, the recommended workflow is: slice with `orcaslicer-bambulab`, `orcaslicer`, or `bambustudio` to get a sliced 3MF, then pass that output path to `print_3mf`.
1196
+ You can provide either `template_3mf_path` or `template_name` when you want to slice from a saved template. `template_name` resolves through the local template registry directory configured for the server.
1197
+
1198
+ For printing on a Bambu printer, the recommended workflow is: slice with `bambustudio` to get a sliced 3MF, then pass that output path to `print_3mf`.
1124
1199
 
1125
- #### Bambu-compatible Slicer Options
1200
+ #### BambuStudio Slicer Options
1126
1201
 
1127
- When `slicer_type` is `bambustudio`, `orcaslicer`, or `orcaslicer-bambulab`, these additional parameters are available on `slice_stl`:
1202
+ When `slicer_type` is `bambustudio` (the default), these additional parameters are available on `slice_stl`:
1128
1203
 
1129
1204
  | Parameter | Type | Description |
1130
1205
  |-----------|------|-------------|
1131
- | `uptodate` | boolean | Update 3MF configs to latest Bambu-compatible presets |
1206
+ | `uptodate` | boolean | Update 3MF configs to latest BambuStudio presets |
1132
1207
  | `repetitions` | number | Number of copies to print |
1133
1208
  | `orient` | boolean | Auto-orient model for optimal printability |
1134
1209
  | `arrange` | boolean | Auto-arrange objects on the build plate |
@@ -1215,6 +1290,8 @@ Resources follow the MCP resource protocol and can be read by calling `ReadResou
1215
1290
 
1216
1291
  - `printer://{host}/files` -- File listing for the printer's SD card. Equivalent to calling `list_printer_files`. Returns files grouped by directory.
1217
1292
 
1293
+ - `printer://{host}/hms` -- HMS and error diagnostics from the latest status payload. Returns connection state, printer status, explicit HMS payloads when present, and shallow raw fields whose names indicate errors, failures, warnings, or HMS data.
1294
+
1218
1295
  **Example:** To read the status of the default printer, use URI `printer://192.168.1.100/status`. The host segment must match a configured printer IP; the server uses `PRINTER_HOST` if the default URI template is used.
1219
1296
 
1220
1297
  ---
@@ -1231,6 +1308,18 @@ After connecting the MCP server in Claude Desktop or Claude Code, you can ask Cl
1231
1308
  - "Cancel the current print job."
1232
1309
  - "Set the nozzle temperature to 220 degrees."
1233
1310
  - "Set the bed to 65 degrees."
1311
+ - "Turn the chamber light on."
1312
+ - "Set the chamber fan to 40 percent."
1313
+ - "List the object IDs in this sliced 3MF."
1314
+ - "Skip object 6495 on the current print."
1315
+ - "Start the AMS drying cycle on AMS 0."
1316
+ - "Stop drying on AMS 1."
1317
+ - "Match the AMS slots for this 3MF against my loaded filaments without printing."
1318
+ - "Auto-match AMS slots and print this 3MF."
1319
+ - "Take a camera snapshot of the print bed."
1320
+ - "Show me the HMS error codes on the printer."
1321
+ - "What speed mode is the printer in?"
1322
+ - "Set the airduct to cooling mode."
1234
1323
 
1235
1324
  ### Printing 3MF files
1236
1325
 
@@ -1238,9 +1327,7 @@ After connecting the MCP server in Claude Desktop or Claude Code, you can ask Cl
1238
1327
  - "Upload bracket.3mf to the printer and start printing with AMS slots 0 and 1."
1239
1328
  - "Print my_model.3mf with bed leveling enabled and vibration calibration off."
1240
1329
  - "Upload this 3MF without printing it yet."
1241
- - "Slice model.stl with FULU OrcaSlicer-bambulab and then print the result."
1242
- - "Probe the FULU BambuNetwork bridge and tell me whether the macOS runtime is ready."
1243
- - "Print bracket.3mf through FULU BambuNetwork cloud printing on my P1S."
1330
+ - "Slice model.stl with BambuStudio and then print the result."
1244
1331
 
1245
1332
  ### STL manipulation
1246
1333
 
@@ -1256,65 +1343,16 @@ After connecting the MCP server in Claude Desktop or Claude Code, you can ask Cl
1256
1343
  ### Combined workflows
1257
1344
 
1258
1345
  - "Rotate model.stl 45 degrees around Z, extend the base by 2mm, then print it on my Bambu P1S."
1259
- - "Take this unsliced 3MF, slice it with OrcaSlicer-bambulab, and print the result."
1346
+ - "Take this unsliced 3MF, slice it with BambuStudio, and print the result."
1260
1347
  - "Scale this part to 80% of its size, lay it flat, and start a print."
1261
1348
 
1262
1349
  ---
1263
1350
 
1264
- ## Troubleshooting and Tester Reports
1265
-
1266
- The fastest way to improve this is to keep reports concrete. A print command that was merely published is not the same thing as a printer starting motion. Always check the printer status after a print attempt.
1267
-
1268
- ### Quick diagnosis flow
1269
-
1270
- 1. Run `get_printer_status` first. Confirm the printer is connected, idle, has an SD card/storage available, and reports the expected model.
1271
- 2. If using a source checkout, run `npm run build` and `npm test` so local TypeScript or behavior-test failures are separated from printer/runtime failures.
1272
- 3. If using direct local printing, call `print_3mf`, then immediately call `get_printer_status` again. Look for `gcode_state`, `subtask_name`, `mc_percent`, and `hms`.
1273
- 4. If using FULU, call `bambu_network_bridge_status` with `connect: true` before printing. Confirm `network_loaded`, `source_loaded`, and `agentReady`.
1274
- 5. Try the default FULU method for your connection type. If LAN fails, retry with `bambu_network_method: "start_local_print_with_record"` and include the return code in your report.
1275
- 6. Report whether the printer actually left `IDLE`. A returned value of `0` is useful, but printer motion/status is the proof.
1276
-
1277
- ### Common symptoms
1278
-
1279
- | Symptom | Likely layer | What to check |
1280
- |---|---|---|
1281
- | `BAMBU_MODEL is required` | Safety gate | Set `BAMBU_MODEL` or pass `bambu_model`. The server intentionally refuses to guess printer model for print operations. |
1282
- | Slicer CLI cannot find a Bambu profile | Slicer setup | Use BambuStudio or Orca/FULU with installed printer profiles, or set `BAMBU_SLICER_PROFILE_DIRS` for custom profile locations. |
1283
- | `3MF does not contain Metadata/plate_<n>.gcode` | Unsliced file | Let `print_3mf` auto-slice with a configured slicer, or export a sliced 3MF from BambuStudio/Orca/FULU first. |
1284
- | FTPS upload fails | Local LAN file path/auth | Confirm Developer Mode/LAN access code, printer IP, port `990`, and SD card/storage state. |
1285
- | Direct path says command sent but printer stays `IDLE` | Printer rejected MQTT command | Check `hms`; `0500050000010007` means `MQTT Command verification failed`. Try the FULU bridge path and report firmware/model details. |
1286
- | `bambu_network_bridge_status` cannot start | Bridge command/runtime | Check `BAMBU_NETWORK_BRIDGE_COMMAND`, wrapper path, runtime files, and Lima/WSL setup. |
1287
- | FULU print returns `-4030` or `send msg failed` | BambuNetwork runtime/printer acceptance | Bridge reached the library, but the print start failed. Report method, platform, firmware, connection type, and redacted bridge status. |
1288
- | Bridge loads only after ABI retry | Expected with some FULU builds | The MCP auto-detects `network_actual_abi_version`; include it in reports but do not manually set it unless debugging. |
1289
-
1290
- ### Minimal useful report
1291
-
1292
- Please include:
1293
-
1294
- - OS and architecture: for example `macOS 15 Apple Silicon`, `Ubuntu x86_64`, or `Windows 11 + WSL 2`.
1295
- - Install source: npm package version, git commit SHA, or local branch.
1296
- - Printer model and firmware version.
1297
- - Slicer used: `bambustudio`, `orcaslicer`, or `orcaslicer-bambulab`.
1298
- - Print path used: direct `print_3mf`, `print_3mf` with `connection_mode: "bambu_network"`, or `print_3mf_bambu_network`.
1299
- - FULU method if applicable: `start_print`, `start_local_print`, `start_local_print_with_record`, `start_send_gcode_to_sdcard`, or `start_sdcard_print`.
1300
- - Redacted `bambu_network_bridge_status` output when using FULU.
1301
- - Return payload from the failed tool call with access codes, serial numbers, tokens, cloud account data, and local usernames redacted.
1302
- - `get_printer_status` after the attempt, especially `gcode_state` and `hms`.
1303
-
1304
- Please do not include:
1305
-
1306
- - Full printer serial number.
1307
- - LAN access code.
1308
- - Bambu account token or raw `user_info` JSON.
1309
- - Public IPs, VPN hostnames, or home-network details that are not needed for debugging.
1310
-
1311
- ---
1312
-
1313
1351
  ## Bambu Lab Printer Limitations
1314
1352
 
1315
1353
  Understanding these constraints will help you avoid frustrating errors and set appropriate expectations.
1316
1354
 
1317
- 1. **Printable 3MF required for print_3mf.** The `print_3mf` tool expects a sliced 3MF containing at least one `Metadata/plate_<n>.gcode` entry. If you pass an unsliced 3MF (one exported from a CAD tool without slicing), the server will attempt to auto-slice it using the configured slicer. If auto-slicing fails, the tool errors out rather than sending an incomplete command to the printer.
1355
+ 1. **Printable 3MF required for print_3mf.** The `print_3mf` tool expects a sliced 3MF containing at least one `Metadata/plate_<n>.gcode` entry. If you pass an unsliced 3MF (one exported from a CAD tool without slicing), the server will attempt to auto-slice it using the configured slicer — but this fallback is brittle and the recommended workflow is to pre-slice in Bambu Studio and pass the resulting `.gcode.3mf`. See [docs/SLICING.md](./docs/SLICING.md) for the full procedure.
1318
1356
 
1319
1357
  2. **Layer height, temperature, and slicer settings are baked in.** The `project_file` MQTT command tells the printer which plate to run. It does not support overriding layer height, temperature targets, infill percentage, or other slicing parameters at print time. These must be set in your slicer before generating the 3MF.
1320
1358
 
@@ -1324,12 +1362,10 @@ Understanding these constraints will help you avoid frustrating errors and set a
1324
1362
 
1325
1363
  5. **Real-time status has latency.** `get_printer_status` sends a `push_all` MQTT request and waits up to 1.5 seconds for a response before reading cached state. If the printer is not responding quickly (busy, sleeping, or transitioning states), you may see slightly stale data. There is no persistent event subscription in this server -- each status call is a fresh request.
1326
1364
 
1327
- 6. **Direct MCP printing is LAN-only; FULU bridge printing is opt-in.** The default MQTT/FTPS tools require the printer to be on the same local network as the machine running this server with Developer Mode enabled. Remote/cloud printing requires the optional FULU BambuNetwork bridge and `print_3mf_bambu_network`.
1365
+ 6. **LAN mode required.** All operations require the printer to be on the same local network as the machine running this server. Cloud-only or remote access setups are not supported. If your printer is connected only via Bambu Cloud and LAN mode is disabled, connection will fail.
1328
1366
 
1329
1367
  7. **Self-signed TLS certificate.** The printer's FTPS server uses a self-signed certificate. The `basic-ftp` client is configured with `rejectUnauthorized: false` to accept it. This is standard for local network Bambu connections but assumes a trusted local network environment.
1330
1368
 
1331
- 8. **Newer firmware can reject third-party project commands after upload.** A successful FTPS upload and MQTT publish does not guarantee the printer accepted the job. On the macOS test bench, the printer returned HMS `0500050000010007`, which BambuStudio describes as `MQTT Command verification failed`. This README calls that out because pretending the job started would waste everyone's time.
1332
-
1333
1369
  ---
1334
1370
 
1335
1371
  ## General Limitations and Considerations
@@ -1352,7 +1388,7 @@ STL manipulation tools load the entire mesh into memory as Three.js geometry. Fo
1352
1388
 
1353
1389
  ### Performance considerations
1354
1390
 
1355
- - Slicing with BambuStudio or OrcaSlicer CLI can take 30 seconds to several minutes depending on model complexity, layer height, and your system's CPU. The `slice_stl` call is synchronous and will block until the slicer process completes.
1391
+ - Slicing with BambuStudio CLI can take 30 seconds to several minutes depending on model complexity, layer height, and your system's CPU. The `slice_stl` call is synchronous and will block until the slicer process completes.
1356
1392
  - FTPS uploads for large 3MF files (multi-plate prints, high-detail models) may take 15 to 60 seconds depending on your local network speed.
1357
1393
  - MQTT connections are pooled by `host + serial` key. The first call to any printer tool in a session establishes the MQTT connection; subsequent calls reuse it. If the connection drops (printer power cycled, network interruption), the next call will reconnect automatically.
1358
1394
 
@@ -1363,3 +1399,7 @@ STL manipulation tools load the entire mesh into memory as Three.js geometry. Fo
1363
1399
  GPL-2.0. See [LICENSE](./LICENSE) for the full text.
1364
1400
 
1365
1401
  This project is a fork of [mcp-3D-printer-server](https://github.com/DMontgomery40/mcp-3D-printer-server) by David Montgomery, also GPL-2.0.
1402
+
1403
+ ## Acknowledgements
1404
+
1405
+ Some printer command surfaces and workflow priorities were informed by [Bambuddy](https://github.com/maziggy/bambuddy), an AGPL-3.0 Bambu Lab printer management project. This project does not vendor Bambuddy code.