Skip to main content

ldraw-mcp

Give your MCP client eyes for LEGO® models.

Render LDraw files (.ldr / .mpd / .dat) to images with real part geometry — studs, slopes, window glass — using headless Blender and the ImportLDraw addon. The output looks like a BrickLink Stud.io render, with no GUI anywhere in the loop.

PyPI Python License: MIT MCP

Two rendered views of a red LEGO car — real studs, transparent glass, rubber tires, steering wheel

A ~90-line .ldr rendered front-left and rear-right — actual bricks, not a geometric proxy.


Point a vision-capable model at a build and it sees the actual bricks: crossed rotation matrices, floating plates, sunken windows — the kinds of export bugs a geometric proxy render will happily hide.

Quickstart

# 1. install
pip install ldraw-mcp

# 2. install the LDraw parts library + ImportLDraw addon
ldraw-mcp-setup

# 3. register with Claude Code
claude mcp add ldraw -- ldraw-mcp

Then ask things like "render output/build.ldr and tell me what looks wrong" — the model sees the render, not just the text.

Blender is a prerequisite (see Requirements); it is not installed by ldraw-mcp-setup.

Tools

tool what it does
render_ldraw_file(path, azimuths="-60,120", resolution=640, samples=24) Render a model file to a PNG (multi-view, stitched side by side)
render_ldraw_text(ldr, azimuths="-60,120", resolution=640, samples=24) Render inline LDraw content without writing a file first
check_renderer() Diagnose the Blender / addon / parts-library setup

azimuths is a comma-separated list of view angles in degrees; each is rendered and the views are stitched horizontally. Elevation is fixed at 22°. Higher samples = cleaner but slower.

Requirements

  • Blender 4.x on PATH, or point LDRAW_MCP_BLENDER at the binary. Install it yourself (package manager, blender.org, or a local build); ldraw-mcp-setup does not install Blender.
  • ImportLDraw addon (io_scene_importldraw) in Blender's addons dir — installed by ldraw-mcp-setup.
  • LDraw parts library at ~/.ldraw (or LDRAW_LIBRARY_PATH) — installed by ldraw-mcp-setup.

Environment variables

var meaning
LDRAW_MCP_BLENDER Path to the blender binary (overrides PATH lookup)
LDRAW_MCP_DISABLE Set to 1 to force is_available() to False
LDRAW_LIBRARY_PATH Path to the LDraw parts library (community convention)

Manual setup

If ldraw-mcp-setup can't detect things automatically:

  • LDraw library: download complete.zip and unzip so that ~/.ldraw/parts/ exists.
  • ImportLDraw addon: download the latest release from TobyLobster/ImportLDraw and install it via Blender > Preferences > Add-ons > Install, or unzip into ~/.config/blender/<version>/scripts/addons/io_scene_importldraw/. (Launch Blender once first so the config directory exists.)

Troubleshooting

  • check_renderer says NOT FOUND: run ldraw-mcp-setup, or set the relevant env var above.
  • No GPU / WSL2 / containers: rendering uses Cycles on CPU, which works headless everywhere — no GPU or display needed. A ~150-part model takes a few seconds at the default 640px / 24 samples.
  • "no mesh objects imported": the addon couldn't resolve parts — usually a wrong or incomplete LDraw library path. Re-run setup or check LDRAW_LIBRARY_PATH.
  • Addon not enabled: the render script enables it automatically per run; if a manual Blender session complains, enable io_scene_importldraw in Preferences > Add-ons.

Provenance

This renderer was extracted from the prompt2brick project, where it started life as the vision critic's "see the actual model" path. prompt2brick keeps its own vendored copy of the render wrapper and Blender script, but this repo is the canonical source going forward — fixes and improvements to the renderer should land here first and be ported back into prompt2brick.

License

MIT — see LICENSE.


LEGO® is a trademark of the LEGO Group, which does not sponsor, authorize, or endorse this project. This tool is not affiliated with the LEGO Group, BrickLink, or the LDraw.org organization.

Metadata

Release files for ldraw-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ldraw-mcp 0.1.0
File Size Uploaded Provenance Actions
ldraw_mcp-0.1.0.tar.gz 833.6 kB Without provenance Details for ldraw_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ldraw-mcp 0.1.0
File Interpreter ABI Platform Actions
ldraw_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for ldraw_mcp-0.1.0-py3-none-any.whl

Total release size: 846.7 kB

Release files / ldraw_mcp-0.1.0.tar.gz

Download URL ldraw_mcp-0.1.0.tar.gz
Size 833.6 kB
Tags Source
SHA-256 checksum
How to use checksums
675efcdbd9f37597d7341cafed891b0c5c248523d0cf66bc8a012e3401236687
BLAKE2b-256 checksum
How to use checksums
45fef2fa18eacc25f512ac7c5d77f1925da033e8da289cc7339325566e2ae2ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / ldraw_mcp-0.1.0-py3-none-any.whl

Download URL ldraw_mcp-0.1.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ddc6b50310632dc72a0b0d027cb69c0f7dd576663f75d9782072a5579e5a923
BLAKE2b-256 checksum
How to use checksums
b2f9b847cae01c7312f76835f73fe813707fd70b9ae3af3a2263c1a90f2b8c69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for ldraw-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page