Skip to main content

MCP server for headless DXF generation via ezdxf + LibreCAD preview — purpose-built for site plans and architectural drafting

Project description

AIBlueprint MCP

CI

MCP server for headless DXF generation via ezdxf + LibreCAD preview — purpose-built for site plans, architectural drafting, and pool bid layouts.

Built on the ezdxf backend architecture from autocad-mcp (MIT), extended with offset, fillet, dimension overrides, solid fills, and LibreCAD integration. No AutoCAD required — runs on Linux, macOS, WSL, or a Chromebook.

Why This Exists

AutoCAD MCP servers exist, but they require Windows and an AutoCAD license ($600+/year). LibreCAD is free and open-source, but has no scripting API — its "API" is the DXF file format.

AIBlueprint bridges the gap: an MCP server that generates DXF via ezdxf, renders previews through LibreCAD's dxf2png, and exposes the same tool interface LLMs already know from autocad-mcp — all at $0 in software costs.

Quick Start

git clone https://github.com/thebossnow/aiblueprint-mcp.git
cd aiblueprint-mcp
uv sync
uv run aiblueprint-mcp

Configure LibreCAD (for previews)

# Set path to your librecad binary (required for previews)
export AIBLUEPRINT_LIBRECAD_BIN=/path/to/librecad

# Optional: working directory for preview renders
export AIBLUEPRINT_WORKSPACE=/path/to/workspace

Don't have LibreCAD? The server works without it — you just won't get PNG previews. Build from source or install via your package manager (sudo apt install librecad on Debian/Ubuntu).

MCP Client Configuration

Add to your MCP client (Claude Desktop, Hermes, etc.):

{
  "mcpServers": {
    "aiblueprint-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/aiblueprint-mcp", "aiblueprint-mcp"],
      "env": {
        "AIBLUEPRINT_LIBRECAD_BIN": "/path/to/librecad",
        "AIBLUEPRINT_WORKSPACE": "/path/to/workspace"
      }
    }
  }
}

Tools

drawing — File + Session Management

Operation Description Data
create New empty drawing — returns a handle {name?}
open Open existing DXF (within workspace) {path}
info Layers, entity count, blocks
save Save to path (within workspace) {path?}
list List all open drawings in the session
switch Make another open drawing current {handle}
undo Revert the current drawing to the previous checkpoint
redo Re-apply the most recently undone checkpoint

Multiple drawings can be open at once. Each create/open returns a handle; use switch to change which drawing subsequent operations target. File paths for open/save are confined to AIBLUEPRINT_WORKSPACE — traversal outside it (../, absolute escapes) is rejected.

entity — Entity CRUD + Modification

Create:

Operation Parameters
create_line x1, y1, x2, y2, layer?
create_circle data: {cx, cy, radius}, layer?
create_polyline points: [[x,y],...], data: {closed?}, layer?
create_rectangle x1, y1, x2, y2, layer?
create_arc data: {cx, cy, radius, start_angle, end_angle}, layer?
create_text data: {x, y, text, height?, rotation?}, layer?
create_mtext data: {x, y, width, text, height?}, layer?
create_hatch entity_id, data: {pattern?, scale?}
import_boundary ⭐ Irregular parcel boundary. data: {points: [[x,y],...]} or {geojson: {...}}, layer? → returns handle + area/perimeter/bbox

Read: list (by layer), get (full detail for LINE/CIRCLE/ARC/LWPOLYLINE/TEXT/MTEXT/INSERT/HATCH), measure (area / perimeter / length quantity takeoff by entity_id)

Modify:

Operation Notes
copy / move / rotate / scale / mirror Standard CAD transforms
offset ⭐ Offset polylines (open or closed) — deck bands, setbacks
fillet ⭐ Fillet two lines with a radius arc + auto-trim
array Rectangular array (rows × cols)
erase By entity_id or "last"

layer — Layer Management

list, create, set_current, set_properties, freeze, thaw, lock, unlock

Named colors: red, yellow, green, cyan, blue, magenta, white, grey, lightgrey. For arbitrary colors, pass true_color: [r, g, b] (0–255) to create or set_properties.

block — Blocks + Attributes

list, insert, insert_with_attributes, get_attributes, update_attribute, define

annotation — Dimensions, Text, Leaders

Operation Notes
create_text Single-line text with rotation
create_dimension_aligned ⭐ With dim_overrides
create_dimension_linear ⭐ With dim_overrides
create_dimension_angular ⭐ With dim_overrides
create_dimension_radius ⭐ With dim_overrides
create_leader Leader line + mtext

Dimension overrides: dimtxt, dimasz, dimlunit, dimclrd, dimclre, dimclrt, dimtxsty

Example:

{
  "operation": "create_dimension_aligned",
  "data": {
    "x1": 0, "y1": 0, "x2": 100, "y2": 0, "offset": -5,
    "dim_overrides": {"dimtxt": 1.75, "dimasz": 1.25, "dimlunit": 2}
  }
}

view — Previews + Screenshots

