Skip to main content

MCP server that converts 2D images into 3D relief models in STL format

Project description

MCP STL 3D Relief Generator

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

Features

  • Convert any image to a 3D relief model
  • Control model dimensions (width, thickness)
  • Add optional base to the 3D model
  • Invert depth for different relief effects
  • Fast processing with immediate download links

Installation

Prerequisites

  • Python 3.10+
  • uv

Option 1: Local Installation

  1. Clone the repository:
git clone https://github.com/bigchx/mcp_3d_relief.git
cd mcp_3d_relief
  1. Install dependencies:
uv pip sync requirements.txt
  1. Run/Inspect the server:
mcp run server.py
mcp dev server.py

Usage

JSON Configuration

{
  "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.

How It Works

  1. The image is processed to create a depth map (darker pixels = lower, brighter pixels = higher)
  2. The depth map is converted to a 3D mesh with triangular facets
  3. A base is added to the bottom of the model
  4. The model is saved as an STL file

Our partners

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_mcp_3d_relief-1.0.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_mcp_3d_relief-1.0.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_mcp_3d_relief-1.0.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_mcp_3d_relief-1.0.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_mcp_3d_relief-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0e985c57025fcb5cc708d2da24902098c2fcea8eed7734be6a552410f849f888
MD5 7224137bd594b09ef9d85d4293094576
BLAKE2b-256 88619f75c0cf35f3cff0b558422a3fce5100776f9960386896a4cea23cc09624

See more details on using hashes here.

File details

Details for the file iflow_mcp_mcp_3d_relief-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_mcp_3d_relief-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_mcp_3d_relief-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19fd7e0026cc5c28a6a6267c8a76e727e9d8fd3dfc97c7a2c98e0579ba661270
MD5 112e703e4febd76629c0bdc80d07b127
BLAKE2b-256 eeebb8bc6cccab808896ca79c263e1af41eeb6f6695f8e562ff4925b004f115b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page