OCCTMCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
OCCTMCP
MCP server that gives LLMs the ability to author, inspect, and iterate on 3D CAD models with OpenCASCADE via the OCCTSwift family.
Part of the OCCTSwift ecosystem: see the ecosystem map for how this package sits on top of the kernel, viewport, bridge, and AIS layers. SemVer-stable from v1.0.0.
The Swift implementation calls OCCT directly in-process (no subprocess, no JSONL marshalling) and exposes 83 typed MCP tools that cover authoring, scene reads, mutation, introspection, construction, analysis, I/O, mesh, drawing, selection / remap, mesh-zone analysis, mesh inspection, alignment, dimension overlays, and the agent-to-viewport-host selection bridge.
How It Works
LLM picks a typed tool (boolean_op, transform_body, render_preview, …)
→ OCCTMCP runs the OCCT operation directly via OCCTSwift / Tools / AIS / Mesh
→ Writes BREP/STEP/PNG + manifest.json + annotations.json
→ OCCTSwiftViewport (optional) auto-reloads the 3D modelFor novel geometry the typed tools don't cover, the LLM falls back to execute_script: arbitrary Swift code with the full OCCTSwift API, compiled and run in-process.
Related MCP server: CAiD MCP Server
Tools
83 tools, organized below. Call get_api_reference({ category: "mcp_tools" }) to dump every tool's JSON Schema in one shot, useful for LLM auto-discovery. Most flows can answer "what's the volume?", "make it red", "boolean-subtract these", "render a preview", "add a dimension between these two faces", "export to STEP", and "draw this" without ever touching execute_script.
Authoring
Tool | Purpose |
| Write & execute arbitrary Swift CAD code (full OCCTSwift API) |
| Read the most recent script's source |
| Browse OCCTSwift API by category |
Scene reads
Tool | Purpose |
| Read current scene manifest (bodies, colors, materials) |
| List exported BREP / STEP / STL / OBJ file paths |
| Diff current scene vs N runs ago (added / removed / appearance / file changed) |
Scene mutation
Tool | Purpose |
| Delete a body from the scene (manifest + BREP file) |
| Wipe all bodies, optionally keep diff history |
| Change a body's id |
| Update color / opacity / roughness / metallic / display name |
Introspection
Tool | Purpose |
| Per-body topology validation (isValid, error counts) |
| Volume, area, centroid, bounding box, principal axes |
| Find faces / edges / vertices matching criteria, return stable IDs. Edge results (#119) carry endpoints (every kind) plus a unit direction for LINE edges, and circleCenter/radius/axis/startAngle/endAngle for CIRCULAR edges. Face results (#249) carry radius plus axis/axisPoint for cylinders and radius plus sphereCenter for spheres. Face-only |
| Min distance + contacts between two bodies, or (Swift, #249) between two sub-shapes: |
| Signed, spatially-resolved surface deviation between two bodies: max / rms / mean / p95 / |
| Exact per-vertex distance table from a mesh body's own vertices to a target body's real BRep geometry ( |
| Pockets and holes via AAG heuristics |
| Walk an XCAF assembly tree (STEP / IGES / XBF) |
Construction
Tool | Purpose |
| Drill / fillet / chamfer / extrude / revolve / thread / boolean (FeatureSpec) |
| Translate / rotate / uniform-scale (records identity history for remap) |
| Union / subtract / intersect / split (records per-input history for remap) |
| Mirror / linear / circular pattern → N new bodies |
Engineering analysis
Tool | Purpose |
| Wall-thickness analysis with thin-region flags |
| Pairwise interference / minimum clearance |
| Heal imported / non-watertight geometry; before/after stats |
Deviation & reconstruction QA
Signed, spatially-resolved comparison of a reconstruction against its source mesh. Where measure_deviation's scalars can hide a systematic shape error (a wrong cross-section that averages out), these expose where and which way the candidate departs. Pure-Swift rendering: no Python/matplotlib.
Which way is out? measure_deviation, deviation_histogram and signed_deviation_heatmap share one signed-distance engine, so they share a signMode knob. The sign of a deviation depends on which reference triangle a sample is judged against, and against an open, thin-walled reference (a raw scan / STL skin) the nearest one is often the wrong one: a candidate flank sitting 4.5 mm inside a 2 mm wall is only 2.5 mm from the wall's inner surface, so that surface wins on proximity and, facing the cavity, reports +2.5 proud for a part that is 4.5 shy. Wrong side, wrong magnitude, nothing tying to flag it. signMode: "robust" (the default since v1.17.0) rejects reference triangles whose outward normal opposes the sample's own before the nearest survivor wins, recovering both figures; samples with no compatible surface in reach are reported ambiguous and withheld from the signed statistics rather than guessed. signMode: "nearest" restores the pre-v1.17 raw nearest-triangle sign, which is correct against a watertight / single-surface reference. An ambiguousFraction near 1.0 means the reference's winding is likely inverted relative to the sampled body; where nothing has a trustworthy sign the signed figures come back null rather than a zero that would read as "perfectly centred".
The two families of number answer different questions, and signMode moves only the second:
Family | Measures to | Moved by |
Unsigned: | the nearest reference surface, whatever it is | No, same meaning as pre-v1.17 |
Signed: | the surface the sample corresponds to | Yes |
Against a watertight reference these are the same surface and the families agree. Against an open thin-walled one they diverge on purpose: max: 2.5 next to signedMin: -4.5 says the nearest reference geometry is an inner wall 2.5 away while the skin that flank belongs to is 4.5 above it. Both true. A gap between them is itself the tell that the reference is thin-walled.
Tool | Purpose |
| Signed point-to-surface deviation distribution: μ / σ / median / p95 / proud-shy extremes, percent within ±tolerance, bucket histogram + optional PNG. A non-zero mean or bimodal shape ⇒ systematic error |
| Slice both bodies at N stations across their shared axis-extent overlap; per-section signed-mean / RMS / area-ratio / centroid-offset + a pose-robust radial shape scalar, with overlay PNGs. Default |
| The direct geometric fidelity figure a mean/RMS surface deviation can hide via cancellation: the two one-sided volumes between a candidate and a reference (excess-only, missing-only) and their sum, via |
| Render the candidate surface coloured by signed distance (proud = red, shy = blue) through a diverging colormap with a colorbar legend. Triangles whose sign can't be established against an open/thin-walled reference render grey ( |
| Render the reference mesh semi-transparent over the opaque candidate solid: see the departure in 3D |
Mesh analysis (zones)
The mesh-inspection surface for raw scans / STL skins: split a body's mesh into surface zones (plane / cylinder / sphere / cone, via OCCTSwiftMesh's dihedral region-growing + primitive-fit merge), then measure how far each zone's own cross-section stays constant along an axis (a loftable-extent map). Both are pure mesh-domain composition: the aggregation/verdict logic here is independent of OCCTReconstruct's own engine, per the mandatory-analytic-verification policy.
Tool | Purpose |
| Split a body's mesh into surface zones; each zone gets a stable |
| Sweep a zone (or whole body) along an axis; report maximal within-tolerance runs (loftable extents) and deviation intervals between them, each with world |
| Inspect the zone registry ( |
| Wipe the zone registry, optionally for one body |
| Schnabel-style RANSAC primitive report (plane/cylinder/sphere/cone), claiming GLOBAL inliers rather than |
Mesh inspection
The mesh-domain check-list / measurement surface (Phase 2 of the mesh-analysis expansion): integrity diagnosis, wall thickness, reflective-symmetry detection, and two-body alignment, all working directly on a body's tessellated surface rather than BREP topology, so they don't degrade on facet shells (a raw STL import) the way check_thickness does.
Tool | Purpose |
| Printability-check-list integrity report: watertight, edge/vertex-manifold, orientable, connected components, boundary loops, Euler characteristic / genus, duplicate/degenerate triangle counts, sliver signals, plus derived pass/warn/fail |
| Mesh-domain wall thickness via the ray method (normal-opposite, first-hit, optional cone-averaged median): the complement to |
| Detect reflective (mirror-plane) symmetry: 3 PCA candidate planes through the area-weighted centroid, each verified by reflecting sampled points and measuring their residual distance back to the surface. Rotational/axis symmetry detection is deferred to a later phase |
| GOM-style alignment: register a source body onto a reference body via point-to-plane ICP (PCA pre-align + normal-space sampling + trimmed correspondence). |
| Per-vertex discrete curvature (Rusinkiewicz per-face tensor) over a body's own welded mesh: principal curvatures k1/k2, mean, gaussian, plus a colored render ( |
| Crease-ring feature outlines (doors, panels, window returns, recesses) on a raw scan mesh via dihedral-fold-edge detection: welds the mesh, chains fold edges exceeding |
| Segments an ordered 3D point chain (typically a |
Selection & remap
Tool | Purpose |
| Pick faces / edges / vertices, get a stable |
| Carry |
| Map |
| Bulk pick by feature kind (e.g. all hole edges) |
| Inspect the in-memory selection registry |
| Wipe the registry |
| Read a live viewport host's current selection ( |
| Ask a live viewport host to highlight one sub-shape ( |
Annotations & overlays
Tool | Purpose |
| Add a linear / angular / radial dimension; renders in |
| Add trihedron / workPlane / axis / pointCloud / boundingBox / diffMarker |
| Heuristic dimension drop for the principal extents |
| Add a body's AABB as an overlay |
| Visualize the diff between two snapshots |
| Remove a dimension or primitive by id |
| Inspect the annotations sidecar |
I/O
Tool | Purpose |
| Load a |
| Multi-format import (STEP / IGES / STL / OBJ); optional XCAF assembly; |
| Export to STEP / IGES / BREP / STL / OBJ / glTF / GLB |
| Modify XCAF document or per-component metadata |
Mesh & visualisation
Tool | Purpose |
| Tessellate to triangles + quality metrics |
| QEM mesh decimation to .stl/.obj: wraps OCCTSwiftMesh's |
| One-shot PNG render with measurement labels and primitive overlays. Mesh-scale bodies (imported scans, >10k edges) render via a linear path in seconds: edge overlays kept up to 100k edges, surface-only beyond |
| Cast a render_preview-framed ray through a pixel → world surface point + selectionId (usable as an |
| Multi-view ISO 128-30 DXF technical drawing: |
Drawing read (2D drawings)
Tool | Purpose |
| Read an ASCII DXF, a DWG or a JWW as a drawing: entity counts by type and layer, units, extents, the source record (file, SHA-256, format and its version, the release line of each reader) and what the reader skipped or warned about (for a JWW, the scale each layer group was drawn at and the dimensions rebuilt from loose pieces; a JWW is read at full size). Blocks are expanded unless |
| Entities (splines with their NURBS data, hatches with their boundaries, leaders) with an id, DXF handle, geometry and layer, filtered by type, layer or a rectangle on the sheet; paged |
| Every DIMENSION: kind, stored value (absent when the file stores none) and the value its geometry gives, rotation, style, text override, definition points, layer, handle, and |
| Distance, angle or radius between named entities or points, in drawing units and mm; exact OCCT extrema (a spline is an exact NURBS edge), so a slot width is the true gap between its walls; in a JWW whose layer groups are at different scales every distance carries a note that a distance across groups is not the sheet distance |
Topology graph (low-level)
Tool | Purpose |
| Validate a BREP's topology graph (raw path) |
| Drop unreferenced graph nodes; write rebuilt BREP |
| Deduplicate shared surface / curve geometry |
| Export topology + UV/edge samples as ML-friendly JSON |
| Local graph adjacency / selection: face neighbours (+ convexity), edge faces, vertex edges, face-adjacency (gAAG), edge classes |
| Pockets + holes (raw BREP path; |
Reconstruction graph (read/write)
LLM read/write over an attributed reconstruction graph: annotate per-node decisions and persist them. Backed by OCCTSwift 1.2.0's NodeAttributeStore + Codable GraphSnapshot. Nodes are addressed as <kind>:<index> (e.g. face:3). The reconstruction engine (surface fitting, congruence detection) lives in OCCTReconstruct; these tools are the annotate-and-persist layer: reconstruct_force_fit records an override for the engine to honour, it does not re-fit here.
Tool | Purpose |
| Export the attributed graph as JSON: topology counts, annotated nodes (with |
| Annotate a node's |
| Override a node's fitted surface type (e.g. force |
| Confirm / reject a congruence cluster ("these N nodes are one part definition") |
| Write the session snapshot to disk (byte-stable JSON) |
| Reload a snapshot file into a session |
Implementations
This repo ships two implementations side-by-side:
Swift (
Sources/,Package.swift): the primary server. In-process against OCCTSwift / OCCTSwiftMesh / OCCTSwiftTools / OCCTSwiftAIS / DrawingComposer using the official Swift MCP SDK. 83 tools. macOS 15+ (the OCCT.xcframework arm64 platform).Node / TypeScript (
src/,dist/): the original implementation. Shells out to theocctkitCLI for everything Swift-side. 37 tools (the pre-v0.4 surface; selection / remap / annotations are Swift-only). Useful if you can't run a macOS binary; setOCCTMCP_OCCTKIT_WASMto a WASIocctkit.wasmto run the geometry tools on Linux (see docs/guides/wasm-core.md).
Both speak stdio MCP and read/write the same manifest format.
Prerequisites
macOS 15+ (for the Swift implementation)
Swift 6.1+ / Xcode 16+
For the Node implementation only: Node.js 18+, plus a sibling clone of OCCTSwiftScripts so
occtkitis on$PATH(ormake installit)
Setup
Swift implementation (recommended)
git clone https://github.com/SecondMouseAU/OCCTMCP.git
cd OCCTMCP
swift build -c releaseIn Claude Code's .mcp.json:
{
"mcpServers": {
"occtmcp": {
"command": "/path/to/OCCTMCP/.build/release/occtmcp-server"
}
}
}The Swift package is published on the Swift Package Index.
Node implementation
git clone https://github.com/SecondMouseAU/OCCTMCP.git
cd OCCTMCP
npm install
npm run buildIn .mcp.json:
{
"mcpServers": {
"occtmcp": {
"command": "node",
"args": ["/path/to/OCCTMCP/dist/index.js"]
}
}
}Example
The LLM can author CAD models by composing typed tools: most everyday flows never touch execute_script:
boolean_op(op: "subtract", aBodyId: "block", bBodyId: "hole", outputBodyId: "drilled")
→ "drilled" body added to the scene
select_topology(bodyId: "drilled", kind: "face", limit: 1)
→ returns selectionId "sel:drilled#face[12]"
add_dimension(kind: "linear", anchors: [...]) ; render_preview()For novel geometry, drop into execute_script with the full OCCTSwift API:
import OCCTSwift
import ScriptHarness
let ctx = ScriptContext()
let C = ScriptContext.Colors.self
let box = Shape.box(width: 40, height: 30, depth: 20)!
let hole = Shape.cylinder(radius: 5, height: 30)!
.translated(by: SIMD3(20, -1, 10))!
let result = box.subtracting(hole)!
let filleted = result.filleted(radius: 2.0)!
try ctx.add(filleted, id: "part", color: C.steel, name: "Bracket")
try ctx.emit(description: "Filleted bracket with mounting hole")API Categories
The get_api_reference tool provides documentation for:
primitives: box, cylinder, sphere, cone, torus, wedge
sweeps: extrude, revolve, pipe sweep, loft, ruled
booleans: union, subtract, intersect, section
modifications: fillet, chamfer, shell, offset, draft, defeature
transforms: translate, rotate, scale, mirror
wires: rectangle, circle, polygon, spline, helix, offset
curves2d/3d: line, arc, ellipse, bspline, bezier, interpolate
surfaces: plane, cylinder, cone, sphere, extrusion, revolution, plate
analysis: volume, area, distance, bounds, validation
import_export: STL, STEP, IGES, BREP, OBJ, PLY
mcp_tools: every MCP tool's JSON Schema (handy for LLM auto-discovery)
Versioning
OCCTMCP follows Semantic Versioning. The Swift port reached v1.0.0 on 2026-05-09, feature-complete against the original Node implementation, plus a layer of selection / remap / annotation tools that are Swift-only.
Releases are tagged on GitHub. The main branch is what SPI tracks.
License
LGPL-2.1-or-later, same as OCCTSwift.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Parametric 3D CAD for AI agents: build print-ready parts, check them, export STL, 3MF or STEP.
CAD in ChatGPT and Claude: editable parts, STEP/STL/drawings, in-chat 3D, automatic checks.
Text-to-CAD: build exact STEP or 3MF/STL on the server, each stated requirement measured.
A browser 3D CAD for your AI: it scripts real-size models, uCAD builds them and returns pictures.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to automate SolidWorks (open/save parts, modify dimensions, export STEP) via COM, and optionally generate geometry using build123d code-CAD with PNG previews.MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to perform validated 3D CAD modeling using CAiD and OpenCASCADE, with tools for creating, modifying, querying, and exporting 3D shapes.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to design, modify, and verify exact B-rep 3D CAD models by running build123d scripts on an OpenCascade kernel, with live three.js preview, collision and FDM printability checks, text-based spatial perception, user notes/sketch annotations, version history, and one-click export to OrcaSlicer.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to inspect, generate, and edit parametric 3D CAD models in Onshape, including sketches, features, assemblies, variables, FeatureScript, rendering, and exports. Model-changing tools return structured reports of actual changes and regeneration warnings so agents can verify their work.MIT