Skip to main content
Glama
AutoCAD MCP Native Bridge

AutoCAD MCP Native Bridge

by Yimmingyang

AutoCAD MCP Native Bridge

Node tests License: MIT 中文 | English

中文

AutoCAD MCP Native Bridge 是 Windows 本机 MCP 桥接项目。Node.js MCP 服务通过命名管道与 AutoCAD 进程内的 .NET 插件通信,使兼容 MCP 客户端能够读取图纸状态、检查几何,并通过 AutoCAD API 执行编辑操作。

实机验证范围:AutoCAD 2025 / R25.0 / Windows x64,已完成安装、服务配置和 get_bridge_status 连接测试。 安装器按本机 AutoCAD API 和运行时编译 2020–2027 插件;除 2025 实机验证外,其它版本仍需对应 CAD 主机加载/连接测试,不将“能编译”当作“实机兼容”。

Windows 安装器

仓库提供 installer/ WinForms 连接器:扫描 AutoCAD 2020–2027 并显示构建号;扫描并支持 OpenAI Codex、DeepSeek Harness 两种 MCP 客户端;安装时依据所选 AutoCAD 的本机 API 和运行时编译插件,部署便携 Node.js/MCP 服务,并写入所选 AI 客户端配置。状态检测分开报告 AutoCAD 插件握手、MCP tools/list 工具发现和 AI 客户端配置。AutoCAD 2020 使用 .NET Framework 4.7、2021–2024 使用 .NET Framework 4.8;2025/2026 按本机运行时选 .NET 8 或 10,2027 使用 .NET 10。AutoCAD 2027 对应 R26.0。

构建安装器:使用 Windows .NET 8 SDK 运行 dotnet publish installer/AutoCadMcpInstaller.csproj -c Release -o installer/publish。单文件输出为 installer/publish/AutoCadMcpInstaller.exe。

功能

  • 读取活动图纸、单位、范围、图层、模型空间实体、尺寸和文字。

  • 按类型、图层和条件筛选对象,读取实体详细属性。

  • 创建/编辑线、圆、多段线、弧、椭圆、文字、尺寸、填充、图层和块。

  • 执行复制、移动、旋转、镜像、偏移、阵列、删除和属性修改。

  • 通过 list_tools / cad_call 发现和调用原生操作。

  • preview_drawing_plan 与 apply_drawing_plan 支持批量计划验证和事务应用。

  • MCP 使用 stdio;AutoCAD 端只监听本机命名管道 AutoCAD_MCP_<年份>_V2,不开放 TCP 端口、不使用 OAuth。

要求

  • Windows x64;AutoCAD 2020–2027(安装时需要相应 API 文件和可识别的 .NET 运行时)。

  • 安装器可部署便携 Node.js LTS 和从 Microsoft 官方源校验下载的 .NET SDK;编译阶段需要访问 GitHub 源码与 NuGet。

  • Windows x64 上的 OpenAI Codex 或 DeepSeek Harness。其他 MCP 客户端可手动配置 stdio 服务,目前不会由连接器自动发现/管理。

  • 安装器需要所选 AutoCAD 版本的 managed API DLL;插件按对应本机 API 编译。

快速安装

从 GitHub Releases 下载 AutoCadMcpInstaller.exe,运行后选择 AutoCAD 版本和已检测的 AI 客户端,再点“安装/修复”。安装期间关闭 AutoCAD。安装器会备份旧插件和所选客户端配置,并只将本插件 bundle 子树追加到对应 AutoCAD 配置的 TRUSTEDPATHS(不关闭 SECURELOAD)。打开 AutoCAD 和所选 AI 客户端后点“测试 MCP 连接”;该检查分别报告 CAD 插件响应、MCP 工具清单能否发现和客户端配置是否写入。AI 客户端需重启/新建会话,实际工具可见性还应在客户端内核实。

手动运行 MCP 服务或开发服务端时,可以从源码安装:

git clone https://github.com/yanmiong/autocad-mcp-native.git
cd autocad-mcp-native
npm ci
npm test
npm run check

重启/新建 AI 会话,先调用 get_bridge_status、drawing_summary 等只读工具确认连接,再进行写操作。完整安装、更新、卸载说明见 docs/安装与使用.md,故障排查见 docs/故障排查.md,工具参数见 docs/API.md。

安全建议

  • 初次使用采用只读检查;编辑前备份源 DWG,确认活动图纸路径。

  • 复杂修改先预览绘图计划,再显式应用;超时后先检查当前图纸,不要盲目重放。

  • 不要加载来源不明的插件,不要为了方便全局关闭 AutoCAD 安全加载。

  • 不要将含客户设计、个人路径、日志或凭据的内容提交到公开仓库。

开发与测试

npm ci
npm test
npm run check

本地 MCP 测试共 7 项,不要求运行 AutoCAD;另有安装器兼容性测试覆盖 AutoCAD 系列映射、运行时识别与构建目标选择。两者均不等于实时 AutoCAD 宿主集成验证。插件按本机版本构建示例:

