MCP server for AutoCAD — Control AutoCAD from Claude via ObjectARX + Unix Socket
AutoCAD MCP
Claude (or any LLM) から AutoCAD を操作するための Model Context Protocol (MCP) サーバー。
ObjectARX C++ プラグインを AutoCAD 内にロードし、Unix Domain Socket 経由で MCP サーバーと通信することで、LLM が AutoCAD の全機能にアクセスできます。
Architecture
Claude ──stdio──> MCP Server (Rust)
│
Unix Socket (/tmp/gfp-arx-bridge.sock)
│
ObjectARX Plugin (.bundle)
│
AutoCAD
- 読み取り操作: ソケットスレッドで直接実行(高速)
- 書き込み操作: メインスレッドキュー経由(AutoCAD API の要件)
- LISP 実行:
sendStringToExecute+ 一時ファイルで結果取得
MCP Tools
| Tool | Description |
|------|-------------|
| eval_lisp | 任意の AutoLISP 式を評価。AutoCAD の全機能にアクセス可能 |
| acad_command | AutoCAD コマンドを LISP 経由で実行 |
| get_variable | AutoCAD システム変数を取得 |
| draw_line | 線分を描画 |
| draw_rectangle | 四角形を描画 |
| get_drawing_info | 図面情報を取得 |
| list_layers | レイヤー一覧を取得 |
eval_lisp を使えば、上記以外の任意の AutoCAD 操作が可能です:
;; 円を描く
(command "CIRCLE" "0,0" 1000)
;; レイヤーを作成
(command "LAYER" "M" "MyLayer" "C" "1" "MyLayer" "")
;; ポリラインを描く
(command "PLINE" "0,0" "100,0" "100,50" "0,50" "C")
;; 全エンティティ数を取得
(sslength (ssget "X"))
Prerequisites
- AutoCAD 2025+ (Mac or Windows)
- ObjectARX SDK (free, Autodesk account required)
- Download from Autodesk Platform Services
- Install to
/Library/Developer/Autodesk/ObjectARX 2027/(Mac)
- Xcode (Mac) or Visual Studio (Windows)
- xcodegen (Mac):
brew install xcodegen - Rust (for MCP server): rustup.rs
Build
ObjectARX Plugin (Mac)
cd arx-plugin
xcodegen generate
xcodebuild -project gfp-arx-bridge.xcodeproj \
-target gfp-arx-bridge \
-configuration Debug build
Output: build/Debug/gfp-arx-bridge.bundle
MCP Server
cd mcp-server
cargo build
Setup
1. Load the plugin in AutoCAD
- Open AutoCAD
- Type
APPLOAD - Navigate to
arx-plugin/build/Debug/gfp-arx-bridge.bundle - Load it
You should see: [GFP] Socket bridge started
2. Configure Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"autocad": {
"command": "/path/to/autocad-mcp-server",
"args": []
}
}
}
3. Use it
Ask Claude to draw, query, or modify your AutoCAD drawings!
Platform Support
| Platform | Status | Communication | |----------|--------|---------------| | macOS (Apple Silicon) | Supported | Unix Domain Socket | | macOS (Intel) | Supported | Unix Domain Socket | | Windows | Planned | Named Pipe (coming soon) |
How it works
ObjectARX Plugin (arx-plugin/)
A native AutoCAD plugin built with the ObjectARX SDK. It:
- Starts a Unix Domain Socket server on a background thread
- Receives JSON commands from the MCP server
- Executes AutoCAD API calls on the main thread (for write operations) or directly (for read operations)
- Returns results as JSON
Key implementation details:
- Write operations use
sendStringToExecuteto dispatch to AutoCAD's main thread, with condition variables for synchronization eval_lispsends LISP expressions viasendStringToExecuteand reads results from a temp filewindef.hmust be included beforeaced.hon Mac (provides Windows type compatibility)
MCP Server (mcp-server/)
A Rust MCP server using rmcp. It:
- Runs as a stdio MCP server
- Connects to the ObjectARX plugin via Unix Domain Socket
- Translates MCP tool calls to bridge commands
- Returns results to the LLM
License
MIT