
ldraw-mcp
io.github.musharna由 GitHub 账号 musharna 发布v0.3.1更新于 Oct 24, 2026
Render LDraw/LEGO models to images with real part geometry via headless Blender + ImportLDraw
概览
通过无界面 Blender 将 LDraw/LEGO 模型文件渲染为具有真实零件几何的 PNG 图片,并提供零件、颜色和物料清单查询。
- 可以做什么
- 该服务器通过无界面 Blender 和 ImportLDraw 插件,将 LDraw 文件(.ldr、.mpd、.dat)或内联 LDraw 文本渲染为 PNG 图片,可按配置的方位角、分辨率和采样数生成并排拼接的多视角渲染图。它还提供只读查询工具:bill_of_materials 返回零件、颜色和数量行,lookup_color 返回颜色代码、名称、RGB、边缘和透明度数据,search_parts 按查询词查找库中零件。check_renderer 用于诊断 Blender、插件和零件库的配置。
- 适用场景
- 当助手需要查看真实的 LEGO 模型而非几何代理时使用,例如发现导出模型中的旋转矩阵交叉、悬浮板件或下陷窗户等问题。也适合对 LDraw 文件进行零件、颜色和物料清单的快速查询。
- 运行要求
- 作为本地 Python 包运行(pypi ldraw-mcp,使用 uvx 启动)。需要 PATH 中有 Blender 4.x,或将 LDRAW_MCP_BLENDER 指向其可执行文件;需要 ImportLDraw 插件,以及位于 ~/.ldraw 或 LDRAW_LIBRARY_PATH 的 LDraw 零件库;ldraw-mcp-setup 会安装插件和零件库,但不安装 Blender。渲染使用 CPU 上的 Cycles,无需 GPU 或显示器。三个查询工具不需要 Blender。
安装
在 SourceWeft 中
- 打开 控制台中的 ldraw-mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
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]
[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
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
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 pointLDRAW_MCP_BLENDERat the binary. Install it yourself (package manager, blender.org, or a local build);ldraw-mcp-setupdoes not install Blender. - ImportLDraw addon (
io_scene_importldraw) in Blender's addons dir — installed byldraw-mcp-setup. - LDraw parts library at
~/.ldraw(orLDRAW_LIBRARY_PATH) — installed byldraw-mcp-setup.
Environment variables
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_renderersays NOT FOUND: runldraw-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_importldrawin 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.
来源:README.md,提交 1f9b386
工具
0版本历史
3- v0.3.1最新Sep 23, 2026
- v0.3.0Sep 19, 2026
- v0.2.3Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分