Code-first CAD
Geometry that lives in your repo.
Write parts as .kcad.ts, run them with the kernelcad CLI, or let an agent drive the same kernel over MCP. Export STEP or STL when the model is ready.
npm install -g kernelcad docs STEP / STL export
The main page starts from a prompt. This one starts from a file.
bracket.kcad.ts
const w = param('Width', 60, { unit: 'mm' });
const h = param('Height', 40, { unit: 'mm' });
const t = param('Thickness', 5, { unit: 'mm' });
const base = box(w, h, t);
const hole = cylinder(t + 2, 4).translate(w / 2, h / 2, -1);
return base.subtract(hole).fillet(1);
Edit, check, export.
-
Write the part
A
API reference →.kcad.tsfile holds the parameters, sketches and solids. It is plain TypeScript, so a change is a diff and a variant is a loop. -
Run and check it
Connect an agent →kernelcad evaluatebuilds the model and reports failures. An MCP client can run the same checks and review the geometry before you export. -
Export or hand off
Write STEP or STL from the CLI, or open the model in the Studio for drawings and a second look.
Export reference →
From a terminal
npm install --global kernelcad
# build the model, then write files a shop can open
kernelcad evaluate bracket.kcad.ts
kernelcad export step bracket.kcad.ts -o bracket.step
kernelcad export stl bracket.kcad.ts -o bracket.stl
# or expose the same kernel to an agent
kernelcad mcp
The model is the source, not an export.
Code-first means you can read the model in a review, change a parameter and rebuild, generate a family of parts from one loop, and run the same file in CI. Nothing is locked in a binary you have to reopen to understand.
The prompt path on the main page is still the fastest way to a part when you do not want to write it. This page is for the times you do.
Start with a file.
Open the Studio, or install the CLI and write the first part locally.