Skip to main content
Glama
CadMcp.Server

CadMcp.Server

by woodystory
README.md
# CAD-MCP for AutoCAD

> 中文文档: [README.zh-CN.md](README.zh-CN.md)

Drive desktop AutoCAD from any MCP host (WorkBuddy, Claude, Codex, VS Code, and
other MCP clients) — query drawings, create and modify entities, run batch edits
with precise per-handle rollback, and extract device lists from layouts.

> **Official sources**: this GitHub repository is the upstream. The
> [Gitee repository](https://gitee.com/woodystory/cad-mcp-for-autocad) is the official
> mirror (code and release assets synced). Any same-named repository or installer
> found elsewhere is not published by the maintainer.

**Status**: v1.0.0 — first public release. Read path (C-family) and write path
(B-family batch editing with precise per-handle rollback) are both complete and
verified: 187 automated tests, real-machine acceptance on AutoCAD
2025/2026/2027, 151-op batch rollback with zero residue.

## Architecture

Three stages, one direction of dependency:

```text
┌──────────────────────────┐
│ MCP host (LLM)           │  WorkBuddy / Claude / any MCP client
└────────────┬─────────────┘
             │ MCP protocol (stdio)
┌────────────▼─────────────┐
│ CadMcp.Server            │  56-tool catalog + validation gates
│  (this repo, net8.0)     │
└────────────┬─────────────┘
             │ Named Pipes, JSON envelope per command
┌────────────▼─────────────┐
│ CadMcp.Bridge            │  nine-step pipeline inside AutoCAD
│  (loaded by AutoCAD)     │  parse → auth → gates → dispatch → execute → receipt
└────────────┬─────────────┘
             │ AutoCAD .NET API (acdbmgd, main-thread only)
┌────────────▼─────────────┐
│ AutoCAD 2025/2026/2027   │  user's licensed installation
└──────────────────────────┘
```

Details in [docs/en/ARCHITECTURE.md](docs/en/ARCHITECTURE.md).

## Supported AutoCAD versions

| AutoCAD | Shell | Bundle component |
|---|---|---|
| 2025 | `acad25.dll` (acmgd 25.0) | `CadMcpAcad25` |
| 2026 | `acad26.dll` (acmgd 25.1) | `CadMcpAcad26` |
| 2027 | `acad27.dll` (acmgd 26.0) | `CadMcpAcad27` |

One bundle ships all three shells; each AutoCAD year loads its own.

## Installation

> **Just want to use it? No code needed.**
> Follow **[docs/en/MANUAL-INSTALL.md](docs/en/MANUAL-INSTALL.md)** — per-host guides
> with screenshots for WorkBuddy, Doubao Work, TraeWork, and QwenWork, ~2 min each.

Details for contributors below. In short:

1. Download the release zip (checksums provided) and unzip to a space-free path
2. Add a custom MCP connector in your host pointing at `server\CadMcp.Server.exe`
3. Start AutoCAD — the plug-in bundle deploys and auto-loads on first connector
   registration (trust paths are written automatically when AutoCAD is closed)

## Building from source

```bash
dotnet build src/CadMcp.Server      # server (net8.0, no AutoCAD references)
dotnet test tests/CadMcp.Tests      # 187 tests, no AutoCAD needed

# shells need the local AutoCAD SDK:
dotnet build shells/acad26 -p:AcadCADDir="C:\Program Files\Autodesk\AutoCAD 2026"
```

See [docs/en/ARCHITECTURE.md](docs/en/ARCHITECTURE.md) for the module map and
[docs/en/TESTING.md](docs/en/TESTING.md) for the test layout.

## Repository layout

| Path | Content |
|---|---|
| `src/` | CadMcp.Server / CadMcp.Bridge / CadMcp.Shared (net8.0) |
| `shells/` | AutoCAD plug-in shells, one per year (acad25/26/27) |
| `tests/` | xUnit suite (187 tests) + D4Harness real-machine acceptance tool |
| `docs/` | Architecture, installation guide, testing, changelog, trademark notes |
| `contract/` | Wire-protocol schema (JSON envelope) |
| `scripts/` | Packaging and VM verification scripts |
| `installer/` | (reserved) future installer |

## Trademark notice

AutoCAD is a trademark of the Autodesk group of companies. CAD-MCP is not
affiliated with, endorsed, or sponsored by Autodesk. See
[docs/en/TRADEMARK-NOTES.md](docs/en/TRADEMARK-NOTES.md).

## License

Apache-2.0 — see [LICENSE](LICENSE).

## Feedback

GitHub Issues, or email `woody0123@126.com`.