This MCP server bridges AI image generation with 3D modeling, allowing you to create parametric OpenSCAD models from text descriptions or images using multi-view reconstruction techniques. It supports both local processing and remote CUDA processing for computationally intensive tasks.
Clone the repository:
git clone https://github.com/jhacksman/OpenSCAD-MCP-Server.git
cd OpenSCAD-MCP-Server
Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Install OpenSCAD:
# Ubuntu/Debian
sudo apt-get install openscad
# macOS
brew install openscad
# Windows: Download from openscad.org
Install CUDA Multi-View Stereo:
git clone https://github.com/fixstars/cuda-multi-view-stereo.git
cd cuda-multi-view-stereo
mkdir build && cd build
cmake ..
make
Set up API keys:
Create a .env
file in the root directory with:
GEMINI_API_KEY=your-gemini-api-key
VENICE_API_KEY=your-venice-api-key # Optional
REMOTE_CUDA_MVS_API_KEY=your-remote-api-key # For remote processing
Install CUDA Multi-View Stereo on the server machine:
git clone https://github.com/fixstars/cuda-multi-view-stereo.git
cd cuda-multi-view-stereo
mkdir build && cd build
cmake ..
make
Start the remote CUDA MVS server:
python src/main_remote.py
Configure remote processing in your .env
file:
REMOTE_CUDA_MVS_ENABLED=True
REMOTE_CUDA_MVS_USE_LAN_DISCOVERY=True
REMOTE_CUDA_MVS_API_KEY=your-shared-secret-key
Alternatively, specify a server URL directly:
REMOTE_CUDA_MVS_ENABLED=True
REMOTE_CUDA_MVS_USE_LAN_DISCOVERY=False
REMOTE_CUDA_MVS_SERVER_URL=http://server-ip:8765
REMOTE_CUDA_MVS_API_KEY=your-shared-secret-key
Start the server:
python src/main.py
The server will start on http://localhost:8000
Access the web interface at http://localhost:8000/ui/
Use these MCP commands to interact with the server:
{
"prompt": "A low-poly rabbit with black background",
"model": "gemini-2.0-flash-exp-image-generation"
}
{
"prompt": "A low-poly rabbit",
"num_views": 4
}
{
"image_ids": ["view_1", "view_2", "view_3", "view_4"],
"output_name": "rabbit_model"
}
{
"prompt": "A low-poly rabbit",
"num_views": 4
}
{
"model_id": "your-model-id",
"format": "obj" // or "stl", "ply", "scad", etc.
}
{
"timeout": 5
}
{
"server_id": "server-id",
"job_id": "job-id"
}
{
"server_id": "server-id",
"job_id": "job-id",
"output_name": "model-name"
}
{}
{
"model_id": "your-model-id",
"printer_id": "your-printer-id"
}
The server supports multiple image generation methods:
The server can export models in several formats:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.