Skip to main content
Glama
3DP MCP Server

3DP MCP Server

by brs077
README.md
# 3DP MCP Server

MCP server that gives Claude the ability to create 3D-printable CAD models using build123d. Outputs STL, STEP, and 3MF files ready for slicing in Bambu Studio, OrcaSlicer, or PrusaSlicer.

**Version 2.0.0** — see [What's new in 2.0](#whats-new-in-20), including two breaking changes. Release history is in [CHANGELOG.md](CHANGELOG.md).

With it, Claude can:

- model a part from a description, then look at a rendered preview of the result
- check printability: measured wall thickness, overhangs, fit on your printer's bed
- pick a print orientation, split or pack parts, and estimate filament, cost, and time
- generate enclosures, hinges, gears, dovetails, snap-fits, threaded holes, and labels
- generate standard hardware: real threads, screws, nuts, bearings, sprockets, flanges, extrusions
- import and modify existing STL, 3MF, and STEP files
- publish to GitHub Releases, Thingiverse, MyMiniFactory, or Cults3D

Also available as a **Claude Code plugin** — install it and all 45 tools and 7 skills are available automatically.

## Install as Plugin (Recommended)

Add the marketplace and install the plugin from within Claude Code:

```
/plugin marketplace add brs077/3dp-mcp-server
/plugin install 3dp-mcp-server@3dp-tools
```

The plugin sets up a Python environment and installs dependencies on first use. Requires Python 3.11+ and [uv](https://docs.astral.sh/uv/).

### Plugin Skills

Once installed, Claude gains seven workflow skills:

| Skill | Use it for |
|-------|------------|
| `design-model` | Modelling a new part: write, preview, check, fix, export |
| `design-enclosure` | Cases and project boxes for boards and electronics |
| `design-mating-parts` | Joints, clearances, hinges, gears, threaded holes |
| `mechanical-parts` | Real threads, fasteners, bearings, sprockets, flanges, extrusions |
| `modify-model` | Importing and modifying STL, 3MF, or STEP files |
| `print-prep` | Orientation, supports, bed fit, packing, multi-colour, estimates |
| `publish-model` | Sharing a finished model |

## Manual Setup (Alternative)

With uv:

```bash
git clone https://github.com/brs077/3dp-mcp-server.git
cd 3dp-mcp-server
make install
claude mcp add 3dp-mcp-server -- uv run --directory "$(pwd)" threedp-mcp
```

Without uv, `bash setup.sh` creates a virtual environment with pip, installs the package, and registers the server with Claude Code.

If you run Claude Code inside the cloned repository, you can skip the `claude mcp add` step: the repository's `.mcp.json` offers the server as a project server, and Claude Code asks you to approve it on first start.

To load the repository as a local plugin instead (tools and skills):

```bash
claude plugin add /path/to/3dp-mcp-server
```

### Upgrading from 1.x

Pull, then run `make install` (or re-run `setup.sh`). This reinstalls the dependencies at the versions 2.0 needs (`mcp` 2.x, `build123d` 0.13.x). Read the breaking changes below first.

## What's new in 2.0

**Breaking changes**

- **Side names are unified.** `front`/`back` now mean −Y/+Y in `add_text`, `shell_model`, and `split_model_by_color`, matching the preview and drawing views. In 1.x these three tools treated `front` as +Y.
- **Requires `mcp` 2.x and `build123d` 0.13.x.** Versions are capped in `pyproject.toml`. (`mcp` 2.0 renamed `FastMCP`, which stopped 1.x from starting at all.)

Smaller behaviour changes:

- `create_threaded_hole` measures depth from the hole's opening.
- `create_hinge` also produces a pin.
- `create_gear` needs `bd_warehouse` and no longer falls back to an approximate shape.
- Model names are restricted to letters, digits, `_`, `-` and `.`.
- The `parametric-components` skill is replaced by `design-enclosure` and `design-mating-parts`.

**New tools**

- `render_preview` — shaded PNG of the model, returned to Claude as an image
- `fillet_model`, `chamfer_model` — round or bevel edges of an existing model
- `set_printer` — printer presets or a custom build volume
- `delete_model` — free memory in long sessions

**Fixed**

- Tools that failed on every call with current `build123d`: `transform_model`, `shell_model`, `section_view`, `export_drawing`, 3MF export, and `convert_format`
- The package could not be installed on Linux (`pyproject.toml` named a README file that only matched on case-insensitive file systems)
- Overhang detection was inverted; `suggest_orientation` was scoring on the wrong data
- Geometry that reported success but was wrong: threaded holes at half depth, enclosure vents and holes that did not go through, hinge leaves that overlapped, a colour split that did not split, debossed text that cut nothing, sideways text on side faces
- Mechanical parts: button-head, pan-head and low-profile screws, flanged nuts, washers and lapped flanges failed with their default settings
- `estimate_print` could report more filament than the model's volume and gave unrealistic times
- Helper functions in `create_model` code, STL imports with zero volume, splitting a model away from the origin

**Improved**

- `analyze_printability` measures minimum wall thickness and checks fit against the selected printer
- `create_thread` can produce a printable rod or sleeve (`solid_body`), not just the loose thread ridge
- List and object parameters accept native JSON values as well as JSON strings
- `transform_model` has a `place_on_bed` operation
- Errors in model code report the failing line; unavailable fastener and bearing sizes list the available ones
- QR labels build in about a second instead of a minute
- The test suite exercises every tool against real geometry, and checks the skills and docs against the server

## Tools (45)

### Core
| Tool | Description |
|------|-------------|
| `create_model` | Execute build123d code, auto-exports STL + STEP; errors point at the failing line of your code |
| `export_model` | Export to STL, STEP, or 3MF |
| `measure_model` | Bounding box, volume, surface area, face/edge counts |
| `analyze_printability` | Geometry validity, measured minimum wall thickness, build-volume fit, warnings for unconnected solids |
| `list_models` | List all models in current session |
| `get_model_code` | Retrieve the code used to create a model |
| `delete_model` | Remove a model from the session, optionally with its exported files |
| `set_printer` | Show or change the printer profile used for build-volume checks |

### Transform & Combine
| Tool | Description |
|------|-------------|
| `transform_model` | Scale, rotate, mirror, translate, or place a model on the bed |
| `combine_models` | Boolean union, subtract, or intersect two models |
| `import_model` | Import an STL, 3MF, STEP, or BREP file from disk |

### Modification
| Tool | Description |
|------|-------------|
| `shell_model` | Hollow out a model with optional open sides |
| `split_model` | Split a model along a plane at any position |
| `add_text` | Emboss or deboss upright text onto any side of a model |
| `create_threaded_hole` | Add tap-drill or heat-set insert holes (M2–M10) in any axis direction |
| `fillet_model` | Round a model's edges (all, top, bottom, vertical, or horizontal) |
| `chamfer_model` | Bevel a model's edges (all, top, bottom, vertical, or horizontal) |

### Analysis & Export
| Tool | Description |
|------|-------------|
| `estimate_print` | Rough estimate of filament usage, weight, cost, and time |
| `analyze_overhangs` | Find overhang faces needing support material |
| `suggest_orientation` | Rank the 6 axis-aligned print orientations |
| `render_preview` | Shaded PNG preview from one or more views, returned as an image |
| `section_view` | Generate 2D cross-section as SVG |
| `export_drawing` | Multi-view 2D drawing as SVG with hidden lines dashed |
| `split_model_by_color` | Split into per-filament STLs for multi-color printing |

### Utility
| Tool | Description |
|------|-------------|
| `shrinkage_compensation` | Scale model to compensate for material shrinkage |
| `pack_models` | Arrange models on build plate for batch printing |
| `convert_format` | Convert between STL, 3MF, STEP, BREP |

### Parametric Components
| Tool | Description |
|------|-------------|
| `create_enclosure` | Electronics enclosure with snap/screw lid, vents, cable hole, screw posts |
| `create_gear` | Involute spur gear (via bd_warehouse) |
| `create_snap_fit` | Cantilever snap-fit joints |
| `create_hinge` | Pin hinge: two leaves and a pin, modelled with clearance |
| `create_dovetail` | Male or female dovetail joints |
| `generate_label` | 3D-printable label with text (auto-fitted) and optional QR code |

### Mechanical Parts (bd_warehouse)
| Tool | Description |
|------|-------------|
| `create_thread` | ISO metric, ACME, metric trapezoidal, or plastic bottle threads; optional printable rod or sleeve |
| `create_fastener` | Screws, nuts, washers, heat-set inserts (14 classes) |
| `create_bearing` | Ball and roller bearing reference models (5 classes) |
| `create_sprocket` | Chain sprockets for ANSI chains |
| `create_flange` | ASME B16.5 pipe flanges (5 types) |
| `create_pipe` | Pipe/tube sections |
| `create_openbuilds_part` | V-Slot rails, C-Beam rails, lead screws |

### Community
| Tool | Description |
|------|-------------|
| `search_models` | Search Thingiverse for 3D models |

### Publishing
| Tool | Description |
|------|-------------|
| `publish_github_release` | Upload STL/STEP/3MF to GitHub Releases (via `gh` CLI or API) |
| `publish_thingiverse` | Create a Thing and upload STL to Thingiverse |
| `publish_myminifactory` | Create object and upload STL to MyMiniFactory |
| `publish_cults3d` | Create listing on Cults3D via GraphQL API |

See [TOOLS.md](TOOLS.md) for parameters, examples, and response formats, or [docs/](docs/README.md) for the same reference as one page per tool. Credentials for the community and publishing tools are listed in [.env.example](.env.example).

A few conventions hold across all tools:

- Sides are named the same way everywhere (text faces, open faces, color slabs, preview and drawing views): top/bottom = +Z/−Z, front/back = −Y/+Y, right/left = +X/−X.
- List and object parameters take native JSON values; a JSON string of the same value also works.
- Model names are 1–64 letters, digits, `_`, `-` or `.`, starting with a letter or digit.

The server sends a short usage guide to MCP clients when they connect, and marks its read-only, destructive, and publishing tools with MCP annotations so clients can treat them appropriately.

## Configuration

| Environment variable | Purpose |
|----------------------|---------|
| `THREEDP_PRINTER` | Printer preset for build-volume checks: `bambu_x1c` (default), `bambu_p1s`, `bambu_a1`, `bambu_a1_mini`, `prusa_mk4`, `prusa_mini`, `ender3`, `voron_2.4_350`. The `set_printer` tool changes it during a session and also accepts a custom `[x, y, z]` volume. |
| `THREEDP_OUTPUT_DIR` | Where generated files are written. Defaults to `outputs/` in the repository. |

## Development

```bash
make install          # Install dependencies
make test             # Run the test suite
make lint             # Check code style
make format           # Auto-format code
make verify           # Lint + test
make docs             # Regenerate docs/ from TOOLS.md
make run              # Start the MCP server
make clean            # Remove build artifacts
```

The tests run every tool against real build123d geometry, except the network calls of the search and publish tools, which need credentials and are tested with mocks. `tests/test_skills.py` runs the examples in `skills/` against the server and checks that `TOOLS.md`, `docs/`, and the version numbers agree with the code.

`TOOLS.md` is the source for the tool documentation. The per-tool pages under `docs/` are generated from it; after editing `TOOLS.md`, run `make docs`.

## Requirements

- Python 3.11+
- [uv](https://docs.astral.sh/uv/) package manager (or pip, via `setup.sh`)
- macOS, Linux, or Windows 11
- Claude Code CLI
- Python dependencies are listed in `pyproject.toml` with capped version ranges, so a new major release of `mcp` or `build123d` cannot break an install

## Project Structure

```
src/threedp_mcp/
├── server.py       # Thin entrypoint — MCPServer init + tool registration
├── constants.py    # Materials, ISO threads, printer profiles, views, client instructions
├── helpers.py      # Model store, code execution, export/import, analysis and rendering helpers
└── tools/
    ├── core.py         # create, export, measure, analyze, set_printer, list, get_code, delete
    ├── transform.py    # transform, combine, import
    ├── modification.py # shell, split, add_text, threaded_hole, fillet, chamfer
    ├── analysis.py     # estimate, overhangs, orientation, preview, section, drawing, color_split
    ├── utility.py      # shrinkage, pack, convert
    ├── components.py   # enclosure, gear, snap_fit, hinge, dovetail, label
    ├── mechanical.py   # threads, fasteners, bearings, sprockets, flanges, pipes, openbuilds
    ├── community.py    # search_models
    └── publishing.py   # github, thingiverse, myminifactory, cults3d
skills/                 # Plugin skills
tests/                  # Test suite
scripts/build_docs.py   # Generates docs/ from TOOLS.md
```

## Uninstall

### Plugin

```
/plugin uninstall 3dp-mcp-server@3dp-tools
```

### Manual Install

```bash
claude mcp remove 3dp-mcp-server -s user
rm -rf 3dp-mcp-server
```

## License

This project is licensed under [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/). You can use it personally and share it with attribution, but commercial use and redistribution of modified versions are not permitted.

Interested in collaborating or commercial licensing? [Open an issue](https://github.com/brs077/3dp-mcp-server/issues) to get in touch.