ldraw-mpd-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ldraw-mpd-mcp find a red 2x4 brick, then render it as step 1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ldraw-mpd-mcp
A zero-native-dependency Model Context Protocol (MCP) server for building, 3D-rendering, visually verifying, and offline-packing LEGO® LDraw (.ldr / .mpd) models step-by-step with AI coding agents.
Everything — the Z-buffered 2×-supersampled isometric 3D rasterizer, PNG encoder/decoder/stitcher, DFS building-step engine, sub-build isolator, offline .mpd bundler, and official LDraw library installer — runs in pure TypeScript/Node.js with no Blender, LDView, OpenGL, Python, or native C++ build dependencies.
How It Works
flowchart LR
A[Instruction Image] --> B[ldraw_lookup_part & ldraw_inspect_part]
B --> C[Write Step N in .ldr / .mpd]
C --> D[ldraw_render_step / ldraw_verify_step]
D -- FAIL + Side-by-Side PNG --> C
D -- PASS (Text-Only JSON) --> E{More Steps?}
E -- Yes --> B
E -- No --> F[ldraw_pack_mpd -> 100% Offline .mpd]Related MCP server: dxf-cad-mcp
Features
Pure-TS 3D Software Renderer (
ldraw_render_step,ldraw_inspect_part) — 2× SSAA Z-buffered rasterizer with edge lines, alpha transparency, optional+X / -Y Up / +Zaxis gizmos, step-fade highlighting, and side-by-side reference PNG stitching.Exact Three.js
LDrawLoaderStep Order + Sub-Build Isolation — DFS global step numbering across0 FILE <submodel>.ldrblocks with automatic Sub-Build Focus Mode andstep_join.datincorporation markers.100% Offline Self-Contained MPD Packer (
ldraw_pack_mpd) — Recursively inlinesLDConfig.ldr0 !COLOURheaders and every referenced.dat,parts/s/*.dat,p/*.dat, andp/48/*.datprimitive into a single portable.mpdfile.Generic LDraw Search + Optional Set Catalog (
ldraw_lookup_part) — Works out-of-the-box against your entire local LDraw library (parts.lst/parts/*.dat), and optionally loads a custom JSON BOM catalog (LDRAW_CATALOG_PATH) for set-specific builds.Independent Vision QA Judge (
ldraw_verify_step) — Optional step-by-step visual QA using Gemini or any OpenAI-compatible vision API. Returns compact JSON only (zero images) onPASSto keep agent context clean, and returns LDU discrepancies + a side-by-side PNG onFAIL.One-Command Official LDraw Setup (
setup) — Automatically downloads and extracts the official LDraw Parts Library (complete.zip) fromlibrary.ldraw.orginto~/.ldraw, or auto-detects an existing BrickLink Studio 2.0 / LDraw installation.
Quick Start
1. Get the LDraw Parts Library (.dat files)
This package does not bundle .dat part files. Choose either option:
Option A — One-command download from LDraw.org (recommended):
npx ldraw-mpd-mcp setup # Optional: include unofficial LDraw parts too npx ldraw-mpd-mcp setup --unofficialDownloads the official
complete.zip(~75 MB) fromlibrary.ldraw.organd extracts it to~/.ldraw.Option B — Use an existing BrickLink Studio 2.0 / LDraw install:
ldraw-mpd-mcpautomatically searchesLDRAW_DIR,~/.ldraw, BrickLink Studio 2.0 default directories (C:/Program Files/Studio 2.0/ldraw,/Applications/Studio 2.0/ldraw), and standard system LDraw paths.
Verify detection anytime with:
npx ldraw-mpd-mcp doctor2. Configure Your MCP Client
Add ldraw-mpd-mcp to your MCP client config (Claude Desktop, Cursor, Claude Code, Antigravity, etc.):
{
"mcpServers": {
"ldraw-mpd-mcp": {
"command": "npx",
"args": ["-y", "ldraw-mpd-mcp"],
"env": {
"LDRAW_DIR": "/path/to/your/ldraw",
"GEMINI_API_KEY": "optional-for-ldraw_verify_step"
}
}
}
}Tip:
LDRAW_DIRis optional if you rannpx ldraw-mpd-mcp setup(installs to~/.ldraw) or installed BrickLink Studio 2.0 in its default location.GEMINI_API_KEYis only needed if you useldraw_verify_step— the other 5 tools work 100% offline with zero API keys.
MCP Tools
Tool | Description |
| Reports detected |
| Searches parts by keyword, colour, or category across a custom set BOM catalog ( |
| Renders a single |
| Renders an |
| Runs an independent Vision LLM QA check comparing a rendered step against a reference instruction image. Returns text-only JSON on |
| Packs an |
Configuration & Environment Variables
Variable | CLI Flag | Description |
|
| Path to local LDraw library containing |
|
| Optional path to a custom JSON BOM catalog (array of part objects with |
| — | API key for |
| — | API key for |
| — |
|
| — | Override the vision QA model (e.g. |
| — | Custom OpenAI-compatible base URL (e.g. LiteLLM, OpenRouter, Ollama). |
Bundled Agent Skill
A ready-to-use agent workflow guide (coordinate conventions, 3×3 rotation matrices, Sub-Build Isolation pattern, and verification loop) is included in skills/ldraw-mpd-maker/SKILL.md.
Development & Publishing
npm install
npm run typecheck
npm test
npm run pack:checkCI: Every push and PR runs typechecking, full unit + MCP end-to-end tests, LF shebang verification, tarball inspection across Ubuntu/macOS/Windows on Node 20 & 22, plus
npm audit.CD: Pushing a
v*.*.*tag triggers.github/workflows/release.yml, which verifies tag/version parity, smoke-tests the packed tarball in a clean install, publishes to npm with--provenance, and creates a GitHub Release. See CONTRIBUTING.md and CHANGELOG.md.
License & Legal Notice
Code: MIT License.
LDraw Parts Library: Parts downloaded via
setupare sourced directly from LDraw.org and are licensed under CC BY 4.0 by the LDraw.org contributors.Disclaimer: LEGO® is a trademark of the LEGO Group of companies, which does not sponsor, authorize, or endorse this project. BrickLink® and Studio are trademarks of BrickLink Limited.
Available Tools
6 toolsldraw_inspect_partA
Inspect a single LDraw .dat part at a given color and 3x3 rotation matrix. Returns its transformed LDU bounding box and a 2x-supersampled isometric 3D PNG with +X (Red), -Y Up (Green), and +Z (Blue) axis arrows.
Inputs: datFile (required), matrix, yawDeg, pitchDeg, +1 more.
ldraw_library_statusA
Inspect the active LDraw parts library path, color table source, optional set catalog, and vision verifier configuration.
Inputs: no named parameters.
ldraw_lookup_partB
Search LEGO parts in the configured set catalog (if LDRAW_CATALOG_PATH is set) or across the entire local LDraw parts library by keyword, colour, or category.
Inputs: limit, query, colour, source, +1 more.
ldraw_pack_mpdA
Bundle an LDraw .ldr/.mpd file with LDConfig.ldr colours and all recursively referenced .dat parts/subparts/primitives into a single 100% offline-ready .mpd file compatible with Three.js LDrawLoader.
Inputs: inputLdrPath (required), outputMpdPath (required).
ldraw_render_stepA
Render an LDraw .ldr or .mpd model up to a specific stepNumber into a 2x-supersampled 3D isometric PNG with bounding-box diagnostics, optional side-by-side reference stitching, and Sub-Build Isolation (0 FILE <submodel>.ldr).
Inputs: yawDeg, ldrPath, pitchDeg, showAxes, +7 more.
ldraw_verify_stepA
Independently verify an LDraw step against a reference instruction image using a configured Vision LLM (Gemini or OpenAI-compatible). Returns compact JSON on PASS (zero image bloat) or LDU discrepancy diagnosis + side-by-side PNG on FAIL.
Inputs: stepNumber (required), instructionImagePath (required), yawDeg, ldrPath, +5 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct stage of the workflow: config inspection, catalog search, single-part spec inspection, packing, model rendering, and vision-based verification. The only mild overlap is ldraw_inspect_part vs ldraw_render_step, since both emit isometric PNGs, but their scope (single .dat part vs multi-step model) is clearly stated.
All six tools share the ldraw_ prefix and snake_case, with a clear verb_noun pattern (pack_mpd, lookup_part, inspect_part, render_step, verify_step). ldraw_library_status is a noun-phrase outlier, but it reads naturally as a status query and does not break the scheme.
Six tools is a tight, well-scoped set covering the stated purpose of inspecting, packing, rendering, and verifying LDraw files. It is on the lean side—no file-assembly or step-enumeration tool—but nothing feels redundant.
The surface covers a solid pipeline: library check -> part lookup -> part inspect -> pack -> render -> verify. Minor gaps exist, such as listing/extracting the individual steps or sub-builds of an MPD, or writing/editing an MPD, which agents would have to work around externally.
Maintenance
Related MCP Connectors
Build and check custom brick sets with your agent: real parts, revisions, exports.
Parametric 3D CAD for AI agents: build print-ready parts, check them, export STL, 3MF or STEP.
PDF and image tools for AI agents: compress, merge, split, OCR, sign. Runs locally, never uploads.
A browser 3D CAD for your AI: it scripts real-size models, uCAD builds them and returns pictures.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to render 3D models by providing tools to execute OpenSCAD code and generate single or multi-perspective views. It returns high-quality PNG renderings directly to LLM applications for visual feedback and 3D model visualization.MIT
- AlicenseAqualityCmaintenanceEnables AI agents to create, inspect, render, and export 2D engineering drawings through DXF files, including entities, dimensions, hatches, splines, blocks, layers, PNG previews, and vector PDFs without needing a CAD GUI.11MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to create, edit, and analyze CAD drawings either live through AutoCAD COM on Windows or headlessly via ezdxf anywhere, drawing mechanical parts, architectural plans, and P&IDs with ISO standard layers, dimensions, fits, and title blocks. It also reads existing drawings back for critique, diffing, scale checks, topology checks, and bill-of-material takeoffs to Excel or CSV.-
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to turn natural-language descriptions and dimensional sketches into validated, watertight 3D-printable STL files by compiling build123d scripts, inspecting meshes, and rendering deterministic multiview previews.MIT