aicad-mcp
by ACs-del
README.md
# `aicad-mcp` — Open-Source Parametric CAD MCP Server, CLI & TypeScript Library
**Generate watertight binary `.stl`, exact B-rep `.step` (ISO-10303-21), `.svg`, and AutoCAD R12 `.dxf` parts for 3D printing directly from Claude, Cursor, Windsurf, your terminal, or Node.js.**
Powered by [Manifold](https://github.com/elalish/manifold) and [OpenCascade / replicad](https://github.com/sgenoud/replicad) running locally in Node/WASM — with a free interactive browser CAD workbench at **[aicadhub.com](https://aicadhub.com/studio)**.
> Looking for visual interactive 3D editing or free-form AI Text-to-CAD for hinges, snap-fit enclosures, and arbitrary custom parts?
> Try the hosted web studio at **[https://aicadhub.com/studio](https://aicadhub.com/studio)** · Hosted zero-install HTTP MCP endpoint: **`https://aicadhub.com/api/mcp`**
---

## Why `aicad-mcp`?
Unlike text-to-mesh generators that output non-manifold triangles with arbitrary units, **`aicad-mcp` guarantees exact millimeter tolerances and closed solids** checked on every export:
- **Watertight 3D Printing Geometry**: Every exported STL is verified as a closed, consistently oriented single body (`manifold-3d`).
- **Exact B-rep STEP (`ISO-10303-21`)**: Spur gears, L-brackets, spacers, reducers, open boxes, and functional library mounts export as exact analytic B-rep CAD solids (`replicad` / OpenCascade), ready for Fusion 360, Onshape, SolidWorks, or Bambu Studio / PrusaSlicer.
- **Real 3D Printing Engineering Standards**: Built-in Gridfinity 42 mm / 7 mm standard (`0.25 mm` per-side clearance, `4.75 mm` stepped foot, stacking lip, `6.5 × 2.4 mm` magnet pockets), involute spur gears (`14.5°` / `20°` / `25°` pressure angle, undercut warning, meshed center distance), and metric `M2–M10` FDM clearance + brass heat-set insert boss dimensions.
- **100% Local & Offline-Capable**: Runs natively in Node.js (`>=20`) with zero API keys or rate limits.
---
## Quick Start: Connect as an MCP Server
### Option 1: Local Stdio MCP Server (Exports `.stl` / `.step` / `.svg` / `.dxf` directly to disk)
Works with **Claude Desktop**, **Cursor**, **Claude Code**, **Windsurf**, and **Devin / Antigravity**.
```json
{
"mcpServers": {
"aicad": {
"command": "npx",
"args": ["-y", "github:ACs-del/aicad-mcp"]
}
}
}
```
<details>
<summary>Or install locally from source (fastest startup)</summary>
```bash
git clone https://github.com/ACs-del/aicad-mcp.git
cd aicad-mcp
npm install
npm run build
```
Then configure your MCP client:
```json
{
"mcpServers": {
"aicad": {
"command": "node",
"args": ["/absolute/path/to/aicad-mcp/dist/mcp-server.js"]
}
}
}
```
</details>
### Option 2: Zero-Install Hosted HTTP MCP Endpoint (Math, Sizing, Parsing & SVG→DXF)
Add the stateless JSON-RPC 2.0 endpoint directly — no Node install required:
```json
{
"mcpServers": {
"aicadhub": {
"url": "https://aicadhub.com/api/mcp"
}
}
}
```
Claude Code one-liner:
```bash
claude mcp add --transport http aicadhub https://aicadhub.com/api/mcp
```
Try live payloads at [https://aicadhub.com/mcp](https://aicadhub.com/mcp).
---
## Available MCP Tools (10 Tools)
| Tool | What it does |
| --- | --- |
| `export_gridfinity` | Builds a watertight Gridfinity bin or baseplate (`1x1`–`10x10`, dividers, stacking lip, magnet pockets) and writes `.stl` / `.step` to disk. |
| `export_spur_gear` | Generates an involute spur gear or meshed 2-gear pair (`8–150T`, round or D-shaft bore, hub) and saves `.stl`, exact B-rep `.step`, and `.svg`. |
| `export_parametric_part` | Parses natural-language dimensions (`mm`, `cm`, `in`, fractions, Chinese/English) into a bracket, spacer, reducer, or box and writes `.stl` / `.step`. |
| `export_library_part` | Builds any of 8 ready-to-print functional parts (`wall-hook`, `phone-stand`, `cable-clip`, `pegboard-hook`, `knob-6mm-d-shaft`, `hex-key-holder`, `pipe-clamp-32mm`, `headphone-desk-hook`) with parameter overrides. |
| `list_library_parts` | Lists all 8 functional designs with parameter names, defaults, and min/max millimeter bounds. |
| `convert_svg_to_dxf` | Converts 2D SVG paths, rects, circles, polygons, and Beziers into AutoCAD R12 (`AC1009`) `.dxf` polylines in millimeters. |
| `parse_cad_prompt` | Parses & validates a natural-language bracket, spacer, reducer, or box prompt without exporting files. |
| `calculate_gear` | Computes pitch/base/outside/root diameters, undercut risk, and meshed center distance. |
| `gridfinity_dimensions` | Returns exact millimeter envelope, foot taper, lip height, interior span, and magnet pocket dimensions. |
| `get_fastener_clearance` | Looks up `M2–M10` FDM bolt clearance holes, hex nut WAF, and brass heat-set insert pilot/boss sizing. |
---
## CLI Usage (`aicad`)
After installing globally (`npm i -g github:ACs-del/aicad-mcp`) or inside a cloned checkout (`node dist/cli.js`):
### 1. Gridfinity Bin & Baseplate Generator
```bash
aicad gridfinity --x 2 --y 1 --height 3 --compartments-x 2 --magnets --stl gf-2x1.stl --step gf-2x1.step
```
Verified output:
```text
[aicad] Gridfinity bin (2x1)
Bounds: 83.5 x 41.5 x 25.4 mm
Volume: 27.08 cm³ (~33.6 g PLA)
Mesh: 2,672 triangles | watertight=true | bodies=1
Preview: https://aicadhub.com/gridfinity-generator
STL saved: .../gf-2x1.stl (133,684 bytes)
STEP saved: .../gf-2x1.step (6,359,397 bytes, faceted)
```

### 2. Involute Spur Gear Generator (Exact B-Rep STEP)
```bash
aicad gear --teeth 20 --module 2 --bore 6 --stl gear-20t.stl --step gear-20t.step --svg gear-20t.svg
```
Verified output:
```text
[aicad] Involute spur gear (gear-20t-m2)
Bounds: 44 x 44 x 10 mm
Volume: 11.95 cm³ (~14.8 g PLA)
Mesh: 2,800 triangles | watertight=true | bodies=1
Preview: https://aicadhub.com/gear-generator
Pitch Ø: 40.000 mm | Outer Ø: 44.000 mm | Root Ø: 35.000 mm
STL saved: .../gear-20t.stl (140,084 bytes)
STEP saved: .../gear-20t.step (2,159,033 bytes, exact B-rep)
```
### 3. Prompt-to-Parametric Part, Library Parts, Clearances & SVG→DXF
```bash
# Parse plain English or Chinese into an exact bracket / spacer / reducer / box
aicad part "L-bracket 60 x 40 x 35 mm, 4 mm thick, M4 holes" --stl bracket.stl --step bracket.step
# Customize one of the 8 functional library parts
aicad library list
aicad library wall-hook --set reach=30 --stl hook.stl --step hook.step
# Metric M2-M10 FDM bolt clearance & brass heat-set insert sizing chart
aicad clearance all
# SVG -> AutoCAD R12 DXF for laser cutters & CNC
aicad svg2dxf mounting-plate.svg --unit mm --out mounting-plate.dxf
```
---
## TypeScript / Node.js SDK
```ts
import { writeFile } from 'node:fs/promises'
import {
generateGridfinity,
generateSpurGear,
generateParametricPart,
lookupFastenerClearance,
} from 'aicad-mcp'
// 1. Watertight 2x1x3 Gridfinity bin
const bin = await generateGridfinity({ x: 2, y: 1, height: 3, compartmentsX: 2, magnets: true })
await writeFile('gridfinity-2x1.stl', bin.stlBuffer)
// 2. Involute spur gear with exact ISO-10303-21 STEP export
const gear = await generateSpurGear({ teeth: 20, module: 2, bore: 6 })
const step = await gear.exportStepBuffer() // step.faceted === false (exact B-rep)
await writeFile('gear-20t.step', step.buffer)
// 3. Natural-language parametric bracket
const bracket = await generateParametricPart('L-bracket 60 x 40 x 35 mm, 4 mm thick, M4 holes')
console.log(bracket.dimensionsMm, `${bracket.estimatedPlaGrams} g PLA`)
// 4. M3 heat-set insert reference
console.log(lookupFastenerClearance('M3'))
```
---
## Local Open Source vs. AI CAD Hub Web Studio
| Capability | `aicad-mcp` (MIT Open Source) | [AI CAD Hub Studio](https://aicadhub.com/studio) |
| --- | --- | --- |
| Gridfinity bins & baseplates | ✅ Unlimited local STL / STEP | ✅ Free interactive 3D builder |
| Involute spur gears & pairs | ✅ STL / exact STEP / SVG | ✅ Free live preview & sliders |
| Parametric bracket / spacer / reducer / box | ✅ STL / exact B-rep STEP | ✅ Free instant preview & checks |
| Fastener & heat-set insert clearances + SVG→DXF | ✅ CLI + MCP tools | ✅ Free web tools & guides |
| Arbitrary custom parts (hinges, vents, enclosures, mounts) from natural language | — | ✅ AI Text-to-CAD + auto topology repair |
---
## Development & Tests
```bash
npm install
npm run build
npm test
```
## License
[MIT](./LICENSE) © 2026 [AI CAD Hub](https://aicadhub.com)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues