# puran-water/autocad-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/puran-water/autocad-mcp
- Repository: https://github.com/puran-water/autocad-mcp

## Overview

AutoCAD MCP exposes drawing automation as eight consolidated MCP tools. A client request enters the Python server, which obtains a configured backend and returns drawing results; backend selection supports headless DXF generation or AutoCAD LT via file IPC. The README documents drawing, entity, layer, block, annotation, P&ID, view, and system capabilities. Some domain dispatch code and the LISP implementation were not excerpted, so those documented capabilities are shown without speculative internal call links.

Main entry points: [`src/autocad_mcp/server.py`](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py) (MCP tool server), [`src/autocad_mcp/backends/file_ipc.py`](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/backends/file_ipc.py) (File IPC backend), [`src/autocad_mcp/client.py`](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/client.py) (Backend client), [`src/autocad_mcp/backends/ezdxf_backend.py`](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/backends/ezdxf_backend.py) (Headless DXF backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["MCP interface"]
  node_server["MCP tool server<br/>[server.py]"]
  node_client_core["Backend client<br/>[client.py]"]
end

subgraph group_routing["Backend routing"]
  node_config["Backend configuration<br/>[config.py]"]
  node_backend_contract["Backend contract<br/>[base.py]"]
  node_ezdxf["Headless DXF backend<br/>[ezdxf_backend.py]"]
  node_file_ipc["File IPC backend<br/>[file_ipc.py]"]
end

subgraph group_cad_ops["CAD operations"]
  node_drawing["Drawing management<br/>[server.py]"]
  node_entities["Entity operations<br/>[server.py]"]
  node_layers["Layer management<br/>[server.py]"]
  node_blocks["Block operations<br/>[server.py]"]
  node_annotation["Annotation tools<br/>[server.py]"]
  node_pid["P&amp;ID tools<br/>[server.py]"]
  node_views["View and capture<br/>[server.py]"]
  node_system["System tools<br/>[server.py]"]
end

subgraph group_runtime["Runtime integrations"]
  node_cto[("CTO symbol catalog<br/>[cto_library.py]")]
  node_screenshots["Screenshot providers<br/>[screenshot.py]"]
  node_autocad["AutoCAD LT"]
  node_lisp_dispatch["AutoLISP dispatcher<br/>[mcp_dispatch.lsp]"]
  node_ipc_files[("IPC command files")]
end

node_mcp_client(("MCP client"))

node_mcp_client -->|"sends tool requests"| node_server
node_server -->|"gets backend"| node_client_core
node_client_core -->|"detects backend"| node_config
node_client_core -->|"initializes"| node_ezdxf
node_client_core -->|"initializes"| node_file_ipc
node_ezdxf -->|"implements"| node_backend_contract
node_file_ipc -->|"implements"| node_backend_contract
node_server -->|"dispatches"| node_drawing
node_server -->|"dispatches"| node_entities
node_server -->|"dispatches"| node_layers
node_server -->|"dispatches"| node_blocks
node_server -->|"dispatches"| node_annotation
node_server -->|"dispatches"| node_pid
node_server -->|"dispatches"| node_views
node_server -->|"dispatches"| node_system
node_ezdxf -->|"uses catalog"| node_cto
node_ezdxf -->|"renders screenshots"| node_screenshots
node_file_ipc -->|"captures view"| node_screenshots
node_file_ipc -->|"exchanges JSON"| node_ipc_files
node_file_ipc -->|"triggers commands"| node_autocad
node_autocad -->|"runs dispatcher"| node_lisp_dispatch
node_lisp_dispatch -->|"reads and writes"| node_ipc_files

click node_server "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_client_core "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/client.py"
click node_config "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/config.py"
click node_backend_contract "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/backends/base.py"
click node_ezdxf "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/backends/ezdxf_backend.py"
click node_file_ipc "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/backends/file_ipc.py"
click node_drawing "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_entities "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_layers "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_blocks "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_annotation "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_pid "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_views "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_system "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py"
click node_cto "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/pid/cto_library.py"
click node_screenshots "https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/screenshot.py"
click node_lisp_dispatch "https://github.com/puran-water/autocad-mcp/blob/main/lisp-code/mcp_dispatch.lsp"

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_client_core,node_mcp_client toneBlue
class node_config,node_backend_contract,node_ezdxf,node_file_ipc toneAmber
class node_drawing,node_entities,node_layers,node_blocks,node_annotation,node_pid,node_views,node_system toneMint
class node_cto,node_screenshots,node_autocad,node_lisp_dispatch,node_ipc_files toneRose
```

## Components

### MCP interface

- [MCP tool server](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`
- [Backend client](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/client.py): `src/autocad_mcp/client.py`

### Backend routing

- [Backend configuration](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/config.py): `src/autocad_mcp/config.py`
- [Backend contract](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/backends/base.py): `src/autocad_mcp/backends/base.py`
- [Headless DXF backend](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/backends/ezdxf_backend.py): `src/autocad_mcp/backends/ezdxf_backend.py`
- [File IPC backend](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/backends/file_ipc.py): `src/autocad_mcp/backends/file_ipc.py`

### CAD operations

- [Drawing management](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`
- [Entity operations](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`
- [Layer management](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`
- [Block operations](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`
- [Annotation tools](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`
- [P&ID tools](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`
- [View and capture](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`
- [System tools](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/server.py): `src/autocad_mcp/server.py`

### Runtime integrations

- [CTO symbol catalog](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/pid/cto_library.py): `src/autocad_mcp/pid/cto_library.py`
- [Screenshot providers](https://github.com/puran-water/autocad-mcp/blob/main/src/autocad_mcp/screenshot.py): `src/autocad_mcp/screenshot.py`
- **AutoCAD LT**
- [AutoLISP dispatcher](https://github.com/puran-water/autocad-mcp/blob/main/lisp-code/mcp_dispatch.lsp): `lisp-code/mcp_dispatch.lsp`
- **IPC command files**

### Other components

- **MCP client**

## Connections

- MCP client → MCP tool server: sends tool requests (evidence: `README.md`)
- MCP tool server → Backend client: gets backend (evidence: `src/autocad_mcp/server.py`)
- Backend client → Backend configuration: detects backend (evidence: `src/autocad_mcp/client.py`)
- Backend client → Headless DXF backend: initializes (evidence: `src/autocad_mcp/client.py`)
- Backend client → File IPC backend: initializes (evidence: `src/autocad_mcp/client.py`)
- Headless DXF backend → Backend contract: implements (evidence: `src/autocad_mcp/backends/ezdxf_backend.py`)
- File IPC backend → Backend contract: implements (evidence: `src/autocad_mcp/backends/file_ipc.py`)
- MCP tool server → Drawing management: dispatches (evidence: `README.md`)
- MCP tool server → Entity operations: dispatches (evidence: `README.md`)
- MCP tool server → Layer management: dispatches (evidence: `src/autocad_mcp/server.py`)
- MCP tool server → Block operations: dispatches (evidence: `README.md`)
- MCP tool server → Annotation tools: dispatches (evidence: `README.md`)
- MCP tool server → P&ID tools: dispatches (evidence: `src/autocad_mcp/server.py`)
- MCP tool server → View and capture: dispatches (evidence: `src/autocad_mcp/server.py`)
- MCP tool server → System tools: dispatches (evidence: `README.md`)
- Headless DXF backend → CTO symbol catalog: uses catalog (evidence: `src/autocad_mcp/backends/ezdxf_backend.py`)
- Headless DXF backend → Screenshot providers: renders screenshots (evidence: `src/autocad_mcp/backends/ezdxf_backend.py`)
- File IPC backend → Screenshot providers: captures view (evidence: `src/autocad_mcp/backends/file_ipc.py`)
- File IPC backend → IPC command files: exchanges JSON (evidence: `src/autocad_mcp/backends/file_ipc.py`)
- File IPC backend → AutoCAD LT: triggers commands (evidence: `README.md`)
- AutoCAD LT → AutoLISP dispatcher: runs dispatcher (evidence: `README.md`)
- AutoLISP dispatcher → IPC command files: reads and writes (evidence: `README.md`)
