autocad-mcp
An AutoCAD 2027 for Mac MCP server that lets an MCP client control live AutoCAD GUI sessions or run headless/offline DWG/DXF workflows.
Check AutoCAD GUI, TCP bridge, and AcCoreConsole status; auto-bootstrap the live bridge.
Evaluate AutoLISP, send raw AutoCAD commands, and inspect drawing metadata, bounds, system variables, and entity counts.
Draw geometry: lines, polylines, circles, arcs, rectangles, TEXT/MTEXT, dimensions, and hatches.
Modify entities: move, copy, rotate, scale, mirror, erase, and change layer/color.
Manage layers and blocks, including creating/inserting block references.
Retrieve selections and query entities by DXF type and layer.
Save/export drawings to DWG, DXF, PDF, or PNG with verification.
Run batch AutoLISP or .scr scripts in headless AcCoreConsole.
Create/inspect DXF files offline with ezdxf and optionally open them in AutoCAD.
Operate in live GUI mode with headless fallback and unified diagnostic fields.
Provides tools for interacting with AutoCAD 2027 for Mac in both live GUI and headless batch modes, enabling drawing creation and editing, layer and block management, entity querying and modification, AutoLISP evaluation, command execution, and export to DWG, DXF, PDF, or PNG.
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., "@autocad-mcp Draw a 50mm circle at 0,0 on the Walls layer and export the drawing as PDF"
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 2027 for Mac MCP Server (autocad-mcp)
A native Model Context Protocol (MCP) server for AutoCAD 2027 for Mac (26.0.60.171, Apple Silicon & Intel), featuring a Dual-Mode Hybrid Architecture:
Real-Time Live GUI Mode (
autocad_mcp_bridge.crx+mcp_helpers.lsp)Native Objective-C++ Core Runtime Extension (
.crx) loaded automatically into the running AutoCAD 2027 GUI process viaacaddoc.lsp.Exposes a local JSON-RPC over TCP endpoint (
127.0.0.1:9877) and dispatches AutoLISP evaluation & command execution directly onto AutoCAD's Cocoa main thread (libaccore.dylib/acedPostCommand/acedEvaluateLisp).
Headless Batch & Offline Mode (
AcCoreConsole+ezdxf)Seamless fallback and batch DWG processing using AutoCAD 2027's built-in
/Applications/Autodesk/AutoCAD 2027/AutoCAD 2027.app/Contents/Helpers/AcCoreConsole.app/Contents/MacOS/AcCoreConsole.High-speed offline DXF creation and inspection via
ezdxf.
Quick Start (macOS)
git clone https://github.com/GeongyeeLee/autocad-mcp.git
cd autocad-mcp
chmod +x install_mac.sh
./install_mac.shRegister in OpenAI Codex (~/.codex/config.toml)
[mcp_servers.autocad]
command = "/path/to/autocad-mcp/.venv/bin/autocad-mcp"Or via Codex CLI:
codex mcp add autocad -- /path/to/autocad-mcp/.venv/bin/autocad-mcpRelated MCP server: AutoCAD MCP Ultra
Available MCP Tools (20 Tools)
Category | Tool Name | Description |
Core & Scripting |
| Check AutoCAD 2027 GUI, live TCP bridge ( |
| Evaluate arbitrary AutoLISP expressions in live GUI or headless | |
| Post raw AutoCAD commands directly to the active command line (e.g. | |
| Get active drawing metadata, bounds ( | |
2D/3D Geometry |
| Draw a |
| Draw a lightweight polyline ( | |
| Draw a | |
| Draw an | |
| Draw a closed rectangular | |
| Create single-line | |
| Add linear or aligned dimensions ( | |
| Create a | |
Editing & Organization |
| Move, copy, rotate, scale, mirror, erase, or change layer/color of entities by handle |
| List, create, switch current layer, or toggle on/off/freeze/lock states | |
| List block definitions, create a block from entity handles, or insert a block reference ( | |
Inspection & Export |
| Retrieve currently selected entities and their DXF properties |
| Query entities in the drawing by DXF type and layer | |
| Save or export the active drawing to | |
Batch & Offline |
| Run batch AutoLISP or |
| Fast offline DXF creation and inspection via |
Reliability & Unified Diagnostic Fields (v0.2.0)
Every tool response includes 17 unified diagnostic fields for full observability across both Live GUI and Headless AcCoreConsole modes:
requested_mode / actual_mode / fallback_reason
request_id / elapsed_ms / execution_stage
active_document / command_names / busy / modal_dialog
script_success / command_success
output_exists / output_size / reopen_verified
error_code / raw_log_pathKey v0.2.0 hardening highlights:
Granular Live Readiness: Separates
bridge_online,drawing_ready, andcommand_executable, inspecting[NSApp modalWindow],CMDACTIVE(interactive bits1|2|8), andCMDNAMESon the Cocoa main thread with a bounded timeout.Anti-Reentrancy & Event-Loop Wakeup: Prevents main-thread stalls by waking the Cocoa runloop with
NSEventTypeApplicationDefined, waiting briefly (~600ms) for trailing commands to unwind, and explicitly rejecting or cancelling (CANCELCMD) when busy (COMMAND_ACTIVE_BUSY/MODAL_DIALOG_ACTIVE).Verified DWG Persistence:
save_as_dwgandexport_drawingverify file existence, non-empty size,AC10...header magic, and headless reopen verification (reopen_verified: true) before returningsaved_dwg.Full UTF-8 / CJK Path & Output Support: Uses
(open path mode "utf8")in AutoLISP and multi-encoding fallback (utf-8→utf-16-le→gb18030) with raw byte logs preserved at/tmp/autocad_mcp_logs/<request_id>.log.Strict Live Mode (
require_live): Disables silent fallback to a blank headlessDrawing1.dwgwhen querying or modifying the foreground drawing unlessallow_headless_fallback=Trueorinput_dwgis specified.Verified Document Open:
inspect_or_create_dxf(open_in_autocad=True)separatesopen_dispatchedfromdocument_loaded_verifiedand confirmsloaded_entity_countin the newly opened document.
Running Tests
./.venv/bin/python tests/test_autocad_mcp.pyLicense
MIT
Available Tools
20 toolsadd_dimensionA
Add a linear or aligned dimension between point1 and point2.
Args: point1: First extension line origin [x, y]. point2: Second extension line origin [x, y]. dim_line_point: Point specifying the dimension line location [x, y]. dim_type: 'aligned' or 'linear'. layer: Optional layer name for the dimension.
Inputs: point1 (required), point2 (required), dim_line_point (required), layer, +1 more. Returns: result
draw_arcA
Draw a circular arc counter-clockwise from start_angle_deg to end_angle_deg.
Args: center: [x, y] or [x, y, z] center coordinates. radius: Arc radius (> 0). start_angle_deg: Start angle in degrees. end_angle_deg: End angle in degrees. layer: Optional layer name. color: Optional ACI color (1-255).
Inputs: center (required), radius (required), end_angle_deg (required), start_angle_deg (required), +2 more. Returns: result
draw_circleB
Draw a circle in AutoCAD 2027.
Args: center: [x, y] or [x, y, z] center coordinates. radius: Circle radius (> 0). layer: Optional layer name. color: Optional ACI color (1-255).
Inputs: center (required), radius (required), color, layer. Returns: result
draw_hatchA
Create a HATCH inside a closed entity specified by its handle.
Args: boundary_handle: Hex handle of the closed boundary entity (e.g. from draw_rectangle, draw_polyline, or draw_circle). pattern: Hatch pattern name (e.g. 'SOLID', 'ANSI31', 'ANSI37', 'NET'). scale: Hatch pattern scale (ignored for SOLID). angle_deg: Hatch pattern angle in degrees. layer: Optional layer name. color: Optional ACI color (1-255).
Inputs: boundary_handle (required), color, layer, scale, +2 more. Returns: result
draw_lineB
Draw a line between two 2D/3D points in AutoCAD 2027.
Args: start_point: [x, y] or [x, y, z] start coordinates. end_point: [x, y] or [x, y, z] end coordinates. layer: Optional layer name (automatically created if it does not exist). color: Optional AutoCAD Color Index (ACI 1=Red, 2=Yellow, 3=Green, 4=Cyan, 5=Blue, 6=Magenta, 7=White).
Inputs: end_point (required), start_point (required), color, layer. Returns: result
draw_polylineB
Draw a lightweight polyline (LWPOLYLINE) through a sequence of vertices.
Args: vertices: List of [x, y] vertices (at least 2 points). closed: Whether the polyline should be closed. width: Constant global width of the polyline segments. layer: Optional layer name (auto-created if missing). color: Optional ACI color (1-255).
Inputs: vertices (required), color, layer, width, +1 more. Returns: result
draw_rectangleA
Draw an axis-aligned rectangle (as a closed LWPOLYLINE) from two opposite corners.
Args: corner1: First corner [x1, y1]. corner2: Opposite corner [x2, y2]. width: Optional line width. layer: Optional layer name. color: Optional ACI color (1-255).
Inputs: corner1 (required), corner2 (required), color, layer, +1 more. Returns: result
draw_textA
Create single-line TEXT or multiline MTEXT in AutoCAD 2027.
Args: position: Insertion point [x, y] or [x, y, z]. text: Text string content. height: Text height. rotation_deg: Rotation angle in degrees. multiline: If True, creates MTEXT; otherwise creates TEXT. layer: Optional layer name. color: Optional ACI color (1-255).
Inputs: text (required), position (required), color, layer, +3 more. Returns: result
eval_autolispA
Evaluate arbitrary AutoLISP code in AutoCAD 2027 and return the serialized result.
Args: code: AutoLISP expression(s) to evaluate, e.g. '(getvar "ACADVER")' or '(mcp:make-line ...)'. prefer_live: Use the live AutoCAD 2027 GUI window if available; falls back to headless AcCoreConsole if False or if input_dwg is provided. timeout_ms: Execution timeout in milliseconds. input_dwg: Optional path to an existing .dwg file to process in headless AcCoreConsole mode. save_as_dwg: Optional path to save the resulting .dwg file when running in headless mode.
Inputs: code (required), input_dwg, timeout_ms, prefer_live, +1 more. Returns: result
export_drawingC
Save or export the active AutoCAD 2027 drawing to DWG, DXF, PDF, or PNG.
Args: output_path: Target file path (e.g. '/tmp/output.dwg', '/tmp/output.dxf', '/tmp/output.pdf', '/tmp/preview.png'). format: One of 'dwg', 'dxf', 'pdf', 'png'.
Inputs: output_path (required), format. Returns: result
get_connection_statusA
Check AutoCAD 2027 GUI process, live TCP bridge (127.0.0.1:9877), and AcCoreConsole status.
Args: auto_bootstrap: If True and the live bridge is not yet connected, automatically open a workspace drawing in AutoCAD 2027 to load the native bridge.
Inputs: auto_bootstrap. Returns: result
get_drawing_infoA
Get metadata, system variables, bounds, and entity count of the active drawing (or a file via input_dwg).
Inputs: input_dwg. Returns: result
get_selectionA
Get all currently or previously selected entities in the active AutoCAD 2027 drawing.
Inputs: no named parameters. Returns: result
inspect_or_create_dxfA
High-speed offline DXF inspection or creation using ezdxf, with optional handoff to AutoCAD 2027.
Args: dxf_path: Path to the .dxf file to inspect or create. action: 'inspect' to read layers/entities summary of an existing DXF, or 'create' to generate a new DXF from entities_spec. entities_spec: For action='create', a list of dicts describing entities, e.g. [{'type': 'LINE', 'start': [0,0], 'end': [100,0], 'layer': 'WALL'}, {'type': 'CIRCLE', 'center': [50,50], 'radius': 20}]. open_in_autocad: If True, opens the DXF file in the AutoCAD 2027 GUI after completion.
Inputs: dxf_path (required), action, entities_spec, open_in_autocad. Returns: result
manage_blockB
List blocks, create a new block definition from entity handles, or insert a block reference.
Args: action: One of 'list', 'create', 'insert'. block_name: Name of the block (required for 'create' and 'insert'). point: Base point (for 'create') or insertion point (for 'insert'). handles: List of entity handles to group into the block (required for 'create'). scale_x: X scale factor for 'insert'. scale_y: Y scale factor for 'insert'. scale_z: Z scale factor for 'insert'. rotation_deg: Rotation angle in degrees for 'insert'. layer: Optional layer name for 'insert'. color: Optional ACI color for 'insert'.
Inputs: color, layer, point, action, +6 more. Returns: result
manage_layerB
List, create, switch, or change properties of AutoCAD layers.
Args: action: One of 'list', 'create', 'set_current', 'on', 'off', 'freeze', 'thaw', 'lock', 'unlock'. name: Layer name (required for all actions except 'list'). color: Optional ACI color (1-255) when creating or updating a layer. linetype: Optional linetype name (e.g. 'Continuous', 'DASHED', 'CENTER').
Inputs: name, color, action, linetype. Returns: result
modify_entitiesA
Modify one or more entities identified by their handles.
Args: handles: List of entity hex handles (e.g. ['2DA', '2DB']). action: One of 'move', 'copy', 'rotate', 'scale', 'mirror', 'erase', 'set_layer', 'set_color'. base_point: Base point [x, y, z] for move/copy/rotate/scale/mirror. target_point: Target point [x, y, z] for move/copy or second mirror point. rotation_deg: Rotation angle in degrees (for action='rotate'). scale_factor: Scale factor (for action='scale'). layer: Target layer name (for action='set_layer'). color: Target ACI color 1-255 (for action='set_color').
Inputs: action (required), handles (required), color, layer, +4 more. Returns: result
query_entitiesA
Query entities in the active drawing (or a DWG file) with optional type and layer filters.
Args: entity_type: Optional DXF entity type filter (e.g. 'LINE', 'LWPOLYLINE', 'CIRCLE', 'ARC', 'TEXT', 'MTEXT', 'INSERT', 'DIMENSION', 'HATCH'). layer: Optional layer name filter. limit: Maximum number of entity records to return (default 100). input_dwg: Optional path to a .dwg file to inspect in headless mode.
Inputs: layer, limit, input_dwg, entity_type. Returns: result
run_accoreconsole_scriptA
Run a batch AutoLISP or .scr script in AutoCAD 2027's headless AcCoreConsole.
Args: script_or_lisp: AutoLISP expressions (if is_lisp=True) or raw AutoCAD .scr script lines (if is_lisp=False). is_lisp: Whether script_or_lisp is AutoLISP code (True) or raw .scr commands (False). input_dwg: Optional input .dwg file path to open in AcCoreConsole. save_as_dwg: Optional output .dwg file path to save after execution. timeout_sec: Maximum execution time in seconds.
Inputs: script_or_lisp (required), is_lisp, input_dwg, save_as_dwg, +1 more. Returns: result
send_commandC
Send a raw command string directly to the active AutoCAD 2027 command line.
Args: command: Raw AutoCAD command sequence (e.g. '_.ZOOM E' or '.REGEN').
Inputs: command (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Most tools have clearly distinct purposes: drawing primitives, layer/block management, querying, and export are easy to separate. The main ambiguity is among eval_autolisp, send_command, and run_accoreconsole_script, which all execute code or commands in different contexts, though the descriptions help distinguish live GUI execution from headless batch execution.
The set uses consistent snake_case and mostly follows a verb_noun pattern such as draw_line, get_drawing_info, and modify_entities. Minor deviations include multiplexed manage_layer/manage_block tools and the compound inspect_or_create_dxf name.
At 20 tools, the surface is borderline heavy, though the CAD domain legitimately requires many drawing, query, and execution operations. Some overlap among eval_autolisp, send_command, and run_accoreconsole_script, plus get_selection versus query_entities, keeps it from feeling fully tight.
The surface covers core CAD workflows: drawing primitives, dimensions, hatches, modification, layers, blocks, querying, export, and headless scripting. Minor gaps such as explicit new-drawing creation, undo/redo, and richer entity property editing can likely be handled through eval_autolisp or send_command.
Maintenance
Related MCP Connectors
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.
Headless CAD engine & MCP server for 2D/3D drafting, solids, DXF/SVG export, and automation.
Related MCP Servers
- AlicenseBqualityAmaintenanceProduction-grade AutoCAD automation server enabling real-time CAD control via COM and headless DXF operations through 87 tools, including drawing creation, entity modification, layer management, and batch processing, designed for AI agent integration via the Model Context Protocol.2435,506 PyPI297MIT
- AlicenseBqualityDmaintenanceEnables AI agents to drive AutoCAD 2024+ and AutoCAD LT through live COM and AutoLISP engines, with support for headless DXF processing, ISO GD&T, P&ID drafting, and Rhino.Inside Grasshopper battery workflows.162MIT
- AlicenseBqualityBmaintenanceEnables AI assistants to read, modify, and verify AutoCAD 2027 drawings using transactional, safety-checked CAD tools, with optional headless DXF/PNG/PDF drawing and preview when AutoCAD is unavailable.41MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to drive a live AutoCAD session over stdio with transactional, serialized writes: inspecting and saving documents, managing layers, creating and editing line/circle/arc/polyline/rectangle/text entities, querying selections, setting checkpoints, and exporting DXF. Every request is validated against strict schemas with document revision checks and save-reopen geometry readback, and a headless backend is available when no AutoCAD instance is running.MIT