mesh2cad is a tool that converts mesh models into editable parametric CAD; the project is hosted on GitHub and licensed under MIT.
Purpose: It targets simple mechanical parts, such as plates, brackets, and boxes, as well as holes, bolt circles, slots, bosses (including bosses located on extruded profiles), counterbores, countersinks, and fillets on these parts. Input formats are STL, OBJ, or PLY meshes, and outputs are STEP solids plus CadQuery, OpenSCAD, and FreeCAD scripts in which dimensions are expressed as named parameters for easy subsequent modification.
Main capabilities:
- Primitive geometry fitting: supports planes, cylinders, spheres, cones, and equal-radius fillets, and writes the fitting results as selectable faces.
- Parametric script output: the generated scripts list parameters such as diameters, thicknesses, and positions by name at the top; after modifying parameters, the scripts and STEP files can be regenerated.
- Local operation: the fitting process is completed on the local machine with no data uploaded.
- MCP server: after installing the mcp extra, the server can be started over stdio via mesh2cad mcp.
- Quality checks: scripts must pass stricter checks, with deviation not exceeding max(4 times the tolerance, 0.1 mm) and volume error not exceeding 1%.
- Fallback mechanism: when fitting quality is poor, surfaces are not fabricated; the STEP output falls back to a still-valid faceted solid, and the report explains this fallback.
Usage: Install extras via pip, for example pip install "mesh2cad[mcp]", then run mesh2cad mcp to start the server. On the command line, you can first write out scripts containing named parameters, then modify the parameters and rewrite the scripts and generate STEP files. The cadquery extra allows mesh2cad to run and check the generated scripts; OpenSCAD and FreeCAD are standalone programs, and installation instructions are in the project documentation. The MCP tools, client configuration, and return values are described in the project MCP documentation.
Applicable scenarios: Suitable for converting mesh models of simple mechanical parts into editable CAD, especially when parametric dimensions need to be preserved for easy subsequent modification. The project description mentions that all 6 Original Prusa i3 MK3S printed parts in the test set can be converted accurately, including in STEP and script form.
Limitations: Does not support organic or sculpted shapes, scans, or freeform surfaces. When fitting quality is poor, surfaces are not fabricated; the STEP output falls backto a faceted solid. Scripts have stricter deviation and volume error checks. The list of fitted surfaces, parameter names, and rejection cases are described in the project Limits documentation. Meshes with poor conversion results can be reported via a GitHub issue, and the project provides an STL failure template.