Skip to main content
Glama
README.md
# voxcad

**CAD you talk to.** Describe a part, and an AI agent builds a real, manufacturable
3D solid. It checks its own work, and you can say "make it 10 mm wider" instead of
redrawing anything.

> 🚧 Early prototype (v0.1). The core loop works today with any MCP-capable agent,
> such as Claude Code. See the [roadmap](ROADMAP.md).

```text
You:    I need an L-bracket, 60 mm wide, 40 mm legs, 5 mm thick, with two M6 holes in each leg.
Agent:  Built 'bracket': 40 × 60 × 40 mm, one solid, 4 × Ø6.5 mm holes. [checks the render]
You:    Make it 80 wide, and how heavy is it in steel?
Agent:  Widened to 80 mm (only `width` changed). In steel it weighs 228 g.
You:    Export a STEP for the machine shop.
```

## How it works

voxcad is an [MCP](https://modelcontextprotocol.io) server. Your AI agent talks to
it; it talks to a real CAD kernel.

- **Every model is a short Python script** using [build123d](https://github.com/gumyr/build123d)
  on top of the [Open CASCADE](https://dev.opencascade.org/) kernel: the same B-rep
  solids that professional CAD uses, not a mesh.
- **Dimensions are named parameters.** `width = 80` at the top of the script is a
  parameter, so "make it wider" is an exact, one-number edit with nothing else disturbed.
- **The agent verifies its own work.** Every build returns its size, volume, solid
  count and validity. `render_views` gives the agent a 4-view image to look at, so
  it can catch a misplaced hole or fillet before you do.
- **A live 3D viewer** in your browser updates on every build.
- **Every version is kept**, so `undo` always works, and a failed edit never
  breaks the last good model.

### Tools

| Tool | What it does |
|---|---|
| `build_model` | Create or replace a model from a build123d script, and build it |
| `set_params` | Change named dimensions (`{"width": 80}`) and rebuild |
| `get_model` / `list_models` | Read a model's script, parameters and size |
| `render_views` | Isometric, front, top and right views as one image |
| `measure` | Size, volume, area, centre of mass, mass in a chosen material |
| `undo` | Go back one version |
| `export_model` | STEP (CAD/CNC), STL (3D printing) or GLB (web/AR) |
| `open_viewer` | URL of the live browser viewer |

## Quick start

Requires Python 3.10+.

```bash
git clone https://github.com/sudo-KNO3/voxcad
cd voxcad
python -m venv .venv && .venv/bin/pip install -e .
```

Connect it to Claude Code:

```bash
claude mcp add voxcad -- "$(pwd)/.venv/bin/voxcad"
```

Any other MCP client works too: run the `voxcad` command over stdio. Then just ask
for a part.

Models are stored in `~/voxcad/models/<name>/` (set `VOXCAD_HOME` to change this).
Each folder holds the script, its history, and the latest STEP, STL and GLB. The
viewer runs at `http://127.0.0.1:8765/` (set `VOXCAD_PORT` to change it).

### Talk instead of typing: `voxcad-voice`

`voice/` holds a small Rust program that adds push-to-talk to Claude Code, or to
any terminal app. Speech is transcribed **locally** with
[Whisper](https://github.com/ggml-org/whisper.cpp); no audio leaves your machine.

```bash
# one-time: build it (needs Rust, cmake and a C++ compiler) and fetch the model (~140 MB)
cargo install --path voice
mkdir -p ~/.local/share/voxcad/whisper && curl -L -o ~/.local/share/voxcad/whisper/ggml-base.en.bin \
  https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin

voxcad-voice            # starts Claude Code with push-to-talk
```

Press **Ctrl+Space** (or **F8**) and speak, then press it again. Your words appear in
the prompt; check them and press Enter (or pass `--send` to send automatically).
The window title shows when it is listening and transcribing. A short command
transcribes in under a second on a laptop CPU.

It runs the app inside its own terminal session and types into that, which is why
it works on Wayland, where programs cannot type into other windows. Audio is
captured with `pw-record` (PipeWire), with `arecord` as a fallback, so there is no
audio library to install.

## Safety

Model scripts are Python, and they run on your machine with your permissions. Each
build runs in a separate process with a timeout, so a broken script can't crash the
server. **That is isolation, not a security sandbox.** Review scripts from people
or agents you don't trust, as you would any code.

## Development

```bash
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest                      # unit + end-to-end build tests
.venv/bin/python examples/smoke_test.py   # drives the real MCP server over stdio
cd voice && cargo test                    # voice input
```

## Why this exists

Professional CAD is expensive and takes months to learn. Modern AI models are
good at writing code but bad at dragging shapes in 3D. voxcad uses that strength:
the model is code, the AI writes it, and an industrial-grade kernel does the
geometry. Everything is open source, built from other open-source projects.

## Licence

[Apache-2.0](LICENSE). Built on [build123d](https://github.com/gumyr/build123d) (Apache-2.0),
[Open CASCADE Technology](https://dev.opencascade.org/) (LGPL-2.1 with exception) via
[OCP](https://github.com/CadQuery/OCP), the [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk) (MIT)
and [three.js](https://threejs.org/) (MIT).