# u-c4n/autocad-mcp architecture

> Architecture diagram of the GitHub repository u-c4n/autocad-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/u-c4n/autocad-mcp
- Repository: https://github.com/u-c4n/autocad-mcp

## Overview

AutoCAD MCP Pro exposes drawing, analysis and engineering tools to AI agents through an MCP server. The main workflow is a tool call against a drawing, executed through a shared backend contract by live AutoCAD COM or headless ezdxf, then returned as drawing data or an engineering result. Major branches include drawing understanding and takeoff, discipline-specific design, and QA/verification; durable history, checkpoints, security and constrained access support operation. Several domain modules are unsampled, so their links are shown only where the README documents the capability or the source index supports the reference.

Main entry points: [`server.py`](https://github.com/u-c4n/autocad-mcp/blob/main/server.py) (MCP server), [`backends/base.py`](https://github.com/u-c4n/autocad-mcp/blob/main/backends/base.py) (Backend contract), [`engineering/understand`](https://github.com/u-c4n/autocad-mcp/tree/main/engineering/understand) (Understand drawing), [`engineering/mech`](https://github.com/u-c4n/autocad-mcp/tree/main/engineering/mech) (Mechanical tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["MCP interface"]
  node_server["MCP server<br/>[server.py]"]
  node_discovery["Tool discovery<br/>[transform.py]"]
end

subgraph group_backends["Drawing engines"]
  node_contract["Backend contract<br/>[base.py]"]
  node_com["Live AutoCAD<br/>[com_backend.py]"]
  node_ezdxf["Headless DXF<br/>[ezdxf_backend.py]"]
end

subgraph group_analysis["Drawing analysis"]
  node_snapshot["Drawing snapshot<br/>[snapshot.py]"]
  node_understand["Understand drawing"]
  node_takeoff["Pipe takeoff<br/>[takeoff.py]"]
end

subgraph group_engineering["Engineering design"]
  node_architecture["Architecture tools"]
  node_mechanical["Mechanical tools"]
  node_partfeatures["Part features<br/>[features.py]"]
  node_pid["P&amp;ID tools"]
  node_router["Line router<br/>[router.py]"]
end

subgraph group_trust["Quality and state"]
  node_changes["Change previews<br/>[preview.py]"]
  node_verification["Artifact verification<br/>[artifact.py]"]
  node_qa["Critique and QA<br/>[critique.py]"]
  node_history[("Journal and checkpoints<br/>[checkpoints.py]")]
  node_security["Policy and security<br/>[security.py]"]
  node_metrics["Session metrics<br/>[session_metrics.py]"]
end

node_agent(("AI agent"))

node_agent -->|"calls tools"| node_server
node_server -->|"lists tools"| node_discovery
node_server -.->|"dispatches drawing calls"| node_contract
node_contract -->|"implemented by"| node_com
node_contract -->|"implemented by"| node_ezdxf
node_server -->|"offers analysis"| node_understand
node_snapshot -->|"feeds analysis"| node_understand
node_understand -->|"supports takeoff"| node_takeoff
node_server -->|"offers design tools"| node_architecture
node_server -->|"offers part tools"| node_mechanical
node_mechanical -->|"uses features"| node_partfeatures
node_server -->|"offers P&amp;ID tools"| node_pid
node_pid -->|"routes lines"| node_router
node_server -->|"previews edits"| node_changes
node_server -->|"verifies saved artifacts"| node_verification
node_server -->|"reports QA"| node_qa
node_server -->|"exposes drawing history"| node_history
node_server -->|"enforces restrictions"| node_security
node_server -.->|"records calls"| node_metrics

click node_server "https://github.com/u-c4n/autocad-mcp/blob/main/server.py"
click node_discovery "https://github.com/u-c4n/autocad-mcp/blob/main/discovery/transform.py"
click node_contract "https://github.com/u-c4n/autocad-mcp/blob/main/backends/base.py"
click node_com "https://github.com/u-c4n/autocad-mcp/blob/main/backends/com_backend.py"
click node_ezdxf "https://github.com/u-c4n/autocad-mcp/blob/main/backends/ezdxf_backend.py"
click node_snapshot "https://github.com/u-c4n/autocad-mcp/blob/main/engineering/understand/snapshot.py"
click node_understand "https://github.com/u-c4n/autocad-mcp/tree/main/engineering/understand"
click node_takeoff "https://github.com/u-c4n/autocad-mcp/blob/main/engineering/understand/takeoff.py"
click node_architecture "https://github.com/u-c4n/autocad-mcp/tree/main/engineering/arch"
click node_mechanical "https://github.com/u-c4n/autocad-mcp/tree/main/engineering/mech"
click node_partfeatures "https://github.com/u-c4n/autocad-mcp/blob/main/engineering/mech/features.py"
click node_pid "https://github.com/u-c4n/autocad-mcp/tree/main/engineering/pid"
click node_router "https://github.com/u-c4n/autocad-mcp/blob/main/engineering/pid/router.py"
click node_changes "https://github.com/u-c4n/autocad-mcp/blob/main/engineering/changes/preview.py"
click node_verification "https://github.com/u-c4n/autocad-mcp/blob/main/engineering/verification/artifact.py"
click node_qa "https://github.com/u-c4n/autocad-mcp/blob/main/engineering/critique.py"
click node_history "https://github.com/u-c4n/autocad-mcp/blob/main/backends/checkpoints.py"
click node_security "https://github.com/u-c4n/autocad-mcp/blob/main/security.py"
click node_metrics "https://github.com/u-c4n/autocad-mcp/blob/main/backends/session_metrics.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_discovery toneBlue
class node_contract,node_com,node_ezdxf toneAmber
class node_snapshot,node_understand,node_takeoff toneMint
class node_architecture,node_mechanical,node_partfeatures,node_pid,node_router toneRose
class node_changes,node_verification,node_qa,node_history,node_security,node_metrics,node_agent toneIndigo
```

## Components

### MCP interface

- [MCP server](https://github.com/u-c4n/autocad-mcp/blob/main/server.py): `server.py`
- [Tool discovery](https://github.com/u-c4n/autocad-mcp/blob/main/discovery/transform.py): `discovery/transform.py`

### Drawing engines

- [Backend contract](https://github.com/u-c4n/autocad-mcp/blob/main/backends/base.py): `backends/base.py`
- [Live AutoCAD](https://github.com/u-c4n/autocad-mcp/blob/main/backends/com_backend.py): `backends/com_backend.py`
- [Headless DXF](https://github.com/u-c4n/autocad-mcp/blob/main/backends/ezdxf_backend.py): `backends/ezdxf_backend.py`

### Drawing analysis

- [Drawing snapshot](https://github.com/u-c4n/autocad-mcp/blob/main/engineering/understand/snapshot.py): `engineering/understand/snapshot.py`
- [Understand drawing](https://github.com/u-c4n/autocad-mcp/tree/main/engineering/understand): `engineering/understand`
- [Pipe takeoff](https://github.com/u-c4n/autocad-mcp/blob/main/engineering/understand/takeoff.py): `engineering/understand/takeoff.py`

### Engineering design

- [Architecture tools](https://github.com/u-c4n/autocad-mcp/tree/main/engineering/arch): `engineering/arch`
- [Mechanical tools](https://github.com/u-c4n/autocad-mcp/tree/main/engineering/mech): `engineering/mech`
- [Part features](https://github.com/u-c4n/autocad-mcp/blob/main/engineering/mech/features.py): `engineering/mech/features.py`
- [P&ID tools](https://github.com/u-c4n/autocad-mcp/tree/main/engineering/pid): `engineering/pid`
- [Line router](https://github.com/u-c4n/autocad-mcp/blob/main/engineering/pid/router.py): `engineering/pid/router.py`

### Quality and state

- [Change previews](https://github.com/u-c4n/autocad-mcp/blob/main/engineering/changes/preview.py): `engineering/changes/preview.py`
- [Artifact verification](https://github.com/u-c4n/autocad-mcp/blob/main/engineering/verification/artifact.py): `engineering/verification/artifact.py`
- [Critique and QA](https://github.com/u-c4n/autocad-mcp/blob/main/engineering/critique.py): `engineering/critique.py`
- [Journal and checkpoints](https://github.com/u-c4n/autocad-mcp/blob/main/backends/checkpoints.py): `backends/checkpoints.py`
- [Policy and security](https://github.com/u-c4n/autocad-mcp/blob/main/security.py): `security.py`
- [Session metrics](https://github.com/u-c4n/autocad-mcp/blob/main/backends/session_metrics.py): `backends/session_metrics.py`

### Other components

- **AI agent**

## Connections

- AI agent → MCP server: calls tools
- MCP server → Tool discovery: lists tools
- MCP server → Backend contract: dispatches drawing calls
- Backend contract → Live AutoCAD: implemented by (evidence: `backends/com_backend.py`)
- Backend contract → Headless DXF: implemented by
- MCP server → Understand drawing: offers analysis
- Drawing snapshot → Understand drawing: feeds analysis (evidence: `engineering/understand/snapshot.py`)
- Understand drawing → Pipe takeoff: supports takeoff (evidence: `engineering/understand/takeoff.py`)
- MCP server → Architecture tools: offers design tools
- MCP server → Mechanical tools: offers part tools
- Mechanical tools → Part features: uses features (evidence: `engineering/mech/features.py`)
- MCP server → P&ID tools: offers P&ID tools
- P&ID tools → Line router: routes lines (evidence: `engineering/pid/router.py`)
- MCP server → Change previews: previews edits
- MCP server → Artifact verification: verifies saved artifacts
- MCP server → Critique and QA: reports QA
- MCP server → Journal and checkpoints: exposes drawing history
- MCP server → Policy and security: enforces restrictions
- MCP server → Session metrics: records calls
