OpenSCAD 3D Model Generator MCP server

Transforms natural language descriptions into parametric 3D models through a pipeline of image generation, object segmentation, 3D modeling, and OpenSCAD code conversion for customizable 3D printing.
Back to servers
Provider
J Hacksman
Release date
Mar 21, 2025
Language
Python
Stats
25 stars

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.

Installation

Prerequisites

  1. Clone the repository:

    git clone https://github.com/jhacksman/OpenSCAD-MCP-Server.git
    cd OpenSCAD-MCP-Server
    
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Install OpenSCAD:

    # Ubuntu/Debian
    sudo apt-get install openscad
    
    # macOS
    brew install openscad
    
    # Windows: Download from openscad.org
    
  5. 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
    
  6. 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
    

Remote Processing Setup

Server Setup (on the machine with CUDA GPU)

  1. 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
    
  2. Start the remote CUDA MVS server:

    python src/main_remote.py
    

Client Configuration

  1. 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
    
  2. 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
    

Using the Server

  1. Start the server:

    python src/main.py
    
  2. The server will start on http://localhost:8000

  3. Access the web interface at http://localhost:8000/ui/

Core Commands

Use these MCP commands to interact with the server:

Generate images from text

{
  "prompt": "A low-poly rabbit with black background",
  "model": "gemini-2.0-flash-exp-image-generation"
}

Generate multiple views for 3D reconstruction

{
  "prompt": "A low-poly rabbit",
  "num_views": 4
}

Create a 3D model from approved images

{
  "image_ids": ["view_1", "view_2", "view_3", "view_4"],
  "output_name": "rabbit_model"
}

Complete pipeline from text to 3D model

{
  "prompt": "A low-poly rabbit",
  "num_views": 4
}

Export a model to a specific format

{
  "model_id": "your-model-id",
  "format": "obj"  // or "stl", "ply", "scad", etc.
}

Remote Processing Commands

Discover CUDA MVS servers on your network

{
  "timeout": 5
}

Check remote job status

{
  "server_id": "server-id",
  "job_id": "job-id"
}

Download completed model from remote server

{
  "server_id": "server-id",
  "job_id": "job-id",
  "output_name": "model-name"
}

3D Printing Commands

Discover network printers

{}

Print a model

{
  "model_id": "your-model-id",
  "printer_id": "your-printer-id"
}

Supported Image Generation Options

The server supports multiple image generation methods:

  • Google Gemini API (Default): Uses Gemini 2.0 Flash Experimental model
  • Venice.ai API (Optional): Alternative service with various models
  • User-Provided Images: Upload your own images for reconstruction

Supported Export Formats

The server can export models in several formats:

  • OBJ: Standard 3D model format
  • STL: For 3D printing
  • PLY: For point clouds and meshes
  • SCAD: OpenSCAD source code (parametric)
  • CSG: OpenSCAD CSG format (preserves parameters)
  • AMF: Additive Manufacturing File Format
  • 3MF: 3D Manufacturing Format

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later