Skip to content
Back to search

autocad-mcp

MCP server for AutoCAD LT v3.1: freehand AutoLISP execution, 8 consolidated tools, File IPC + ezdxf backends, focus-free dispatch, undo/redo, P&ID symbols, and robust IPC with ESC prefix and UTF-8 fallback. Companion agent skill: puran-water/autocad-drafting

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/puran-water/autocad-mcp with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/puran-water/autocad-mcp'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/puran-water--autocad-mcp/badge.svg)](/listings/puran-water--autocad-mcp)

HTML

<a href="/listings/puran-water--autocad-mcp"><img src="/api/listings/puran-water--autocad-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

1. Clone and install

git clone https://github.com/puran-water/autocad-mcp.git
cd autocad-mcp
uv sync

2. Load the LISP dispatcher in AutoCAD LT

Open AutoCAD LT and load `mcp_dispatch.lsp` using **APPLOAD**:

1. Type `APPLOAD` in the AutoCAD command line 2. Browse to `<repo>/lisp-code/mcp_dispatch.lsp` 3. Click **Load** 4. You should see: `=== MCP Dispatch v3.1 loaded ===` and `Ready 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 `command` must point to the **Windows Python** inside the project venv (not WSL python). - `AUTOCAD_MCP_BACKEND` can be `auto` (default — tries File IPC, falls back to ezdxf), `file_ipc` (requires AutoCAD), or `ezdxf` (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.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 442 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # AutoCAD MCP Server
  2. ## PuranOS role and current scope
  3. This is an active drawing-automation integration used alongside the PuranOS engineering workflow. AutoCAD LT and headless DXF are distinct backends with the platform requirements below. The current guarded revision helpers operate on an explicitly identified working drawing; engineering basis, canonical equipment records and release decisions live in the wider workflow.
  4. [Sizing-to-balance, proposals and BEPs](https://github.com/puran-water/PuranOS-public/blob/main/docs/workflows.md) produce the engineering basis. [PuranOS Studio](https://github.com/puran-water/PuranOS-public/blob/main/docs/studio.md) presents retained review publications. Neither a successful CAD command nor a screenshot approves a design. This repository is maintained separately from the six-server public calculation mirror.
  5. Built by [Puran Water](https://puranwater.com/) · [Discuss engineering or a drawing workflow](https://puranwater.com/contact/).
  6. MCP server for AutoCAD LT automation and headless DXF generation.
  7. Two backends, one API:
  8. | Backend | Runtime | Requires AutoCAD? | Screenshot |
  9. |---------|---------|-------------------|------------|
  10. | **File IPC** | Windows Python | Yes — AutoCAD LT 2024+ (Windows) | Win32 PrintWindow |
  11. | **ezdxf** | Any platform | No (headless) | matplotlib render |
  12. 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.
  13. ## Prerequisites (File IPC backend)
  14. - **Windows 10/11** (the File IPC backend uses Win32 APIs for focus-free window messaging)
  15. - **AutoCAD LT 2024 or newer** — AutoLISP support was added in LT 2024 for Windows. AutoCAD LT for Mac exists but does **not** support AutoLISP.
  16. - **Python 3.10+** (Windows native — not WSL Python)
  17. - **uv** package manager ([install guide](https://docs.astral.sh/uv/getting-started/installation/))
  18. > The ezdxf headless backend works on any platform (Linux, macOS, WSL) for offline DXF generation without AutoCAD installed.
  19. ## Quick Start
  20. ### 1. Clone and install
  21. ```powershell
  22. git clone https://github.com/puran-water/autocad-mcp.git
  23. cd autocad-mcp
  24. uv sync
  25. ```
  26. ### 2. Use an isolated document job
  27. The native backend uses a resident AutoLISP file queue. It does not type each command
  28. or steal foreground focus. Load the Python and Lisp files from the same
  29. build; `system.runtime` reports the exact loaded/disk hashes and qualification.
  30. A build without a matching `native-qualification.json` reports `different_build` or
  31. `unqualified`: qualify it on a disposable drawing ([queue workflow](docs/queue-workflow.md))
  32. before production use. Automatic document switching and DXF transitions are not supported.
  33. From WSL, `scripts/run-native-wsl.py` starts
  34. `%USERPROFILE%\mcp-servers\autocad-mcp\run-native-ready.cmd`, which calls a
  35. `run-native.cmd` you place beside it to start the Windows server.
  36. Start MCP first, then use `system` with `operation="job"`:
  37. ```json
  38. {"action":"launch","drawing":"C:/work/revision.dwg",
  39. "ipc_dir":"C:/work/ipc-job-001",
  40. "executable":"C:/Program Files/Autodesk/AutoCAD LT 2027/acadlt.exe"}
  41. ```
  42. The drawing must be an existing writable working copy, not already open. The IPC
  43. directory must be new. The launcher starts a separate process with a startup script;
  44. it never switches documents in an AutoCAD process you already have open. Poll `action="observe"`
  45. with `path="<ipc_dir>/job.json"`, then `action="attach"` when the native
  46. worker is idle. The record is `<ipc_dir>/job.json`. A second MCP process can explicitly
  47. attach to this same job after a server restart. Do not launch a second copy on timeout.
  48. Missing fonts or other startup dialogs are reported for deliberate resolution.
  49. For a drawing already open in your own session, `system.worker prepare` can produce a one-use
  50. bootstrap SCRIPT. This is a deliberate handoff, not an automatic keyboard fallback.
  51. Keep one authoritative working DWG and reconcile unsaved changes before choosing
  52. between an existing document and a new process.
  53. ### 3. Configure your MCP client
  54. Add to your MCP client configuration (e.g. Claude Desktop `claude_desktop_config.json`):
  55. ```json
  56. {
  57. "mcpServers": {
  58. "autocad-mcp": {
  59. "command": "C:\\path\\to\\autocad-mcp\\.venv\\Scripts\\python.exe",
  60. "args": ["-m", "autocad_mcp"],
  61. "env": { "AUTOCAD_MCP_BACKEND": "file_ipc" }
  62. }
  63. }
  64. }
  65. ```
  66. **Key points:**
  67. - The `command` must point to the **Windows Python** inside the project venv (not WSL python).
  68. - `AUTOCAD_MCP_BACKEND` can be `auto` (default — tries File IPC, falls back to ezdxf), `file_ipc` (requires AutoCAD), or `ezdxf` (headless only).
  69. #### Running from WSL
  70. 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:
  71. ```json
  72. {
  73. "mcpServers": {
  74. "autocad-mcp": {
  75. "type": "stdio",
  76. "command": "cmd.exe",
  77. "args": ["/d", "/s", "/c", "cd /d C:\\path\\to\\autocad-mcp && set AUTOCAD_MCP_BACKEND=file_ipc&& .venv\\Scripts\\python.exe -m autocad_mcp"]
  78. }
  79. }
  80. }
  81. ```
  82. ### 4. Verify
  83. From your MCP client, call:
  84. ```
  85. system(operation="status")
  86. ```
  87. You should see `backend: "file_ipc"` if AutoCAD is running, or `backend: "ezdxf"` for headless mode.
  88. For native DWG work, require `file_ipc`; the examples above disable headless fallback.
  89. Verify `DWGNAME`, `DWGPREFIX`, `CTAB` and `DBMOD` with `drawing.get_variables`, then
  90. inspect a screenshot before editing. `status` alone does not identify the active DWG.
  91. Use a Windows-local working copy if Windows cannot access a WSL UNC path, and copy
  92. saved deliverables back explicitly. Never use `drawing.create` to make a working copy:
  93. it erases and purges the active drawing.
  94. ## Journaled native revisions
  95. `system(operation="revision", data={"action": "read", "drawing": "C:/work/copy.dwg",
  96. "handles": ["ABCD"]})` reads native entities. The revision adapter supports bounded
  97. exports, layout frames, guarded edits, plotting and AutoCAD 2010 saves. Each mutation
  98. batch has 1–7 operations, a unique journal path, expected document identity and old
  99. entity values. Receipts retain before/after state and created handles. Read the
  100. [operation reference and recovery procedure](docs-revision.md) before use.
  101. Revision clouds can follow an orthogonal route instead of enclosing unrelated labels:
  102. ```json
  103. {
  104. "action": "batch",
  105. "drawing": "C:/work/copy.dwg",
  106. "id": "route-cloud-01",
  107. "journal": "C:/work/route-cloud-01.json",
  108. "operations": [{
  109. "kind": "cloud", "item": "approved-change-42",
  110. "space": "Model", "layer": "REV-01",
  111. "points": [[0,0], [8,0], [8,2], [2,2], [2,8], [0,8]],
  112. "arc": 0.4, "text_height": 0.3, "revision": "01",
  113. "marker_position": [10,3]
  114. }]
  115. }
  116. ```
  117. Create the revision layer first. Pass this object to `system` with `operation="revision"`.
  118. For the Windows CLI, save the object as `request.json` (the extra `action` is ignored):
  119. ```powershell
  120. python -m autocad_mcp.revision batch request.json --output receipt.json
  121. ```
  122. An existing MCP session can use the updated helper through `execute_lisp` without
  123. acquiring a new tool schema: replace `action` with `operation` in the request, then
  124. compile on WSL and submit the resulting expression as `data.code`:
  125. ```bash
  126. python -m autocad_mcp.revision compile request.json \
  127. --lisp-path C:/path/to/autocad-mcp/lisp-code/revision_tools.lsp --output batch.lsp
  128. ```
  129. Keep the Python compiler and Windows LISP helper at the same repository revision.
  130. In worker mode, `revision.save` and `drawing.save` preserve the existing on-disk DWG
  131. format by default (AC1024, AC1027 or AC1032); an explicit format is verified afterward.
  132. `revision.checkpoint` takes a new `path`, saves in place, then atomically copies and
  133. hashes the saved bytes without changing the active document. Existing recovery files
  134. are never overwritten. A copy error after a successful save reports that distinction.
  135. Explicit Save As uses a guarded same-document worker handoff; automatic OPEN and DXF
  136. transitions remain disabled. Do not infer their safety from a successful save.
  137. Guarded revision patches can set an entity's linetype (DXF 6) and linetype scale
  138. (DXF 48), for example electrical signal lines in a P&ID. The linetype must already
  139. be loaded, or be ByLayer/ByBlock; the scale must be finite and positive. Old-value
  140. checks apply to both fields. Inspect the native pattern at the intended plot scale.
  141. For repeated instrument labels, an `attributes` operation updates up to 16 attributes
  142. on one existing block. Supply the changed `attributes` and their `expected_attributes`;
  143. native preflight checks unique tags, old values and unlocked layers before the batch
  144. starts. This groups function/loop/alarm changes while retaining the seven-operation
  145. batch limit, before/after receipts and screenshot review. It does not infer loop identities.
  146. Use the guarded `rotate` revision operation to turn an existing planar block and its
  147. attributes together about its insertion point. `target` is an absolute angle in radians;
  148. include the expected insertion point (DXF 10), rotation (50) and normal (210), in addition
  149. to type, owner and layer. This supports upright instrument lettering without recreating
  150. each attribute. Recheck process/signal attachments: arbitrary equipment rotation can move
  151. its ports. Old-value failures now identify the handle, DXF field and conflicting values.
  152. Inspect native readback and a screenshot after every batch; save checkpoints between
  153. sheets. Journals are evidence, not automatic rollback. Serialize desktop clients and
  154. human edits. On timeout, reconcile the pending receipt and actual drawing before any
  155. retry; newer clients hold dispatch until explicit acknowledgement. Older running
  156. clients need reconnecting to acquire the process lease and new operation schema.
  157. ### Consistent symbols, crossing gaps and layers
  158. `autocad_mcp.symbol_normalization.scale_with_connections(symbol, entities, target,
  159. ports, item=..., anchor=...)` plans a bounded resize from qualified block-local XY
  160. ports. It preserves rotation and mirror signs, matches LINE/open straight-polyline
  161. endpoints, and refuses a resize that would turn an orthogonal connection diagonal.
  162. The optional local anchor keeps that point fixed and retains attribute lettering
  163. through a transform patch. Review unmatched ports, junctions and lettering yourself;
  164. the planner does not infer equipment families or reroute a network. Its return value
  165. contains `operations` and the before/after port matches. Supply fresh native entities.
  166. For CTO symbols, inspect the installed DWG definition's units, base point and real
  167. process ports before choosing target scale. Equal insertion factors across unrelated
  168. definitions are not equal visible sizes. Keep proprietary CTO artwork outside this
  169. repository. Normalize legend samples with the adopted symbol families.
  170. `spline-gap` removes a short, explicitly selected interior interval of an open SPLINE.
  171. Supply its full `expected_dxf` and two ordered 3D `gap` points on the curve. The helper
  172. uses `command-s` inside the guarded call and verifies both resulting spline endpoints.
  173. Use this for an embedded crossing jumper only after identifying the true crossing;
  174. retain hose curvature elsewhere. A non-erase batch operation returning no handles now
  175. fails with `MUTATION_RETURNED_NO_HANDLES` rather than claiming an empty success.
  176. `rename_layers` accepts `drawing`, a new `journal` path, and 1–7 `pairs` of old/new
  177. names. It preflights all names, preserves layer objects, compares all recorded layer
  178. properties except name/ename, and records each rename. It does not merge layers or
  179. change entity overrides. Update cached entity layers before planning another edit.
  180. Layer `0` and `Defpoints` are reserved. Example compiler request:
  181. ```json
  182. {"operation":"rename_layers","drawing":"C:/work/copy.dwg",
  183. "journal":"C:/work/layers-01.json","pairs":[["Process","P-PIPE-MAIN"]]}
  184. ```
  185. These operations were used in a native AutoCAD LT 2027 P&ID revision with bounded
  186. readback and viewport review; no automated test suite was run for this change.
  187. Refresh the actual view after a zoom before capturing it: `ZoomCenter` using the
  188. current `VIEWCTR`/`VIEWSIZE` resolved stale screenshot frames where Regen alone did
  189. not. Cloud replacement must account for the boundary, triangle and revision text
  190. handles returned by its receipt.
  191. The reusable `expected_state` helper preserves the first DXF value when codes repeat.
  192. `cloud_covers_bounds` checks an entire target rectangle against a cloud polygon,
  193. including its concave cutouts; bounding-box overlap alone is insufficient.
  194. For layer cleanup or matching new piping to an existing run, a guarded `patch` can
  195. set colour (DXF 62), layer (8), and lineweight (370). Include their actual old values
  196. in `expect`; use `null` only when the native DXF group is absent. For example,
  197. `"set": {"62": 221, "370": 13}` sets colour 221 and 0.13 mm lineweight. Read the
  198. source run and its layer first: assigning ByLayer can change the plotted appearance.
  199. The adapter validates the standard lineweight values, but does not decide the
  200. engineering role, crossing priority, plot-style overrides or approved house weights.
  201. ## Tools
  202. ### `drawing` — File/drawing management
  203. | Operation | Description | File IPC | ezdxf |
  204. |-----------|-------------|----------|-------|
  205. | `create` | Reset to clean drawing (erase all + purge) | Yes | Yes |
  206. | `open` | Open an existing drawing | Yes | Yes (DXF) |
  207. | `info` | Get entity count and layers | Yes | Yes |
  208. | `save` | Save current drawing (to path if given) | Yes | Yes |
  209. | `save_as_dxf` | Export as DXF | Yes | Yes |
  210. | `plot_pdf` | Plot to PDF | Yes | No |
  211. | `purge` | Purge unused objects | Yes | Yes |
  212. | `get_variables` | Get system variables by name | Yes | Yes |
  213. | `undo` | Undo last operation | Yes | No |
  214. | `redo` | Redo last undone operation | Yes | No |
  215. ### `entity` — Entity CRUD + modification
  216. **Create:** `create_line`, `create_circle`, `create_polyline`, `create_rectangle`, `create_arc`, `create_ellipse`, `create_mtext`, `create_hatch`
  217. **Read:** `list`, `count`, `get`
  218. **Modify:** `copy`, `move`, `rotate`, `scale`, `mirror`, `offset`\*, `array`, `fillet`\*, `chamfer`\*, `erase`
  219. > \* `offset`, `fillet`, `chamfer` are File IPC only (not supported in ezdxf headless backend).
  220. ### `layer` — Layer management
  221. `list`, `create`, `set_current`, `set_properties`, `freeze`, `thaw`, `lock`, `unlock`
  222. ### `block` — Block operations
  223. | Operation | File IPC | ezdxf |
  224. |-----------|----------|-------|
  225. | `list` | Yes | Yes |
  226. | `insert` | Yes | Yes |
  227. | `insert_with_attributes` | Yes | Yes |
  228. | `get_attributes` | Yes | Yes |
  229. | `update_attribute` | Yes | Yes |
  230. | `define` | No | Yes |
  231. ### `annotation` — Text, dimensions, leaders
  232. `create_text`, `create_dimension_linear`, `create_dimension_aligned`, `create_dimension_angular`, `create_dimension_radius`, `create_leader`
  233. ### `pid` — P&ID operations (CTO symbol library)
  234. `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`
  235. > P&ID symbol insertion requires the [CAD Tools Online](https://www.cadtoolsonline.com/) (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.
  236. ### `view` — Viewport and screenshot
  237. | Operation | Description |
  238. |-----------|-------------|
  239. | `zoom_extents` | Zoom to show all entities |
  240. | `zoom_window` | Zoom to a specified window |
  241. | `get_screenshot` | Capture current AutoCAD view as PNG |
  242. Screenshots use `PrintWindow` (Win32) for the File IPC backend — works even when AutoCAD is minimized or in the background. The ezdxf backend renders via matplotlib.
  243. ### `system` — Server management
  244. `status`, `health`, `get_backend`, `runtime`, `init`, `execute_lisp`
  245. > `execute_lisp` runs arbitrary AutoLISP code (File IPC only). Pass `data: {code: "(+ 1 2)"}`. This turns the server into an extensible automation platform — any valid AutoLISP expression can be executed.
  246. ## Architecture
  247. ```
  248. MCP Client (Claude)
  249. │ stdio (JSON-RPC)
  250. ▼
  251. Python MCP Server (autocad_mcp)
  252. │
  253. ├── File IPC Backend ──► C:/temp/*.json ──► mcp_dispatch.lsp (AutoCAD LT)
  254. │ PostMessageW(WM_CHAR) to MDIClient — no focus steal
  255. │
  256. └── ezdxf Backend ──► in-memory DXF (headless, no AutoCAD needed)
  257. ```
  258. The File IPC backend sends keystrokes to AutoCAD's MDIClient window via `PostMessageW(WM_CHAR)`, invoking `(mcp-dispatch-v2 "<request-id>")` for one specific request. The target is rediscovered and validated on each dispatch, and Windows delivery errors are reported. This approach does **not** steal window focus — you can continue working in other applications while automation runs.
  259. ## Environment Variables
  260. | Variable | Default | Description |
  261. |----------|---------|-------------|
  262. | `AUTOCAD_MCP_BACKEND` | `auto` | Backend selection: `auto`, `file_ipc`, `ezdxf` |
  263. | `AUTOCAD_MCP_IPC_DIR` | `C:/temp` | Directory for IPC command/result JSON files (must match on both Python and LISP sides) |
  264. | `AUTOCAD_MCP_IPC_TIMEOUT` | `30.0` | IPC command timeout in seconds (1-300) |
  265. | `AUTOCAD_MCP_IPC_LONG_TIMEOUT` | `120.0` | Timeout for `execute_lisp` and plotting (up to 600) |
  266. | `AUTOCAD_MCP_AUTOLOAD` | `1` | Load `mcp_dispatch.lsp` in the active document before its first v2 request (`0` requires manual preload) |
  267. | `AUTOCAD_MCP_ONLY_TEXT` | `false` | Disable screenshot capture (text feedback only) |
  268. > **Note:** If you change `AUTOCAD_MCP_IPC_DIR`, you must also update the `*mcp-ipc-dir*` variable in `mcp_dispatch.lsp` to match.
  269. ## Development
  270. ```powershell
  271. uv sync
  272. uv run pytest tests/ -v
  273. ```
  274. ## AutoCAD LT AutoLISP Compatibility
  275. AutoLISP was added to AutoCAD LT in the **2024 release (Windows only)**. AutoCAD LT for Mac does not support AutoLISP.
  276. | Supported (LT 2024+ Windows) | Not Supported |
  277. |-------------------------------|---------------|
  278. | `.lsp` / `.fas` / `.vlx` / `.dcl` | VLIDE (Visual LISP IDE) |
  279. | Supported `vl-*` and selected `vla-*`/`vlax-*` functions | Full ActiveX/COM API parity |
  280. | File I/O (`open`, `read-line`, etc.) | Express Tools |
  281. | Entity access (`entget`, `entmod`, etc.) | 3D operations |
  282. | Selection sets | AutoLISP on Mac |
  283. The revision helper was exercised in Windows AutoCAD LT 2027. It uses selected
  284. `vla-*`/`vlax-*` functions available inside that runtime; this does not imply support
  285. for the complete ActiveX API or external COM automation. Qualify required operations
  286. on a disposable drawing for other releases.
  287. After a document switch, a stale cached command window can prevent command pickup.
  288. Inspect the desktop and pending receipts first. If the command was never picked up
  289. and no mutation occurred, `system(operation="init")` refreshes the connection; verify
  290. the active drawing again before resuming. Do not use reinitialization to bypass an
  291. uncertain completion hold.
  292. ## What's New in v3.1
  293. - **`execute_lisp`** — Run arbitrary AutoLISP code via temp file pattern. Turns the server from a fixed command set into an extensible automation platform.
  294. - **Undo / Redo** — Single-step undo and redo via `drawing` tool.
  295. - **Drawing open** — Open existing `.dwg` files programmatically (FILEDIA suppressed).
  296. - **Drawing create** — Now resets current drawing (erase all + purge) instead of `_.NEW`, preserving the LISP dispatcher namespace.
  297. - **Drawing save with path** — `save` with a `path` parameter uses SAVEAS; without path uses QSAVE.
  298. - **`get_variables` fix** — Respects the `names` parameter; returns requested variables with proper type handling.
  299. - **Polyline/leader fix** — Point arrays properly encoded via semicolon-delimited format.
  300. - **ESC prefix** — Sends 2x ESC before each dispatch to cancel stale pending commands from prior timeouts.
  301. - **UTF-8/cp1252 fallback** — Handles non-ASCII characters in LISP result files (AutoCAD writes Windows-1252).
  302. - **Configurable IPC timeout** — `AUTOCAD_MCP_IPC_TIMEOUT` env var (1–300 seconds, default 30); `execute_lisp` and plotting use `AUTOCAD_MCP_IPC_LONG_TIMEOUT` (default 120).
  303. - **Dispatcher autoload** — `mcp_dispatch.lsp` is loaded per drawing. The v2 trigger loads it before dispatch in a document that lacks protocol 2. There is no automatic second trigger or command replay. Disable with `AUTOCAD_MCP_AUTOLOAD=0`.
  304. - **Thread-safe backend init** — `asyncio.Lock` prevents parallel initialization races.
  305. ### File IPC v2 recovery
  306. Deploy `src/autocad_mcp` and `lisp-code/mcp_dispatch.lsp` together and restart the
  307. Python MCP process. V2 uses `pcad-v2-<id>.ready.json`, `.claimed.json`,
  308. `.cancelled.json` and `.result.json`; legacy wildcard dispatchers cannot consume
  309. these files. AutoLISP claims by same-directory rename **before reading**. Python
  310. can instead rename ready to cancelled. Only the winning rename authorizes execution.
  311. A delayed trigger names its old ID and cannot run a newer request.
  312. `pcad-pending.json` fences subsequent clients until completion or reconciliation.
  313. On `IPC_NOT_PICKED_UP_CANCELLED`, stop edits and inspect `system.desktop` and its
  314. screenshot. `cancelled_before_claim: true` is verifiable non-execution evidence;
  315. `system.acknowledge` with the exact ID can preserve it and release the fence.
  316. It does not automatically resend a request or clear partially typed input. If the
  317. claim exists, reconcile native handles and the matching late result before
  318. acknowledgement. Missing files alone are never evidence of non-execution.
  319. Legacy pending markers still need explicit recovery; their old read/delete protocol
  320. cannot supply a v2 cancellation proof. Retain them with the recovery record.
  321. Windows process launch failures from WSL (`UtilAcceptVsock ... accept4 failed 110`)
  322. are a different transport layer. Preserve the pending receipt and check interop and
  323. kernel logs; do not use AutoCAD retries to diagnose WSL. See `docs/ipc-v2.md` for
  324. protocol invariants, deployment/rollback and qualification status.
  325. ## Reliable execution
  326. Bounded edit/readback/screenshot batches and automatic recovery saves are execution
  327. checks, not review gates.
  328. Keep one Windows MCP process alive for the job. `system.job launch/attach/close`
  329. runs on Windows without additional WSL process launches. `close` saves first and
  330. requires a stopped worker and DBMOD=0. It never discards unsaved changes or kills an
  331. unrelated AutoCAD process. `system.worker renew` renews the same document at a safe
  332. boundary. Request uncertainty stops mutations; no timeout is automatically replayed.
  333. The [queue workflow](docs/queue-workflow.md) documents qualification and operational
  334. limits. Earlier keyboard-trigger qualification in `docs/ipc-v2.md` is historical;
  335. it does not qualify the current worker build.
  336. ## License
  337. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.