auto-autocad-mcp
# auto-autocad-mcp
An **electrical shopdrawing workflow** MCP server and Agent Skill for AutoCAD: seat health,
xref repair, plot preflight, Drawing List extraction & code minting, A3 title-block /
project-frame sheets, sheet-set publish to a single grey PDF, layer and material takeoff
(XLSX / CSV / DWG / DXF), and drawing export.
It is a thin **FastMCP 3.x** server built over [`autocad-mcp-pro`](https://pypi.org/project/autocad-mcp-pro/).
On Windows it controls a **live AutoCAD seat** via COM; on other platforms (or when
`AUTOCAD_MCP_BACKEND=ezdxf`) it falls back to the headless **ezdxf** engine.
It is project-agnostic: every project-specific constant (code prefix, source layer, title-block
cell coordinates, plot style, material rules, even the server's name and tool-name prefix) is
loaded from a JSON **project profile**, so adapting to a new project is a config change rather
than a code change.
## Repository layout
| Component | Path |
|---|---|
| MCP server package (`auto_autocad`) | `auto_autocad/` |
| Pipeline Agent Skill & PDF verifier | `skills/auto-autocad-pipeline/` |
| Worked sample profile | `examples/sample.profile.json` |
| Offline test suite & live harness | `tests/` and `tests/live/` |
## Requirements
- **Python >= 3.11** and [`uv`](https://docs.astral.sh/uv/) (recommended).
- **Windows + full AutoCAD** (not AutoCAD LT) for live COM operations and multi-sheet PDF
publishing.
- `autocad-mcp-pro>=1.8.0,<1.9` (install with `[full]` extra for `openpyxl` XLSX export and
`pywin32` COM support).
> [!NOTE]
> **Headless `.dwg` read/write support:** Stock `autocad-mcp-pro` v1.8.0 on PyPI supports
> headless `.dxf` via `ezdxf` and headless `.dwg` conversion via the **ODA File Converter**.
> Headless `.dwg` export/read via AutoCAD's `accoreconsole.exe` requires the upstream fork/PR
> patch on top of `autocad-mcp-pro` v1.8.0; when running against stock PyPI `v1.8.0` without
> ODA File Converter, use `fmt="dxf"` or export on a live Windows AutoCAD COM seat.
## 1. Install
Run directly with `uvx` (once published), or install from this repository:
```powershell
# From PyPI
uvx --from auto-autocad-mcp auto-autocad-mcp
# Build and install local wheel
uv build
uv tool install dist\auto_autocad_mcp-0.4.0-py3-none-any.whl
```
For local development:
```powershell
pip install "autocad-mcp-pro[full]>=1.8.0,<1.9"
pip install -e .
```
## 2. Register the MCP server
Add to your MCP client config (Claude Code, Antigravity, Trae, Cursor, etc.):
```json
{
"mcpServers": {
"auto-autocad-mcp": {
"command": "auto-autocad-mcp",
"args": [],
"env": {
"AUTOCAD_MCP_BACKEND": "com",
"COM_CALL_TIMEOUT": "300",
"AUTO_AUTOCAD_PROFILE": "<absolute path to your auto-autocad.profile.json>"
}
}
}
}
```
If running via `uvx` without installing locally, set `"command": "uvx"` and
`"args": ["--from", "auto-autocad-mcp", "auto-autocad-mcp"]`.
`AUTO_AUTOCAD_PROFILE` is optional; if omitted, the built-in neutral profile (`auto_*` tools)
is used.
## 3. AutoCAD COM notes
When using the COM backend (`AUTOCAD_MCP_BACKEND=com`), start a full AutoCAD session first (or
leave `CAD_LAUNCH=auto`). Large shopdrawings open slower than the default timeout, so keep
`COM_CALL_TIMEOUT=300` (or higher).
During publish jobs, the modal `"Sheet Set Manager - DST File Not Found"` dialog is expected.
`auto_autocad/dialogs.py::KNOWN_DIALOGS` defines the exact whitelist of dialogs that may be
dismissed automatically; unknown dialogs are never clicked.
## 4. Project profile
Every project-specific setting comes from one JSON file; omitted keys fall back to neutral
built-in defaults. Resolution order (highest wins):
```text
tool argument (non-empty) > $AUTO_AUTOCAD_PROFILE > <working dir>/auto-autocad.profile.json > built-in default
```
Minimal example:
```json
{
"project": "My Building",
"codes": { "prefix": "MB1-SD-EL" },
"source": { "layer": "E-TEXT" },
"plot": { "style": "MB1.ctb" }
}
```
See [`examples/sample.profile.json`](examples/sample.profile.json) for a full template, or call
`auto_profile` from your MCP client to inspect the active merged profile.
## 5. Install the pipeline skill
The five-stage workflow lives in [`skills/auto-autocad-pipeline`](skills/auto-autocad-pipeline/SKILL.md)
(Agent Skills standard) and includes [`scripts/check_pdf.py`](skills/auto-autocad-pipeline/scripts/check_pdf.py)
for post-publish verification. Copy `skills/auto-autocad-pipeline` into your client's skills folder:
| Client | Skills directory |
|---|---|
| Antigravity | `<workspace-root>\.agents\skills\` |
| Claude Code | `.claude\skills\` |
| Trae | `.trae\skills\` |
## 6. Run & verify
```powershell
auto-autocad-mcp # STDIO (default)
python -m auto_autocad.server # STDIO, from checkout
auto-autocad-mcp --transport http --port 8010 # streamable HTTP
```
Verify any published shopdrawing PDF before delivering:
```powershell
python skills/auto-autocad-pipeline/scripts/check_pdf.py "<path-to-published.pdf>" --expect-pages <N>
```
Check that the page count matches the sheet count, `TOTAL NON-GREY OPS: 0`, bookmark order
matches the drawing list, and no `.bak` / `.ds$` / staging leftovers remain in the pack.
## Tests
```powershell
pytest tests -q
```
The offline suite runs against a scripted fake backend (no AutoCAD required). Live tests against
a running AutoCAD seat live in [`tests/live/`](tests/live/README.md).
## License
MIT — see [LICENSE](LICENSE).
TDQS
Scored across 12 tools
Most tools have clearly distinct purposes: seat health, xref repair, plot preflight, layer takeoff, material takeoff, sheet build/discover/set, and export are separable. The main overlaps are auto_drawing_list vs auto_source_list (both produce drawing indexes) and auto_sheet_discover vs auto_sheet_set with discover mode (both enumerate sheets), though descriptions explain the difference.
All names share an auto_ prefix and snake_case domain_action structure, which is predictable and readable. Minor inconsistency: some second tokens are verbs (build, discover, repair) while others are nouns (list, set, profile), but the pattern remains understandable.
Twelve tools is well within the appropriate range for a specialized AutoCAD automation server. Each tool maps to a distinct workflow stage (health, discovery, takeoff, build, publish, export), so none feels redundant.
The surface covers the core shopdrawing lifecycle: profile inspection, seat health, drawing/source indexes, sheet discovery/build/publish, xref repair, takeoffs, and export. Gaps include no explicit drawing open/close or layer/entity editing tools, but those may be outside the intended read/build/export scope.