Mcp_3d_relief

by Bigchx

303 downloads
Not rated
GitHub

About

This project provides a MCP server that converts 2D images into 3D relief models in STL format, suitable for 3D printing or rendering.

Details

Author
Bigchx
Downloads
303
Categories
Other

- Converts images to 3D relief models in STL format
- Customizable model width, thickness, and base thickness (in mm)
- Adjustable detail level to control resolution and file size
- Option to invert or skip depth map generation
- Supports external depth maps for higher quality results
- Can be used as an MCP tool or standalone command-line script

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Mcp_3d_relief
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install the MCP server and configure it with the tool parameters. Invoke the tool by providing an image_path (local file or web URL) along with optional parameters for model dimensions, base thickness, and detail level. The server returns a JSON response containing paths to the generated depth map and STL file. Alternatively, you can use the included Python script directly from the command line: python3 relief.py path/to/your/image.jpg.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp_3d_relief": {
            "mcp_3d_relief": {
                "command": "uv",
                "args": [
                    "--directory",
                    "{fill_in_your_path_here}",
                    "run",
                    "server.py"
                ]
            }
        }
    }
}

McpServers

{
    "mcp_3d_relief": {
        "command": "uv",
        "args": [
            "--directory",
            "{fill_in_your_path_here}",
            "run",
            "server.py"
        ]
    }
}

MCP Tool Parameters

- image_path: Local path or web URL to the input image file
- model_width: Width of the 3D model in mm (default: 50.0)
- model_thickness: Maximum thickness/height of the 3D model in mm (default: 5.0)
- base_thickness: Thickness of the base in mm (default: 2.0)
- skip_depth: Whether to use the image directly or generate a depth map (default: true)
- invert_depth: Invert the relief (bright areas become low instead of high) (default: false)
- detail_level: Controls the resolution of the processed image (default: 1.0). At detail_level = 1.0, the image is processed at 320px resolution, producing an STL file typically under 100MB. Higher values improve detail quality but significantly increase both processing time and STL file size. For example, doubling the detail_level can increase file size by 4x or more. Use with caution.

Response

The MCP Tool returns a JSON response with:

{
  "status": "success",
  "depth_map_path": "path/to/yourimage_depth_map.png",
  "stl_path": "path/to/yourimage.stl"
}

Where LLMs can access the generated files from this MCP server, using the provided URLs.

Command Line

You can also use the script directly from the command line to generate a relief model from an image:

python3 relief.py path/to/your/image.jpg

External Depth Map Generation

For higher quality depth maps, you can use external depth map generation services like Depth-Anything-V2. This service can generate more accurate depth maps that you can then use with this project:

1. Visit https://huggingface.co/spaces/depth-anything/Depth-Anything-V2
2. Upload your image to generate a depth map
3. Download the generated depth map
4. Use this depth map with our converter by setting skip_depth=false

This approach can provide better 3D relief models, especially for complex images.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.