Skip to main content
Glama
root-ext-cad

root-ext-cad

by graphgrow

root-ext-cad

CAD-engineering MCP tool server — code-CAD builds (build123d/CadQuery), model inspection, meshing, DFM-lite validation, and mechanical calculators. Built as the mechanical-engineering pack for [ROOT Workspace], but it speaks plain MCP stdio and works with any MCP host.

The workspace client stays domain-free by doctrine; this repo is where the CAD knowledge lives. Tools reach both ROOT runtimes (the brain-governed deployment and the lite Tier-0 harness) through the client's mcp-bridge, and every call is governed — write-class tools gate like any write; network tools park for approval.

The charter (binding)

Source is truth; artifacts are derived. The pack never overwrites a user's file in place: geometry writes land in a caller-named output directory (default derived/ beside the source), and every write tool refuses an output path that collides with its input. tests/test_server.py::test_no_inplace_mutation_tools_exist and the collision-refusal tests enforce this in CI, not just in prose.

Parametric source (a build123d or CadQuery .py script) is the model; STEP/STL/glTF/3MF are exports. model_build executes scripts — it says so plainly, runs them in this pack's own venv as a resource-capped subprocess, and is classed write, never read.

Related MCP server: build123d-mcp

Tools

Tool

Class*

What it does

model_inspect

read

STEP/BREP/STL → bounding box, volume/area, mass (given density), topology counts, per-solid summary

model_validate

read

DFM-lite lint: open (non-watertight) shells, invalid B-rep, tiny edges/faces, pairwise interference & clearance — every finding carries its evidence and threshold

model_build

write

Run a build123d/CadQuery parametric script (sandboxed subprocess, CPU/memory/wall caps) → STEP/STL/glTF/3MF into the output dir + a build report

model_mesh

write

STEP/BREP → tessellated STL/glTF/3MF with linear + angular tolerance controls

calc_fits

read

ISO 286 limits & fits (hole-basis subset), clearance/interference verdicts

calc_fastener

read

Metric coarse threads: pitch, stress area, tap & clearance drills, preload/torque first-cut

calc_beam

read

Beam bending first-cut: cantilever / simply-supported, point / UDL, rect / round / tube sections

calc_mass_rollup

read

Assembly mass + 3D center of gravity from a component list, envelope check

model_diff

read

Geometric diff of two revisions: volume/area/bbox deltas, bodies unchanged/moved/added/removed by shape signature — geometry, not a feature tree, and the report says so

drawing_project

write

Named-view (front/top/…/iso) SVG or DXF projection: visible edges + dashed hidden layer — a silhouette for hand-off, not a dimensioned drawing

text_to_cad

external

Starter model from a text prompt via Zoo's ML-ephant API (+ its editable KCL source when returned); needs ZOO_API_KEY, refuses by name without it

* Classes derive fail-safe from annotations in the ROOT client: read tools declare readOnlyHint: true, openWorldHint: false; write tools declare readOnlyHint: false, openWorldHint: false (the closed-world write class); network tools (Phase CAD-D: text_to_cad) will declare openWorldHint: true and refuse by name without their key.

Connect it to ROOT Workspace

Settings → Connected tools → the connect form:

  • Name: cad-eng

  • Command: uv run --project /path/to/root-ext-cad root-ext-cad (a local checkout), or once published: uvx root-ext-cad

Run the row's Check (doctor) after connecting. Keep model files and build scripts inside granted folders so the agent can cross-read them with fs.*. Builds must finish inside the bridge's call ceiling (120 s; 90 s once promoted) — the default subprocess wall cap is 75 s.

Development

uv venv .venv
uv pip install --python .venv/bin/python -e ".[dev]"
.venv/bin/pytest

Layering rule: server.py is wiring only; every capability lives in a plain-Python module (inspection.py, meshing.py, validate.py, buildrun.py, calc.py, geometry.py) with logic separated from I/O so the rules stay unit-testable on synthetic shapes — no fixture model files required.

Roadmap

  • Later, each behind its own ADR: FreeCAD GUI-bridge companion, Onshape connector, KCL as a second source dialect, FEA hand-off recipes, PMI/GD&T presence reporting

Available Tools

11 tools
calc_beamA
Read-only

Beam bending first-cut (Euler–Bernoulli): case one of cantilever_point, cantilever_udl, simply_point_center, simply_udl; section rect {b_mm,h_mm}, round {d_mm}, or tube {d_outer_mm,d_inner_mm}. Point loads in N, distributed in N/mm, E in GPa (default 200, steel). Returns I, max deflection, moment, bending stress, and a safety factor when you pass yield_mpa. No shear deflection, buckling, or stress concentration.

Inputs: case (required), dims_mm (required), section (required), length_mm (required), +4 more.

calc_fastenerA
Read-only

Metric coarse-thread fastener numbers for M1.6–M30: pitch, tensile stress area, tap drill, ISO 273 clearance holes (close/medium/coarse), proof stress for the property class, 75% preload, and a T = K·F·d torque first-cut (K default 0.2, dry) — lubrication changes K dramatically.

Inputs: size_m (required), friction_k, property_class.

calc_fitsA
Read-only

