OpenSCAD MCP V2

v1.3.0
io.github.JohnnyTheTank/openscad-mcp-v2 Checked 2 days ago Published 15 hours ago

Write, validate, render, version and export parametric OpenSCAD designs for 3D printing.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

check_setup Check the OpenSCAD setup

OpenSCAD: reports the OpenSCAD executable and version, the library folders and installed libraries (BOSL2, NopSCADlib, MCAD, …), the design workspace and the configured printer profiles with their build volumes. Says what is missing when something is not set up.

get_guidelines Get design guidelines

OpenSCAD: returns the design guidelines of this server. Topic "3d-printing" (default, together with "libraries" and, when there are any, "learnings"): workflow, code structure, orientation, FDM printing rules, standard screw sizes and what to check in the images. "openscad-reference": language reference with tested helper modules. "libraries": the libraries installed on this machine with usage examples. "learnings": lessons recorded with record_learning in this workspace.

ParameterTypeDescription
topicstringDefault: "3d-printing" plus "libraries" plus "learnings" when there are any.

list_designs List designs

OpenSCAD: lists the designs in the workspace with description, latest version number, time of the last change and the path of the .scad file. Most recently changed first.

create_design Create a design

OpenSCAD: saves new SCAD code as a design (version 1), validates it with OpenSCAD and returns errors, warnings and echo output with the affected source lines. A valid design comes back with an isometric image of the rendered model. Fails when the name is taken.

ParameterTypeDescription
code *stringComplete OpenSCAD source of the design.
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
descriptionstringOne line on what the part is and what it is for.
previewbooleanAttach an isometric image of the model when the code is valid. Default: true (server setting).

update_design Update a design

OpenSCAD: changes a design and saves the result as a new version, either with `edits` (exact text replacements, the rest of the code stays untouched) or with the complete new `code`. Validates like create_design and returns an image of the rendered model when the code is valid. Earlier versions stay available.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
codestringComplete new source. Use this or `edits`.
editsarrayTargeted replacements, applied in order. Use this or `code`.
notestringWhat changed, for the version history.
previewbooleanAttach an isometric image of the model when the code is valid. Default: true (server setting).

get_design Read a design

OpenSCAD: returns the current code of a design with its metadata and its parameters (name, value, range, description), or the code of one earlier version.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
versionintegerAn earlier version; default is the current code.

validate_design Validate a design

OpenSCAD: evaluates the current file of a design without computing geometry and returns errors, warnings and echo output with file, line and the affected source lines. Covers syntax errors, unknown variables and modules and failed asserts; it also sees changes typed in OpenSCAD's editor.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.

render_views Render views

OpenSCAD: renders PNG images of a design from the chosen sides (iso, iso_back, front, back, left, right, top, bottom; default iso, front, top, right) and returns them with the console output. Mode "render" (the default when OpenSCAD has the Manifold backend) shows the exact geometry that would be exported. Mode "preview" is OpenSCAD's quick OpenCSG view with $preview = true; it can show holes or missing faces that are not in the model. `params` overrides parameters for this render only, without changing the file.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
modestringDefault: "render" with the Manifold backend, otherwise "preview".
paramsobjectParameter overrides as name → value, e.g. {"pole_diameter": 32, "label": "A"}. Values are numbers, booleans, strings or lists of those.
viewsarraySides to render. Default: iso, front, top, right.

open_in_openscad Open in OpenSCAD

OpenSCAD: opens a design in the OpenSCAD application on the user's screen, starting OpenSCAD when needed. With OpenSCAD's setting "Design → Automatic Reload and Preview" the window then follows every later change to the design; the result says whether that setting is on. A design this server already opened is not opened a second time: OpenSCAD is brought to the front instead.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
reopenbooleanOpen a window again although this server already opened the design (the user closed the window).

list_versions List versions

