Skip to main content
Glama
autocad-mcp

autocad-mcp

by agtmwebtoon

autocad-mcp

AutoCAD / AutoCAD LT 자동화를 위한 MCP 서버.

Claude 같은 LLM이 자연어로 AutoCAD 도면을 생성·편집할 수 있도록 MCP 프로토콜로 연결합니다.

특징

  • AutoCAD LT 지원 — COM/ActiveX 없이 LISP + 파일 IPC 방식으로 LT에서도 동작

  • 헤드리스 모드 — ezdxf 백엔드로 AutoCAD 없이 DXF 파일 직접 생성

  • Validation Layer — 도면 실행 전 기하·의존성·간섭 검증 (AssemblyValidator로 shape 간 충돌 사전 차단)

  • P&ID 지원 — 공정 배관 계장도 심볼·라인 삽입

Related MCP server: Greenloom CAD MCP Server

아키텍처

LLM (Claude)
    │  MCP tool call
    ▼
MCP Server (server.py)          ← 8개 툴 + validate
    │
    ├─ Validation Layer          ← 실행 전 검증 (geometry / dependency / assembly)
    │
    ├─ File IPC Backend          ← AutoCAD LT: JSON 파일 → LISP dispatch → 결과 파일
    └─ ezdxf Backend             ← 헤드리스: Python에서 DXF 직접 생성

MCP 툴 목록

툴

설명

drawing

파일 생성·열기·저장·PDF 출력

layer

레이어 생성·속성·잠금·동결

entity

도형 생성 (선·원·호·사각형·폴리라인 등) 및 수정

block

블록 삽입·속성 조회·수정

annotation

치수·지시선

pid

P&ID 심볼·배관 라인

view

줌·화면 제어

system

핑·백엔드 전환·스크린샷

validate

실행 전 Validation (geometry / dependency / assembly) — 개발 중

설치

# 의존성 설치
uv sync

# AutoCAD LT 연결 시 LISP 로드 (AutoCAD 명령창에서)
(load "C:/path/to/lisp-code/mcp_dispatch.lsp")

실행

# MCP 서버 시작
uv run python -m autocad_mcp

# 백엔드 선택 (환경변수)
AUTOCAD_MCP_BACKEND=ezdxf   uv run python -m autocad_mcp  # 헤드리스
AUTOCAD_MCP_BACKEND=file_ipc uv run python -m autocad_mcp  # AutoCAD LT

Claude Desktop 연결

claude_desktop_config.json:

{
  "mcpServers": {
    "autocad-mcp": {
      "command": "...python.exe",
      "args": ["-m", "autocad_mcp"],
      "env": {
        "AUTOCAD_MCP_BACKEND": "file_ipc"
      }
    }
  }
}

AutoCAD LT IPC 동작 방식

AutoCAD LT는 COM 자동화를 지원하지 않으므로 파일 기반 IPC를 사용합니다.

Python → C:/temp/autocad_mcp_cmd_{id}.json 작성
       → "(c:mcp-dispatch)" 입력 전송
       → AutoCAD LISP이 명령 실행
       → C:/temp/autocad_mcp_result_{id}.json 작성
       → Python이 결과 파일 폴링

Validation Layer

현재 개발 중입니다. API와 동작 방식은 변경될 수 있습니다.

validate(operation="pipeline", data={"intents": [...]})
    │
    ├─ Phase 1: shape별 개별 검증
    │   ├─ GeometryValidator  — 치수 범위, 최소 반지름
    │   └─ DependencyValidator — layer → entity 순서 (DFA)
    │
    └─ Phase 2: 전체 교차 간섭 검증
        └─ AssemblyValidator  — shape 간 겹침·여유 거리

테스트

uv run pytest

Available Tools

9 tools
annotationA

Annotation: text, dimensions, and leaders.

Operations: create_text — data: {x, y, text, height?, rotation?, layer?} create_dimension_linear — data: {x1, y1, x2, y2, dim_x, dim_y} create_dimension_aligned — data: {x1, y1, x2, y2, offset} create_dimension_angular — data: {cx, cy, x1, y1, x2, y2} create_dimension_radius — data: {cx, cy, radius, angle} create_leader — data: {points: [[x,y],...], text}

Inputs: operation (required), data, include_screenshot. Returns: result

blockA

Block definition, insertion, and attribute management.

Operations: list — List all block definitions. insert — data: {name, x, y, scale?, rotation?, block_id?} insert_with_attributes — data: {name, x, y, scale?, rotation?, attributes: {tag: value}} get_attributes — data: {entity_id} update_attribute — data: {entity_id, tag, value} define — data: {name, entities: [{type, ...}]}

Inputs: operation (required), data, include_screenshot. Returns: result

drawingA

Drawing file management.

Operations: create — Create a new empty drawing. data: {name?} open — Open an existing drawing. data: {path} info — Get drawing extents, entity count, layers, blocks. save — Save current drawing. data: {path?} (saves to path if given, else QSAVE) save_as_dxf — Export as DXF. data: {path} plot_pdf — Plot to PDF. data: {path} purge — Purge unused objects. get_variables — Get system variables. data: {names: [...]} undo — Undo last operation. redo — Redo last undone operation.

Inputs: operation (required), data, include_screenshot. Returns: result

