Printer Control Tools
counterpart_print_record
Use list_jobs: true to discover the retained job IDs before selecting an older job_id. Latest-job reads discover newer dispatches made by another MCP process. The process that authorized dispatch owns report writes while it is alive; after it exits, a restarted observer can take over from the saved record. Concurrent passive MCP sessions read the same disk evidence without overwriting the active recorder. Camera bytes appear once, in structuredContent, when include_frames: true.
Read the flight record of a job this server dispatched, without contacting the printer. Firmware finished means the printer finished its commands; it does not verify the physical object.
{"job_id":"optional saved record UUID", "include_frames":false}Omit job_id for the latest job on the configured printer; ordinary printer target overrides select another saved printer. The result has contract: "counterpart/1", status: "recorded" | "unavailable", an optional version-1 record, and separate physical evidence. Bambu records allowlisted native report fields; other adapters retain their existing normalized observations, without inventing fields their firmware/adapter does not expose. A record is established at the existing send-authorization boundary, so a lost transport/helper reply still leaves the exact hash/mapping with dispatch.outcome: "unconfirmed". A successful transport reply marks it accepted; a matching active firmware report marks it observed-active. These outcomes do not verify physical success or authorize a retry. The record retains the inspected artifact SHA-256, selected plate/hash, filament mapping/materials, timestamped allowlisted state/error/stage/AMS/temperature changes, latest state, truncation count and camera metadata. Printer names, hosts, serials, credentials, arbitrary report text and URLs are excluded; the target and dispatched job identity are hashed. Raw unknown fields remain unknown; AMS remain: -1 is not empty. After an active report has been seen, firmware terminal reports freeze the job record so later cooling does not evict its failure evidence. Returned task/subtask execution IDs are hashed. A changed execution ID or an observed ended-to-active reprint invalidates current-progress evidence durably (a bounded one-byte marker), including same-filename reprints; explicit archived reads keep the original evidence. History before this feature or outside retained/connected observations is unavailable, not reconstructed by contacting the printer.
Storage is private (directory 0700, files 0600), survives MCP restart, and is capped at ten jobs, 1 MiB/2048 report changes per job, a 64 KiB visual-observation sidecar, and 32 JPEGs of at most 512 KiB each. At most four images are returned per request. Older changes/jobs are removed; droppedReports, droppedFrames and skippedCheckpoints disclose gaps. COUNTERPART_RECORD_DIR is a trusted server environment override, never a tool-selected filesystem path. Storage failure warns on stderr and marks a record volatile; diagnostics never authorize printing, resume or another mutation.
While the client monitors counterpart_print_progress, existing reports trigger bounded asynchronous preparation-frame candidates (up to three stage changes), a first-layer frame, a completed-first-layer follow-up when layer 2 is observed, then a snapshot at crossed ten-layer milestones and height fractions (5%, 30%, 60%, 90%). The 32-frame ring preserves baseline/first-layer evidence and the latest recorded empty-footprint anomaly. There is no additional status polling or autonomous watcher. Without a monitoring client, known layer geometry, a matching active job and a usable existing camera source, no physical verdict is inferred. Skipped heights are not backfilled. Each frame binds its ID, actual report layer/time, expected sliced Z, capture receipt/acquisition time and image SHA-256. Image acquisition must be at or after its associated report boundary; an active stream waits for a newer frame when its cached frame predates that boundary. Old cached frames, a layer/state change during acquisition, and bounded camera failures are marked unavailable. A stable reported layer is not a hardware-synchronized shutter. include_frames:true reads saved JPEG base64 from disk; it does not open a camera. Expected geometry is the selected 3MF plate's or inspected standalone G-code snapshot's sliced layer Z and extrusion-path XY bounds, including swept extrema for G2/G3 XY arcs, not a calibrated camera silhouette or measured flow. Oversize/unsupported G-code or missing layer reports leave geometry/correspondence unknown.
physical.status is unknown, consistent, suspect_no_growth or suspect_no_extrusion, independently of firmware state. Without a usable client visual observation or calibrated height measurements it remains unknown, including after FINISH. When physical.assessment is present, the client worker should fetch its frameId and any useful referenceFrameIds with counterpart_print_record using frame_format:"images" and optional frame_ids (at most four). This returns normal MCP image content exactly once, indexed by imageContentIndex in frame metadata. Image format defaults to compact view:"evidence"; omittedReports/omittedGeometryLayers disclose omitted journal detail. view:"record" retains the full forensic record. The request includes the selected sliced footprint bounds, layer/height and explicit visibility/deposition criteria.
The client vision worker then calls counterpart_print_assess with:
{"job_id":"saved job UUID","artifact_sha256":"saved dispatch hash","frame_id":"saved frame UUID","image_sha256":"saved JPEG hash","visibility":"clear","footprint_visible":true,"deposition":"absent","attempted":true}The hashes/IDs must match the saved job and image. visibility is clear|dark|occluded|out_of_view|unknown; deposition is absent|present|unknown. Set attempted only when the frame follows attempted object deposition, and footprint_visible only when sufficient expected deposition area can be judged. Optional reference_frame_id, reference_visibility and reference_empty provide empty-bed context. A clearly visible empty footprint after attempted printing is sufficient for suspect_no_extrusion; no reference is required. A lowered, dark or occluded reference is not proof and does not suppress a clear direct observation. Dark/occluded/unlocatable current evidence stays unknown. Merely visible material does not verify height, coverage or final success.
This tool writes only bounded local visual observations (idempotently) and has no printer/camera I/O, model call or control. Observations live separately from the single-writer telemetry journal, so a worker process cannot overwrite live reports. Their result survives MCP restart and firmware FINISH. A suspect_no_extrusion warning stays active for the job through later unknown/dark/occluded observations and FINISH; only a later clear present observation with a visible footprint at a higher layer may supersede it (without proving final success). It is the first structured progress problem, with the observed layer (physical.observedLayer) and separate wording after firmware completion. A first-layer unknown observation still permits a new assessment at the crossed ten-layer checkpoint (10, 20, …), subject to fresh reports, available geometry and camera visibility. Image interpretation is the client worker's responsibility: the MCP does not contain an image classifier or pretend pixel change proves extrusion. Clients must consume pending assessments and should never announce a first layer is down from a counter alone. Installing these backend tools alone does not add that worker loop to an older client.
A worker may also fetch the images/geometry and pass up to four calibrated height measurements to this read tool:
{"measurements":[
{"frameId":"saved frame UUID", "visible":true, "observedHeightMm":24, "uncertaintyMm":0.5, "method":"calibrated-height"},
{"frameId":"another saved frame UUID", "visible":true, "observedHeightMm":24, "uncertaintyMm":0.5, "method":"calibrated-height"}
]}The MCP validates the saved frame identities/times and evaluates these client-supplied measurements; it runs no vision model. Two visible, sufficiently separated expected heights can support consistency, or an unchanged short observed height can support suspect_no_growth. Occluded, out-of-view, uncalibrated, uncertain, stale or contradictory evidence stays unknown. consistent concerns height in those frames only; it does not verify final shape, strength or print success. The assessment returns frame IDs and explicit limitations and is computed without altering the record. There is no automatic stop, pause, resume, model call or printer-setting change.
Sensor limits: Bambu Studio v02.08.02.61 declares P1S lidar calibration unavailable, X1 Carbon lidar calibration available, and H2D calibration/wrapping capabilities. These are capability/configuration facts, not deposited-height measurements. Studio parses xcam detection options and live support bits and AMS air-print capability with firmware exceptions. This feature records reported evidence; it never enables a detector or assumes a capability from a model name.
Validation is offline replay and mocked transports only. No real-printer physical-success claim is made.
Every printer tool accepts host, port, type, and api_key, and Bambu printers also use bambu_serial and bambu_token. Omitted values fall back to PRINTER_HOST, PRINTER_PORT, PRINTER_TYPE, API_KEY, BAMBU_SERIAL, and BAMBU_TOKEN. Keep keys in the server configuration rather than passing them in calls.
What each call does depends on the backend; see printer backend setup for the exact API routes.
Every print start and positive heating command, on every backend, goes through a safety gate: the server inspects the exact G-code it will start, checks each heater target against hardware and material ceilings, and checks that the printer is ready. It does not ask for confirmation or for a bed check: the client's own print action is the approval. Turning a heater off (temperature: 0), pause_print, and cancel_print are never gated. resume_print reheats and moves the printer, so it only resumes a job this server inspected and started. It asks a person first only when the printer cannot hand the file back for re-reading.
get_printer_status
Read the printer's current status. The response is the backend's own status data: Bambu returns temperatures, job state, progress, layers, time remaining, and AMS data; OctoPrint returns printer state and temperatures; Klipper returns the Moonraker host state only.
{
"type": "klipper",
"host": "192.168.1.50",
"port": "7125"
}list_printer_files
List the files stored on the printer or its host software. On Bambu printers it lists the cache/, timelapse/, and logs/ directories.
{
"type": "octoprint",
"host": "192.168.1.100"
}upload_gcode
Upload G-code to the printer, and optionally start it. Pass gcode_path for a local file, or gcode with the content (or a local path). filename defaults to the basename of gcode_path; when printing, use a plain filename so the started file is exactly the uploaded one.
{
"type": "klipper",
"host": "192.168.1.50",
"port": "7125",
"gcode_path": "/path/to/benchy.gcode",
"print": true,
"material": "PETG"
}- Without
print, the file is only uploaded and nothing is inspected or started. - With
print: true, the exact uploaded bytes are inspected first (everySandRheater target, tool changes, and hardware and material ceilings), and the printer's state is checked before the job starts. - Printing needs a declared material: slicer metadata in the file (
; filament_type = PLA) or thematerialargument, which must not contradict the file. - On Bambu printers, files go to
cache/over FTPS, and printing also needs the model (bambu_modelorBAMBU_MODEL). Automatic printing after upload supports.gcodeonly; print.3mfprojects withprint_3mf. - The result's
jobNameis the remote file name.counterpart_print_progressreports the same name asjob.namewhile that job runs.
start_print
Start a G-code file that is already stored on the printer. The server downloads that exact file, inspects it, checks the printer's state, and then starts a uniquely named checked copy. This works on Bambu Lab, OctoPrint, Klipper (Moonraker), and Duet. Repetier, Prusa, and Creality refuse, because their adapters have no verified download route; use upload_gcode with print: true instead.
{
"type": "octoprint",
"host": "192.168.1.100",
"filename": "benchy.gcode",
"material": "PLA"
}Pass material when the file has no filament_type metadata. On Bambu printers it also needs the model and supports .gcode files only; bare filenames are looked up in cache/. The result's jobName is the checked copy's name (checked-<id>-<file>), which is the name the printer reports for the job.
cancel_print
Cancel the current print job. Cancelling is never gated and also cancels checked prints still waiting to start, including a pending resume_print. A cancelled job cannot be resumed; use pause_print to stop temporarily. Bambu stops go over the connection that printed (connection_mode, connection_type, default BAMBU_DEFAULT_CONNECTION_MODE/_TYPE): LAN MQTT, or FULU's BambuNetwork session, which reports the printer's err_code when it refuses.
{
"type": "prusa",
"host": "192.168.1.120"
}pause_print
Pause the current print. Pausing is never gated. Routes: OctoPrint POST /api/job ({"command":"pause","action":"pause"}), Moonraker POST /printer/print/pause, PrusaLink PUT /api/v1/job/<id>/pause, Duet M25, Repetier @pause, Creality printers that run Moonraker, and Bambu {"print":{"command":"pause"}} over LAN MQTT or FULU's BambuNetwork session (the connection that printed, as for cancel_print).
{
"type": "klipper",
"host": "192.168.1.50",
"port": "7125"
}connect_printer
OctoPrint only. Connects OctoPrint to the printer when it is running but not connected: counterpart_print_progress reports octoprint.disconnected then. It uses OctoPrint's own saved serial port, baud rate and printer profile unless serial_port, baudrate or printer_profile is given, and waits up to wait_ms (default 20000) for the connection to settle. With power_on: true it first switches the printer on through the PSU Control plugin when that plugin reports the power off. If OctoPrint is already connected, nothing is sent. The result has action (none, connected, connecting or failed), a message, and OctoPrint's connection (state, port, baudrate, ports, powerOn).
{ "type": "octoprint", "host": "octopi.local", "power_on": true }octoprint_request_api_key
Gets an OctoPrint API key through OctoPrint's Application Keys approval, so nobody copies a key by hand. Call it with OctoPrint's host and port, and an app name for OctoPrint's prompt. The result is pending, with a request_id and approve_url (OctoPrint's own approval page; every signed-in OctoPrint page also shows the prompt). Call again with request_id and wait_ms (up to 120000) to wait for the answer. approved returns api_key and env: {"API_KEY": …}. The other statuses are denied, expired, unsupported (no Application Keys plugin: copy a key from OctoPrint's settings), unreachable and rate-limited (OctoPrint allows 3 requests a minute, 5 in 10 minutes and 10 an hour). OctoPrint drops a request that isn't polled every 5 seconds, so this server keeps polling between calls, for up to 10 minutes.
{ "host": "octopi.local", "port": "80", "app": "Counterpart" }resume_print
Resume a paused print. Resume reheats and moves the printer, so it is gated like a print start. It resumes only the job this server instance inspected and started, and after a fresh report that the same job is paused. OctoPrint, Klipper and Duet re-download the file and compare its SHA-256 with the inspected bytes, and resume without a prompt. PrusaLink, Repetier and Creality have no download route here, so the job is matched by name only and a person confirms through MCP elicitation first. The printer is read again just before the resume is sent. Cancelling the job, or a report that it ended, retires it, so a later job that reuses the name is never resumed. A job started at the printer, from another app, or before the server restarted is refused; resume it at the printer. Duet's download route needs the Duet Software Framework, so a standalone board's resume is refused. The result's bytesVerified says whether the bytes were re-read. OctoPrint drops a resume sent while it is still pausing, so the server waits for a settled pause (job.stage "Pausing" means not yet). Routes: OctoPrint {"command":"pause","action":"resume"}, Moonraker POST /printer/print/resume, PrusaLink PUT /api/v1/job/<id>/resume, Duet M24, and Repetier continueJob.
Bambu resumes as bambu-printer-mcp does: the paused job must report the unique name this server started it under (subtask_name), the fresh-state check is repeated, and its bytes are re-read over FTPS (the uploaded 3MF, else the cache/<name>_plate_<n>.gcode a P1S extracts) and compared. A file this server uploaded that cannot be re-read refuses the resume; only a file FULU's plug-in placed that cannot be re-read asks a person. The resume goes over the connection that printed.
counterpart_printer_info
Describe the printer in the shared counterpart/1 shape: the server's name and version, the printer's kind, host and any model, serial or name it reports, and which features work. A Bambu printer also has displayName, the model with its maker as Bambu names it ("Bambu Lab P1S"), taken from the serial's prefix, else the reported model; a client shows it as given. Other firmware does not report its maker, so their printers have none. Capabilities are detected from the firmware, never assumed. For example, camera is http-snapshot only when the firmware names a snapshot URL or the conventional one answers with a JPEG.
{
"contract": "counterpart/1",
"server": { "name": "mcp-3d-printer-server", "version": "1.2.21" },
"printer": { "kind": "klipper", "host": "192.168.1.50", "name": "voron" },
"capabilities": { "progress": true, "layers": true, "camera": "http-snapshot", "filaments": "single",
"pause": true, "resume": true, "cancel": true, "print3mf": false, "gcode": true, "diagnostics": true }
}capabilities.diagnostics is true when this server has counterpart_diagnostics; an older server leaves it out.
counterpart_self_check
Whether this install's own runtime dependencies loaded: {contract, server: {name, version}, ok, checks: [{name, ok, optional?, version?, message?}]}. One check says the running server is its installed package's version; one per dependency in package.json says it resolves from this install, loads, and its installed version meets the exact pin (such as bambu-node), ^ or ~ range; web crypto says the global Web Crypto API the streamable HTTP transport needs is present. sharp, an optional dependency, is marked optional and does not make ok false. Run it after an update. It contacts no printer. bambu-printer-mcp returns the same shape.
package.json carries a counterpart field, readable with npm view mcp-3d-printer-server counterpart before a client downloads a version: contract (counterpart/1), one sentence of notes about that release, and autoUpdate, which a release sets to false to ask clients not to install it automatically.
counterpart_diagnostics
This server's own diagnostics for a bug report, {package, version, files: [{name, content, truncated}], notes}, for a client to add to its own export without knowing any log path. files are relative paths with UTF-8 text: server.json (package, version, Node.js, platform), printers.json (the configured printer's id, kind, host, serial, model, connection and whether a credential is set; firmware is not read), settings.json (PRINTER_*, BAMBU_*, SLICER_*, CAD_* and similar settings, secret ones only as [set]), slicer.json (slicer type, path, profiles and the version its macOS bundle or AppImage name gives; the slicer is never run), cad.json (CAD runtime status), tool-errors.log (recent failed calls: tool and error, never arguments), server-stderr.log (this run's stderr, including printer connection and Bambu MQTT messages). The Bambu network plug-in and native helper logs are left out: other programs write them, and they can hold secrets this server cannot recognise. Optional printer (a serial or host) limits printers.json to that printer; optional max_bytes (default 4,194,304, at most 8,388,608) bounds the names, contents and notes together, keeping each file's newest lines. Redaction fails closed: the configured secrets and secret arguments go wherever they appear, also URL-encoded, JSON-escaped or base64; logged objects are redacted by key, and an object whose field names a secret loses its other values; settings show values only for known non-secret settings (any other only as [set]); and any log line that names a secret, in any spelling or encoding, is withheld whole as [line withheld: may contain a secret] with the lines that continue it, keeping its time and level. Serial numbers, error codes, firmware versions and whether a secret is set stay. A secret this server never held, on a line that names no secret, is the one thing it cannot recognise. A missing log is a note, never an error. It contacts no printer.
counterpart_print_progress
Read the printer's state and current job in one shape for every firmware. state is one of idle, preparing, printing, paused, finished, failed, cancelled, offline, or busy. job carries the file name (the same as the upload's jobName), progress (0 to 100), elapsedSec, remainingSec, layer and totalLayers where the firmware reports them, and stage for transitional states. problems lists firmware errors and messages. Optional fields are omitted, never null. A printer that does not answer at all is offline. See progress, camera, pause and resume for each firmware's requests and mapping.
{
"contract": "counterpart/1",
"observedAt": "2026-11-01T12:00:00.000Z",
"state": "printing",
"job": { "name": "checked-4f2a-bracket.gcode", "progress": 25, "elapsedSec": 1200, "remainingSec": 3600, "layer": 12, "totalLayers": 80 },
"temps": { "nozzle": { "actual": 215, "target": 215 }, "bed": { "actual": 60, "target": 60 } },
"problems": []
}counterpart_make_3mf
Takes {parts: [{stl_path, name, filament?}], out_path} and writes a new 3MF for multi-colour printing, in the shared counterpart/1 contract. The parts become one assembly: they keep their relative positions, and each part prints with its own filament number (by default part 1 uses filament 1, part 2 filament 2, and so on). Slice it with slice_stl and one load_filaments profile per filament number, then print it with print_3mf and ams_slots or ams_mapping. The file holds one assembly rather than one object per part, because Bambu Studio 02.08.02.61's CLI arranges separate objects apart, reports G-code path conflicts between stacked objects when arranging is off, and refuses load_filament_ids for 3MF input. The assembly is centred on the BAMBU_MODEL bed, or a 256 mm bed when none is set, with its lowest point on the bed. It never overwrites a file. The result lists path, objects, filaments (the highest filament number) and each part's triangle count.
{ "parts": [{ "stl_path": "/Users/yourname/parts/body.stl", "name": "Body" }, { "stl_path": "/Users/yourname/parts/lid.stl", "name": "Lid", "filament": 2 }], "out_path": "/Users/yourname/parts/assembly.3mf" }camera_snapshot
Capture one JPEG frame and return it as base64, with the same arguments and result as bambu-printer-mcp's camera_snapshot plus capturedAt. Pass save_path to also write the file, and timeout_ms (default 8000).
- OctoPrint: the Classic Webcam snapshot URL on 1.9 and later (
plugins.classicwebcam.snapshot),webcam.snapshotUrlon 1.8, thenhttp://<host>/webcam/?action=snapshot. - Moonraker: the first enabled webcam's
snapshot_urlfrom/server/webcams/list. - Repetier: the printer's webcam
staticUrl. - PrusaLink and Duet have no local snapshot API.
PRINTER_CAMERA_SNAPSHOT_URLoverrides the source for any printer.
Relative URLs and loopback hosts in the firmware's settings are read as the printer itself. The API key is sent only to the printer's own API address, and only a JPEG is accepted.
{ "status": "success", "format": "image/jpeg", "sizeBytes": 78719, "base64": "/9j/4AAQ…", "capturedAt": "2026-11-01T12:00:00.000Z", "source": "moonraker-webcam" }get_printer_filaments
Report the loaded filament as one external slot, {"slots": [{"id": "ext", "material", "color", "name", "source", "profile"}]}. Moonraker printers with Spoolman report the active spool's material, #RRGGBB colour and name (source: "spoolman"); other non-Bambu printers report source: "unknown".
Bambu printers report the live AMS from the printer's MQTT report, with bambu-printer-mcp's fields unchanged: trays (one per AMS tray, empty ones included: absolute slot = AMS id × 4 + tray, loaded, tray_type, tray_color, tray_info_idx, remain_percent, the resolved Bambu Studio/Orca filament profile resolved_profile_path with profile_resolution and match_confidence, and display_name), summary, recommended and load_filaments_all. Profiles resolve by tray_info_idx in the slicer's BBL/filament folder (BAMBU_PROFILES_ROOT, else the SLICER_PATH installation), preferring the bambu_model and nozzle_diameter preset. slots lists every loaded tray and the external spool ("254", and "254"/"255" on dual-nozzle printers) with source: "printer". Pass a tray's slot to print_3mf as ams_slots.
Each slot also carries profile: the absolute path of the installed slicer filament profile for its material, which slice_stl takes as load_filaments. It is resolved in the slicer slice_stl uses by default (SLICER_TYPE, SLICER_PATH), for the printer in SLICER_PROFILE. OrcaSlicer searches its bundled profiles/<vendor>/filament, the OrcaSlicer/system copies and the user's OrcaSlicer/user/<id>/filament presets, reading filament_type and compatible_printers through inherits. PrusaSlicer and Slic3r search the data folder's filament/*.ini presets. The material must equal the profile's filament_type exactly (case aside): a PLA spool never gets a PLA-CF profile. Profiles that list other printers are skipped; one that lists this printer comes first, then profiles for every printer, user presets before bundled ones. With no reported material, profile is the filament slice_stl loads by default (FILAMENT_PROFILE), when that file exists. When nothing resolves, profile is omitted.
set_printer_temperature
Set a target temperature for a printer component. Use bed or extruder; Bambu also accepts nozzle, tool, and tool0. OctoPrint nozzle targets are sent to tool0.
{
"type": "klipper",
"host": "192.168.1.50",
"port": "7125",
"component": "extruder",
"temperature": 215,
"material": "PLA"
}temperaturemust be a finite number of 0 or more.0switches the heater off and is never gated.- Positive targets are checked before connecting against independent hardware ceilings and the material's ceiling, and need a ready printer.
- Positive nozzle heating needs
material(for example PLA, PETG, or ABS), including for spools without RFID. - On Bambu printers, positive heating also needs
bambu_model(orBAMBU_MODEL), and nozzle heating usesnozzle_diameter(0.2, 0.4, 0.6, or 0.8; defaultNOZZLE_DIAMETERor 0.4). Both are checked against the live printer.