AutoCAD-Agent MCP Server
Drives a running AutoCAD instance on Windows via COM to create and modify drawings: configure layers, text and dimension styles, draw geometry, hatches, text, dimensions, and blocks with attributes, run batch drawing operations, inspect entities, and export PNG views for visual verification.
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-Agent MCP Server
讓 Claude 等 AI 助理透過 Model Context Protocol (MCP) 直接操作 Windows 上的 AutoCAD:畫圖、標註、讀圖、核對字高、輸出圖片檢查,以及插入圖塊和填寫屬性。
專為建築圖說工作流程設計:完整支援中文字型(微軟正黑體、標楷體等 TrueType 與 SHX 大字體),可一次設定圖層、文字型式與標註型式,並能整批繪製數百個物件。
English summary An MCP server that lets Claude (or any MCP client) drive a running AutoCAD on Windows through COM. 29 tools: drawing primitives, hatches, text and dimensions, one-call drawing setup (layers, text and dimension styles), batch drawing with undo grouping, atomic rollback and dry-run validation, entity inspection with text-height statistics, PNG view export for visual verification, block insertion with attributes, and a guarded command or AutoLISP channel. Built for architectural drafting with full CJK font support.
功能一覽(29 個工具)
分類 | 工具 | 說明 |
繪圖環境 |
| 一次設定圖層、線型、文字型式、標註型式、系統變數 |
| 建立或切換圖層;建立中文文字型式(解決中文變問號) | |
幾何繪圖 |
| 對應 LINE、PLINE、REC、CIRCLE、ARC、ELLIPSE、SPLINE |
填充與邊界 |
| 剖面線填充(SOLID、ANSI31、AR-CONC…)、BOUNDARY |
文字與標註 |
| 單行與多行文字、線性、對齊、半徑標註 |
批次繪圖 |
| 一次建立數百個物件(線、聚合線、弧、圓、文字、填實、標註、圖塊)。整批為一個 UNDO 群組; |
讀圖與檢核 |
| 依範圍、類型、圖層或 Handle 讀取物件; |
| 把視圖或指定範圍輸出為 PNG,讓 AI 看圖核對結果 | |
| 圖面名稱、物件數、圖層、AutoCAD 是否閒置 | |
圖塊與屬性 |
| 列出圖塊與屬性標籤、插入圖塊並填屬性(支援鏡射 |
檢視與復原 |
| ZOOM E、REGENALL、UNDO |
檔案 |
| 以樣板開新圖面 |
通用通道 |
| 執行任何 AutoCAD 指令或 AutoLISP。PURGE、SAVE、QSAVE、SAVEAS、CLOSE、QUIT、EXIT、AUDIT、RECOVER 會被攔截,須經使用者確認後加上 |
Related MCP server: AutoCAD 2024 MCP
系統需求
Windows 10 或 11
AutoCAD 完整版(需支援 COM/ActiveX;AutoCAD LT 不支援)
Python 3.10 以上
支援 MCP 的客戶端,例如 Claude Desktop、Claude Code
安裝
git clone https://github.com/topjgapadsup804-pixel/autocad-mcp.git
cd autocad-mcp
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt設定 Claude Desktop
編輯 %APPDATA%\Claude\claude_desktop_config.json,加入(路徑請改成您實際的位置):
{
"mcpServers": {
"autocad": {
"command": "C:\\path\\to\\autocad-mcp\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\autocad-mcp\\server.py"]
}
}
}存檔後完全關閉再重新開啟 Claude Desktop。使用前請先開啟 AutoCAD,並至少開一張圖面。
選用環境變數
變數 | 預設值 | 用途 |
|
|
|
|
|
|
使用範例
直接用中文跟 Claude 說:
「開新圖,建立『牆』『門窗』『文字』三個圖層,文字型式用微軟正黑體」
「畫一個 6000×4000 的房間,牆厚 150,中間標上『會議室』,字高 300」
「讀取 (0,0) 到 (20000,15000) 範圍內的所有文字,統計各字高的數量」
「把 (0,0)-(10000,8000) 輸出成圖片,幫我檢查標註有沒有重疊」
「插入圖框圖塊,張號填 A-101」
draw_batch 的 JSON 格式範例:
[
{"t": "pline", "pts": [[0,0],[6000,0],[6000,4000],[0,4000]], "closed": true, "layer": "牆"},
{"t": "text", "s": "會議室", "p": [3000,2000], "h": 300, "ha": 1, "va": 2, "style": "微軟正黑體", "layer": "文字"},
{"t": "dim", "p1": [0,0], "p2": [6000,0], "at": [3000,-800], "rot": 0, "style": "ISO-25"},
{"t": "block", "name": "號碼球", "p": [7000,2000], "sx": -1, "attrs": {"NO": "1"}}
]建議先用 dry_run=true 預檢,確認圖層、型式和圖塊都存在後再實際繪製。
運作原理
Claude ──MCP (stdio)──> server.py ──COM (pywin32)──> AutoCAD.Application大部分工具直接呼叫 AutoCAD ActiveX API;execute_cad_command 和 create_boundary 則透過 SendCommand,並輪詢 GetAcadState().IsQuiescent 確認指令執行完畢。AutoCAD 忙碌而拒絕 COM 呼叫(Call was rejected by callee)時會自動重試。
注意事項
本工具會直接修改您開啟中的圖面。請在副本上測試,重要圖檔請先備份。
execute_cad_command能執行任意 AutoLISP,等同給 AI 完整的 AutoCAD 操作權限;只在您信任的 MCP 客戶端中使用。inspect_entities和export_view_png指定範圍時會暫時縮放視圖,完成後自動還原。本專案為第三方工具,與 Autodesk 無關。AutoCAD 為 Autodesk, Inc. 的註冊商標。
授權
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
- AutoMEPDeprecatedapp.automep
Edit AutoCAD and Revit MEP drawings from Claude or ChatGPT in plain English.
Read, query, edit and render DWG drawings with AI. No AutoCAD required.
Read and edit drawings in AutoCAD 2020–2027 on your PC. Needs the free AutoCAD MCP plug-in.
1Headless CAD engine & MCP server for 2D/3D drafting, solids, DXF/SVG export, and automation.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables programmatic control of AutoCAD through COM automation, allowing natural language commands to create structures, manage layers, and manipulate entities via MCP clients like Claude.70Apache 2.0
- FlicenseBqualityBmaintenanceNatural-language MCP bridge for AutoCAD 2024. Enables users to inspect and edit DWG drawings, manage layers, entities, layouts, styles, and system variables; draw 2D geometry and 3D solids; perform measurements and transactional edits; and export to DWG, STL, PDF, DWF, SVG, or raster formats through a local named-pipe connection.211-
- AlicenseNot gradedqualityBmaintenanceConnects Claude Desktop to a running AutoCAD instance over local Windows COM, letting users query, draw, edit, organize layers, measure areas, take off quantities, and export sheets to PDF using plain language. Every action is undoable, logged, and optionally restricted to read-only mode with no network exposure.MIT
- AlicenseNot gradedqualityBmaintenanceLets Claude draw in and inspect the AutoCAD session already running on a Windows PC by attaching over COM, so no add-in or restart is needed. Provides 32 tools for drawings, layers, geometry, dimensions, blocks, queries, view capture and PDF plotting, with an edit guard, busy guard and one undo step per tool.5MIT