
build123d-mcp
Exposes build123d CAD operations as MCP tools so AI assistants can build, inspect, and iterate on 3D geometry interactively.
Add to your client
Copy the config for your MCP client and paste it into its config file.
pip install build123d-mcpPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"build123d-mcp": {
"command": "uv",
"args": [
"tool",
"run",
"--python",
"3.12",
"build123d-mcp@latest"
]
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- uv (astral-sh/uv) — used to fetch and launch the server
- An MCP-compatible client (Claude Code, Claude Desktop, Cursor, VS Code/Continue/Copilot, etc.)
- Python 3.11, 3.12, 3.13, or 3.14 (uv can auto-download a managed interpreter)
- All Python deps (build123d, vtk, etc.) are installed automatically by uv
About build123d-mcp
An MCP server that exposes build123d CAD operations as tools, enabling AI assistants to build, inspect, and iterate on 3D geometry interactively. When an AI writes build123d scripts blind it cannot see the geometry it produces; this server closes the feedback loop so the AI can create geometry, render views, query dimensions, run feature recognition and printability analysis, generate engineering drawings, and catch errors incrementally rather than writing a whole script and hoping it is correct. It runs over stdio (one isolated session per client process), is installed from PyPI, and launched via uv tool run. A persistent execute() session, MCP resources (build123d quick reference, selector cookbook, drafting cookbook, live session state, bd_warehouse parts catalogue), and a start-cad-session prompt round out the workflow.
Tools & capabilities (34)
executeRun build123d Python code in a persistent session; use show(shape, name) to register named parts.
resetClear the session back to empty state (namespace, shapes, snapshots).
measureFull geometric summary: volume, area, topology, bounding box, centre of mass, inertia tensor, face-type inventory.
clearanceMinimum distance (mm) between two named shapes.
cross_sectionsCross-sectional areas at evenly spaced planes along X/Y/Z; useful for detecting voids and wall-thickness variation.
resolveEvaluate a selector expression (e.g. .faces().filter_by(Axis.Z).last()) against a named object and return a geometry descriptor.
find_holesFeature recognition: coaxial drill + counterbore + spotface stacks reported as one hole record (axis, location, diameter, depth, bottom type).
find_bossesFeature recognition: external bosses with height.
find_hole_patternsRecognise bolt-circle and linear-array hole patterns.
analyze_printabilityBREP-exact FDM printability analysis: overhangs, thin walls, minimum features, bed fit, tip-over risk.
session_stateFull JSON snapshot of active shapes, named objects, snapshot names, and Python namespace variables.
last_errorDetails of the last failed execute(): type, message, line number, and code excerpt.
render_viewRender one or more shapes as PNG/SVG/DXF; auto-detects 3D vs 2D, supports assembly compositing, high-quality tessellation, cross-section clip planes, and optional labels.
suggest_view_layoutAuto-calculate safe page positions for a standard multi-view drawing layout.
view_axesWorld-to-page axis mapping for a projected view, computed analytically before rendering.
render_drawingRasterise an SVG file from disk to PNG.
inspect_drawingStructured bbox/annotation report for a 2D drawing (session objects or an SVG on disk).
lint_drawingStructural drawing-quality checks: label/geometry divergence, overlapping annotations, page overshoot.
save_drawing_annotationsWrite a .dims.json sidecar capturing label metadata alongside an exported SVG.
exportExport as STEP / STL / DXF / SVG (or comma-separated); auto-detects 2D vs 3D; targets a named object, the current shape, or * for all objects as an assembly.
import_cad_fileLoad a STEP or STL file as a named object for comparison.
shape_compareCompare two named shapes by volume, bbox, topology, and centre offset, plus a localized surface-deviation diff pinpointing where geometry changed, with an exact-boolean magnitude.
align_checkCheck alignment between two named objects along an axis (flush / center / clearance modes).
save_snapshotCheckpoint the current geometric state.
restore_snapshotRecover a previously saved geometric state.
diff_snapshotCompare geometric state against a snapshot.
search_librarySearch the part library by keyword; returns full parameter specs (requires --library flag).
load_partLoad a named part with optional parameter overrides (requires --library flag).
versionReturn the server version.
health_checkVerify VTK/SVG/STEP/STL dependencies work end-to-end.
repair_hintsGet targeted fix suggestions for a given execute() error message.
workflow_hintsGuidance on using the tools effectively.
scriptAssemble a reproducible Python script from the session's executed code blocks.
install_skillCopy a b123d workflow skill (modeling or drawing) into the current project (targets: agents-md, claude, cursor, windsurf).
When to use it
- Let an AI assistant model 3D parts in build123d with a visual/geometric feedback loop instead of writing scripts blind
- Render PNG/SVG/DXF views and measure volume, bounding box, and topology to verify a part matches a spec
- Run feature recognition (holes, counterbores, bosses, bolt-circle patterns) on imported or generated geometry
- Check FDM 3D-printability — overhangs, thin walls, minimum features, bed fit, tip-over risk — before printing
- Generate and lint code-first engineering drawings, then export STEP/STL/DXF/SVG
- Use bd_warehouse fasteners (screws, threads, gears, bearings) and a parametric part library in CAD workflows
Security notes
Ships with defence-in-depth sandboxing applied before any user code runs: (1) AST inspection that rejects non-allowlisted imports and blocks eval/exec/compile/open and dunder attribute access; (2) restricted builtins with __import__ rewrapped to enforce the allowlist at runtime; (3) a wall-clock exec timeout (default 120s, --exec-timeout N) enforced via SIGALRM with worker restart on breach. Filesystem, networking, and shell modules are blocked, and path traversal is rejected for export()/render_view(save_to=). Not a perfect sandbox (memory is unbounded; introspection chains could in principle escape) — for untrusted input wrap the whole server in an OS-level sandbox (e.g. @anthropic-ai/sandbox-runtime or a container). --allow-imports / --allow-all-imports / --no-sandbox relax the policy and should be used only in trusted/isolated environments. The --library directory is treated as trusted input — point it only at directories you control. HTTP mode shares a single CAD session across all requests unless per-request session middleware is installed; do not expose it to multiple users without that.
build123d-mcp FAQ
How do I add it to Claude Desktop or Cursor?
Add an mcpServers entry with command "uv" and args ["tool", "run", "--python", "3.12", "build123d-mcp@latest"] to the client's config (claude_desktop_config.json, ~/.cursor/mcp.json, or .mcp.json for Claude Code), then restart the client. The server runs over stdio and uv fetches the package on launch; no clone or prior install is required.
Which Python versions are supported?
Python 3.11, 3.12, 3.13, and 3.14 are all supported and CI-tested. The example config passes --python 3.12 as a widely-available default, but you can swap in any supported interpreter; uv will auto-download a managed Python if you don't have one.
Is it safe to run LLM-generated CAD code?
It ships with defence-in-depth sandboxing (AST import allowlist, restricted builtins with eval/exec/open/__import__ guarded, and a SIGALRM exec timeout); filesystem, network, and shell modules are blocked. It is not a perfect sandbox, so for truly untrusted input the README recommends wrapping the whole server in an OS-level sandbox such as @anthropic-ai/sandbox-runtime or a container.
What is the recommended workflow for complex parts?
Simple shapes can be built entirely in execute(). For complex parts that risk the 120s exec timeout, probe API signatures in the MCP, build the geometry in a standalone Python script (no timeout), then import_cad_file() the result and use measure()/render_view() to verify.
Does it support HTTP transport?
Yes, with --transport http it serves streamable-HTTP for web/embedded deployments, but HTTP mode shares one CAD session across all requests unless per-request session middleware is installed, so it should not be exposed to multiple users without that middleware. The default and recommended transport is stdio.
Alternatives to build123d-mcp
Compare all alternatives →Control Blender from Claude and other LLMs for prompt-assisted 3D modeling, scene creation, and asset generation.
Popular community server that feeds Figma layout data to coding agents via a Figma API token.
Generate beautiful, modern UI components from natural-language descriptions inside your IDE.
Compare build123d-mcp with: