BrickScape
Landscape, but for bricks. An MCP server that lets an AI
design LEGO builds that can actually be built.
Ask a language model for a LEGO model and you usually get a file with parts floating in the
air, bricks pushed through each other, and part numbers that don't exist. BrickScape gives the
model a better way to work: it describes what it wants in a short JSON plan (a terraced
hill here, a cobbled path there, an oak by the stream), and BrickScape places every part on
real studs, checks the result against the parts' real shapes and connection points, repairs
what it can, and hands back a BrickLink Studio file, renders, a part list and step-by-step
instructions.
Benchmark (blind, position-swapped judging against plain Claude on 6 briefs): BrickScape was
8.9x cheaper and 7.9x faster, all 6 of its builds pass the strict checker (plain Claude: 0 of 6),
and it won accuracy 5-1-0 and looks 5-1-0 (wins-ties-losses), with average judge scores of
8.2 vs 4.2 and 7.4 vs 4.8 out of 10. Details.
Contents
- How it works
- Install
- Tools
- Brick companies
- Using references
- Build plans
- What "buildable" means here
- Benchmark
- Command line
- Limitations
- Credits
How it works
- Plan, don't place. The client never computes LDraw coordinates. It sends operations
such as
hill, path, water, tree or block with areas in studs. The compiler turns
each one into parts using terrain and plant generators written against real building
techniques (hollow frames, leaning cliff faces, paths set into the ground, leaves on studs).
A height map means later operations land on top of earlier ones.
- Fit as you go. Every decorative part (leaves, stems, flowers) is checked against its
neighbours as it is placed. If it clashes it is turned about its stud, and if no turn fits it
is left out. Bar-ended stems are slid down their stud until the bar is really held.
- Repair. After compiling, parts that are loose or clash are removed when nothing depends
on them, and every part/colour pair that doesn't exist in real LEGO is moved to the nearest
colour (by perceived colour distance) that does.
- Validate. The strict checker runs on everything that leaves the server (details
below). The report says what was removed, recoloured or still
fails, and what was not checked.
- Deliver. A Studio
.io file, four renders from fixed angles, a part list
(CSV and BrickLink wanted-list XML), and on request PDF instructions.
Install
Requires Python 3.10+ and Blender 4.x (for renders and instructions).
pip install git+https://github.com/xanzure/brickscape
brickscape setup
brickscape setup downloads the LDraw parts library and the ImportLDraw Blender add-on (through
ldraw-mcp), the LDCad connection data, and
Rebrickable's part and colour tables into ~/.cache/brickscape. None of these are bundled.
Add the server to your MCP client:
claude mcp add brickscape -- brickscape-mcp # Claude Code
{ "mcpServers": { "brickscape": { "command": "brickscape-mcp" } } }
(Claude Desktop and other clients: add the block above to the client's MCP config.)
| Environment variable |
Default |
Meaning |
BRICKSCAPE_OUT |
./brickscape-out |
where builds are saved |
BRICKSCAPE_SOURCE |
lego |
default part source: lego or gobricks |
LDRAW_LIBRARY_PATH |
~/.ldraw |
LDraw parts library |
LDRAW_MCP_BLENDER |
blender on PATH |
Blender binary |
Tools
| Tool |
What it does |
guide |
The planning guide: coordinates, every operation, style tips, an example. Read first. |
search_parts |
Find parts by description, with availability and colour count at the part source. |
part_info |
A part's size, its connection points (studs, anti-studs, bars, clips, hinges) and real colours. |
build |
Compile a plan, repair it, validate it, save it. Returns the validation report. |
render |
The four standard views (front-left, front-right, back-right, back-left) as one image. |
compare |
The build rendered from a reference photo's viewpoint, side by side with the photo. |
study_reference |
Analyse a reference build (.io / .ldr): size, density, hollowness, SNOT share, colours, most used parts. |
parts_list |
parts.csv and bricklink.xml (a BrickLink wanted list); prices in GoBricks mode. |
export |
A BrickLink Studio .io file. |
instructions |
Step-by-step building instructions as a PDF (plus an .ldr with STEPs for Studio). |
check |
Strictly validate any .ldr, .mpd or .io file, including ones not made by BrickScape. |
Brick companies
BrickScape isn't tied to one brick maker. Every build is checked against a part source: the
list of parts, and of the colours each part comes in, that a company actually makes. Pass
source to build, check, search_parts, part_info and parts_list, or set
BRICKSCAPE_SOURCE.
| Source |
Company |
What it knows |
Data |
lego (default) |
LEGO |
Every part/colour pair LEGO has produced as an element |
Rebrickable's free downloads, fetched by brickscape setup |
gobricks |
GoBricks / Brickwith |
GoBricks moulds, the colours each is sold in, prices |
a GoBricks catalog file in ~/.cache/brickscape/gobricks (not distributed) |
What changes with the source:
- Validation: parts the company doesn't make, and colours a part doesn't come in, are
reported. A part that GoBricks makes under a different mould number is matched to it.
- Repair: a colour that doesn't exist for a part is swapped for the closest colour that
does at that company, so a GoBricks build only uses GoBricks colours.
- Parts lists: GoBricks mode adds a price for each part and an estimated total.
- Search:
search_parts and part_info show availability and colours for that company.
Adding another company (Mould King, Cada, BrickLink stock, your own collection) is one small
class in src/brickscape/catalog/ with four methods: resolve(part), colours(part),
price(part) and substitute(part).
Using references
You can give the builder reference pictures or reference builds, and it uses them to get much
closer to what you want. Hand your AI client a photo or a Studio .io / .ldr along with the brief:
- Photos: the client reads the layout from the picture (where the rock, water and trees are,
roughly how big in studs), plans it, then uses
compare to look at its build from the photo's
viewpoint next to the photo and fix the biggest differences.
- Builds:
study_reference measures the reference (footprint, height, parts per stud, how
hollow it is, colours, the parts it relies on) so the client can match its proportions,
palette and techniques instead of guessing.
The benchmark includes a reference prompt for exactly this (below).
Build plans
{
"name": "forest clearing",
"board": {"width": 32, "depth": 32},
"seed": 1,
"ops": [
{"op": "hill", "area": {"ellipse": [22, 24, 9, 7], "rough": 0.5}, "height": 8, "style": "terraces"},
{"op": "hill", "area": {"ellipse": [6, 26, 5, 4]}, "height": 12, "style": "rock"},
{"op": "path", "points": [[0, 10], [14, 13], [31, 9]], "width": 3, "style": "cobble"},
{"op": "boulder", "at": [[12, 3, 4], [20, 4, 2]]},
{"op": "tree", "kind": "oak", "size": "medium", "at": [27, 4]},
{"op": "scatter", "area": {"rect": [0, 0, 32, 32]}, "kinds": ["tuft", "flower", "bush"], "density": 0.06}
]
}
Coordinates are studs: x runs left to right, z from the front edge (0) to the back; heights
are plates (3 plates = 1 brick). Boards of any size work: multiples of 16 get baseplates,
other sizes a floor of plates.
| Operation |
Builds |
hill |
Raised ground: terraces (grass treads, earth and stone risers) or rock (an outcrop with cliff faces that lean back, grass on top). |
block |
A raised area built like real LEGO: hollow brick frame, crossed plate decks, tiles, studs or grass on top. |
path |
A cobbled or dirt path set into the ground, with raised verges. |
water |
A stream along points or a pond over an area: smooth tiles, ripples, banks raised 1-2 plates. |
boulder |
Rounded boulders of 1, 2, 4 or 6 studs. |
tree |
Oak (small, medium, tall, fat, big), birch, pine, palm, cypress; moves up to 2 studs to find room. |
plant / scatter |
Single plants, or plants scattered over an area: tufts, flowers, bushes, ferns, reeds, bamboo, cactus, succulents, stones, trees. |
brick |
One part at an exact stud position. |
ldraw |
Raw LDraw part lines, for anything the generators don't cover (still validated). |
Areas are rect, ellipse, polygon or a cells list, with an optional rough edge.
What "buildable" means here
The checker works on the parts' real geometry, not their bounding boxes:
| Check |
How |
| Real parts |
Every part exists in the LDraw library and at the part source. |
| Real colours |
Every part/colour pair exists (LEGO: produced elements; GoBricks: sold colours). |
| Rotations |
Proper rotations only: no mirrored or scaled parts. |
| No duplicates |
No two identical parts in the same place. |
| No intersections |
Each part's mesh is ray-cast into a stack of solid boxes (1.25 LDU columns, hollow undersides and tubes kept hollow). Two parts clash if they interpenetrate deeper than 0.8 LDU. Leaves may rest on each other up to 4 LDU, since real leaves bend. |
| Connected |
Typed connection points from the LDCad shadow library: studs into anti-studs, bars into holes and clips, hinge fingers, pins and balls. A connection needs coaxial, overlapping, size-compatible points of opposite gender. Every part must reach the baseplate through these connections. |
It does not check balance under gravity or how firmly parts clutch, and it says so in every
report.
The checker was tuned on real models made by human designers in BrickLink Studio (their
remaining reports are mostly parts the connection data doesn't cover, such as some flower
stems), and it immediately found real problems in this project's own earlier generators:
Those remaining pairs are what the repair step then removes. All 25 plant and rock generators
pass the strict check on their own (pytest).
Benchmark
Does an AI design better LEGO with BrickScape than without it? Six briefs, each built twice by
fresh Claude Code sessions (one with BrickScape, one without), then scored with blind,
position-swapped judging. Run v1, 2026-11-27.
Results
|
BrickScape |
plain Claude |
| total build time (6 builds) |
21.5 min |
170.5 min (7.9x longer) |
| total cost, API-equivalent |
$2.06 |
$18.35 (8.9x more) |
| builds passing the strict checker |
6 / 6 |
0 / 6 |
| accuracy (wins-ties-losses for BrickScape) |
5-1-0, average score 8.2 / 10 |
4.2 / 10 |
| looks (wins-ties-losses for BrickScape) |
5-1-0, average score 7.4 / 10 |
4.8 / 10 |
| efficiency (cheaper and faster) |
6-0-0 |
|
Win rate / win-or-tie rate: efficiency 100% / 100%, accuracy 83% / 100%, looks 83% / 100%.