Skip to main content
Glama
mcp-server-qidi

mcp-server-qidi

mcp-server-qidi

MCP server for a QIDI X-Plus5 (Klipper + Moonraker) 3D printer: status, chamber webcam, QIDI Box, G-code files and job history, plus gated control (light, heater targets, pause/resume/cancel, emergency stop, start print).

This is an independent, unofficial project. It is not developed, endorsed or supported by QIDI Technology.

Moonraker on the Plus5 trusts every LAN client by default and has no credentials. Unless QIDI_MOONRAKER_API_KEY is set, the printer's privacy therefore rests on the network path (for example a VPN tunnel scoped to the printer's address) and on whatever authenticates callers in front of this server.

Tools

Tool

Tier

qidi_server_status

read

Printer reachable? Which tiers are on, temperature limits.

qidi_printer_status

read

State, file, progress, layer, time left, nozzle/bed/chamber temps, loaded Box slot.

qidi_snapshot

read

Chamber webcam picture (light=true switches the light on first; needs control).

qidi_box_status

read

QIDI Box slots: material, colour, inserted, humidity, drying.

qidi_list_files / qidi_file_metadata

read

G-code on the printer; slicer estimate, filament, temps.

qidi_job_history

read

Recent jobs with result, duration and filament.

qidi_console

read

Last console lines — read this when a start failed.

qidi_set_light

control

Chamber light on/off.

qidi_set_temperature

control

Nozzle/bed/chamber target, capped by QIDI_MAX_*_TEMP.

qidi_pause_print / qidi_resume_print

control

qidi_cancel_print

control

Must name the running file, so a stale conversation cannot cancel the wrong job.

qidi_emergency_stop / qidi_firmware_restart

control

M112 and recovery. Restart is refused while printing.

qidi_box_set_slot

control

Vendor, material and colour of a Box slot. Material and vendor must be in QIDI's filament list on the printer (officiall_filas_list.cfg).

qidi_box_drying

control

Start/stop drying a Box. Temperature is capped by the filament in it (see below).

qidi_box_load / qidi_box_unload

control

Load a slot into the toolhead / unload it. Refused while printing or paused.

qidi_upload_file

control

Put a sliced .gcode on the printer (inline text, or https from an allowed host). Never replaces the file being printed; other files only with overwrite=true.

qidi_start_print

print

Start a file already on the printer. See the plate check below.

There is deliberately no raw G-code tool: every command sent to the printer is built from enumerated input.

Plate check

Nobody is standing next to the printer when a print is started from an MCP client. qidi_start_print refuses unless:

  1. the printer is idle (standby, complete, cancelled or error),

  2. a qidi_snapshot was taken in the last QIDI_PLATE_CHECK_MAX_AGE_MIN minutes (default 15) and after the previous job ended — so whoever starts a print has been shown the plate after the last part came off it,

  3. the caller passes plateIsEmpty: true, and

  4. the file exists on the printer.

A snapshot is good for one start.

Box drying limit

qidi_box_drying refuses (does not lower) a temperature above the limit for that box: the lowest limit among all its slots, by the material each slot is set up with (the insert sensors are ignored, because spools are ejected before drying and then read empty), by filament type — 55 °C for PLA, PVA and TPU, 65 °C for PETG, PET, ABS, ASA, PC, PA and PPS, 50 °C for anything unrecognised — and never above QIDI_MAX_BOX_DRY_TEMP. The limit is only as good as the slot setup, so correct a wrong slot with qidi_box_set_slot first. Drying started from the touchscreen is not covered.

Each Box tool checks Klipper's command list first, so a firmware without the command fails with a clear message instead of an unknown-command error. The commands are the ones the Plus5 touchscreen sends (UPDATE_FILAMENT_INFORMATION, LOAD_/UNLOAD_FILAMENT_CONTROL, BOX_START_DRYING BOX= TIME=<hours> TEMP=, BOX_STOP_DRYING), with the older Box firmware's E_LOAD/E_UNLOAD and ENABLE_BOX_DRY/DISABLE_BOX_DRY as fallback.

Related MCP server: printer-mcp

Configuration

Env var

Default

QIDI_MOONRAKER_URL

http://localhost:7125

Moonraker base URL.

QIDI_SNAPSHOT_URL

<host>/webcam/?action=snapshot

mjpeg-streamer snapshot.

QIDI_MOONRAKER_API_KEY

—

Sent as X-Api-Key. Set it and remove the server's address range from Moonraker's trusted_clients, so only this container can drive the printer.

QIDI_ENABLE_CONTROL

false

Light, temperatures, pause/resume/cancel, e-stop, restart, Box tools, upload.

QIDI_ENABLE_PRINT_START

false

qidi_start_print.

QIDI_MAX_NOZZLE_TEMP / _BED_TEMP / _CHAMBER_TEMP

