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

bill_of_materials(path="", ldr="")

Part × colour × quantity rows for a model file or inline text

lookup_color(query)

Colour code ↔ name / RGB / edge / alpha from LDConfig.ldr

search_parts(query, limit=50)

Library parts whose description or file name contains query

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.

The three query tools are read-only and need no Blender. bill_of_materials expands MPD sub-models (and sibling .ldr/.mpd files next to the model) with their multiplicity, and resolves colour 16 to the colour of the referencing line; colour 24 (edge) is reported as 24. It counts without a parts library — descriptions and colour names are then null. A colour code LDConfig.ldr does not define is listed under unknown_color_codes, a part the library lacks under parts_not_in_library; neither is dropped. A sub-model reference cycle is an error that names the cycle. lookup_color and search_parts need the library (ldraw-mcp-setup).

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

6 tools
bill_of_materialsA

Bill of materials for an LDraw model: part x colour x quantity rows.

Give path (a .ldr/.mpd file) or ldr (inline LDraw text), not both. MPD sub-models are expanded with their multiplicity, and colour 16 inherits the colour of the line that referenced the sub-model. Part descriptions and colour names come from the LDraw library when one is installed; without it the counts are the same and those fields are null. A colour code that LDConfig.ldr does not define is listed in unknown_color_codes, and a part the library lacks in parts_not_in_library.

ParametersJSON Schema
NameRequiredDescriptionDefault
ldrNo
pathNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.4/5.0
Behavior5/5

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

No annotations exist, and the description compensates well by disclosing non-obvious behavior: MPD sub-models are expanded with multiplicity, colour 16 inherits referencing line colour, library absence leaves description/colour fields null while counts are unaffected, and unknown colors/parts are surfaced in separate fields. This gives an agent an accurate model of edge cases and output 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?

Four sentences, with the core purpose first and only consequential edge cases after. No filler; every sentence adds either input constraints or behavior relevant to correct invocation.

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

Completeness5/5

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

An output schema exists, so return-value shape doesn't need repeating. The description still covers input selection, library dependency, color inheritance, and error-surfacing fields, leaving few gaps for an agent to guess about.

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

Parameters5/5

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

Schema coverage is 0%, so the description carries the burden. It defines both parameters (`path` as a .ldr/.mpd file, `ldr` as inline LDraw text) and clarifies the exclusive-or relationship with 'not both'.

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

Purpose4/5

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

The description states the tool produces a bill of materials for an LDraw model and defines output rows as part x colour x quantity, so an agent can tell this from render_ldraw_file/text and lookup_color. It lacks an explicit verb ('computes'/'lists') and doesn't name a differentiating sibling, but the resource and row structure are concrete.

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?

It gives concrete invocation guidance: pass either `path` or `ldr`, not both, and describes what each input form is. However, it never explicitly states when to choose this tool over siblings like render_ldraw_text or search_parts; that choice is only implied by the BOM purpose.

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

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.

lookup_colorA

Look up LDraw colours in the library's LDConfig.ldr.

query is a colour code (4, or a direct colour 0x2FF8800) or part of a name (dark blue, Trans_Red). Returns code, name, RGB, edge colour, alpha and finish for each match; an unknown code returns no matches.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It explains that queries can be numeric codes, direct colours, or partial names, and that matches return code, name, RGB, edge colour, alpha, and finish. It also explicitly states that unknown codes return no matches, which sets expectations for empty results.

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?

The description is compact and front-loaded, starting with the core purpose and then detailing query syntax and return fields. Every sentence adds useful information; there is no filler.

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

Completeness5/5

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

For a simple one-parameter lookup tool with an output schema available, the description fully covers what the agent needs: input format, matching semantics, output fields, and empty-result behavior. Nothing important is missing.

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

Parameters5/5

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

Schema coverage is 0%, so the description must compensate, and it does. It gives concrete examples of valid query forms ('4', '0x2FF8800', 'dark blue', 'Trans_Red') and describes the matching behavior, making the single string parameter's semantics fully clear.

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 the tool looks up LDraw colours from the library's LDConfig.ldr, with a specific verb and resource. It differentiates itself from sibling tools like search_parts and render_ldraw_file by focusing on colour metadata rather than geometry or rendering.

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?

The description makes it obvious when to use the tool: whenever an LDraw colour code or colour name needs to be resolved. It does not explicitly mention alternatives or exclusions, but the scope is clear enough that an agent would not confuse it with the listed sibling tools.

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. Bounds: resolution 32..2048 px per view, samples 1..1024, 1..8 azimuths, and resolution^2 x samples x views at most 2**27.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
samplesNo
azimuthsNo-60,120
resolutionNo

TDQS

A4.2/5.0
Behavior3/5

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

With no annotations, the description must disclose behavioral traits itself. It covers the samples-quality trade-off and the complexity constraint, which is useful. However, it does not state how the PNG is returned (file path, base64, etc.) or any side effects (e.g., writes to disk). This is a moderate disclosure, sufficient but not exhaustive.

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?

Three tight sentences: purpose, behavior, and bounds. No filler. The core purpose is front-loaded, and every sentence earns its place. This is exemplary conciseness.

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 tool with four parameters, no output schema, and no annotations, the description is fairly complete. It covers purpose, parameter semantics, constraints, and trade-offs. The main omission is the output format (how the PNG is delivered), which could leave an agent guessing. Given the absence of structured metadata, this is a minor but notable gap.

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 schema has 0% parameter descriptions, so the description compensates well. It explains azimuths as comma-separated degrees, samples as a quality/performance trade-off, and resolution with bounds. The total complexity constraint also clarifies interactions between parameters. It adds substantial meaning beyond the bare schema, though path is left implicit (obvious from the tool name).

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 the verb and resource: 'Render an LDraw model file (.ldr/.mpd/.dat) to a PNG image.' It specifies the input format and output format, distinguishing it from the sibling render_ldraw_text which likely renders text. The purpose is unambiguous and specific.

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?

The description provides clear context on how the tool operates (azimuths, samples, resolution) and includes bounds, but it does not explicitly contrast with alternatives like render_ldraw_text or state when not to use it. This is clear context without exclusions, fitting the 4-level.

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

render_ldraw_textA

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

Useful for quick experiments without writing a file first. Same bounds as render_ldraw_file.

ParametersJSON Schema
NameRequiredDescriptionDefault
ldrYes
samplesNo
azimuthsNo-60,120
resolutionNo

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only says the tool renders to PNG and that bounds are the same as render_ldraw_file, without explaining what those bounds are, how output is returned, whether files are written, or any limitations.

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?

The description is two sentences, front-loaded with the core operation and output format. The second sentence adds a practical use case and a useful pointer to a sibling tool without unnecessary detail.

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?

With no output schema, no annotations, and minimal parameter documentation, the description is not complete enough. It conveys the high-level purpose but omits parameter semantics, default behavior, output details, and concrete constraints beyond an unspecified reference to render_ldraw_file.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for the four parameters. It only clarifies 'ldr' as inline LDraw text; 'samples', 'azimuths', and 'resolution' remain unexplained, and the 'same bounds' reference does not define their meaning.

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 states a specific verb ('Render'), a clear resource ('inline LDraw content (the text of a .ldr file)'), and an output format ('PNG'). It also distinguishes itself from render_ldraw_file by emphasizing inline text input 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?

The description gives a clear use case ('quick experiments without writing a file first') and references the sibling tool ('Same bounds as render_ldraw_file'). It does not explicitly say 'use render_ldraw_file when you have a file', but the context is clear enough.

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

search_partsA

Search the LDraw library's parts by description or file-name substring.

Case-insensitive, runs of spaces collapsed (brick 2 x 4 matches the header Brick 2 x 4). Returns at most limit parts (max 200) plus the total number of matches.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries full responsibility for behavioral disclosure, and it delivers: case-insensitive matching, collapsing runs of spaces, a max limit of 200, and the guarantee that it returns both the limited result set and the total match count. This gives an agent accurate expectations without needing to inspect the output schema.

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?

The description is tight and front-loaded: the first sentence states the core action, and the second paragraph adds only the behavioral details needed for correct invocation. No redundant phrasing or filler is present.

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

Completeness5/5

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

For a two-parameter search tool with an output schema, the description covers the essential invocation details: what to search, how matching behaves, result limits, and what is returned. There are no significant gaps that would prevent an agent from selecting and using the tool correctly.

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

Parameters5/5

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

The schema has 0% description coverage, but the description fully compensates by explaining that 'query' is a substring matched case-insensitively with whitespace normalization, and that 'limit' caps results at 200 with a default of 50. This adds meaningful semantic value beyond the bare parameter names.

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 opens with a specific verb and resource: 'Search the LDraw library's parts by description or file-name substring.' This clearly distinguishes the tool from siblings like render_ldraw_file or bill_of_materials, which serve different purposes.

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?

The description makes the intended use clear: searching parts by substring across description or filename. It provides concrete matching semantics and result limits, though it does not explicitly contrast with alternatives; none of the siblings perform a similar part search, so explicit exclusion is less critical.

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.3.0
    • Addedbill_of_materials
    • Addedlookup_color
    • Addedsearch_parts
  2. 3 tool updatesv0.1.2
    • First observedcheck_renderer
    • First observedrender_ldraw_file
    • First observedrender_ldraw_text

TDQS

A4.2/5.0

Scored across 6 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: file rendering, inline rendering, bill of materials, renderer status check, color lookup, and part search. The two render tools differ only by input source (file vs inline text), and their descriptions make that boundary explicit.

Naming Consistency4/5

Most tool names follow a clear verb_noun pattern: render_ldraw_file, render_ldraw_text, check_renderer, lookup_color, and search_parts. The exception is bill_of_materials, which is a noun phrase rather than a verb-led action, creating a minor inconsistency.

Tool Count5/5

Six tools is well-scoped for an LDraw-oriented server covering rendering, analysis, and library lookups. Each tool earns its place without redundancy or bloat.

Completeness5/5

The tool surface covers the primary LDraw workflows: rendering models from files or inline content, generating bills of materials, checking renderer availability, and querying the part and color libraries. No obvious dead ends or critical missing operations are apparent for the intended domain.

Maintenance

ActivityActive
ResponsivenessResponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI assistants like Codex or ChatGPT to inspect and control a local Blender scene, including creating objects, editing materials, setting cameras and lights, rendering previews, and saving safe copies of .blend files.
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables any MCP client to drive Blender 5.2 LTS through natural language, with tools for scene inspection, object creation and transformation, material and modifier handling, rendering, viewport capture, and guarded Python execution.
    2
    MIT