nx-mcp
An MCP bridge that lets an AI drive Siemens NX 12 for CAD modeling, drafting, annotation, inspection, and export.
Manage NX parts: check status, create/open/save/close parts, export STEP, fit view, undo, and release task state.
Create sketches on principal datum planes and add lines, rectangles, circles, and arcs.
Build and modify solids: extrude, revolve, simple/counterbore/countersink holes, shell, edge blend, chamfer, mirror, linear/circular patterns, and boolean unite.
Inspect models: list sketches, bodies, features, edges, and faces; measure minimum distances between edges.
Create drawing sheets and projected views; list sheets/views and force drafting view updates.
Add drafting annotations: linear/radius/diameter dimensions with tolerances, notes, roughness symbols, title blocks, and part attributes.
Read back dimensions, annotations, and part attributes; delete annotations by ID, name, or kind/index selector.
Export drawings to PDF and the active part to STEP.
Use natural-language control through the MCP server, resident C# Loader, and Windows named-pipe bridge for NX 12.
Enables AI-driven interaction with Siemens NX 12 through NXOpen, providing tools for 3D modeling, 2D drafting, tolerance and surface-roughness annotation, title blocks, part attributes, dimension/annotation readback, process-note creation, and PDF export.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nx-mcp model a 50mm diameter shaft, dimension it on the drawing, then export PDF"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
nx12-mcp-bridge
用自然语言(AI)驱动 Siemens NX 12:建模 → 出二维图纸 → 标注公差 → 读回校验 → 编制工艺 → 导出 PDF。
本项目是 kongbaic/NX_MCP-Enhanced
(作者:抖音 无趣;其原始项目为 DreamEnding/NX_MCP)
的 NX 12 适配与功能扩展分支。
架构
AI(自然语言)
→ MCP 服务器(Python sidecar)
→ Windows 命名管道
→ NX 进程内常驻的 C# Loader
→ NXOpen核心设计:C# Loader 随 NX 启动加载并在整个会话中常驻, 不必每次执行都跑一遍 journal —— 这是相对"逐条 journal"方案最大的效率优势。
C# 侧:
loader/NX_MCP_Loader.csPython 侧:
src/nx_mcp/(certified.py工具注册、loader_bridge.py命令映射)构建产物:
NX_MCP_Loader.dll(部署到 NX 的 startup 目录)
Related MCP server: inventor-mcp
与上游的差异
NX 12 适配(上游面向更早版本,在 NX 12 上会编译失败)
修复
MirrorBody相关 CS1061(改用保留源体的方式)修复
ShellBuilder相关 CS1061(改用ReplaceRules)迁移
Update.AddToDeleteList→AddObjectsToDeleteList(NX12.0.0 弃用)
新增能力(共 68 个 MCP 工具)
类别 | 命令 |
尺寸标注 |
|
草图读取 |
|
WAVE 链接 |
|
图纸文字 |
|
表面粗糙度 |
|
质量属性 |
|
对称中心线 |
|
DXF/DWG 导出 |
|
角度测量 |
|
剖视图 |
|
删图纸视图 |
|
装配 / BOM |
|
基准符号 |
|
形位公差框 |
|
工序卡 |
|
全套图纸 PDF |
|
标题栏 |
|
部件属性 |
|
读回校验 |
|
清理 |
|
导出 |
|
三维查询 |
|
选择回流 |
|
面带 made_by 特征归属;反射路由,空选择返回 count=0 事实而非报错) | |
面溯源 |
|
点选面后 AI 直接定位生成它的特征;owner_count=0 为事实(unite 后所有权丢失)非错误) |
稳定性修复
"保存 CGM"弹窗把 NX 卡死:含多张图纸页的部件保存时 NX 弹模态框阻塞, 管道命令会一直等到超时。已通过在保存前关闭
SaveOptions.DrawingCgmData根治重复打开同一部件读到陈旧数据:路径分隔符归一化修复
构建
build.bat增加NXOpen.UF.dll引用(三维测量需要 UFUN)
环境要求
Windows
Siemens NX (需
NXBIN\managed\NXOpen*.dll).NET Framework 4.x(构建用
csc.exe)Python 3.x + MCP 客户端
安装与运行
# 1) 构建 Loader
cd loader && build.bat
# 2) 部署 DLL 到 NX 的 startup 目录
# 即 %USERPROFILE%\.nx_mcp_user\startup\NX_MCP_Loader.dll
# 该目录需通过 UGII_USER_DIR 环境变量被 NX 识别
# 3) 启动 NX(需带上述环境变量)
# 从开始菜单直接打开 NX 也可以
# 4) 验证管道
python pipe_smoke.py ping nx_statusMCP 配置示例(~/.workbuddy/mcp.json):
{
"mcpServers": {
"nx-mcp": {
"command": "<venv>/Scripts/python.exe",
"args": ["-m", "nx_mcp.server"],
"cwd": "<repo>"
}
}
}注意:NX 退出后管道即断开。"后台任务不跨会话/跨天存活"是 workbuddy 运行环境的限制: workbuddy 类 AI 设备接入维护本项目时,新会话需重新拉起 NX(
restart_nx.ps1)。 具备本机 shell 权限的 AI 环境(如 ZCode)没有此限制,可自行检测管道并随时拉起 NX,无需人工介入。
使用要点
边索引在部件实例间不稳定(重建后会变)→ 绝不硬编码索引, 先
nx_list_edges再按半径/长度/坐标自动筛选body_id 有两套 ID 空间:
nx_list_bodies显示 NX 日志标识(如EXTRUDED(1)), 命令只认建模时返回的内部 ID(如BODY_1)图纸名/视图名不能有空格(管道按空格分词)
标题栏内容 = 部件属性:格子引用属性显示,填标题栏要用
nx_set_attribute坐标用
{"x":..,"y":..}字典传,传 list 会报错
已知限制
以下功能已研究但未打通,命令保留在源码中、未注册到 MCP (避免 AI 用到必失败的工具):
功能 | 状态 |
局部放大 | 视图/边界/标签可创建,但放大几何不渲染(UFUN 三条路线已探明,差最后一步) |
图框边框线 |
|
真实螺纹 | 上游亦不支持 |
中心线 / DWG-DXF 导出 / 剖视图 已分别于 2026-11 攻克
(nx_create_centerline、nx_export_dwg、nx_create_section_view)。
上表各项的详细调研过程(入口 API、已试组合、排除项、错误原文、下一步建议) 由维护者另行整理,欢迎开 issue 认领其中任意一项——这些是最有价值的待攻克点。
维护者档案(不入库)
代码注释与文档中提到的「受阻项调研档案」「经验总结档案」「交接清单档案」
是维护者的本地调研/交接档案,保存在仓库外(已加入 .gitignore),不随仓库分发。
提及处的章节号指向这些本地档案;需要对应内容的请开 issue 或联系维护者。
致谢
本项目是在以下开源项目基础上的 NX 12 适配与功能扩展:
DreamEnding/NX_MCP — 原始项目,奠定了 MCP 驱动 NX 的整体思路 https://github.com/DreamEnding/NX_MCP (MIT License)
kongbaic/NX_MCP-Enhanced(作者:抖音 无趣)— 本项目的直接基础, 提供常驻 Loader 与命名管道桥 https://github.com/kongbaic/NX_MCP-Enhanced (MIT License)
Cai-aa/CAD-Agent-Hub — 参考其已验证的 NXOpen 实现序列 https://github.com/Cai-aa/CAD-Agent-Hub (MIT License)
感谢以上作者的开源贡献。
Siemens NX 是 Siemens 公司的注册商标。本项目仅通过公开的 NXOpen API 与 NX 交互, 不包含任何 NX 专有代码或二进制文件 —— NX 相关程序集在构建时从本机 NX 安装目录引用。
许可证
本项目整体采用 GNU General Public License v3.0(见 LICENSE)。
上游组件以 MIT License 授权,其许可与版权声明保留在 LICENSES/Upstream-MIT.txt,
不因本项目采用 GPL 而改变;接收者仍可依据 MIT 条款单独使用那些上游组件。
如需商业授权(不适用 GPLv3 的场景),请联系仓库维护者。
Available Tools
50 toolsnx_chamferC
Create a symmetric chamfer on edges of a body; default all edges.
Inputs: offset (required), body_id (required), edge_indices. Returns: object, status, message
nx_circular_patternA
Pattern a body circularly about an axis through center.
count is the total number of instances including the original
(count=4 yields 4 bodies); angle is the total sweep in degrees
(360.0 distributes evenly around a full circle). The original body is
kept and new instances are independent bodies (NOT united); use
nx_unite if merging is required.
Inputs: axis (required), angle (required), count (required), center (required), +2 more. Returns: status, message, objects
nx_close_partB
Close the active work part, optionally saving it first.
Inputs: save. Returns: status, message
nx_counterbore_holeB
Create a coaxial counterbore hole: a smaller deep through hole plus a larger shallow counterbore from the top face. Independent from nx_hole.
Inputs: center (required), body_id (required), hole_depth (required), hole_diameter (required), +3 more. Returns: object, status, message
nx_countersink_holeA
Create a coaxial countersink (conical) hole: a smaller deep through cylinder plus a conical countersink from the top face. Independent of nx_hole / nx_counterbore_hole.
Inputs: center (required), body_id (required), hole_depth (required), hole_diameter (required), +3 more. Returns: object, status, message
nx_create_diameter_dimensionA
Create a DIAMETER dimension on one edge (essential for shafts).
A linear dimension between two edges cannot express a diameter; use this for cylindrical/circular features. edge_index is the 0-based index from nx_list_edges on the given body.
Inputs: pos_x, pos_y, body_id, view_id, +4 more. Returns: status, message
nx_create_dimensionA
Create an associative linear dimension with a bilateral tolerance.
Measures the distance between two model edges (selected by their 0-based index from nx_list_edges on the given body) inside the drafting view. Default tolerance is ±0.1 mm using the BilateralTwoLines style.
Inputs: pos_x, pos_y, body_id, view_id, +6 more. Returns: status, message
nx_create_drawing_sheetB
Create a drawing sheet and place a base view of the given model view.
The part must already contain geometry for the base view to be meaningful.
Inputs: name, size, scale, model_view, +1 more. Returns: status, message
nx_create_noteA
Add technical-requirement / process text to the current drawing sheet.
Use "|" to start a new line, e.g. "技术要求|1. 未注倒角 C0.5|2. 调质 28-32HRC". Position is in sheet coordinates (mm).
Inputs: text (required), pos_x, pos_y. Returns: status, message
nx_create_partC
Create a part inside the configured workspace.
Inputs: path (required), units. Returns: part, status, message
nx_create_projected_viewB
Project a view from an existing drafting view at sheet position (x, y).
Leave parent_view_id empty to use the first drafting view on the sheet.
Inputs: x (required), y (required), name, parent_view_id. Returns: status, message
nx_create_radius_dimensionC
Create a RADIUS dimension on one edge (fillets, arcs, rounds).
edge_index is the 0-based index from nx_list_edges on the given body.
Inputs: pos_x, pos_y, body_id, view_id, +2 more. Returns: status, message
nx_create_roughnessA
Create a surface finish (roughness) symbol on the current drawing sheet.
value goes into the symbol's a1 slot - e.g. "1.6" for Ra 1.6, "3.2" for Ra 3.2. Position is in sheet coordinates (mm).
Inputs: pos_x, pos_y, value. Returns: status, message
nx_create_sketchB
Create and activate a sketch on a principal datum plane.
Inputs: name, plane. Returns: object, status, message
nx_create_title_blockB
Place a title block on the current drawing sheet.
Position is in sheet coordinates (mm); typically bottom-right, e.g. pos_x=340, pos_y=5 for an A3 landscape sheet.
Inputs: pos_x, pos_y. Returns: status, message
nx_delete_annotationA
Delete a note / dimension / GDT / roughness annotation.
Pass either its journal id or name (e.g. "LEN_120", "HANDLE R-5132"), or a "kind:index" selector: note:0, dim:1, gdt:0, rough:0 (0-based, in the order returned by nx_list_dimensions / nx_list_annotations). Useful for cleaning up test annotations that nx_undo cannot reach.
Inputs: annotation_id (required). Returns: status, message
nx_edge_blendB
Create an edge blend (fillet) on edges of a body; default all edges.
Inputs: radius (required), body_id (required), edge_indices. Returns: object, status, message
nx_export_pdfA
Export the current drawing display to a PDF file.
Pass sheet_name to display that sheet first (the export follows the current display). Use nx_list_drawing_sheets to see available sheet names.
Inputs: path (required), sheet_name. Returns: status, message
nx_export_stepB
Export the active work part as STEP inside the configured workspace.
Inputs: path (required). Returns: path, status, message
nx_extrudeC
Extrude a sketch into a new body, or subtract it from an existing target body.
Inputs: distance (required), sketch_id (required), reverse, operation, +2 more. Returns: body, status, feature, message
nx_finish_sketchC
Deactivate and finish an explicit sketch reference.
Inputs: sketch_id (required). Returns: object, status, message
nx_fit_viewA
Fit the active modeling view.
Inputs: no named parameters. Returns: status, message
nx_holeC
Create a hole on a target body (circle sketch + boolean subtract).
Inputs: depth (required), center (required), body_id (required), diameter (required), +1 more. Returns: object, status, message
nx_linear_patternA
Pattern a body linearly along X/Y/Z.
count is the total number of instances including the original
(count=4 yields 4 bodies); spacing is the per-instance delta in mm.
The original body is kept and new instances are independent bodies
(NOT united); use nx_unite if merging is required.
Inputs: count (required), body_id (required), spacing (required), direction (required), +1 more. Returns: status, message, objects
nx_list_annotationsA
Read the non-dimension annotations of a drawing: notes, GD&T, roughness.
Each entry is prefixed by kind: "NOTE|<journal_id>|" drafting / technical-requirement text "GDT|<journal_id>||tol=|datum=,," "ROUGH|<journal_id>" surface finish symbol Use this together with nx_list_dimensions to fully understand an existing NX 2D process drawing.
Inputs: no named parameters. Returns: status, message
nx_list_attributesB
Read back all user attributes set on the part (title-block content).
Inputs: no named parameters. Returns: status, message
nx_list_bodiesB
List bodies in the active work part.
Inputs: no named parameters. Returns: status, message, objects
nx_list_dimensionsA
Read back every dimension in the part: measured size and tolerance.
Returns one entry per dimension, formatted as "<journal_id>||size=|tol=/|<tolerance_type>". Use this to verify dimensions you just created, or to READ an existing NX 2D drawing: sizes and tolerances are recovered from the model, so an agent can understand what a drawing specifies without opening the UI.
Inputs: no named parameters. Returns: status, message
nx_list_drafting_viewsA
List the drafting views on the current drawing sheet.
Inputs: no named parameters. Returns: status, message
nx_list_drawing_sheetsA
List the drawing sheets in the active part.
Inputs: no named parameters. Returns: status, message
nx_list_edgesA
Inspect every edge of a body: index, curve type, endpoints, midpoint, length, bounding box, direction and adjacent face count. Read-only.
Inputs: body_id (required). Returns: object
nx_list_facesA
Inspect every face of a body: index, tag, face type, centroid, area, normal (planar only) and adjacent edge count. Read-only.
Inputs: body_id (required). Returns: object
nx_list_featuresA
List features in the active work part.
Inputs: no named parameters. Returns: status, message, objects
nx_list_sketchesB
List sketches in the active work part.
Inputs: no named parameters. Returns: status, message, objects
nx_measure_distanceA
Measure the minimum 3D distance between two edges of a body.
This is a QUERY: no annotation is created. It returns the numeric distance (mm) plus the two closest points, so an agent can verify geometry instead of guessing. Indices are 0-based from nx_list_edges.
Inputs: body_id, edge_index_1, edge_index_2. Returns: status, message
nx_mirrorA
Mirror a body about a datum plane.
plane selects the mirror datum plane (XY/XZ/YZ); offset shifts
that plane along its normal by the given mm value (default 0). The
mirrored body is created as an independent body and is NOT united with
the source; use nx_unite if merging is required.
Inputs: plane (required), body_id (required), offset. Returns: object, status, message
nx_open_partC
Open a part from the configured workspace.
Inputs: path (required). Returns: part, status, message
nx_releaseA
Clear the current task state and return NX to normal interaction.
With the resident C# Loader backend, the Loader and named pipe remain alive for the entire NX session; nx_release does not unload the plugin or require Alt+F8 to start it again.
Inputs: no named parameters. Returns: status, message
nx_revolveB
Revolve a closed sketch section around an in-sketch 2D axis.
Creates a new solid only (no unite/subtract). axis_start and
axis_end are sketch XY coordinates defining the revolution axis;
angle is the sweep angle in degrees (0 < angle <= 360).
Inputs: axis_end (required), sketch_id (required), axis_start (required), angle, +1 more. Returns: object, status, message
nx_save_partB
Save the active work part.
Inputs: no named parameters. Returns: status, message
nx_set_attributeB
Set a string attribute on the part.
This is how a title block gets its CONTENT: title-block cells usually reference part attributes. Typical names: 名称 / 图号 / 材料 / 设计 / 审核 / 比例 / 单位. Value may contain spaces.
Inputs: name (required), value (required). Returns: status, message
nx_shellA
Shell (hollow) a body: remove one face as an opening and keep a constant wall thickness. First version removes a single face; inward=True keeps the outer dimensions.
Inputs: body_id (required), thickness (required), remove_face_index (required), inward. Returns: object, status, message
nx_sketch_arcC
Add an arc (center, radius, start/end degrees) to an explicit sketch reference.
Inputs: center (required), radius (required), sketch_id (required), end_angle, +1 more. Returns: object, status, message
nx_sketch_circleC
Add a circle (center + diameter) to an explicit sketch reference.
Inputs: center (required), diameter (required), sketch_id (required). Returns: object, status, message
nx_sketch_lineC
Add a line to an explicit sketch reference.
Inputs: end (required), start (required), sketch_id (required). Returns: object, status, message
nx_sketch_rectangleC
Add a rectangle to an explicit sketch reference.
Inputs: corner1 (required), corner2 (required), sketch_id (required). Returns: status, message, objects
nx_statusA
Report bridge, NX version, and active-part status.
Inputs: no named parameters. Returns: status, connected, nx_version, active_part, +1 more
nx_undoB
Undo the last visible NX MCP operation.
Inputs: no named parameters. Returns: status, message
nx_uniteB
Boolean-unite one or more tool bodies into the target body.
The target body keeps its id; the tool bodies are consumed and
disappear from nx_list_bodies after the boolean.
Inputs: tool_body_ids (required), target_body_id (required). Returns: object, status, message
nx_update_viewsA
Force every drafting view on the current sheet to a fresh update.
Clears the out-of-date ("clock") flag shown in the Part Navigator after a drawing or projected view is created or modified.
Inputs: no named parameters. Returns: status, message
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 50 tools
Most tools have clearly distinct purposes: part lifecycle, sketch creation, modeling features, booleans, drafting, annotation, attributes, queries, and export. There is some potential overlap within the hole family (nx_hole, nx_counterbore_hole, nx_countersink_hole) and dimension-creation family, but the descriptions make the boundaries reasonably clear.
All tools use a consistent nx_ snake_case prefix, which makes the set readable and predictable. However, the names are not uniformly verb_noun: several modeling tools use feature nouns or noun-like verbs such as nx_hole, nx_shell, nx_extrude, nx_chamfer, and nx_unite.
Fifty tools is very high for a single MCP server and exceeds the well-scoped range even though NX CAD/drafting is a broad domain. Many granular listing, drafting, annotation, and attribute tools are justified individually, but the overall surface is heavy enough to increase selection cost and cognitive load.
The surface covers a broad CAD workflow: part lifecycle, sketching, solid modeling, booleans, patterns, drafting, dimensions, annotations, attributes, measurement, and export. Remaining gaps include assembly-level operations, editing existing feature parameters, body/feature deletion beyond undo, and some dimension types, but core workflows are well supported.
Related MCP Connectors
Text-to-CAD: build exact STEP or 3MF/STL on the server, each stated requirement measured.
CAD in ChatGPT and Claude: editable parts, STEP/STL/drawings, in-chat 3D, automatic checks.
Parametric 3D CAD for AI agents: build print-ready parts, check them, export STL, 3MF or STEP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables natural language control of Siemens NX for text-to-CAD modeling, generating .prt files via NX Open API. Currently supports basic solids, booleans, and fillets in batch mode.5-
- AlicenseNot gradedqualityCmaintenanceEnables natural-language control of Autodesk Inventor to create parametric parts, sketches, holes, and sheet-metal features, and to inspect, save, or export models.MIT
- AlicenseNot gradedqualityCmaintenanceEnables natural-language generation and editing of native CATIA V5 parts and assemblies through MCP tools, converting semantic requests into parametric CATPart/CATProduct models via the CATIA Automation API.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to drive desktop CAD software through natural language with verified execution, failure recovery, and traceable results across modeling, assemblies, drawings, exports, motion, FEA, and related engineering workflows.1MIT