300 / 110 / 65

Remote target caps (°C), integers 0-400.

QIDI_PLATE_CHECK_MAX_AGE_MIN

15

Snapshot freshness for a start, integer minutes 1-1440.

QIDI_MAX_BOX_DRY_TEMP

65

Ceiling for Box drying, integer °C 30-90, on top of the per-filament limit.

QIDI_UPLOAD_ALLOWED_HOSTS

—

Comma-separated hosts qidi_upload_file may download from (https). Empty = URL uploads off.

QIDI_MAX_UPLOAD_MB

100

Largest G-code upload, integer MB 1-1024. Inline uploads are also bounded by MCP_MAX_BODY_BYTES.

QIDI_TIMEOUT_MS

10000

Per-request timeout.

QIDI_AUDIT_LOG

—

JSONL audit log (who did what; Moonraker logs everything as _TRUSTED_USER_).

QIDI_TRUST_FORWARDED_USER

false

Trust X-MCP-User from an authenticating gateway. Requires MCP_HTTP_TOKEN.

The numeric QIDI_* settings are validated at startup: a value that is not an integer in range stops the server with a message naming the variable. The tools re-read the limits on every call and refuse to act if they are invalid, so a typo can never lift a temperature cap or the plate-check age.

HTTP transport

npm run dev:http (or the Docker image) serves POST /mcp and an unauthenticated GET /healthz. It binds to 127.0.0.1 unless MCP_HTTP_HOST/HOST says otherwise.

Env var

Default

MCP_HTTP_TOKEN

—

Bearer token callers must present on /mcp; at least 32 printable ASCII characters (e.g. openssl rand -hex 32). Required on a non-loopback bind (e.g. 0.0.0.0 in a container), with MCP_ALLOW_ANY_ORIGIN=true or with QIDI_TRUST_FORWARDED_USER=true; the server refuses to start otherwise.

MCP_HTTP_ALLOW_UNAUTHENTICATED

false

Serve /mcp without a token on a non-loopback bind. Only if access is restricted by other means.

MCP_HTTP_HOST / HOST, PORT

127.0.0.1, 3000

Bind address and port.

MCP_MAX_BODY_BYTES

10485760

Request body limit.

MCP_ALLOWED_ORIGINS / MCP_ALLOW_ANY_ORIGIN

localhost origins

Browser origins allowed to call /mcp.

MCP_ALLOWED_HOSTS

localhost names on a loopback bind

Host names accepted in the Host header (DNS-rebinding protection).

MCP_AUTH_FAILURE_LIMIT / MCP_AUTH_FAILURE_WINDOW_MS

20 / 60000

Failed authentication attempts per client address before 429; 0 disables. Valid tokens are never throttled.

Moonraker API requests never follow HTTP redirects. The webcam snapshot follows at most two redirects, and only on the same origin when an API key is set, so the key is never sent to another host.

Security model

  • The server drives the printer with one shared identity: Moonraker's trusted client (or the configured API key). Every MCP client that can call it can use the enabled tool tiers.

  • Per-user authorization belongs in an identity-aware gateway in front of the server. With QIDI_TRUST_FORWARDED_USER=true that gateway's user (X-MCP-User) is written to the audit log; it does not change what the caller may do.

  • Tool access is not data access: the tier switches limit the tools, not what Moonraker accepts from this server's network address.

  • The HTTP server does not terminate TLS. Put it behind a TLS-terminating proxy or keep it on a private network.

Develop

npm install
npm run typecheck && npm test && npm run build
QIDI_MOONRAKER_URL=http://<printer>:7125 npm run dev        # stdio

License

The code is source-available under the Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2).

In plain words:

  • Allowed: reading the code, running it, changing it, using it inside your own organisation (also commercially), using it for non-commercial education and research, and contributing changes back.

  • Not allowed: making it, or something built from it, available to others as a commercial product or service that competes with it, for example a hosted service with the same functionality.

  • Becomes Apache-2.0: each version is also licensed under the Apache License 2.0 from two years after it is released.

  • Earlier versions: versions released before 0.3.0 were licensed under Apache-2.0 and remain so.

The terms in LICENSE are what apply; this summary does not replace them. See also NOTICE.

Available Tools

16 tools
qidi_box_statusQIDI Box statusB
Read-onlyIdempotent

Filament in each QIDI Box slot (vendor, material, colour, whether filament is inserted), which slot is loaded, box humidity, temperature and drying state.

Inputs: no named parameters.

qidi_cancel_printCancel printA
Destructive

Cancel the running or paused print. Cannot be undone: the job is lost. Pass the file name of the running job to confirm which job you mean.

Inputs: filename (required).

qidi_consoleConsole logA
Read-onlyIdempotent

The last lines of the printer console (G-code responses and errors). Read this when a print failed to start or stopped unexpectedly.

Inputs: count.