entityA

Entity creation, querying, and modification.

Create operations: 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_ellipse — data: {cx, cy, major_x, major_y, ratio}, layer? create_mtext — data: {x, y, width, text, height?}, layer? create_hatch — entity_id, data: {pattern?}

Read operations: list — layer? → list entities count — layer? → count entities get — entity_id → entity details

Modify operations: copy — entity_id, data: {dx, dy} move — entity_id, data: {dx, dy} rotate — entity_id, data: {cx, cy, angle} scale — entity_id, data: {cx, cy, factor} mirror — entity_id, x1, y1, x2, y2 offset — entity_id, data: {distance} array — entity_id, data: {rows, cols, row_dist, col_dist} fillet — data: {id1, id2, radius} chamfer — data: {id1, id2, dist1, dist2} erase — entity_id

Inputs: operation (required), x1, x2, y1, +6 more. Returns: result

layerA

Layer creation and management.

Operations: list — List all layers with properties. create — data: {name, color?, linetype?} set_current — data: {name} set_properties — data: {name, color?, linetype?, lineweight?} freeze — data: {name} thaw — data: {name} lock — data: {name} unlock — data: {name}

Inputs: operation (required), data, include_screenshot. Returns: result

pidA

P&ID drawing with CTO symbol library.

Operations: setup_layers — Create standard P&ID layers. insert_symbol — data: {category, symbol, x, y, scale?, rotation?} list_symbols — data: {category} draw_process_line — data: {x1, y1, x2, y2} connect_equipment — data: {x1, y1, x2, y2} add_flow_arrow — data: {x, y, rotation?} add_equipment_tag — data: {x, y, tag, description?} add_line_number — data: {x, y, line_num, spec} insert_valve — data: {x, y, valve_type, rotation?, attributes?} insert_instrument — data: {x, y, instrument_type, rotation?, tag_id?, range_value?} insert_pump — data: {x, y, pump_type, rotation?, attributes?} insert_tank — data: {x, y, tank_type, scale?, attributes?}

Inputs: operation (required), data, include_screenshot. Returns: result

systemB
Read-only

Server status and management.

Operations: status — Backend info, capabilities, health check. health — Quick health check (ping backend). get_backend — Return current backend name and capabilities. runtime — Return process/runtime details for spawn diagnostics. init — Re-initialize the backend. execute_lisp — Execute arbitrary AutoLISP code (File IPC only). data: {code}

Inputs: operation (required), data, include_screenshot. Returns: result

validateA
Read-only

LLM 모호성 → Branch 후보 생성 → Constraint Tree prune → Deterministic 실행 순서 반환.

Operations: branch — DesignIntent → Branch 후보 생성. data: {intent: {shape_type, params, features?}} check — Branch 후보들 → Constraint Tree 검증 (valid/pruned 분류). data: {branches: [...]} select — Valid Branch 중 best 선택 (min cost + semantic priority + hash). data: {valid_branches: [...]} pipeline — Intent 리스트 → branch/check/select 전 단계 한번에. data: {intents: [{shape_type, params, features?}, ...]}

pipeline 반환 예시 (PASS): {ok: true, selected_branch: {branch_hash, total_cost, commands: [...]}, stats: {...}}

pipeline 반환 예시 (FAIL — 모두 prune): {ok: false, all_pruned: true, failures: [{branch_hash, failed_node, reason, suggestion}]}

selected_branch.commands 를 순서대로 entity/layer/... 툴에 실행하면 항상 동일한 input → 동일한 output 이 보장된다.

Inputs: operation (required), data, rule_set. Returns: result

viewA
Read-only

Viewport control and screenshot capture.

Operations: zoom_extents — Zoom to show all entities. zoom_window — Zoom to window: x1, y1, x2, y2 get_screenshot — Capture current view as PNG image.

Inputs: operation (required), x1, x2, y1, +1 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 9 tools

    Disambiguation4/5

    The top-level tools (layer, drawing, entity, block, annotation, pid, view, system, validate) are clearly distinct by domain. However, there is some overlap between entity.create_mtext and annotation.create_text, and between block.insert and pid.insert_symbol, but these are minor and descriptions clarify the context.

    Naming Consistency3/5

    The tool names are single nouns, while operations inside them use a mix of simple verbs (list, create) and compound verbs with underscores (save_as_dxf, get_variables, insert_with_attributes). Naming is not consistently verb_noun across all tools, and read operations use inconsistent verbs (list, get, info).

    Tool Count5/5

    The server has 9 top-level tools, well within the ideal 3-15 range. Each tool represents a clear domain, and the number of tools is proportionate to the wide scope of AutoCAD functionality covered.

    Completeness4/5

    The tool surface is extensive, covering drawing file management, layers, entity CRUD, blocks, annotations, P&ID, view control, and system operations. Minor gaps exist, such as no direct editing of annotations or renaming layers, but these can be worked around with existing tools.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants like Claude for Desktop or Cursor to control supported CAD applications through natural language, including drawing, layer/entity/block management, data export, and file/session operations.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants like Claude for Desktop or Cursor to control AutoCAD, ZWCAD, GstarCAD, and BricsCAD for drawing, layer, block, entity, export, and file operations through natural language or direct tool calls.
      -