AutoCAD MCP Server
Enables AI assistants to control a running AutoCAD drawing session via COM automation, including creating architectural elements and drawing primitives, managing layers, inspecting entities, editing colors, deleting entities, undoing operations, and zooming to extents.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
AutoCAD MCP Server
Control AutoCAD in plain English, through Claude or any MCP-compatible AI assistant.
Quick Start · Tools · How It Works · Troubleshooting
Overview
AutoCAD MCP Server connects AI assistants to Autodesk AutoCAD. It implements the Model Context Protocol (MCP), the open standard that lets AI models use external tools, and turns natural-language requests into real drawing operations in a running AutoCAD session.
Instead of clicking through commands, you can tell the assistant:
"Draw a 20 × 15 room with 6-inch walls, put a 3-foot door on the south wall, add windows on the east and west walls, label everything, and zoom to fit."
The assistant plans the steps and calls the server's tools, and the drawing appears in AutoCAD, organized on the right layers.
Related MCP server: multiCAD-mcp
Contents
Features
Capability | Details | |
🏗️ | Architectural elements | Walls, doors with swing arcs, windows with sill lines, and rooms, each with optional labels |
🗂️ | Automatic layers | 11 standard layers (Walls, Doors, Windows, Electrical, Plumbing, HVAC, ...). Every element is placed on the right one automatically. |
✏️ | Drawing primitives | Lines, circles, arcs, rectangles and text, with colors and optional thickness |
🔍 | Drawing inspection | Reads drawing info, layers and every entity with its type, layer, color, handle and geometry |
🎨 | Editing | Recolors any entity by its handle |
🧹 | Targeted deletion | Deletes by handle, type, layer, color, type + color, the most recent N entities, or everything (with confirmation) |
↩️ | View and history | Undo and zoom-to-extents |
🔌 | Works with any MCP client | Claude Desktop, Claude Code, MCP Inspector or a custom client |
21 tools in total. See the Tool Reference.
Quick Start
Prerequisites
Windows 10 / 11
Full AutoCAD (or an AutoCAD-based product such as Civil 3D). AutoCAD LT isn't supported, because it doesn't offer COM automation.
Python 3.10+
An MCP client, such as Claude Desktop or Claude Code
1. Install
git clone https://github.com/initishkumaryadav/Autocad-MCP.git
cd Autocad-MCP
python -m venv venv
venv\Scripts\activate
pip install -e .Check the dependencies installed correctly:
python -c "import mcp, win32com.client; print('deps OK')"If win32com fails to import, run python venv\Scripts\pywin32_postinstall.py -install once.
2. Connect your MCP client
Claude Desktop: add this to %APPDATA%\Claude\claude_desktop_config.json, using your own path:
{
"mcpServers": {
"autocad": {
"command": "C:\\path\\to\\Autocad-MCP\\venv\\Scripts\\python.exe",
"args": ["-m", "autocad_mcp"]
}
}
}Claude Code: run one command:
claude mcp add autocad -- "C:\path\to\Autocad-MCP\venv\Scripts\python.exe" -m autocad_mcpOther clients: configure a stdio server with the venv's python.exe and the args -m autocad_mcp. After pip install -e ., the autocad-com-mcp command does the same thing.
3. Use it
Open AutoCAD with a drawing. Start it before the client, otherwise the server launches a new AutoCAD instance.
Restart your MCP client. For Claude Desktop, quit it from the system tray first.
Ask the assistant to draw something.
Example Prompts
Goal | Prompt |
Inspect | "What drawing is open, and what layers does it have?" |
Floor plan | "Create a 12 × 10 office with 0.5 thick walls, a door on the south wall, and label it 'Office'." |
Electrical layout | "Add outlets every 8 units along the north wall and a ceiling light in the center." |
Organize | "How many entities are on each layer? Change all walls to red." |
Clean up | "Delete all the text on the ANNOTATION layer, then zoom to fit." |
Tool Reference
Points are [x, y] or [x, y, z]. Angles are in degrees, counter-clockwise from the +X axis. Optional parameters show their default.
Query
Tool | Parameters | Returns |
| — | File name, path, saved state, active layer, entity count, all layers |
|
| Every entity with type, layer, handle, color and geometry, plus a per-layer summary |
Architecture & layers
Tool | Parameters | Notes |
|
| Types: wall, door, window, room, furniture, electrical, plumbing, hvac. The element goes on its standard layer automatically. |
|
| Creates the layer only if it doesn't exist |
|
| Makes the layer active |
geometry_data by structure type:
Type | Keys |
wall, window |
|
door |
|
room |
|
others | any of |
Primitives
Tool | Parameters |
|
|
|
|
|
|
|
|
|
|
Thickness is drawn as outline geometry: a line becomes a closed strip, and circles and arcs get concentric inner and outer copies.
Edit, delete & view
Tool | Parameters |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| — |
| — |
Colors
Use a name or an AutoCAD Color Index (ACI) number such as "3".
Name | ACI | Name | ACI |
red | 1 | magenta | 6 |
yellow | 2 | white | 7 |
green | 3 | gray | 8 |
cyan | 4 | light_gray | 9 |
blue | 5 | bylayer | 256 |
Standard layers
Created automatically when the server connects to a drawing.
Layer | Color | Layer | Color | |
WALLS | White | PLUMBING | Blue | |
DOORS | Green | HVAC | Magenta | |
WINDOWS | Cyan | STRUCTURE | Gray | |
FURNITURE | Yellow | ANNOTATION | White | |
ELECTRICAL | Red | SITE | Green | |
UTILITIES | Red |
Responses
Every tool returns JSON. Success responses include "success": true and the handles of the entities created, which you can pass to the edit and delete tools. Failures return {"error": "..."} instead of crashing, so the assistant can read the problem and retry.
{
"success": true,
"structure_type": "wall",
"layer": "WALLS",
"handles": ["2A1", "2A2", "2A3", "2A4", "2A5"],
"message": "wall created on layer WALLS with label 'North Wall'"
}How It Works
sequenceDiagram
actor User
participant AI as AI assistant
participant Server as AutoCAD MCP Server
participant CAD as AutoCAD
User->>AI: "Draw a wall from (0,0) to (10,0)"
AI->>Server: tool call: create_structure (JSON-RPC over stdio)
Server->>CAD: AddLine(...) via COM / pywin32
CAD-->>Server: new entity handles
Server-->>AI: JSON result with handles
AI-->>User: "Done: wall created on layer WALLS"The assistant reads the list of tools and their input schemas from the server.
For each request, it decides which tools to call and with what parameters.
The server turns each call into AutoCAD COM automation, run against the live drawing.
Results, including entity handles, go back to the assistant, so it can follow up with edits or deletions.
Design notes
Reliable COM data passing. Coordinates are sent as typed
VARIANTarrays, which avoids the type-conversion errors that plain Python lists cause in AutoCAD's API.Self-healing connection. Every operation checks the AutoCAD session first and reconnects if it was lost, for example after a drawing is closed. If AutoCAD isn't running, the server starts it.
Paced COM calls. A short pause after each entity keeps AutoCAD from rejecting calls while it's busy. This trades speed for reliability.
Safe bulk deletion. Entities are collected first and deleted afterwards, so deleting doesn't shift indexes and skip items.
Rule-based layer assignment. A keyword map routes each element type ("outlet", "sink", "beam", ...) to the correct layer.
Safety on destructive actions. Clearing the whole drawing needs an explicit confirmation flag.
Tech stack: Python · MCP Python SDK · pywin32 (COM) · AutoCAD ActiveX API
Project Structure
Autocad-MCP/
├── autocad_mcp/
│ ├── __main__.py # enables `python -m autocad_mcp`
│ ├── server.py # MCP entry point: tool registration, dispatch, main()
│ ├── tools.py # tool catalogue: name, description, schema, handler
│ ├── config.py # colors, standard layers, timing constants
│ ├── geometry.py # pure 2D math (offsets, midpoints, rectangles)
│ ├── com.py # pywin32 helpers (VARIANT points, paced COM calls)
│ └── autocad/ # AutoCAD automation, independent of MCP
│ ├── base.py # connection, color lookup, shared helpers
│ ├── layers.py # layer management
│ ├── drawing.py # lines, circles, rectangles, text, arcs
│ ├── structures.py # walls, doors, windows, rooms, labels
│ ├── query.py # drawing info, entity listing
│ └── editing.py # delete, recolor, undo, zoom
├── pyproject.toml
└── LICENSEThe AutoCAD code doesn't depend on MCP, so you can script it directly from Python:
from autocad_mcp import AutoCADClient
cad = AutoCADClient()
assert cad.connect_to_autocad(), "Start AutoCAD first"
cad.create_structure("wall", {"start": [0, 0], "end": [20, 0]}, thickness=0.5, label="North Wall")
cad.create_circle([10, 10], 2, color="red")
cad.zoom_extents()Configuration
Setting | Where | Purpose |
| environment variable | Set to |
|
| Pause after each COM call (default 1 s). Lower it for speed if AutoCAD keeps up. |
|
| Standard layers and the keyword → layer mapping |
|
| Package and server version |
Extending the Server
Adding a tool takes two steps:
Implement the operation as a method in the matching mixin under
autocad_mcp/autocad/. Decorate it with@autocad_operation("<action>")so it gets the connection check and error handling, and create entities throughself.add_to_model_space(...).Register it by appending a
ToolSpectoTOOLSinautocad_mcp/tools.py. Listing and dispatch are automatic.
To try tools by hand, use the MCP Inspector:
npx @modelcontextprotocol/inspector "C:\path\to\Autocad-MCP\venv\Scripts\python.exe" -m autocad_mcpTroubleshooting
Symptom | What to do |
| Start AutoCAD and close any open dialogs or running commands, then retry |
A second, empty AutoCAD window appears | No running instance was found, so the server launched one. Start AutoCAD before your MCP client. |
Tools don't appear in Claude Desktop | Use the absolute path to the venv's |
| Run |
| Run |
"Call was rejected by callee" | AutoCAD is busy. Press |
Entities created but not visible | Call |
Some entities not deleted | They're on locked layers. Unlock the layer in AutoCAD. |
One undo didn't fully revert a tool call | One tool call can create several undo steps. Call |
Limitations
Windows and full AutoCAD only (COM automation).
Model space only. There are no tools yet for saving, opening, plotting, blocks, dimensions or hatches.
Creation is deliberately paced, so large drawings take a while.
Connecting adds the 11 standard layers to whichever drawing is open.
Acknowledgements
This MCP server was developed with the assistance of an AI coding agent.
License
Released under the Apache 2.0 License. This project is a modified version of earlier Apache-2.0 licensed code.
AutoCAD is a registered trademark of Autodesk, Inc. This project is independent and is not affiliated with or endorsed by Autodesk. A licensed copy of AutoCAD is required.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read, query, edit and render DWG drawings with AI. No AutoCAD required.
Design buildings in 3D by chat: rooms, walls, doors, windows, stairs, roofs and furniture.
Global CAD/BIM, industrial engineering (FEM, CFD) and property tools via one MCP endpoint.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI/natural-language-driven 2D drafting automation on a running Windows AutoCAD, exposing drawing, dimensioning, layer/block management, and mechanical drawing tools such as title blocks, BOM, and balloons to any MCP client.366 PyPI4MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to control supported CAD applications through natural-language instructions and unified MCP tools for drawing, layers, blocks, entities, files, and data export.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to control CAD applications like AutoCAD, ZWCAD, GstarCAD, and BricsCAD through natural language or direct tool calls. Supports drawing, layer and entity management, block operations, data export, and file handling via 7 unified MCP tools covering 56 CAD commands.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants like Claude for Desktop or Cursor to control supported CAD applications through MCP, supporting drawing, layer and entity management, block operations, data export, and file/session control via natural language or unified tool calls.-