Content
# OpenSCAD MCP
A small dependency-free MCP server for generating, reading, validating, and exporting OpenSCAD models.
The server keeps all model access inside this folder:
- `models/` for `.scad` files
- `outputs/` for generated `.stl`, `.3mf`, `.png`, `.svg`, and other exports
## Requirements
- Python 3.10+
- OpenSCAD installed locally
On Windows, install OpenSCAD and either add `openscad.exe` to `PATH`, or set `OPENSCAD_BIN` to the full executable path.
Example PowerShell session:
```powershell
$env:OPENSCAD_BIN = "C:\Program Files\OpenSCAD\openscad.exe"
python .\server.py
```
## Tools
- `list_models`: list `.scad` files in `models/`
- `read_model`: read one model
- `write_model`: create or replace one model
- `discover_parameters`: parse simple top-level assignments such as `width = 80;`
- `set_parameters`: update simple top-level parameter assignments
- `validate_model`: compile to CSG to catch OpenSCAD errors
- `export_model`: export to `stl`, `3mf`, `png`, `svg`, `dxf`, `off`, `amf`, or `csg`
## Claude Desktop / compatible MCP config
Adjust the paths if you move this folder:
```json
{
"mcpServers": {
"openscad": {
"command": "python",
"args": [
"C:\\Users\\admin\\Documents\\New project\\openscad-mcp\\server.py",
"--root",
"C:\\Users\\admin\\Documents\\New project\\openscad-mcp"
],
"env": {
"OPENSCAD_BIN": "C:\\Program Files\\OpenSCAD\\openscad.exe"
}
}
}
}
```
If `openscad.exe` is already on `PATH`, remove the `env` block.
## Manual smoke test
This asks the server to initialize and list tools:
```powershell
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | python .\server.py
```
## Example export call
From an MCP client, call:
```json
{
"name": "export_model",
"arguments": {
"path": "parametric_box.scad",
"format": "stl",
"render": true
}
}
```
The STL will be written under `outputs/`.