Skip to main content
Glama
CAD to Print MCP

CAD to Print MCP

by Kayrim

CAD to Print MCP

A local MCP server that lets Codex and other MCP clients move a design through FreeCAD → STL → OrcaSlicer configuration → G-code → Moonraker printer. It uses stock OrcaSlicer's command-line interface and keeps every exported STL, derived preset, slice manifest, and G-code in a separate output location.

What it does

  • Inspect a FreeCAD .FCStd document and export a named solid to STL.

  • Find, inspect, and derive OrcaSlicer machine, process, and filament presets. Derived presets are copies; originals stay untouched.

  • Preview and run a slice with specified presets and settings. Each run records input hashes, command arguments, effective settings, logs, and output artifacts.

  • Read G-code metadata, query a Moonraker printer, upload G-code, and start an uploaded print as a distinct step.

It does not edit the open OrcaSlicer GUI, paint supports, create CAD geometry from a text description, or control printers other than Moonraker yet. Agents can use their own CAD tools to create .FCStd files before using this server. OrcaSlicer itself is not bundled.

Related MCP server: FreeCAD MCP

Requirements

  • Python 3.10 or newer

  • FreeCAD with FreeCADCmd for .FCStd inspection/export

  • OrcaSlicer with command-line mode

  • Optional: a printer running Moonraker for status, upload, and print start

The server runs locally over MCP stdio. It does not open a listening port.

Install

git clone https://github.com/Kayrim/cad-to-print-mcp.git
cd cad-to-print-mcp
py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e .

On macOS/Linux, use python3 -m venv .venv and .venv/bin/python -m pip install -e ..

Set these environment variables in your MCP client or shell:

Variable

Purpose

FREECAD_CMD_EXE

Path to freecadcmd.exe or FreeCADCmd if it is not on PATH

ORCA_SLICER_EXE

Path to orca-slicer.exe or orca-slicer if auto-discovery fails

ORCA_MCP_PROFILE_DIR

Optional user profile directory override

ORCA_MCP_OUTPUT_DIR

Optional output directory; defaults to ~/OrcaSlicer-MCP/outputs

MOONRAKER_URL

Moonraker URL, such as http://printer.local:7125

MOONRAKER_API_KEY

Optional Moonraker API key; never put it in a repository

Connect Codex

Use the Python executable from your new virtual environment. On Windows:

codex mcp add cad-to-print -- "C:\absolute\path\to\cad-to-print-mcp\.venv\Scripts\python.exe" -m cad_to_print_mcp.server
codex mcp list

For other MCP clients, configure a local stdio server with the same executable and -m cad_to_print_mcp.server arguments. Restart the client after adding it.

Example agent workflow

  1. check_setup and inspect_freecad_document to choose the printable solid.

  2. export_freecad_stl to create a mesh from the chosen FreeCAD object.

  3. find_profiles for compatible machine, process, and filament presets. read_profile and derive_profile can make a variant with support, infill, speed, or other settings.

  4. preview_slice, then run_slice. Or call prepare_print_job to export the selected FreeCAD object and slice it in one step. Review the manifest, logs, and generated G-code. The preset files should match the actual printer, nozzle, material, and firmware.

  5. get_printer_status, then upload_print_file. Uploading alone never starts a print.

  6. When ready, call start_uploaded_print using the returned upload ID. It refuses to start while the printer reports an active or paused job.

The run_slice tool accepts a .3mf with embedded settings or an STL/OBJ/STEP with all three preset JSON files. Common overrides such as layer_height, enable_support, support_type, sparse_infill_density, and wall_loops are directly validated. For other settings, derive a copy of a bundled preset and pass that copy to run_slice. OrcaSlicer validates the resulting configuration during slicing.

Safety and privacy

  • The server never runs shell commands assembled from tool inputs. It invokes FreeCAD and OrcaSlicer with argument arrays.

  • It never edits original CAD files or OrcaSlicer presets.

  • derive_profile refuses script, G-code, print host, and credential fields. read_profile redacts credentials.

  • upload_print_file and start_uploaded_print are separate calls. Print start checks that Klipper is ready and no job is active.

  • Generated files and manifests can contain model names and local paths. The outputs/ directory is Git-ignored.

  • Review G-code and printer preparation before starting a physical print. The server cannot check bed clearance, filament loading, or hardware condition.

Development

.\.venv\Scripts\python.exe -m unittest discover -s tests -v

Tests use local fixtures and mocked process/printer calls. A live smoke test should be run with your own FreeCAD, OrcaSlicer, presets, and Moonraker setup before printing. See docs/architecture.md for the adapter boundaries and roadmap.

License

MIT. This project is independent of FreeCAD, OrcaSlicer, and Moonraker.

Available Tools

15 tools
check_setupB

Check local FreeCAD, OrcaSlicer and profile locations.

Inputs: no named parameters. Returns: object

derive_profileB

Create an isolated copy with new settings; original OrcaSlicer preset is unchanged.

Inputs: path (required), changes (required). Returns: object

export_freecad_stlB

Export one selected FreeCAD object to STL without altering the CAD document.

Inputs: path (required), object_name (required). Returns: object

find_profilesB

Find bundled or user OrcaSlicer machine, process, or filament presets by name.

Inputs: kind (required), limit, query. Returns: object

get_printer_statusA

Read Moonraker connection and current print state.

Inputs: no named parameters. Returns: object

inspect_freecad_documentB

List solid objects, dimensions and validity from a FreeCAD .FCStd document.

Inputs: path (required). Returns: object

list_supported_settingsA

List the validated print settings accepted by this server.

Inputs: no named parameters. Returns: object

list_user_profilesB

List local machine, process, and filament JSON presets available for slicing.

Inputs: no named parameters. Returns: object

prepare_print_jobC

Export one FreeCAD solid and slice it with explicit OrcaSlicer presets.

Inputs: cad_path (required), object_name (required), machine_profile (required), process_profile (required), +3 more. Returns: object

preview_sliceA

Validate a slice request and show inputs, settings, and hashes without slicing.

Inputs: model (required), settings, machine_profile, process_profile, +1 more. Returns: object

read_gcode_summaryB

Read available print time, filament, and layer metadata from G-code or sliced 3MF.

Inputs: path (required). Returns: object

read_profileB

Read a preset's settings, with credential fields redacted.

Inputs: path (required). Returns: object

run_sliceC

Slice with stock OrcaSlicer in a unique output folder; return artifacts and logs.

Inputs: model (required), settings, machine_profile, process_profile, +2 more. Returns: object

start_uploaded_printA

Start an uploaded G-code file after checking the printer is ready and idle.

Inputs: upload_id (required). Returns: object

upload_print_fileA

Upload G-code to Moonraker without starting the printer; return an upload ID.

Inputs: path (required). Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 15 tools

    Disambiguation4/5

    Most tools have clearly distinct roles (inspect vs export vs preview vs run), but prepare_print_job strongly overlaps with export_freecad_stl + run_slice, and find_profiles vs list_user_profiles could be confused at a glance.

    Naming Consistency4/5

    Predominantly consistent verb_noun snake_case (check_setup, inspect_freecad_document, run_slice), with only minor deviations where the verb is omitted (get_printer_status) or the pattern shifts to adjective_noun (list_supported_settings).

    Tool Count5/5

    15 tools is a well-scoped set for a CAD-to-print pipeline spanning discovery, inspection, slicing, and printer upload; each tool has a distinct phase in the workflow.

    Completeness4/5

    The surface covers the full lifecycle from CAD inspection through slicing to printer control, but lacks cancellation or print-job status/monitoring beyond a single get_printer_status, which agents would likely need in practice.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables interaction with 3D printer management systems through an MCP server, supporting STL file manipulation, slicing, and control of printers like OctoPrint, Klipper, Duet, and more.
      30
      9,494 npm
      262
      GPL 2.0
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI clients to create, edit, and export CAD models and drawings in a locally installed FreeCAD via MCP.
      3
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes MCP tools that slice models with headless OrcaSlicer, stage gcode on Moonraker-based Klipper printers, gate job starts behind explicit operator authorization, and report status, telemetry-derived events, snapshots, and alerts. It also manages spools and lets AI agents query job estimates, blockers, and start-precondition checks.
      1
      Apache 2.0
    • A
      license
      C
      quality
      B
      maintenance
      Enables AI assistants to drive PrusaSlicer through MCP: select profiles, manage bed models, slice with verified settings, analyze G-code and print risks, and upload or control prints on networked printers.
      33
      AGPL 3.0