Skip to main content
Glama
README.md
<div align="center">

<img src="img/claude-logo.png" alt="Claude" width="64">

# AutoCAD MCP Server

**Draw in AutoCAD by talking to Claude.**

[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
![Python](https://img.shields.io/badge/python-3.10%2B-blue)
![Platform](https://img.shields.io/badge/platform-Windows-lightgrey)

</div>

An [MCP](https://modelcontextprotocol.io) server that lets Claude Desktop drive AutoCAD (or GstarCAD / ZWCAD) through the Windows COM interface. Type *"draw a red circle at (100, 100) with radius 50"* and it appears in your drawing — no LISP, no macros.

<div align="center">
<img src="img/schema.png" alt="Claude Desktop → MCP server → AutoCAD via COM" width="420">
</div>

## Requirements

- Windows (COM is Windows-only)
- Python 3.10+
- AutoCAD, GstarCAD or ZWCAD

## Install

```bash
git clone https://github.com/Porta048/AutoCad-MCP.git
cd AutoCad-MCP
pip install -e .
```

Add the server to `%APPDATA%\Claude\claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "autocad": { "command": "autocad-mcp" }
  }
}
```

Restart Claude Desktop. It starts the server for you; if AutoCAD isn't open, the server launches it.

## Usage

Just ask, in any language:

```
Draw a red circle at (100, 100) with radius 50
Create a rectangle from (0, 0) to (200, 100)
Add text "Hello" at (50, 50)
List all circles on layer 0
Save the drawing to C:/drawings/test.dwg
```

Coordinates are `(x, y)` or `(x, y, z)`; angles are in degrees, counter-clockwise from X. Name a color and Claude maps it to the AutoCAD Color Index (1 red, 2 yellow, 3 green, 4 cyan, 5 blue, 6 magenta, 7 white).

### Tools

| Draw | Read & save |
|------|-------------|
| `autocad_draw_line`, `autocad_draw_circle`, `autocad_draw_arc`, `autocad_draw_ellipse` | `autocad_list_entities` |
| `autocad_draw_rectangle`, `autocad_draw_polyline`, `autocad_draw_text` | `autocad_list_layers` |
| `autocad_draw_hatch`, `autocad_add_dimension` | `autocad_save_drawing` |

## Configuration

Edit `src/autocad_mcp/config.json`:

```json
{
  "cad": { "type": "AUTOCAD", "startup_wait_time": 20 }
}
```

`type` can be `AUTOCAD`, `GCAD` or `ZWCAD`. Raise `startup_wait_time` if your CAD is slow to start.

## Troubleshooting

- **Server not listed in Claude** — check that `autocad-mcp` runs from a terminal, then restart Claude Desktop.
- **"CAD not initialized"** — open AutoCAD manually and retry.
- **Logs** — `%APPDATA%\Claude\logs\mcp-server-autocad.log`.

## Contributing

Issues and pull requests are welcome. For development:

```bash
pip install -e ".[dev]"
ruff check src && mypy src
```

## License

[MIT](LICENSE) © Alessandro di Martino

*AutoCAD is a trademark of Autodesk, Inc. This project is not affiliated with or endorsed by Autodesk.*

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues