openscad-mcp

v0.6.1
openscad-mcp Checked 12 hours ago Published 2 months ago

MCP server for OpenSCAD: render, measure, check assemblies, extract features, judge printability, export

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

check_openscad Check Openscad

Verify OpenSCAD installation and return version info.

ParameterTypeDescription
include_pathsbooleanInclude searched paths in response

export_model Export Model

Export OpenSCAD code or file to a mesh, 2D, or CSG format. With parts=[{name, code, place?}] every part is exported separately (in its assembly position) and bundled into one 3MF with named objects, or into a directory of STLs when output_format="stl"; a manifest is returned. Mesh exports (stl, 3mf, amf, off, nef3) also return a "mesh_health" block from OpenSCAD's CGAL statistics: "manifold" is true, false, or null when OpenSCAD did not perform the check. A non-manifold result usually means parts touch along an edge or face; overlap them slightly.

ParameterTypeDescription
include_pathsAdditional include paths for OpenSCAD via the OPENSCADPATH environment variable
output_formatstring"stl", "3mf", "amf", "off", "nef3" (3D), "dxf", "svg", "pdf" (2D), or "csg" (evaluated CSG tree). Default "stl".
output_pathPath to write the exported file. If not specified, a temp directory is used.
parts
quality
scad_contentOpenSCAD code to export (mutually exclusive with scad_file)
scad_filePath to OpenSCAD file (mutually exclusive with scad_content)
variablesVariables to pass to OpenSCAD via -D flags

model Model

Manage .scad files in a workspace: action = "create" | "get" | "update" | "list" | "delete". name is the file name (".scad" added); content is the source for create/update. Every response carries an "etag" (content hash) so a later update can be checked against the version last read. template="part:<id>" with action="create" writes a purchased-part module from the parts catalog (see reference(topic="parts")) instead of content. workspace defaults to the server temp models directory; when allowed_paths is configured the workspace must lie inside it.

ParameterTypeDescription
action *string
content
name
template
workspace

get_libraries Get Libraries

Discover installed OpenSCAD libraries on the system. Searches standard OpenSCAD library paths for the current platform, plus the OPENSCADPATH environment variable. For each found library directory, lists subdirectories as libraries and reports file counts, README presence, and main entry files. This is a read-only operation that does not require OpenSCAD to be installed.

clear_cache Clear Cache

Delete all cached render files and report freed space. Removes every cached image and its dependency manifest from the configured cache directory. Does nothing (and still reports success) when the cache is disabled or the directory does not exist.

get_project_files Get Project Files

mode="files": every .scad under project_dir with size/mtime and the include/use/import/surface references of each. mode="trace": the constant dependency graph for symbol= (lexical, file-scope constants only): its definition, what depends on it (direction="downstream") or what it depends on ("upstream"), by depth, and the part files that use them. project_dir must be inside allowed_paths when configured.

ParameterTypeDescription
project_dir *string
directionstring
modestring
symbol

render Render

Images of a model, each preceded by a text digest (view direction, camera, scale, bbox) and followed by metadata with errors/warnings/ hints. Check those: OpenSCAD draws a blank scene and exits 0 on a failed assert or unknown module. mode "views": one image per view (default ["isometric"]; front back left right top bottom isometric dimetric) or a custom camera_position. "section": exact cut at section_axis=section_offset (mm, or an expression in the model's scope). "parts": parts=[{name, code, place?, color?, ghost?, explode?}] in stable colours; isolate=name ghosts the rest. "compare": before…

ParameterTypeDescription
annotateboolean
callouts
camera_position
camera_target
camera_up
color_schemestring
groundedboolean
image_size
include_paths
isolate
look_at
modestring
parts
quality
scad_content
scad_content_after
scad_file
section_axisstring
section_offset
variables
variables_after
views

measure Measure

Exact numbers from a model's geometry (mm). Prefer this over judging a picture. parts=[{name, code, place?, material?, mass_g?}] names assembly parts; coordinates are then in the assembly frame. mode "model": bbox, volume, area, solid/cavity counts, watertight, mesh_health (2D: area/perimeter). "parts": per part plus assembly bbox. "section": cut contours at section_axis=section_offset (mm or an expression). "mass": grams for material/density; with parts= and about_axis=[[point],[dir]] the assembly mass, centre of mass and inertia about the axis (mass_g overrides purchased parts). "probe": poi…

ParameterTypeDescription
about_axis
density_g_cm3
include_paths
layer_height_mm
material
mesh
modestring
nozzle_mmnumber
orientation
part
parts
points
polyline
quality
rays
response_formatstring
scad_content
scad_file
section_axisstring
section_offset
variables

validate Validate

Check a model. "valid" is false whenever an ERROR was reported, whatever OpenSCAD's exit code was. mode: "syntax": parse and evaluate without geometry (fast): errors, warnings, echo_output, hints, unresolved_includes with locations. "geometry": export the mesh and report findings: not watertight, non-manifold, several solids, cavities, empty; with the numbers. "predicates": predicates=["W > 10", ...] evaluated in the model's own scope; each must be true. sweep={variable, values:[..]} re-runs them per value and reports the first failure and the crossing. "includes": ever…

ParameterTypeDescription
autofixboolean
include_paths
modestring
orientation
predicates
profile
scad_content
scad_file
sweep
variables

scad_eval Scad Eval

Evaluate OpenSCAD expressions and return typed values (number, vector, string, bool, range, undef). With scad_content/scad_file the expressions run in that model's variable and function scope, so "wall*2 + clearance" or "len(hole_positions)" work; without a model they run standalone. Numbers carry OpenSCAD's 6 significant digits. No geometry is evaluated.

ParameterTypeDescription
expressions *array
include_paths
scad_content
scad_file
variables

reference Reference

Sourced engineering data for 3D-printed parts, each entry with a confidence label (standard / consensus / calibrate). topics: fits (clearances per side and diametral, $slop), fasteners (metric screws, clearance and tap holes), inserts (heat-set), bearings, magnets, joints (dovetail, snap, press, hinge; BOSL2 module names), parts (purchased-part catalog: envelope, mount pattern, shaft, mass, a BOSL2 module with named anchors and a clearance mask; write it with model(action=create, template="part:<id>")), conventions, cheatsheet, dfm (FDM design rules), materials. query filters entries. topic="f…

ParameterTypeDescription
bore_mm
detailedboolean
diameter_mm
query
shaft_mm
topicstring

check Check

Relations between named parts, exported separately (never unioned), cached, in the assembly frame. parts=[{name, code, place?, frame?, ghost?, mass_g?, motion?}] (code "lid();", place "translate(P)") or check_file= (YAML/JSON: frames, quality, parts, checks, model). mode "interference": clear|contact|interference with penetration depth and witness point (flush contact is contact). "clearance": exact minimum distance, closest points, min_mm. "contact": area, normal, plane; kind=static|sliding. "alignment": coaxial hole stacks across parts, offsets, orphans. "motion": sweep moving= about axis/ce…

ParameterTypeDescription
against
axis
center
check_file
checks
frames
include_paths
kind
min_mm
modestring
moving
pairs
parts
quality
range
response_formatstring
scad_content
scad_file
stepsinteger
tolerance_mmnumber
variables
vector
volumeboolean