formastep-mcp
Official# formastep
Clean-room open-source parametric 3D CAD engine, local offline CAD & DFM Web Studio, ISO 10303-21 STEP inspector/exporter, DFM manufacturability auditor, and Model Context Protocol (MCP) server.
`formastep` compiles parametric solids from strict declarative JSON (`PartSpec`), verifies manifold topology, exports STEP / 3MF / STL / 3-view orthographic SVG drawings, and runs automated Design for Manufacturing (DFM) checks from the GUI (`formastep ui`), CLI, or MCP server with zero proprietary licenses or cloud lock-in.
Live browser demo: [https://eclipse-technology.eu/demos/formastep/](https://eclipse-technology.eu/demos/formastep/)

## Documentation
- **English**: [Documentation Home](docs/index.md) | [GUI Studio Guide](docs/gui-guide.md) | [CLI Reference](docs/cli-reference.md) | [MCP Setup](docs/mcp-setup.md)
- **Francais**: [Accueil](docs/fr/index.md) | [Guide Studio GUI](docs/fr/gui-guide.md) | [Reference CLI](docs/fr/cli-reference.md) | [Configuration MCP](docs/fr/mcp-setup.md)
## Why formastep
Commercial CAD suites charge $299/yr to $2,820+/yr per seat and gate STEP export or headless batch automation behind proprietary desktop licenses. `formastep` gives hardware engineers and automated manufacturing pipelines a deterministic, MIT-licensed toolchain:
- **Zero arbitrary code execution**: declarative Pydantic v2 `PartSpec` schema with an explicit AST arithmetic evaluator for named parameters (zero `eval`, zero `exec`).
- **Offline SolidWorks/CATIA-Style CAD & DFM Workstation (`formastep ui`)**: local loopback GUI (`127.0.0.1:8743`) or standalone desktop window (`--desktop` / `formastep-desktop`) with CommandManager ribbon, FeatureManager Design Tree, PropertyManager, interactive 3D viewport (`Shaded+Edges`, `Shaded`, `Hidden Lines`, `Wireframe`, `CATIA Blue` backdrop), ISO 3-view blueprints, 1-click exports, STEP validator, and EN/FR interface.
- **Guaranteed-manifold CSG compilation**: uses `manifold3d` and `trimesh` for exact boolean union/difference/intersection, fillets, chamfers, extruded 2D profiles with holes, revolutions, countersunk holes, and linear/circular patterns.
- **Clean-room ISO 10303-21 STEP**: built-in STEP AP214/AP203 parser and referential-integrity validator (`step_inspect`), plus a deterministic AP214 `FACETED_BREP` writer.
- **Automated DFM QA & BOM**: checks watertightness, 2-manifold topology, Euler/genus, ray-cast minimum wall thickness, build-plate overhang angles, sharp internal corners, hole aspect ratios, injection draft angles, and emits a structured BOM JSON.
- **Deterministic 3-view engineering drawings**: pure vector orthographic SVG sheets (`TOP (XY)`, `FRONT (XZ)`, `RIGHT (YZ)`) with silhouette and crease edge extraction.
- **Native MCP Server**: exposes typed tools (`part_build`, `step_inspect`, `dfm_audit`, `view_render_svg`, `export_manufacturing_bundle`) over `stdio` with workspace path confinement.
## Requirements
- Python 3.10+
## Installation
```bash
git clone https://github.com/eldertek/formastep.git
cd formastep
pip install -e ".[dev]"
```
## Quickstart CAD Workstation
Launch the offline SolidWorks/CATIA-style CAD & DFM Workstation (`127.0.0.1:8743`):
```bash
formastep ui
# Or launch in a standalone desktop application window:
formastep ui --desktop
formastep-desktop --workspace-dir ./parts
# Or use the dedicated web-UI entrypoint:
formastep-ui --workspace-dir ./parts
```
Use `--port 0 --no-open` to bind an ephemeral port without launching a browser tab automatically. See the [GUI Studio Guide](docs/gui-guide.md) for a full walkthrough, or try the live web demo at [https://eclipse-technology.eu/demos/formastep/](https://eclipse-technology.eu/demos/formastep/).
## Quickstart CLI
Check installed geometry backends:
```bash
formastep doctor
```
Save a parametric mounting flange (`flange.json`):
```json
{
"schema_version": "1.0",
"name": "motor_flange_v1",
"units": "mm",
"parameters": {
"outer_d": 60.0,
"bore_d": 22.0,
"thickness": 8.0,
"bolt_circle_r": 21.0
},
"material": {
"name": "PETG-CF",
"density_g_cm3": 1.32,
"process": "fdm"
},
"root": {
"kind": "cylinder",
"diameter": "outer_d",
"height": "thickness",
"center": true
},
"features": [
{
"kind": "hole",
"diameter": "bore_d",
"position": [0, 0, 0],
"axis": "z"
},
{
"kind": "cut",
"node": {
"kind": "circular_pattern",
"count": 4,
"axis": "z",
"radius": "bolt_circle_r",
"child": {
"kind": "hole",
"diameter": 4.5,
"countersink_diameter": 8.2,
"depth": "thickness + 2"
}
}
}
]
}
```
Compile and export the full manufacturing bundle (`STEP`, `3MF`, `Binary STL`, `3-view SVG`, `DFM JSON`, `BOM JSON`, and SHA-256 manifest):
```bash
formastep bundle flange.json --out-dir ./bundle
```
Other CLI commands:
```bash
formastep build flange.json --out-dir ./out --formats step,3mf,stl,svg
formastep inspect-step ./out/motor_flange_v1.step
formastep dfm flange.json --process fdm --min-wall-mm 1.2
formastep render-svg flange.json --output ./out/motor_flange_v1.svg
```
## MCP Server
Start the server on `stdio`:
```bash
formastep-mcp
# or
formastep mcp-serve
```
Set `FORMASTEP_WORKSPACE_ROOT` to confine all file reads and artifact writes to a specific directory (defaults to the current working directory).
Exposed MCP tools:
- `part_build`: Compile `PartSpec` and write `step`, `3mf`, `stl`, `stl_ascii`, `svg`.
- `step_inspect`: Parse and validate an ISO 10303-21 `.step`/`.stp` file (schema, entities, units, bounding box, duplicate IDs, dangling references).
- `dfm_audit`: Run watertightness, manifoldness, ray-cast wall thickness, overhang/draft, and BOM audit on a `PartSpec` or `.stl`/`.3mf` file.
- `view_render_svg`: Generate deterministic 3-view orthographic SVG output.
- `export_manufacturing_bundle`: End-to-end build, STEP verification, DFM audit, and SHA-256 manifest export.
## v0.1 Scope and Known Limitations
- Default STEP output uses deterministic ISO 10303-21 AP214 `FACETED_BREP` (triangulated closed manifold shells), not analytical NURBS surfaces; optional B-Rep tooling is declared under the `[brep]` extra (`build123d`).
- `PartSpec` targets single-part parametric geometry; multi-part assemblies, mates, and kinematic constraints are not implemented in v0.1.
- Minimum wall-thickness checks rely on mesh ray-casting and depend on cylinder/arc tessellation resolution.
## Development & Tests
```bash
ruff check src tests
pytest -v
```
## Commercial Support & Custom Pipelines
Need headless CAD automation, custom DFM checks, or STEP/ERP integration? See [Eclipse Technology Open Source Pro](https://eclipse-technology.eu/open-source-pro.html).
## License
MIT License. See [LICENSE](LICENSE).
TDQS
Scored across 5 tools
part_build and export_manufacturing_bundle substantially overlap, since both compile a PartSpec and export artifacts, with the bundle tool just chaining validation and DFM on top. step_inspect and dfm_audit also both perform validation-style checks, making the boundary between 'inspect' and 'audit' unclear. The descriptions help somewhat, but an agent could plausibly pick the wrong one for a simple export request.
All names are snake_case, but the word order convention is mixed: part_build, step_inspect, and dfm_audit lead with a noun, while view_render_svg and export_manufacturing_bundle lead with a verb. Readable individually, but there is no predictable pattern an agent can rely on to guess a tool name.
Five tools is a tight, well-scoped set for a parametric CAD pipeline covering build, inspect, audit, render, and package. It is on the lean side, with the bundle tool arguably absorbing part_build's role, but nothing feels gratuitous.
The surface covers the core lifecycle: author a PartSpec, validate the resulting STEP, run DFM checks, visualize, and export a manifest bundle. Gaps exist around editing or mutating an existing PartSpec and around converting an existing STEP/mesh back into a PartSpec, which an agent might reasonably expect.