Operation Description
preview Save DXF + render PNG via LibreCAD dxf2png — returns file paths
screenshot Render the drawing via matplotlib and return it as a native MCP image (no LibreCAD needed)
export Write a PNG/PDF/SVG raster/vector render or a GeoJSON FeatureCollection to the workspace. `data: {format?: "pdf"

Hatch Patterns

Pattern Use
SOLID Water features, colored surfaces
ANSI31 Single diagonal hatch
ANSI37 Dense cross-hatch — hardscape, concrete
ANSI32 Wide cross-hatch
AR-CONC Concrete texture
EARTH Earth/soil fill

Environment Variables

Variable Default Description
AIBLUEPRINT_LIBRECAD_BIN Auto-detects from common locations Path to librecad executable
AIBLUEPRINT_WORKSPACE ~/workspace Working directory for preview renders
DISPLAY :0 X11 display (for WSLg / Linux GUI)

Python API

You can also use the backend directly without the MCP server:

from aiblueprint_mcp.backend import AIBlueprintBackend
import asyncio

async def main():
    b = AIBlueprintBackend()
    await b.initialize()
    await b.drawing_create("my_plan")

    # Draw a 100×80 ft lot with pool deck
    await b.create_rectangle(0, 0, 100, 80, layer="LOT")
    deck = await b.create_rectangle(10, 20, 50, 60, layer="DECK")

    # Offset deck band inward 4 ft
    inner = await b.entity_offset(deck.payload["handle"], -4.0)

    # Add pool with solid blue fill
    pool = await b.create_rectangle(18, 28, 42, 52, layer="POOL")
    await b.create_hatch(pool.payload["handle"], "SOLID")

    # Cross-hatch the deck
    await b.create_hatch(inner.payload["handle"], "ANSI37", scale=12.0)

    # Fillet a corner
    l1 = await b.create_line(50, 60, 50, 20, layer="DECK")
    l2 = await b.create_line(50, 20, 10, 20, layer="DECK")
    await b.entity_fillet(l1.payload["handle"], l2.payload["handle"], 8.0)

    # Dimension with style overrides
    await b.create_dimension_aligned(0, 0, 100, 0, -5,
        dim_overrides={"dimtxt": 1.75, "dimasz": 1.25, "dimlunit": 2})

    # Save and preview
    await b.drawing_save("/tmp/my_plan.dxf")
    result = await b.preview()
    print(result.payload["png_path"])

asyncio.run(main())

Input Validation

Every tool operation validates its input against a per-operation schema (Pydantic) before touching the drawing. Missing required fields, wrong types, out-of-range values (e.g. a negative radius), and unknown fields are rejected with a clear message — {"ok": false, "error": "Invalid input for entity.create_circle: ..."} — instead of a raw traceback.

Development

uv sync --extra dev      # install dev dependencies (pytest, ruff)
uv run pytest -q         # run the test suite (134 tests)
uv run ruff check src tests

CI runs lint + tests on Python 3.10–3.12 via GitHub Actions (.github/workflows/ci.yml).

See CHANGELOG.md for release history and RELEASING.md for how releases are cut.

Roadmap / Known Limitations

Tracked in the issue tracker — contributions welcome:

  • Docker image bundling LibreCAD (#9)
  • Coverage reporting in CI (#10)
  • PyPI publication, versioned releases, changelog (#11)
  • Jurisdiction data beyond California (#12)
  • Live LibreCAD backend via bivex's TCP bridge (#1)

License

MIT — see LICENSE.

This project incorporates architecture and patterns from autocad-mcp by Puran Water LLC, also MIT-licensed. The ezdxf backend, MCP tool dispatch pattern, and command result types are adapted from autocad-mcp v3.1. Entity offset, fillet, dimension overrides, solid fills, and LibreCAD preview are original additions.

Requirements

  • Python 3.10+
  • uv package manager
  • LibreCAD (optional, for PNG previews)
  • 0 software licenses — ezdxf is MIT, LibreCAD is GPLv2

Acknowledgments

  • Hermes (AI coding agent) — co-author. Designed and implemented entity offset, fillet, dimension overrides, solid fills, and LibreCAD preview integration.
  • DeepSeek V4 Pro — the model that powered every line of this project. Fast, precise, never hallucinated a dimension.
  • Julian Goldie — for the relentless push to build in public and ship real tools, not just prompts. Join his AI Profit Lab on Skool.
  • Puran Water LLC — upstream autocad-mcp project (MIT). The ezdxf backend architecture, MCP tool dispatch pattern, and command result types are adapted from their v3.1 release.
  • LibreCAD — the open-source 2D CAD engine that makes $0 drafting possible.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiblueprint_mcp-0.1.1.tar.gz (196.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiblueprint_mcp-0.1.1-py3-none-any.whl (68.9 kB view details)

Uploaded Python 3

File details

Details for the file aiblueprint_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: aiblueprint_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 196.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aiblueprint_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1ab73f0c8921e29b397e40d7b2fdb7641170b1e1aba3f870206fd3637cf5d5c2
MD5 9cd74432fefcec5ae61f2009d55c2b2c
BLAKE2b-256 3c5d632cdb0a5e1ffd9bb1f7f144e70db8d88c6a65280f6182419048af8a0701

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiblueprint_mcp-0.1.1.tar.gz:

Publisher: release.yml on thebossnow/aiblueprint-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiblueprint_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aiblueprint_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 68.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aiblueprint_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9cf11c12b5fbb4b47421f135955ebf4ca110787a20471f25bbcb523969093269
MD5 38b2cdba10993b492af9ca4b8c8a0276
BLAKE2b-256 deb681bf6cf2f4f389b6305ce90d245f357b19f2f9ae32311df72baae53de4ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiblueprint_mcp-0.1.1-py3-none-any.whl:

Publisher: release.yml on thebossnow/aiblueprint-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page