AutoCAD MCP 绘图服务器

AutoCAD MCP Server 是一款通过 MCP 协议让 Claude Desktop 在 Windows 上驱动 AutoCAD/GstarCAD/ZWCAD 的服务器,适用于用自然语言完成绘图、编辑、查询图层和保存图纸等 CAD 操作。

  • by Porta048
  • Python
  • 本地部署
  • 5 星标
  • 更新于
在 GitHub 查看 Porta048/AutoCad-MCP

使用说明

AutoCAD MCP Server

Draw in AutoCAD by talking to Claude.

An MCP 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.

Requirements

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

Install

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:

{
  "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:

{
  "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:

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

License

MIT © Alessandro di Martino

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