OpenSCAD: lists the saved versions of a design, newest first, with time, origin (create, update, set-parameters, restore, external-edit), note and size. Every change through this server is a version; changes typed in OpenSCAD's editor are recorded as external-edit, with the changed values and the number of other changed lines.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.

restore_version Restore a version

OpenSCAD: makes an earlier version the current code of a design again. The restored code is saved as a new version, so the versions in between stay available. Validates the result and returns an image like update_design.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
version *integerThe version to bring back (see list_versions).
previewbooleanAttach an image of the restored model. Default: true.

set_parameters Set parameters

OpenSCAD: changes the default values of a design's parameters in the file (the plain assignments at the top that OpenSCAD's Customizer also offers) and saves the result as a new version. Only the values change; code and comments stay as they are. Called without `params` it lists the parameters with type, current value, range and description.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
paramsobjectParameter overrides as name → value, e.g. {"pole_diameter": 32, "label": "A"}. Values are numbers, booleans, strings or lists of those.
previewbooleanAttach an image of the changed model. Default: true.

analyze_design Analyze a design

OpenSCAD: renders the final geometry of a design and reports its size and bounding box in mm, facet count, whether the mesh is a closed solid, whether the part sits on z = 0, and whether it fits the build volume of each configured printer (also turned 90° around Z). Writes no file. `params` analyzes a variant without changing the design.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
paramsobjectParameter overrides as name → value, e.g. {"pole_diameter": 32, "label": "A"}. Values are numbers, booleans, strings or lists of those.
printerstringPrinter to check against: a configured or built-in profile id (e.g. "a1mini") or a build volume "WIDTHxDEPTHxHEIGHT" in mm. Default: every configured profile.

export_design Export a design

OpenSCAD: renders the final geometry of a design and writes it to the design's exports folder as 3MF (default) or binary STL. Returns the absolute file path, the size and bounding box in mm, the fit per configured printer, the mesh and bed-contact checks and the print orientation stated in the code. The file name carries the version, so earlier exports stay. `params` exports a variant without changing the design. This server does not slice or print.

ParameterTypeDescription
name *stringDesign name, e.g. "broom-holder-28mm". Stored as lower-case letters, digits and dashes.
formatstringDefault "3mf".
paramsobjectParameter overrides as name → value, e.g. {"pole_diameter": 32, "label": "A"}. Values are numbers, booleans, strings or lists of those.
printerstringPrinter to check against: a configured or built-in profile id (e.g. "a1mini") or a build volume "WIDTHxDEPTHxHEIGHT" in mm. Default: every configured profile.

record_learning Record a learning

OpenSCAD: saves a short lesson for later designs in the workspace (.openscad-mcp/learnings.json): a technique that failed or worked, a printing rule, or a preference of the user. get_guidelines returns every learning together with the guidelines. `replaces` swaps an existing learning for a refined one. At most 100 learnings; an identical text is refused.

ParameterTypeDescription
category *string"technique": how to model something in OpenSCAD; "printing": what prints well or badly; "preference": what the user wants in their parts.
reason *stringWhat led to it, e.g. "User asked for all edges rounded on broom-holder".
text *stringThe lesson as one general sentence that holds for later parts, e.g. "Round every outer edge, also the top and bottom of extrusions; screw holes stay sharp."
designstringThe design it came from.
replacesintegerId of a learning this one refines; that one is forgotten.

list_learnings List learnings

OpenSCAD: lists the learnings of this workspace with id, category, text, reason, design and date. Forgotten and replaced ones only with `include_forgotten`.

ParameterTypeDescription
categorystringOnly this category.
include_forgottenbooleanAlso list forgotten and replaced learnings.

forget_learning Forget a learning

OpenSCAD: marks a learning as forgotten, so get_guidelines no longer returns it. It stays in the file with the reason; list_learnings with `include_forgotten` shows it. A learning that is already forgotten stays as it is.

ParameterTypeDescription
id *integerId of the learning, as list_learnings shows it.
reasonstringWhy it no longer holds.