qidi_emergency_stopEmergency stopA
Destructive

Immediately halt the printer (M112): heaters and motors stop and the job is lost. Only for a real problem (spaghetti over the hotend, crash, smoke). Afterwards the printer needs qidi_firmware_restart.

Inputs: reason (required).

qidi_file_metadataG-code metadataB
Read-onlyIdempotent

Slicer metadata for one file: estimated print time, filament type/name/weight, temperatures, layer height, object height.

Inputs: filename (required).

qidi_firmware_restartFirmware restartA
Destructive

Restart Klipper firmware after an emergency stop or an error/shutdown state. Refused while a job is printing or paused.

Inputs: no named parameters.

qidi_job_historyJob historyB
Read-onlyIdempotent

Recent print jobs, newest first: file, result, start/end time, print duration and filament used.

Inputs: limit.

qidi_list_filesList G-code filesB
Read-onlyIdempotent

G-code files on the printer, newest first. Optional case-insensitive name filter.

Inputs: limit, filter.

qidi_pause_printPause printA
Idempotent

Pause the running print (the printer parks the nozzle). Resume with qidi_resume_print.

Inputs: no named parameters.

qidi_printer_statusPrinter statusA
Read-onlyIdempotent

Current state of the QIDI X-Plus5: job state, file, progress, layer, elapsed and estimated remaining time, nozzle/bed/chamber temperatures and targets, loaded QIDI Box slot, light.

Inputs: no named parameters.

qidi_resume_printResume printA
Idempotent

Resume a paused print.

Inputs: no named parameters.

qidi_server_statusServer statusA
Read-onlyIdempotent

Which printer this server talks to, which tool tiers are switched on, and whether the printer answers.

Inputs: no named parameters.

qidi_set_lightChamber lightC
Idempotent

Switch the chamber light on or off.

Inputs: on (required).

qidi_set_temperatureSet heater targetA
Idempotent

Set the target temperature of the nozzle, bed or chamber heater (0 = off). Targets above the server limits are refused. Typical use: switch heaters off, or restore a chamber target that something else reset during a print.

Inputs: heater (required), target (required).

qidi_snapshotWebcam snapshotA
Read-onlyIdempotent

Take a picture with the chamber webcam. Use it to check that the build plate is empty before starting a print, or to look at a running print. Set light=true to switch the chamber light on first (needs the control tier); the picture is dark without it.

Inputs: light.

qidi_start_printStart printA
Destructive

Start printing a G-code file that is already on the printer. Before calling: take qidi_snapshot (light=true) and LOOK at the picture — the plate must be empty. The server refuses unless a snapshot was taken in the last few minutes and after the previous job ended, and the printer is idle. After starting, check qidi_printer_status again after ~4 minutes (heating + probing) before reporting that the print is running.

Inputs: filename (required), plateIsEmpty (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 16 tools

    Disambiguation5/5

    The tools split cleanly by purpose: server/tier status vs. live printer state, box filament info, file listing/metadata, history, console diagnostics, and distinct control actions. A minor overlap exists because qidi_snapshot can switch the light on, but the description makes qidi_set_light the dedicated light-control tool.

    Naming Consistency5/5

    All tools use the same qidi_ prefix and snake_case convention, with predictable verb_noun or noun_status forms such as qidi_set_light, qidi_list_files, and qidi_printer_status. A few noun-only names like qidi_snapshot and qidi_console are still clear and consistent with the overall pattern.

    Tool Count4/5

    At 16 tools this is slightly above the typical 3-15 well-scoped range, but each tool maps to a distinct printer monitoring or control function and there is little obvious filler. The count is reasonable for a printer control server, though a few tools could be consolidated if simplicity were prioritized.

    Completeness3/5

    The surface covers monitoring and job lifecycle well: status, snapshot, files, metadata, history, console, temperature, light, start, pause, resume, cancel, emergency stop, and firmware restart. However, notable gaps remain around file lifecycle management (upload/delete) and hardware operations such as filament load/unload or motion/jog/calibration.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables LAN-based monitoring and control of Bambu Lab P2S/P1S printers, including confirm-gated print, pause, resume, stop, file upload, and slicing workflows.
      10
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables an agent to inspect, slice, upload, start, and monitor jobs on a Moonraker/Klipper 3D printer end to end, using one JSON profile for machine-specific configuration. Built-in safety checks block unsafe starts such as incomplete G-code, nozzle mismatches, hot beds, or running jobs.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to monitor and control Bambu Lab 3D printers over a local network via MQTT, including real-time status, AMS filament info, print control, and maintenance tracking. It supports guided setup, safety confirmations, read-only mode, and a built-in printer simulator.
      2
      80 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to query and control Klipper 3D printers through Moonraker, covering status, temperatures, files, print jobs, and G-code/macro execution, with confirmation gating for dangerous operations.
      MIT