luiccian-autocad-mcp

v2.5.0
luiccian-autocad-mcp Checked 8 hours ago Published 7 days ago

Model Context Protocol (MCP) server connecting Autodesk AutoCAD 2027 and Civil 3D with AI agents (Claude, Antigravity, Cursor) via AutoCAD AI Gateway.

AutoCAD MCP Bidirectional AI Gateway and Model Context Protocol (MCP) server for Autodesk AutoCAD 2027 and Civil 3D. Connects AI coding agents (Antigravity, Claude Desktop, Cursor, VS Code) to a live AutoCAD 2027 or Civil 3D 2027 session with 89 tools across 10 domains (75 canonical actions and 14 legacy aliases), selectable via AUTOCAD_MCP_TOOL_MODE (granular, compound, or core). 1. Load and Start the Gateway in AutoCAD 2027 1. Build from source (.\scripts\build.ps1) or download AutoCAD.Gateway-Release.zip. 2.

Summary extracted from the README.

Connects AI coding agents (Antigravity, Claude Desktop, Cursor, VS Code) to a live AutoCAD 2027 or Civil 3D 2027 session with 89 tools across 10 domains (75 canonical actions and 14 legacy aliases), selectable via AUTOCAD_MCP_TOOL_MODE (granular, compound, or core).


Quick Start

1. Load and Start the Gateway in AutoCAD 2027

  1. Build from source (.\scripts\build.ps1) or download AutoCAD.Gateway-Release.zip.
  2. In AutoCAD 2027 or Civil 3D 2027, run NETLOAD and select AutoCAD.Gateway.dll, then start the loopback listener:
    AI_START_SERVER
    
    Available Gateway commands: AI_START_SERVER, AI_STOP_SERVER, AI_SHOW_CONFIG, AI_SET_TOKEN, AI_GENERATE_TOKEN, AI_EDIT_GUARD.
  3. Optionally install as an Autodesk Autoloader .bundle (with SHA-256 verification) or uninstall cleanly:
    .\scripts\install-bundle.ps1
    .\scripts\install-bundle.ps1 -Uninstall
    

Requires uv. Runs luiccian-autocad-mcp on demand with zero local compilation and automatic {pid}.json session discovery:

{
  "mcpServers": {
    "autocad-mcp": {
      "command": "uvx",
      "args": ["luiccian-autocad-mcp"],
      "env": {
        "AUTOCAD_MCP_TOOL_MODE": "compound"
      }
    }
  }
}

[!NOTE] Leave AUTOCAD_GATEWAY_TOKEN and AUTOCAD_GATEWAY_PORT unset for zero-config auto-discovery. Only set AUTOCAD_GATEWAY_TOKEN if you pinned a custom token via AI_SET_TOKEN inside AutoCAD.


Architecture & Tool Modes

flowchart LR
    AI["AI Client (STDIO JSON-RPC)"] --> MCP["MCP Server (Python FastMCP or .NET 10)"]
    MCP -->|"HTTP Loopback 127.0.0.1 + X-Gateway-Token"| GW["AutoCAD.Gateway (.NET 10 TcpListener)"]
    GW -->|"Application.Idle Main Thread"| ACAD["AutoCAD 2027 / Civil 3D"]

Selective Tool Loading (AUTOCAD_MCP_TOOL_MODE)

Mode Tools Exposed Behavior
granular (default) 89 tools Exposes all 75 canonical tools and 14 legacy aliases directly.
compound 10 domain routers Exposes autocad_context through autocad_execution using action and params (with action="help" introspection).
core 28 tools Exposes high-leverage standalone tools with zero aliases for minimal context overhead.

Domain Catalog (89 Tools)

Domain (compound Router) Canonical / Alias Count Representative Canonical Actions
autocad_context 10 + 6 aliases get_drawing_info, get_layers, get_drawing_extents, capture_screenshot
autocad_entities 6 + 0 aliases query_entities, get_entity, modify_entity, transform_entities, delete_entities, execute_native_batch
autocad_drafting 10 + 0 aliases create_dimension, create_mleader, create_hatch, create_table, define_block, set_block_attributes, list_xrefs, explode_entities
autocad_drawing 8 + 0 aliases draw_batch_geometry, draw_line, draw_polyline, draw_rectangle, draw_circle, draw_arc, insert_text, insert_block
autocad_layers 4 + 0 aliases create_layer, set_current_layer, set_layer_state, delete_layer
autocad_documents 9 + 0 aliases list_documents, new_drawing, open_drawing, activate_document, close_document, allow_edit_document, cancel_command, get_system_variable, set_system_variable
autocad_measurement 4 + 1 alias measure_distance, calculate_polygon_area, purge_and_audit_drawing, regen_all
autocad_plotting 5 + 2 aliases create_layout, configure_layout_page, create_viewport, insert_title_block, export_pdf
autocad_civil3d 11 + 2 aliases check_civil3d_status, list_civil3d_surfaces, get_surface_elevation, get_civil3d_surface_stats, list_civil3d_alignments, sample_longitudinal_profile, sample_civil3d_cross_section, create_civil3d_alignment, create_civil3d_surface
autocad_execution 8 + 3 aliases ping_gateway, execute_command, execute_batch_commands, evaluate_lisp, load_lisp_file, configure_drawing_units, zoom_extents, save_drawing

Alternative Execution Modes

Option B: Native C# Server (AutoCAD.McpServer.dll)

Build the solution (dotnet build AutoCAD_Integration.slnx -c Release) or download AutoCAD.McpServer-Release.zip from Releases, then configure:

{
  "mcpServers": {
    "autocad-mcp": {
      "command": "dotnet",
      "args": [
        "${workspaceFolder}/AutoCAD.McpServer/bin/Release/net10.0/AutoCAD.McpServer.dll"
      ],
      "env": {
        "AUTOCAD_MCP_TOOL_MODE": "compound"
      }
    }
  }
}

Option C: Local Python Development (uv run)

{
  "mcpServers": {
    "autocad-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "${workspaceFolder}/AutoCAD.McpPython",
        "run",
        "autocad-mcp"
      ],
      "env": {
        "AUTOCAD_MCP_TOOL_MODE": "compound"
      }
    }
  }
}

Run tests locally:

dotnet run --project AutoCAD.Gateway.Tests -c Release
uv run --directory AutoCAD.McpPython --all-extras pytest

Documentation, Skills & Governance

Resource Purpose
Getting Started Guide Step-by-step installation, Autoloader bundle, and client setup
System Architecture Loopback TcpListener, Application.Idle dispatcher, and security model
MCP Tools Reference Parameter schemas and return payloads
Tools Cheat Sheet Goal-to-tool decision matrix
Troubleshooting Guide Resolving NETLOAD, ports, Edit Guard, and Civil 3D issues
PyPI Publishing Guide Trusted Publishing (OIDC) and PEP 740 attestations
Agent Skills (skills/) AutoCAD MCP Automation, YQArch Fast Drafting, AutoLISP Drafting
Examples (examples/) AutoLISP routines and gateway HTTP diagnostic scripts

Licensed under the Apache License 2.0. See CHANGELOG.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.