/mcpylib:mcpylib-buildingfrom MCPyLib Skills
Procedural Minecraft building with MCPyLib in pure Python (no numpy). Generates spheres, domes, cylinders, cones, pyramids, tori, houses, towers, pixel art from images and heightmap or noise terrain as rectangular block arrays, then places them with edit() in chunk-sized batches with a dry-run plan, overwrite protection and an undo file. Use when the user asks to build, generate or draw something in a Minecraft world with code, such as shapes, buildings, statues, image or pixel art, landscapes, mazes or other large structures, or wants faster bulk placement than setblock loops. Builds on the mcpylib skill for connection and API details.
Ships in MCPyLib Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Generate block layouts in Python, then write them in a few big edit() calls.
For connection setup, API details and general safety rules, use the mcpylib
skill. Connection settings come from MCPYLIB_HOST, MCPYLIB_PORT and
MCPYLIB_TOKEN (environment or ./.env).
Copy this checklist and tick it off:
- [ ] 1. Setup works: mcpylib skill -> scripts/check_setup.py --player NAME
- [ ] 2. Location chosen: --player NAME (front faces the player) or --at X Y Z
- [ ] 3. Dry run: run the script WITHOUT --apply and read the plan
- [ ] 4. Show the plan to the user (box, cells, "existing non-air blocks that would be replaced")
- [ ] 5. If anything would be replaced, get explicit confirmation -> add --allow-overwrite
- [ ] 6. Re-run with --apply; keep the printed undo command
- [ ] 7. Ask the user to check it in game; undo with scripts/undo.py if needed
All scripts are dry runs by default. With --apply they still refuse to replace
non-air blocks unless --allow-overwrite is given, and they write
mcpylib-undo/undo-<label>-<time>.jsonl before changing anything. They only write
cells that actually change, so existing blocks that already match keep their states.
Run these from this skill's scripts/ directory (they import buildkit.py):
| Script | Builds | Example |
|---|---|---|
scripts/shapes.py | sphere, dome, cylinder, cone, pyramid (optional stairs), torus, box | python shapes.py dome --radius 10 --block glass --hollow --player Steve |
scripts/buildings.py | house (gable roof, windows, door, torches), tower (battlements or cone roof, ladder) | python buildings.py house --width 9 --depth 7 --player Steve |
scripts/pixel_art.py | image to wall or floor art (concrete, wool, terracotta or full palette, optional dithering) | python pixel_art.py logo.png --width 64 --player Steve |
scripts/terrain.py | noise or heightmap landscape with soil layers, beaches, lakes and snow | python terrain.py --at 1000 -500 --size 96 96 --survey |
scripts/undo.py | restores an undo file (skips cells players changed since) | python undo.py mcpylib-undo/undo-house-....jsonl --apply |
Common flags:
--at X Y Z: centre of the footprint at base level.--player NAME: build --gap blocks in front of the player, front facing them.--front north|east|south|west: which way the front faces.--apply, --allow-overwrite: see the workflow above.--max-cells: cells per call (default 65,536).--host, --port, --timeout: connection overrides.terrain.py instead takes --at X Z (the north-west corner) and needs
--allow-overwrite to apply, because it rewrites whole columns.
Run any script with --help for its options. With --player, the scripts refuse if
the player is in the Nether or End, because MCPyLib always builds in the main
overworld.
Prefer buildkit over raw arrays. It handles rotation, Y clipping, the
read-before-write survey, batching, undo and deferred light sources:
import argparse
import buildkit as bk
ap = argparse.ArgumentParser()
ap.add_argument("--steps", type=int, default=10)
bk.add_common_args(ap)
args = ap.parse_args()
grid = bk.Grid() # local coords: footprint centred, base y = 0, front = +Z
n = args.steps
for i in range(n): # a straight staircase climbing toward -Z (away from the front)
if i:
grid.box(0, 0, -i, 0, i - 1, -i, "stone_bricks") # solid support under each step
grid.set(0, i, -i, bk.stair("stone_brick_stairs", "north"))
grid.box(0, 0, -n, 0, n - 1, -n, "stone_bricks") # landing column at the top
grid.set(0, n, -n, "lantern", defer=True) # light source on solid ground, placed with setblock()
with bk.connect(args) as mc:
anchor, turns = bk.resolve_placement(mc, args, grid)
raise SystemExit(bk.execute(mc, bk.Build.from_grid(grid, anchor, turns, "stairs"), args))
Save it next to buildkit.py and run it like the other scripts. For a one-off build
without buildkit, follow the core skill's rules:
blocks[dx][dy][dz].None for cells you don't touch.getblocks the box first and report what would be replaced.block_state takes any vanilla property with vanilla values, such as
slab type: top/double, leaves persistent: true (otherwise they decay),
lantern hanging, lit, sign rotation: 0-15. A key the block doesn't have
raises Unsupported property.edit(), give one cell (door's lower half, bed's foot, or
just "red_bed") and the plugin adds the other half, replacing whatever is there
unless the array sets that cell. Giving both halves yourself keeps them in the
survey and undo file. With setblock(), place the upper half or the head first.facing is where the tall back of the step is,
so a slope rises toward its facing. On a gable roof, the south slope uses
facing: north. bk.stair() builds these cells, and rotation remaps them.edit(), dict cells included: use glass blocks
rather than panes, and walls of solid blocks rather than fences, which won't
connect. Gravel and sand float until disturbed, and placed water stays still.
Place torches, lanterns and glowstone with defer=True (setblock) so their light
updates.LICENSE.txt (opens in a new tab)references/blocks.md (opens in a new tab)references/recipes.md (opens in a new tab)scripts/buildings.py (opens in a new tab)scripts/buildkit.py (opens in a new tab)scripts/pixel_art.py (opens in a new tab)scripts/pngdecode.py (opens in a new tab)scripts/shapes.py (opens in a new tab)scripts/terrain.py (opens in a new tab)scripts/undo.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
4 skills in this plugin
/mcpylibControls a Minecraft Paper/Spigot server from Python with the MCPyLib library and its server plugin. Covers setup checks (plugin, token, .env), connecting, coordinates and the -64..319 build height, block ids with block_state and NBT, choosing between setblock, fill, edit bulk arrays, clone and getblocks, batching for speed, error handling, and safe read-before-write editing, plus players, entities, chat, world settings and the raw TCP JSON protocol for other languages. Use when the user mentions MCPyLib or mcpylib, wants a script that places, reads or changes blocks, players, entities or settings on a Minecraft server, or hits MCPyLib connection, token or plugin errors./mcpylib-mcpInstalls, configures and uses mcpylib-mcp, the MCP server that exposes MCPyLib as 86 tools (blocks, players, world, entities, chat, scoreboard) for Claude Code, Claude Desktop, Cursor, VS Code, Codex and other MCP clients. Covers the uvx install, the MCPYLIB_HOST, MCPYLIB_PORT and MCPYLIB_TOKEN settings, per-client configuration, read-only mode, tool allow and deny lists, the per-call block limit, the text-layers build format, troubleshooting, and when to use MCP tools versus a Python script with the mcpylib library. Use when the user wants to connect an AI assistant or editor to a Minecraft server, mentions MCP, mcpylib-mcp, Model Context Protocol, uvx or claude mcp add, sees mcpylib tools such as get_blocks or build_from_layers, or asks whether to use tools or a script for a Minecraft task.npx claudepluginhub treeleaves30760/mcpylib-skills --plugin mcpylib