powershell -ExecutionPolicy Bypass -File .\scripts\Build-AutoCADPlugin.ps1 `
  -CadYear 2025 -DotNetMajor 8 `
  -AutoCADDir "C:\Program Files\Autodesk\AutoCAD 2025" `
  -OutputDirectory "$env:TEMP\AutoCadMcpBuild"

路线图

  • 对 AutoCAD 2020–2027 各运行时组合完成实机加载与连接测试,并在兼容矩阵中记录结果。

  • 完善安装状态、更新与回滚界面。

  • 对新发布的 AutoCAD 主版本及时增加运行时/API 映射和对应测试。

项目许可见 LICENSE;贡献流程见 CONTRIBUTING.md。

Related MCP server: autocad-mcp

English

AutoCAD MCP Native Bridge connects a Node.js MCP server to an in-process .NET plug-in in AutoCAD through a local Windows named pipe. It supports drawing inspection and native editing operations for MCP clients.

Host integration verified so far: AutoCAD 2025 / R25.0 on Windows x64. The installer compiles against the selected installation's API and runtime; other supported year/runtime combinations still require host load and pipe-connection tests. Do not manually load a prebuilt DLL into a different release. See the Chinese installation guide and docs/API.md. Licensed under MIT.

Available Tools

23 tools
apply_drawing_planA

Apply the exact operations of a previously previewed plan to the same active drawing in one transaction. Any error rolls the transaction back.

Inputs: planId (required).

cad_callB

Call any native AutoCAD operation by name with a JSON argument object. Discover names with list_tools.

Inputs: tool (required), args.

count_modelspace_entitiesC

Count model-space entities by DXF type.

Inputs: limit.

create_blockA

Create a named local block definition from 1 to 50 line, circle, rectangle and/or text entities; rejects duplicate names.

Inputs: name (required), entities (required).

create_drawing_copyB

Create a full DWG copy of the active drawing without renaming or modifying the source drawing.

Inputs: path (required).

delete_entityC

Delete exactly one entity identified by its AutoCAD hexadecimal handle.

Inputs: handle (required).

draw_circleC

Draw a circle in model space using center XYZ coordinates and positive radius in drawing units.

Inputs: center (required), radius (required).

draw_lineB

Draw a line in model space using start/end XYZ coordinates in drawing units.

Inputs: end (required), start (required).

draw_polylineB

Draw a 2D lightweight polyline with optional bulge arcs. Points are XY drawing units; each bulge controls the outgoing segment.

Inputs: points (required), bulges, closed.

draw_rectangleB

Draw a closed rectangular polyline in model space using opposite XY corners in drawing units.

Inputs: x1 (required), x2 (required), y1 (required), y2 (required).

get_active_drawingA

Read the active AutoCAD drawing name/path and current space state.

Inputs: no named parameters.

get_bridge_statusB

Check the loaded AutoCAD plug-in version, named pipe, active drawing, read-only state and units.

Inputs: no named parameters.

insert_blockC

Insert an existing local block definition into model space with uniform scale and rotation in degrees.

Inputs: name (required), position (required), scale, rotation.

inspect_drawing_geometryB

Read drawing units, model-space extents, entity coordinates, dimension values and text without modifying the drawing.

Inputs: limit.

list_blocksA

List named, non-layout, non-anonymous local block definitions that can be inserted.

Inputs: no named parameters.

list_layersA

List drawing layers and off/frozen/locked state.

Inputs: no named parameters.

list_modelspace_entitiesB

List model-space entity handles, DXF types and layers. Use the returned handle for targeted edits.

Inputs: limit.

list_toolsA

List every native AutoCAD operation the plug-in exposes (name, JSON params, mutating flag). Call this first when you need a capability that has no dedicated tool.

Inputs: no named parameters.

move_entityC

Move one entity by handle by the given XYZ offset in drawing units.

Inputs: dx (required), dy (required), handle (required), dz.

open_drawingA

Open an existing DWG in AutoCAD through the bridge. Set readOnly to true to prevent modifications.

Inputs: path (required), readOnly.

preview_drawing_planA

Validate and preview up to 100 geometry, text, dimension and layer operations without changing the drawing. Returns a planId for explicit commit.

Inputs: operations (required).

save_active_drawingA

Save changes in the active drawing to its existing path.

Inputs: no named parameters.

set_entity_layerC

Change a model-space entity to an existing drawing layer.

Inputs: layer (required), handle (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 23 tools

    Disambiguation4/5

    Most tools target distinct resource-action pairs, but get_active_drawing and get_bridge_status both expose active drawing information, and inspect_drawing_geometry overlaps somewhat with list_modelspace_entities in reading entity data. Descriptions provide enough context to disambiguate in practice.

    Naming Consistency4/5

    Nearly all tools follow a consistent snake_case verb_noun pattern (get_active_drawing, draw_line, preview_drawing_plan), making names predictable. The outlier cad_call uses a noun_verb order, which is a minor deviation but still readable.

    Tool Count4/5

    23 tools is slightly heavy for the typical 3-15 sweet spot, but each tool appears to earn its place by covering a specific CAD bridge operation. The set is well-scoped for the domain despite being on the larger side.

    Completeness4/5

    Core drawing, entity, layer listing, block, and plan workflows are covered, with cad_call providing a generic escape hatch for native operations. Minor gaps exist for dedicated layer creation/modification, text drawing, and dimension creation, but agents can work around them using cad_call.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      MCP server for full AutoCAD automation, AutoCAD LT automation, and headless DXF generation. It provides 8 consolidated tools for drawing, entity, layer, block, annotation, P&ID, view, and system operations via MCP stdio transport.
      12
      45
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI/natural-language-driven 2D drafting automation on a running Windows AutoCAD, exposing drawing, dimensioning, layer/block management, and mechanical drawing tools such as title blocks, BOM, and balloons to any MCP client.
      300 PyPI
      4
      MIT
    • F
      license
      B
      quality
      B
      maintenance
      Natural-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.
      21
      1
      -
    • A
      license
      C
      quality
      C
      maintenance
      Enables MCP clients to create and edit technical drawings, manage layers and geometry, process GIS/research mapping data, generate previews and layouts, and automate AutoCAD documents on Windows through COM.
      225
      578 npm
      MIT