Skip to main content
Glama
musharna

ldraw-mcp

by musharna

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 MCP CI Glama DOI

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.

Related MCP server: DeepSlate MCP

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.

Available Tools

3 tools
check_rendererA

Report whether the LDraw rendering stack is available and why not.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It clearly indicates the tool reports availability and reasons for unavailability, which is transparent for a simple check tool. No missing behavioral context like side effects or permissions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no wasted words, front-loaded with the core action 'Report whether the LDraw rendering stack is available and why not.'

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple parameterless tool with an output schema, the description is mostly adequate. It could elaborate on what 'available' means, but the output schema likely covers the response format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters with 100% schema description coverage (empty schema). Baseline is 4; description needs no additional parameter information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a clear verb 'report' and specific resource 'LDraw rendering stack availability'. It distinguishes from sibling tools render_ldraw_file and render_ldraw_text, which perform rendering rather than status checking.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies diagnostic usage ('and why not') but does not explicitly state when to use this tool (e.g., before rendering) or when not to. No alternatives or exclusions are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

render_ldraw_fileA

Render an LDraw model file (.ldr/.mpd/.dat) to a PNG image.

Views are rendered at each comma-separated azimuth (degrees) and stitched side by side. Higher samples = cleaner but slower.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
samplesNo
azimuthsNo-60,120
resolutionNo

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses rendering to PNG, azimuth stitching, and sample trade-off. With no annotations, description carries full burden; missing details on side effects (overwrites?), output destination (file or return?), and error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no unnecessary words. Front-loaded with purpose, then key behavioral notes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers core functionality for a rendering tool with 4 params, required path. Lacks explanation of output format (PNG returned or saved?), error handling, or file size limits. Moderate completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so description must add meaning. Explains azimuths as comma-separated degrees and samples effect, but path and resolution (default 640, units?) lack explanation beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states verb (render), resource (LDraw model file with extensions .ldr/.mpd/.dat), and output (PNG image). Distinct from siblings: render_ldraw_text likely renders text, check_renderer is a check tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage by describing parameters (path, samples, azimuths, resolution) and behavior (stitching azimuths, samples vs quality). But lacks explicit guidance on when to use this vs siblings or when not to use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

render_ldraw_textB

Render inline LDraw content (the text of a .ldr file) to a PNG.

Useful for quick experiments without writing a file first.

ParametersJSON Schema
NameRequiredDescriptionDefault
ldrYes
samplesNo
azimuthsNo-60,120
resolutionNo

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It mentions rendering to PNG but does not disclose any behavioral traits such as side effects, auth needs, or error handling. For a rendering tool, this is minimal transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no fluff. Efficiently communicates the core purpose and use case.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters, no output schema, and no annotations, the description is too minimal. It fails to explain parameter semantics, return value format, or any constraints, leaving an agent under-informed for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so description must add meaning. The description does not explain any parameters (ldr, samples, azimuths, resolution) beyond their names, leaving the agent without guidance on valid values or formats.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Render inline LDraw content ... to a PNG' with a specific verb and resource, and distinguishes from sibling tools (render_ldraw_file) by noting 'without writing a file first'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides context: 'Useful for quick experiments without writing a file first', which indicates when to use this tool over alternatives (render_ldraw_file). However, it lacks explicit when-not or exclusion criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.2
    • First observedcheck_renderer
    • First observedrender_ldraw_file
    • First observedrender_ldraw_text

TDQS

A3.8/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: checking renderer availability, rendering from a file, and rendering from inline text. No overlap or ambiguity.

Naming Consistency5/5

All tools follow a consistent 'verb_noun' pattern (check_renderer, render_ldraw_file, render_ldraw_text), making them predictable.

Tool Count4/5

With only 3 tools, the set is minimal but appropriate for a focused rendering server. It could benefit from additional utilities like listing supported formats, but the count is reasonable.

Completeness4/5

The set covers the core rendering workflow (check availability, render from file or text). Minor gaps exist, such as no way to cancel or monitor rendering progress, but overall it feels complete for its stated purpose.

Maintenance

ActivityMaintained
ResponsivenessResponsive

Related MCP Connectors

Related MCP Servers