vn-autocad-claude
An MCP server that drives AutoCAD (LT 2024+ on Windows, full AutoCAD for Mac) or headless DXF generation via ezdxf, exposed as 8 consolidated tools over stdio.
Drawing management — create/reset, open, save, save as DXF, plot to PDF, purge, get system variables, undo/redo, and get drawing info.
Entity CRUD — create lines, circles, polylines, rectangles, arcs, ellipses, MTEXT, hatches; list/count/get entities; and copy, move, rotate, scale, mirror, offset, array, fillet, chamfer, erase.
Layer control — list, create, set current, set properties, freeze/thaw, lock/unlock.
Block & attribute ops — list, insert, insert with attributes, get/update attributes, and define blocks.
Annotations — text, linear/aligned/angular/radius dimensions, and leaders.
P&ID drafting — CTO symbol library setup, symbol insertion, process lines, equipment connections, flow arrows, tags, line numbers, valves, instruments, pumps, tanks.
View & screenshots — zoom extents/window and capture PNG screenshots (PrintWindow on Windows, screencapture on macOS, matplotlib for ezdxf).
System tools — status/health/backend info, runtime diagnostics, re-init, arbitrary AutoLISP execution, and batch commands for bulk drawing in one round-trip.
Provides tools for drawing, editing, querying, managing layers, blocks, annotations, taking screenshots, and plotting to PDF in AutoCAD.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@vn-autocad-claude draw a line from 10,10 to 100,100"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AutoCAD MCP Server
MCP server for AutoCAD LT automation and headless DXF generation.
Two backends, one API:
Backend | Runtime | Requires AutoCAD? | Screenshot |
File IPC | Windows Python | Yes — AutoCAD LT 2024+ (Windows) | Win32 PrintWindow |
File IPC (macOS, experimental) | macOS Python | Yes, full AutoCAD for Mac |
|
ezdxf | Any platform | No (headless) | matplotlib render |
The server exposes 8 consolidated tools (drawing, entity, layer, block, annotation, pid, view, system) over the MCP stdio transport. An MCP client (Claude Desktop, Claude Code, etc.) connects and drives AutoCAD through natural-language requests.
Prerequisites (File IPC backend)
Windows 10/11 (the File IPC backend uses Win32 APIs for focus-free window messaging)
AutoCAD LT 2024 or newer — AutoLISP support was added in LT 2024 for Windows. AutoCAD LT for Mac exists but does not support AutoLISP.
Python 3.10+ (Windows native — not WSL Python)
uv package manager (install guide)
The ezdxf headless backend works on any platform (Linux, macOS, WSL) for offline DXF generation without AutoCAD installed.
On a Mac with full AutoCAD for Mac, see macOS (AutoCAD for Mac) to drive the live drawing.
Related MCP server: zwcad-kr
Quick Start
1. Clone and install
git clone https://github.com/puran-water/autocad-mcp.git
cd autocad-mcp
uv sync2. Load the LISP dispatcher in AutoCAD LT
Open AutoCAD LT and load mcp_dispatch.lsp using APPLOAD:
Type
APPLOADin the AutoCAD command lineBrowse to
<repo>/lisp-code/mcp_dispatch.lspClick Load
You should see:
=== MCP Dispatch v3.1 loaded ===andReady for commands via (c:mcp-dispatch)
Tip: Add the file to your AutoCAD Startup Suite (in the APPLOAD dialog) so it loads automatically with every drawing.
3. Configure your MCP client
Add to your MCP client configuration (e.g. Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"autocad-mcp": {
"command": "C:\\path\\to\\autocad-mcp\\.venv\\Scripts\\python.exe",
"args": ["-m", "autocad_mcp"],
"env": { "AUTOCAD_MCP_BACKEND": "auto" }
}
}
}Key points:
The
commandmust point to the Windows Python inside the project venv (not WSL python).AUTOCAD_MCP_BACKENDcan beauto(default — tries File IPC, falls back to ezdxf),file_ipc(requires AutoCAD), orezdxf(headless only).
Running from WSL
If your MCP client runs in WSL (e.g. Claude Code), launch the server through cmd.exe so it runs as a native Windows process:
{
"mcpServers": {
"autocad-mcp": {
"type": "stdio",
"command": "cmd.exe",
"args": ["/d", "/s", "/c", "cd /d C:\\path\\to\\autocad-mcp && .venv\\Scripts\\python.exe -m autocad_mcp"],
"env": { "AUTOCAD_MCP_BACKEND": "auto" }
}
}
}4. Verify
From your MCP client, call:
system(operation="status")You should see backend: "file_ipc" if AutoCAD is running, or backend: "ezdxf" for headless mode.
macOS (AutoCAD for Mac)
Experimental. Built on Autodesk's documented AutoLISP support for Mac (every
vl-*function the dispatcher uses is listed as "Windows and Mac OS") and covered by mocked tests. Please report results on real Macs.
Requirements:
Full AutoCAD for Mac (not AutoCAD LT for Mac, which has no AutoLISP).
macOS Python 3.10+ and uv.
How it works: AutoCAD for Mac has no COM and no Win32 messages, so the server writes the command JSON to /tmp/autocad_mcp/, briefly brings AutoCAD to the front, types the MCPD command through System Events (osascript), then returns focus to the app you were using. MCPD is a vowel-free alias of (c:mcp-dispatch), so Vietnamese Telex/VNI input sources cannot rewrite it while it is typed.
1. Install
git clone https://github.com/andyluu98/vn-autocad-claude.git
cd vn-autocad-claude
uv sync2. Load the dispatcher in AutoCAD for Mac
Type APPLOAD, choose lisp-code/mcp_dispatch.lsp, click Load (add it to the Startup Suite to load it with every drawing). The command line should show IPC directory: /tmp/autocad_mcp/.
3. Grant macOS permissions
In System Settings > Privacy & Security, enable for the app that launches the MCP server (Terminal, iTerm, VS Code or Claude):
Permission | Needed for |
Accessibility | Typing |
Automation > System Events | Asked on first run, click OK (required) |
Screen Recording |
|
Restart that app after granting permissions.
4. Configure your MCP client
{
"mcpServers": {
"autocad-mcp": {
"command": "/path/to/vn-autocad-claude/.venv/bin/python",
"args": ["-m", "autocad_mcp"],
"env": { "AUTOCAD_MCP_BACKEND": "auto" }
}
}
}Or with Claude Code:
claude mcp add autocad-mcp -- /path/to/vn-autocad-claude/.venv/bin/python -m autocad_mcpNotes for Mac
Each command switches to AutoCAD for a fraction of a second; avoid typing in another app while a batch runs. Prefer
batchfor many entities (one switch for the whole batch).Keep a drawing open and the command line idle (no open dialog), as on Windows.
Not yet verified on Mac:
plot_pdf(uses theDWG To PDF.pc3plotter) and the P&ID library pathC:\PIDv4-CTO\.
Tools
drawing — File/drawing management
Operation | Description | File IPC | ezdxf |
| Reset to clean drawing (erase all + purge) | Yes | Yes |
| Open an existing drawing | Yes | Yes (DXF) |
| Get entity count and layers | Yes | Yes |
| Save current drawing (to path if given) | Yes | Yes |
| Export as DXF | Yes | Yes |
| Plot to PDF | Yes | No |
| Purge unused objects | Yes | Yes |
| Get system variables by name | Yes | Yes |
| Undo last operation | Yes | No |
| Redo last undone operation | Yes | No |
entity — Entity CRUD + modification
Create: create_line, create_circle, create_polyline, create_rectangle, create_arc, create_ellipse, create_mtext, create_hatch
Read: list, count, get
Modify: copy, move, rotate, scale, mirror, offset*, array, fillet*, chamfer*, erase
*
offset,fillet,chamferare File IPC only (not supported in ezdxf headless backend).
layer — Layer management
list, create, set_current, set_properties, freeze, thaw, lock, unlock
block — Block operations
Operation | File IPC | ezdxf |
| Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| No | Yes |
annotation — Text, dimensions, leaders
create_text, create_dimension_linear, create_dimension_aligned, create_dimension_angular, create_dimension_radius, create_leader
pid — P&ID operations (CTO symbol library)
setup_layers, insert_symbol, list_symbols, draw_process_line, connect_equipment, add_flow_arrow, add_equipment_tag, add_line_number, insert_valve, insert_instrument, insert_pump, insert_tank
P&ID symbol insertion requires the CAD Tools Online (CTO) P&ID Symbol Library installed at
C:\PIDv4-CTO\. The ezdxf backend has built-in CTO library support. For the File IPC backend, some P&ID operations require additional LISP helpers — see the P&ID section in the wiki for setup details.
view — Viewport and screenshot
Operation | Description |
| Zoom to show all entities |
| Zoom to a specified window |
| Capture current AutoCAD view as PNG |
Screenshots use PrintWindow (Win32) for the File IPC backend, which works even when AutoCAD is minimized or in the background. On macOS they use screencapture on AutoCAD's front window (AutoCAD is brought to the front first). The ezdxf backend renders via matplotlib.
system — Server management
status, health, get_backend, runtime, init, execute_lisp
execute_lispruns arbitrary AutoLISP code (File IPC only). Passdata: {code: "(+ 1 2)"}. This turns the server into an extensible automation platform — any valid AutoLISP expression can be executed.
Architecture
MCP Client (Claude)
│ stdio (JSON-RPC)
▼
Python MCP Server (autocad_mcp)
│
├── File IPC Backend ──► C:/temp/*.json ──► mcp_dispatch.lsp (AutoCAD LT)
│ PostMessageW(WM_CHAR) to MDIClient — no focus steal
│
├── File IPC Backend (macOS) ──► /tmp/autocad_mcp/*.json ──► mcp_dispatch.lsp (AutoCAD for Mac)
│ osascript types MCPD, then restores focus
│
└── ezdxf Backend ──► in-memory DXF (headless, no AutoCAD needed)The File IPC backend sends keystrokes to AutoCAD's MDIClient window via PostMessageW(WM_CHAR), triggering the (c:mcp-dispatch) AutoLISP command. This approach does not steal window focus — you can continue working in other applications while automation runs.
Environment Variables
Variable | Default | Description |
|
| Backend selection: |
|
| Directory for IPC command/result JSON files (must match on both Python and LISP sides) |
|
| IPC command timeout in seconds (1-300) |
|
| Disable screenshot capture (text feedback only) |
Note:
mcp_dispatch.lspreadsAUTOCAD_MCP_IPC_DIRfrom the operating-system environment when AutoCAD can see it; otherwise it uses the defaults above. If you set the variable only in the MCP client config, AutoCAD will not see it: also set*mcp-ipc-dir*inmcp_dispatch.lsp(with a trailing/).
Development
uv sync
uv run pytest tests/ -vAutoCAD LT AutoLISP Compatibility
AutoLISP was added to AutoCAD LT in the 2024 release (Windows only). AutoCAD LT for Mac does not support AutoLISP.
Supported (LT 2024+ Windows) | Not Supported |
| VLIDE (Visual LISP IDE) |
All |
|
File I/O ( | Express Tools |
Entity access ( | 3D operations |
Selection sets | AutoLISP in AutoCAD LT for Mac |
The mcp_dispatch.lsp dispatcher is fully compatible with LT 2024+. It uses no vla-/vlax-/vlr- (ActiveX) calls, so the same file loads in full AutoCAD for Mac.
What's New in v3.1
execute_lisp— Run arbitrary AutoLISP code via temp file pattern. Turns the server from a fixed command set into an extensible automation platform.Undo / Redo — Single-step undo and redo via
drawingtool.Drawing open — Open existing
.dwgfiles programmatically (FILEDIA suppressed).Drawing create — Now resets current drawing (erase all + purge) instead of
_.NEW, preserving the LISP dispatcher namespace.Drawing save with path —
savewith apathparameter uses SAVEAS; without path uses QSAVE.get_variablesfix — Respects thenamesparameter; returns requested variables with proper type handling.Polyline/leader fix — Point arrays properly encoded via semicolon-delimited format.
ESC prefix — Sends 2x ESC before each dispatch to cancel stale pending commands from prior timeouts.
UTF-8/cp1252 fallback — Handles non-ASCII characters in LISP result files (AutoCAD writes Windows-1252).
Configurable IPC timeout —
AUTOCAD_MCP_IPC_TIMEOUTenv var (1–300 seconds, default 10).Thread-safe backend init —
asyncio.Lockprevents parallel initialization races.
License
MIT
Available Tools
8 toolsannotationA
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
systemARead-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} batch — Run many commands in one round-trip + one UNDO group (File IPC only). data: {commands: [{command, params}, ...]} e.g. {"commands": [ {"command": "create-line", "params": {"x1":0,"y1":0,"x2":100,"y2":0}}, {"command": "create-text", "params": {"x":10,"y":10,"text":"Phòng ngủ","height":25}} ]} Far faster than one call per entity; use for bulk drawing.
Inputs: operation (required), data, include_screenshot. Returns: result
viewARead-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
Scored across 8 tools
Each top-level tool maps to a distinct CAD domain (file, entity, layer, block, annotation, P&ID, view, system), so an agent can usually select the right one. Minor overlap exists between entity's create_mtext and annotation's create_text, and between P&ID symbol insertion and generic block insertion, but the grouped operations help differentiate intent.
The top-level tool names are consistently single lowercase nouns, and sub-operations generally follow a readable snake_case verb_noun style. However, there are minor deviations: some verbs differ for similar actions (create_*, insert_*, add_*, draw_*), and the batch example uses kebab-case command names while descriptions use underscores.
Eight domain-focused tools are well-scoped for an AutoCAD automation server. Each tool groups a set of closely related operations, keeping the MCP surface manageable while still covering a broad range of CAD functionality.
The set covers the full core lifecycle for drawings, entities, layers, blocks, annotations, P&ID symbols, views, and server management. Minor gaps exist, such as changing an existing entity's layer/properties, some advanced dimension types, and block explode/redefinition workflows, but execute_lisp provides an escape hatch.
Maintenance
Related MCP Connectors
CAD in ChatGPT and Claude: editable parts, STEP/STL/drawings, in-chat 3D, automatic checks.
Read, query, edit and render DWG drawings with AI. No AutoCAD required.
DXF and PDF/X-4 for AI agents: structured facts, PNG renders, an interactive in-chat viewer.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConnects Claude AI to AutoCAD for architectural design, enabling natural language to execute 684 commands. Automates drawing creation and editing through the Model Context Protocol.43 npm9MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to read and edit ZWCAD drawings directly, including summarizing drawings, querying layers and entities, reading dimensions and text, and creating lines, text, and blocks.1MIT
- AlicenseNot gradedqualityBmaintenanceConnects Claude Desktop to a running AutoCAD instance over local Windows COM, letting users query, draw, edit, organize layers, measure areas, take off quantities, and export sheets to PDF using plain language. Every action is undoable, logged, and optionally restricted to read-only mode with no network exposure.MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude to connect to an already-running full AutoCAD instance through COM Automation, reading and drawing geometry live in the open drawing with 50 tools covering entities, layers, queries, modifications and AutoLISP escape hatches. Every tool call lands as a single undo step, so changes can be reversed with one Ctrl+Z.MIT