Content
# 🔧 AutoCAD MCP Server
<p align="center">
<img src="https://img.shields.io/badge/MCP-Protocol-blue?style=flat-square" alt="MCP Protocol">
<img src="https://img.shields.io/badge/Python-3.10+-green?style=flat-square" alt="Python">
<img src="https://img.shields.io/badge/AutoCAD-2026-red?style=flat-square" alt="AutoCAD">
<img src="https://img.shields.io/badge/License-MIT-yellow?style=flat-square" alt="License">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square" alt="PRs">
</p>
**First-ever MCP (Model Context Protocol) Server for AutoCAD.**
Let AI agents directly control DWG drawings — open files, list entities, draw lines — through standard MCP tools.
> 🎯 **Why this exists**: 10,000+ MCP servers exist for developer tools (Blender, VS Code, Jupyter), but **zero** for AutoCAD — the world's most widely used CAD software with millions of engineers. The gap: AutoCAD's COM interface requires Windows + win32com skill, a niche most MCP developers don't have.
---
## Architecture
```
┌───────────┐ MCP/JSON-RPC ┌─────────────┐ COM/win32com ┌──────────┐
│ AI Agent │◄──────────────►│ MCP Server │◄──────────────►│ AutoCAD │
│ (Claude, │ (stdio) │ (Python 60LOC)│ │ (2026) │
│ Copilot, │ └─────────────┘ └──────────┘
│ Cursor) │
└───────────┘
```
The MCP server wraps AutoCAD's COM interface into 3 standardized tools. No external dependencies beyond `mcp` and `pywin32`.
---
## Quick Start
### Prerequisites
- Windows 10/11
- AutoCAD (tested on 2026, likely works on 2023+)
- Python 3.10+
### Install
```bash
git clone https://github.com/wade20250715/autocad-mcp-server.git
cd autocad-mcp-server
pip install mcp pywin32
```
### Configure Your AI Agent
Add to your MCP client config (Claude Desktop / Cursor / VS Code):
```json
{
"mcpServers": {
"autocad": {
"command": "python",
"args": ["-I", "path/to/autocad-mcp-server/server.py"],
"env": { "PYTHONPATH": "" }
}
}
}
```
### Run Manually
```bash
# Start AutoCAD first, then:
python -I server.py
```
---
## Tools
| Tool | Description | Parameters |
|------|-------------|------------|
| `open_dwg` | Open a DWG drawing file | `filepath: str` |
| `list_entities` | List all entities in current drawing (lines, circles, text with coordinates) | — |
| `add_line` | Draw a straight line | `x1, y1, x2, y2: float` |
### Example: AI Agent Conversation
```
User: "Open D:\drawings\floorplan.dwg and tell me what's in it"
Agent → open_dwg("D:\drawings\floorplan.dwg")
Server → "Opened: floorplan.dwg, 247 entities"
Agent → list_entities()
Server → "[0] Line: (0.0,0.0)→(10.0,0.0)
[1] Circle: center(5.0,5.0) radius 2.5
[2] Text: 'MAIN ENTRANCE' at (1.0,8.0)
..."
```
---
## Verified
This server has been tested with the MCP protocol:
```
✓ JSON-RPC initialize handshake
✓ tools/list returns 3 registered tools
✓ Server starts in <1 second
```
Manual testing with AutoCAD requires the application to be open.
---
## Technical Notes
- Uses `pythoncom.CoInitialize()` for COM thread safety
- Handles AutoCAD-not-running state with graceful error messages
- `-I` flag recommended to avoid PYTHONPATH conflicts
- All Chinese text in docstrings; switch to English for international use
---
## Roadmap
- [ ] `add_circle`, `add_text`, `add_dimension` — extend drawing tools
- [ ] `get_selection` — read user-selected entities
- [ ] `modify_entity` — change properties (layer, color, lineweight)
- [ ] `export_dxf` — save as DXF format
- [ ] Non-Windows support via ezdxf backend
---
## Related Projects
- [office-mcp-server](https://github.com/wade20250715/office-mcp-server) — Excel/Word/PPT MCP
- [blender-mcp](https://github.com/ahujasid/blender-mcp) — Blender MCP (21k+ stars)
- [freecad_mcp](https://github.com/bonninr/freecad_mcp) — FreeCAD MCP
---
## License
MIT © [wade20250715](https://github.com/wade20250715)