ISO 286 limits and fits, hole-basis subset: hole H5–H11 against shaft letters d e f g h js k m n p s, sizes to 500 mm. Returns deviations (µm), min/max clearance, and the fit kind (clearance/transition/interference). Computed from the standard's deviation formulas — verify critical fits against the ISO 286-2 tables.

Inputs: size_mm (required), hole, shaft.

calc_mass_rollupA
Read-only

Total mass and 3D center of gravity from a component list — each item {name, mass_g, x_mm, y_mm, z_mm} measured from one datum. Pass envelope {x_min_mm, x_max_mm, y_min_mm, y_max_mm, z_min_mm, z_max_mm} (any subset of axes) to get a CG-within-envelope verdict.

Inputs: components (required), envelope.

drawing_projectA
Idempotent

Project a B-rep model (STEP/BREP/IGES) to a 2D SVG or DXF (by out_path suffix) from a named view — front, back, top, bottom, left, right, iso. Visible edges on one layer, hidden edges dashed on another. A silhouette for hand-off, NOT a dimensioned drawing. Refuses an out_path that collides with the input (charter).

Inputs: path (required), out_path (required), view, scale, +1 more.

model_buildA
Idempotent

EXECUTES a parametric CAD script (build123d or CadQuery Python) in this pack's own venv as a resource-capped subprocess (CPU rlimit + wall timeout, default 75 s), then exports the script's module-level result shape to the requested formats (default step+glb) in out_dir — default derived/ beside the script, and never a directory containing the script itself (charter: source is truth, artifacts are derived). PARAMS (your params dict) is available inside the script. Returns the written files and a build report: volume, area, bbox, center of mass, the script's own prints.

Inputs: script_path (required), params, wall_s, formats, +1 more.

model_diffA
Read-only

Geometric diff of two B-rep revisions (STEP/BREP/IGES): volume, area, and bbox deltas, plus per-body matching by shape signature — unchanged, moved (with the displacement), added, removed. This is geometry, not a feature tree: a reshaped body reports as removed+added, and the report says so.

Inputs: path_a (required), path_b (required).

model_inspectA
Read-only

Summarize a CAD model: bounding box, volume, surface area, topology counts, per-solid volumes and centers of mass — plus mass when you pass a density (g/cm³). Reads STEP/STP, BREP, IGES/IGS (B-rep, kernel-exact) and STL/3MF (mesh — triangle sums; volume is only reported for watertight meshes, and the summary names which world it measured). Reads the file on this machine; nothing leaves it.

Inputs: path (required), density_g_cm3.

model_meshA
Idempotent

Tessellate a B-rep model (STEP/BREP/IGES) into a mesh file — STL, GLB, GLTF, or 3MF by out_path suffix — at explicit linear (mm) and angular (degrees) tolerances, echoed in the report. Refuses an out_path that collides with the input (charter). Writes only the one output file.

Inputs: path (required), out_path (required), linear_tolerance_mm, angular_tolerance_deg.

model_validateA
Read-only

DFM-lite lint for a B-rep model (STEP/BREP/IGES): kernel validity per solid, non-manifold topology, open (no-solid) surface models, tiny edges/faces (sliver artifacts), and pairwise interference + clearance between bodies against clearance_mm. Every finding carries its evidence and threshold so you can disagree with the rule. Wall thickness, draft, threads, and GD&T are NOT checked — absent, not hidden.

Inputs: path (required), clearance_mm.

text_to_cadA

Generate a STARTER CAD model from a text prompt via Zoo's ML-ephant API (zoo.dev) — files land in out_dir like any derived artifact, with the editable KCL source beside them when returned. Needs ZOO_API_KEY in this server's environment; answers with a named refusal when it is not set. Verify dimensions before use. Reaches the network.

Inputs: prompt (required), out_dir (required), timeout_s, output_format.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: model_inspect summarizes, model_validate checks manufacturability, model_build executes scripts, model_mesh tessellates, model_diff compares, drawing_project projects to 2D, text_to_cad generates from text, and the calc_* tools cover specific engineering calculations with no overlap.

    Naming Consistency4/5

    Tool names consistently use a verb_noun pattern with model_ and calc_ prefixes. Minor deviations: drawing_project uses noun_verb, and text_to_cad uses a different form, but they are still clear and fit the overall scheme.

    Tool Count5/5

    11 tools is well-scoped for a CAD server covering both model operations and engineering calculations. Each tool serves a specific need without being overwhelming or too sparse.

    Completeness4/5

    Covers core CAD workflows: inspect, validate, build, mesh, diff, project, and text generation. Calculation tools cover common mechanical engineering needs. Minor gaps like direct export to common formats or more advanced analysis, but overall complete for its stated purpose.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP server that exposes CAD geometry reasoning over STEP files to LLMs, allowing natural language queries about parts, assemblies, dimensions, holes, and mass properties.
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      MCP server for interacting with Creo Parametric CAD software. Enables tool calls like file_open, feature_set, and J-Link execution through a Python-based server and optional Java gateway.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to programmatically build, analyze, and export 3D CAD geometry using FreeCAD through REST or MCP tools.
      MIT