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);
Source you can diff One TypeScript file per part, reviewed like code.
One kernel The CLI, the Studio and MCP build the same geometry.
Agents and MCP Inspect, edit and review models from your agent.
Real exports STEP for a shop, STL for a printer, PDF for drawings.
The loop

Edit, check, export.

  1. Write the part

    A .kcad.ts file holds the parameters, sketches and solids. It is plain TypeScript, so a change is a diff and a variant is a loop.

    API reference →
  2. Run and check it

    kernelcad evaluate builds the model and reports failures. An MCP client can run the same checks and review the geometry before you export.

    Connect an agent →
  3. 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
Why code

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.