Skip to main content
Glama
dxf-mcp

dxf-mcp

by OmniZenRaj

dxf-mcp

An MCP server that gives an agent structured, read-only access to DXF drawings.

Most CAD automation exists to answer three questions, and shops still answer them by hand: what is in this drawing, what parts does it place, and does it follow our standards. This exposes those as tools, so a model can ask instead of a person opening the file.

Nothing here writes a drawing. The server reads.

Tools

Tool

What it does

list_drawings

DXF files under a directory, relative to the configured root

drawing_summary

DXF version, units, layer and block counts, entity mix

list_layers

Every layer with colour, linetype, on/locked state, entity count

extract_bill_of_materials

Block insertions and their attributes, flattened into rows

check_standards

Required layers, forbidden layers, expected units, empty layers

find_text

Case-insensitive search across TEXT, MTEXT and block attributes

extract_bill_of_materials is the one worth explaining. A block insertion with attributes is how a drawing records a placed component: PARTNO, QTY, MATERIAL. Turning those into one row per component with attribute tags as columns is the step between a drawing and an ERP or PLM record, and it is normally either a bespoke LISP routine per shop or a person retyping.

Related MCP server: aspicio-dxf-viewer

Install

git clone https://github.com/OmniZenRaj/dxf-mcp
cd dxf-mcp
python3 -m venv .venv && .venv/bin/pip install -e .

Configure

Point DXF_MCP_ROOT at the directory holding your drawings. Claude Desktop, in claude_desktop_config.json:

{
  "mcpServers": {
    "dxf": {
      "command": "/absolute/path/to/dxf-mcp/.venv/bin/dxf-mcp",
      "env": { "DXF_MCP_ROOT": "/absolute/path/to/your/drawings" }
    }
  }
}

VS Code, in .vscode/mcp.json:

{
  "servers": {
    "dxf": {
      "type": "stdio",
      "command": "/absolute/path/to/dxf-mcp/.venv/bin/dxf-mcp",
      "env": { "DXF_MCP_ROOT": "/absolute/path/to/your/drawings" }
    }
  }
}

The root is the security boundary

An MCP server hands file access to a model, which means the model chooses what to open. DXF_MCP_ROOT is the only thing standing between that and the rest of the disk, so it is enforced in one place and tested directly.

Paths are resolved before the containment check, so ../../etc/passwd and a symlink pointing outside the root are both refused rather than followed. Relative paths are taken as relative to the root, not to the process working directory, because that is what a caller means. If DXF_MCP_ROOT is unset the root is the working directory, which keeps the server runnable without configuration while still confining it somewhere deliberate.

Example

> Which drawings under ./assemblies are missing a DIMENSIONS layer?

  list_drawings("assemblies")
  check_standards(path, required_layers=["DIMENSIONS"])   # per drawing

> Give me a parts list for assembly.dxf

  extract_bill_of_materials("assembly.dxf")
  -> 2 rows, columns MATERIAL / PARTNO / QTY
     PART  CCI-1042  qty 4  Oak    (layer FRAME)
     PART  CCI-2088  qty 1  Steel  (layer PANEL)

Tests

.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest                        # 16 unit tests
.venv/bin/python scripts/smoke_test.py  # real stdio JSON-RPC against the built server

Fixtures build a real DXF document with ezdxf rather than checking in a binary, so the test drawing is readable as code and easy to extend.

The unit tests cover the DXF and path logic directly. The smoke test drives the installed executable over stdio -- initialize, tools/list, a real extract_bill_of_materials call, and a path-traversal attempt that must come back isError -- because the MCP wiring is the part unit tests cannot see.

The confinement tests were checked by breaking the code on purpose: deleting the containment condition fails three of them, and resolving the path after the check rather than before fails the traversal and symlink cases. A test that never fails is not evidence.

Limitations

Reads DXF, not DWG. DWG is a closed format; converting with ODA File Converter or dwg2dxf first is the usual route.

Bills of material come from block attributes. A drawing that records parts as loose text rather than attributed blocks will produce no rows, which is correct behaviour and not a bug, though find_text will still locate the text.

Licence

MIT.

Available Tools

6 tools
check_standardsA

Check a drawing against drafting standards.

Reports missing required layers, forbidden layers and wrong units as errors, and empty layers as warnings. passed reflects errors only, so a drawing with warnings still passes.

Inputs: path (required), require_units, required_layers, forbidden_layers. Returns: path, passed, findings

drawing_summaryA

Describe one drawing: DXF version, units, layer and block counts, entity mix.

Call this first. It is cheap, and it tells you which of the other tools is worth calling on this file.

Inputs: path (required). Returns: path, units, dxf_version, layer_count, +4 more

extract_bill_of_materialsA

Extract a bill of materials from block insertions and their attributes.

Each placed block becomes a row and each attribute tag becomes a column, which is the shape drawing data has to be in before it can reach an ERP or a PLM record. Pass block to restrict the extract to one block name.

Inputs: path (required), block. Returns: path, rows, row_count, attribute_columns

find_textA

Search TEXT, MTEXT and block attributes for a substring, case-insensitively.

Useful for locating a part number or a revision note when you do not yet know which block or layer it lives on.

Inputs: path (required), needle (required). Returns: result

list_drawingsA

List DXF files available under a directory, relative to the configured root.

Inputs: directory, recursive. Returns: result

list_layersA

List every layer in a drawing with its colour, linetype, state and entity count.

Inputs: path (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool has a distinct purpose: listing files, searching text, summarizing drawings, listing layers, extracting BOMs, and checking standards. No overlap or ambiguity.

    Naming Consistency5/5

    All tools follow a consistent verb_noun lowercase snake_case pattern (list_drawings, find_text, drawing_summary, etc.), making the naming predictable and clear.

    Tool Count5/5

    With 6 tools, the set is compact and focused on the domain of DXF file inspection and processing. Each tool earns its place without redundancy or bloat.

    Completeness5/5

    The tools cover the key workflows: discovering files, searching content, summarizing, inspecting layers, extracting BOM data, and validating standards. No obvious gaps for typical DXF operations.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides DXF parsing, entity extraction, geometry analysis, and optional AutoCAD COM automation for CAD tasks.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Opens, inspects, and renders DXF/CAD drawings for AI agents: describe_dxf returns structured facts (layers with actual drawn colors, units, bounds, text content) and render_dxf returns PNG images. On MCP Apps hosts like ChatGPT and Claude, view_dxf opens an interactive in-chat viewer with pan, zoom, and layer toggles.
      6
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables reading, analyzing, and editing CAD files (DXF and DWG) via natural language, including entity queries, layer management, and safe copy-based edits.
      17
      1
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to create, edit, inspect, and validate production drawings through one typed tool contract, driving either a live AutoCAD seat over COM on Windows or a headless ezdxf engine anywhere. It covers drafting, P&ID, mechanical, and architectural workflows with ISO/ANSI standards, dimension and tolerance checks, takeoffs, and drawing understanding.
      -