OpenSCAD MCP Server
A Model Context Protocol (MCP) server that provides OpenSCAD rendering capabilities. This server allows you to render OpenSCAD code to PNG images through a standardized MCP interface.
Features
- Headless OpenSCAD Rendering: Execute OpenSCAD code and generate PNG images without a GUI
- Flexible Camera Control: Support for custom camera positioning and orientation
- Cross-Platform: Configurable OpenSCAD binary path for different operating systems
Prerequisites
- Node.js: Version 18 or higher
- OpenSCAD: Nightly (dev) version must be installed on your system. Download and install from OpenSCAD.org.
Installation
- Clone this repository:
- Install dependencies:
- Build the project:
Configuration
OpenSCAD Binary Path
By default, the server looks for OpenSCAD at /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD
(macOS path). You can customize this by setting the OPENSCAD_BINARY
environment variable.
Usage as MCP Server in Gemini-cli
In your gemini settings.json file, e.g., ~/.gemini/settings.json
, add the following:
Use included GEMINI.md
file in the folder you want to generate openSCAD code in.
Available Tools
render_openscad
Renders OpenSCAD code to a PNG image file.
Parameters:
code
(string, required): The OpenSCAD code to renderoutput_path
(string, required): Path where the rendered PNG image should be savedcamera
(string, optional): Camera parameters in one of these formats:translate_x,y,z,rot_x,y,z,dist
- Translation, rotation, and distanceeye_x,y,z,center_x,y,z
- Eye position and center point
Example Request:
Response:
Examples with gemini-cli
Prompt:
![]() |
---|
First Iteration |
![]() |
Final Iteration |
Generated OpenSCAD code:
Testing
Run the included tests to verify everything works:
Development
Scripts
npm run build
: Compile TypeScript to JavaScriptnpm run start
: Start the MCP servernpm run dev
: Watch mode for development
Project Structure
Troubleshooting
OpenSCAD Not Found
Solution: Verify OpenSCAD is installed and set the correct OPENSCAD_BINARY
path.
Permission Denied
Solution: Ensure the output directory exists and is writable.
Rendering Timeout
Solution: Simplify your OpenSCAD code or increase the timeout in the source code.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
Links
This server cannot be installed
Provides OpenSCAD rendering capabilities through a Model Context Protocol interface, allowing users to generate PNG images from OpenSCAD code without a GUI.
Related MCP Servers
- AsecurityFlicenseAqualityA Model Context Protocol server that converts PDF documents into PNG images through a simple MCP tool call.Last updated -15Python
- AsecurityFlicenseAqualityA Model Context Protocol server that provides API functionality for creating, managing, and exporting Excalidraw drawings in various formats like SVG, PNG, and JSON.Last updated -86924JavaScript
- -securityAlicense-qualityA Model Context Protocol server that provides tools for converting SVG code to high-quality PNG and JPG images with detailed customization options.Last updated -152JavaScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that converts SVG code to PNG images, offering two conversion methods (CairoSVG and Inkscape) with support for custom working directories.Last updated -3Python