OpenSCAD MCP Server
Integrates with OpenSCAD to create and update scripts, render models from multiple camera views as PNG images, and export STL files for 3D printing.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenSCAD MCP Server Create a 20mm rounded cube, render the isometric view, and export it as STL."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenSCAD MCP Server
A Model Context Protocol (MCP) server that provides seamless integration between Large Language Models and OpenSCAD for collaborative 3D modeling and rapid prototyping.
๐ Features
Natural Language to 3D Models: Describe your design in plain English and get working OpenSCAD code
Live Visual Feedback: Real-time rendering with base64 PNG images optimized for vision models
Instant 3D Printing: Direct STL export ready for your 3D printer
Persistent Workspace: Scratchpad maintains your work across sessions
Multiple Camera Views: Inspect your models from all angles (isometric, front, back, left, right, top, bottom)
Error Handling: Comprehensive error reporting and logging for debugging
Related MCP server: OpenSCAD MCP Server
๐ฏ Use Cases
Rapid Prototyping: Quickly iterate on mechanical parts and assemblies
Educational Tools: Learn 3D modeling through conversational interfaces
Parametric Design: Generate families of related objects with simple parameter changes
Accessibility: 3D modeling for users who prefer text-based interfaces
Automation: Integrate 3D model generation into larger workflows
๐ Requirements
Python 3.8+
OpenSCAD (installed and accessible via command line)
fastmcp library
๐ ๏ธ Installation
1. Install OpenSCAD
Windows:
# Download from https://openscad.org/downloads.html
# Or via Chocolatey:
choco install openscadmacOS:
brew install openscadLinux (Ubuntu/Debian):
sudo apt-get install openscad2. Clone and Run
git clone https://github.com/jabberjabberjabber/openscad-mcp
cd openscad-mcp
uv run --with fastmcp fastmcp dev main.py3. Install
Add this to your client's MCP config:
"mcpServers": {
"openscad-mcp": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"fastmcp",
"run",
"c:/path/to/openscad-mcp/main.py"
],
"env": {
"OPENSCAD_WORK_DIR": "c:/path/to/openscad-mcp/"
}
}
},๐ฎ Usage
The server provides five main tools for 3D modeling workflows:
Available Tools
Tool | Purpose | Parameters |
| Display current script | None |
| Create/update script |
|
| Render PNG image |
|
| Export for 3D printing |
|
| Save script to file |
|
Example Workflow
# 1. Create a model
create_openscad_script("""
// Simple cube with rounded corners
$fn = 32;
minkowski() {
cube([20, 20, 10], center=true);
sphere(r=2);
}
""")
# 2. View the result
view_render("isometric") # Returns base64 PNG
# 3. Export for printing
export_model_to_stl("rounded_cube")
# 4. Save the source
save_openscad_script("rounded_cube")Camera Views
isometric(default) - 3D perspective viewfront- Front orthographic viewback- Back orthographic viewleft- Left side viewright- Right side viewtop- Top-down viewbottom- Bottom-up view
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ LLM Client โโโโโถโ MCP Server โโโโโถโ OpenSCAD โ
โ โ โ โ โ Engine โ
โ Natural Languageโ โ โข Script Storage โ โ โข Rendering โ
โ Descriptions โ โ โข State Mgmt โ โ โข STL Export โ
โ โโโโโโ โข Error Handling โโโโโโ โข Validation โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโKey Components
Persistent State: JSON-based scratchpad for session continuity
OpenSCAD Integration: Subprocess calls with timeout protection
Image Generation: Base64 PNG encoding for vision model compatibility
File Management: Organized output to configurable working directory
Error Handling: Comprehensive logging and graceful failure modes
๐จ Example Projects
Hollow Sphere (Vase Mode)
$fn = 64;
difference() {
sphere(r=15); // 30mm diameter
sphere(r=12); // 3mm wall thickness
}Parametric Gear
module gear(teeth=20, height=5) {
linear_extrude(height=height) {
for (i = [0:teeth-1]) {
rotate([0, 0, i*360/teeth]) {
translate([8, 0, 0]) circle(r=1);
}
}
circle(r=7);
}
}
gear(teeth=16, height=8);Customizable Bracket
width = 30;
depth = 20;
height = 15;
thickness = 3;
difference() {
cube([width, depth, height]);
translate([thickness, thickness, thickness])
cube([width-2*thickness, depth-thickness, height]);
}โ๏ธ Configuration
Environment Variables
OPENSCAD_WORK_DIR: Working directory for files (default: server directory)
Logging
Logs are written to openscad_mcp.log with detailed operation information:
Script updates and validations
Rendering operations and timing
Export operations and file sizes
Error conditions and recovery
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Available Tools
5 toolscreate_openscad_scriptCreate Openscad ScriptC
Create or update the OpenSCAD script in the scratchpad
Inputs: script_content (required). Returns: result
export_model_to_stlExport Model To StlC
Export the current OpenSCAD script to STL file
Inputs: filename (required). Returns: result
save_openscad_scriptSave Openscad ScriptC
Save the current OpenSCAD script to a file
Inputs: filename (required). Returns: result
show_openscad_scriptShow Openscad ScriptA
Show the current OpenSCAD script from the scratchpad
Inputs: no named parameters. Returns: result
view_renderView RenderB
Render the current OpenSCAD script and return as base64 PNG
Inputs: view. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 5 tools
Most tools have clearly distinct purposes: read the scratchpad, update it, render a PNG, export STL, and save to file. The main friction is between create_openscad_script (updates scratchpad) and save_openscad_script (writes to file), which could be confused since both 'persist' the script, but descriptions clarify the target.
Three tools consistently use the verb_openscad_script pattern (show/create/save_openscad_script), which is predictable. view_render and export_model_to_stl deviate with different noun and suffix conventions, but remain readable and verb-first.
Five tools is well-scoped for a scratchpad-based script editing and rendering workflow, with each tool earning its place (read, write, preview, export, persist). No bloat and no obviously redundant operations.
The surface covers the core lifecycle: read, create/update, render preview, export STL, and save to file. Minor gaps exist, such as clearing/deleting the scratchpad or listing/returning saved file locations, but agents can work around these.
Maintenance
Related MCP Connectors
Parametric 3D CAD for AI agents: build print-ready parts, check them, export STL, 3MF or STEP.
A browser 3D CAD for your AI: it scripts real-size models, uCAD builds them and returns pictures.
Remote OpenSCAD: sign in with Google, create and edit designs, export STL or 3MF.
Design 3D-printable parts by chatting: create, edit, render and publish parametric forges.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI-driven 3D model generation and manipulation using OpenSCAD through natural language commands. Users can create primitives, apply transformations, perform boolean operations, and export models to various formats like STL and OBJ.13 npmMIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to render 3D models by providing tools to execute OpenSCAD code and generate single or multi-perspective views. It returns high-quality PNG renderings directly to LLM applications for visual feedback and 3D model visualization.MIT
- AlicenseAqualityCmaintenanceEnables to create, iterate, and export 3D models through natural language conversations with an LLM by bundling OpenSCAD via WebAssembly for zero-setup 3D modeling.1034 npm3GPL 2.0
- AlicenseAqualityDmaintenanceEnables AI assistants to create and manipulate 3D CAD models using OpenSCAD.428 npm1MIT