Skip to main content
Glama
NX MCP Server

NX MCP Server

by kongbaic

NX MCP — Enhanced Edition (V2)

原始项目:DreamEnding/NX_MCP — MIT License. 本项目为 增强版,在原项目基础上增加了 C# 常驻 NXOpen 后端 (NX_MCP_Loader)、扩展建模工具,以及用于“二维工程图 → NX 自动建模”的一体化 Agent Pack。

作者:抖音 无趣

NX MCP 是一套本地运行的 Siemens NX 自动化系统,可通过 Agent 接收文字建模要求,或自动读取二维机械工程图,统一生成建模计划并驱动 Siemens NX 完成建模。所有组件均在本机运行,不依赖云端服务。


推荐架构(V2)

Agent
  -> 文字描述 --------┐
  -> 二维工程图 -> Drawing Reader
                      ↓
               Modeling Planner
                      ↓
                 Plan Runner
                      ↓
              Python MCP sidecar
                      ↓
               LoaderBridge
                      ↓
          named pipe (localhost)
                      ↓
            NX_MCP_Loader.dll
                      ↓
                   NXOpen
                      ↓
                Siemens NX

常驻 Loader 会在 NX 启动时自动加载,正常使用无需 Alt+F8 或手动运行 Journal。 NX_MCP_BACKEND=auto 默认优先使用 Loader,仅在 Loader 不可用时回退到旧版 Python bridge。


Related MCP server: self-host-fusion360-mcp

已认证工具(32 个)

已在 Windows + Siemens NX 2506 真机环境完成验证。

分类

工具

文件

nx_create_part, nx_open_part, nx_save_part, nx_close_part, nx_export_step

状态 / 查询

nx_status, nx_list_sketches, nx_list_bodies, nx_list_features

几何检查

nx_list_edges, nx_list_faces

草图

nx_create_sketch, nx_sketch_line, nx_sketch_rectangle, nx_sketch_circle, nx_sketch_arc, nx_finish_sketch

拉伸

nx_extrude(create / subtract);实体合并使用独立 nx_unite

孔

nx_hole, nx_counterbore_hole, nx_countersink_hole

特征

nx_unite, nx_revolve, nx_mirror, nx_linear_pattern, nx_circular_pattern, nx_shell

边处理

nx_edge_blend, nx_chamfer

视图 / 恢复

nx_undo, nx_fit_view, nx_release


安装 — 一体化一键流程

环境要求

  • Windows 10/11

  • 已安装 Siemens NX(当前在 NX 2506 上完成真机验证)

  • Python 3.10+

  • 已安装并至少启动过一次 Agent 客户端

克隆仓库后,在仓库根目录执行一条命令:

powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1

安装器会自动完成:

  1. 创建 Python 虚拟环境并安装 NX_MCP-Enhanced sidecar

  2. 创建 Workspace

  3. 为当前 Windows 用户配置 UGII_USER_DIR

  4. 构建 C# Loader

  5. 将 Loader 部署到 %UGII_USER_DIR%\startup

  6. 安装统一 nx-agent Skill(文字描述建模 + 二维工程图自动建模)

  7. 安装 Plan Runner 并执行轻量测试

如果存在多个 Agent Profile,可手动指定:

powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1 -AgentProfile "Profile 7"

注:-AgentProfile 是当前安装脚本中的兼容参数名,仅用于指定本机 Profile。

如果安装前 Siemens NX 已经处于运行状态,安装完成后需要重启一次 NX, 让新进程读取 UGII_USER_DIR 并自动加载新部署的 Loader。 如果 NX 尚未启动,安装完成后直接启动即可。

安装完成并启动 / 重启 NX 后,有两种建模方式:

方式一:文字描述建模

新建一个 Agent 对话,直接描述你希望创建或修改的 NX 模型,例如:

用我打开的 NX 创建一个 100×60×10 mm 的底板,四角 R8,
并在四角各打一个 Ø8 通孔。

文字建模由统一 nx-agent 生成建模计划,再通过 Plan Runner → resident Loader 执行;无需额外 MCP 客户端 JSON 配置。

方式二:二维工程图自动建模

新建一个 Agent 对话,上传二维机械工程图,并发送:

开始建模

工程图模式由统一 nx-agent 内部执行:工程图读取 → 建模规划 → Plan Runner;阶段 C 失败时仅允许一次受控自动修复,并从干净状态完整重跑。

完整安装说明请查看 INSTALL.md。


路径自动检测

项目

检测 / 使用顺序

NX 安装目录(UGII_BASE_DIR)

UGII_BASE_DIR 环境变量 → 注册表 → PATH → %ProgramFiles%\Siemens\NX*

Workspace(NX_MCP_WORKSPACE)

环境变量 → %USERPROFILE%\NX_MCP_WORKSPACE

NX 用户目录(UGII_USER_DIR)

优先使用已有环境变量;未设置时自动配置为 %USERPROFILE%\.nx_mcp_user

Loader 启动目录

%UGII_USER_DIR%\startup


当前限制

  • 暂不支持真实螺纹 / 螺纹孔几何。

  • Sweep、Loft、Draft、Spline、渐开线齿轮及复杂自由曲面不在当前认证范围内。

  • 当前真机认证环境为 NX 2506 / Windows;其他 NX 版本可能可用,但尚未正式验证。

  • STEP 导出后,NX Translator 可能需要短暂时间完成文件写入。


两种建模入口

Agent Pack 已经内置在本仓库中,并由 install.ps1 自动安装。

对外只安装一个统一 Skill:

  • nx-agent:自动识别并处理文字描述建模、工作区内已保存零件的安全修改、二维工程图自动建模

工程图模式内部仍保持模块化规则:工程图读取 → 建模规划 → Plan Runner。Plan Runner 作为内部执行器安装,不再作为单独 Skill 展示。

详细使用说明:docs/DRAWING_TO_NX.md

NX_MCP 核心仍可独立使用;install-agent.ps1 保留为高级工具, 用于只重装 Agent Pack,而不重新安装 NX_MCP 核心。


致谢

  • 原始项目:DreamEnding/NX_MCP

  • 增强版 / 一体化 Agent Pack:NX MCP contributors

许可证

MIT License,详见 LICENSE。

原始项目内容继续遵循其自身的 MIT License。

Available Tools

32 tools
nx_chamferB

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_holeA

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_partC

Create a part inside the configured workspace.

Inputs: path (required), units. Returns: part, status, message

nx_create_sketchC

Create and activate a sketch on a principal datum plane.

Inputs: name, plane. Returns: object, status, message

nx_edge_blendC

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_stepB

Export the active work part as STEP inside the configured workspace.

Inputs: path (required). Returns: path, status, message

nx_extrudeB

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_bodiesA

List bodies in the active work part.

Inputs: no named parameters. Returns: status, message, objects

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_sketchesA

List sketches in the active work part.

Inputs: no named parameters. Returns: status, message, objects

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

Gracefully stop the bridge and release the NX GUI for manual editing.

The current command completes, then the journal ends and NX becomes fully interactive (no restart of NX required). Start the bridge again later by running the launcher journal (Alt+F8) again.

Inputs: no named parameters. Returns: status, message

nx_revolveA

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_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_arcA

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_lineB

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_uniteA

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

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 32 tools

    Disambiguation5/5

    Every tool targets a distinct operation: inspection, part management, sketch creation, sketch primitives, feature creation, boolean, patterns, and control. The three hole tools are clearly differentiated by geometry type, and list tools each query a different entity. No two tools appear to do the same thing.

    Naming Consistency5/5

    All tools follow a consistent nx_verb_noun pattern using lower_snake_case, such as list_faces, create_sketch, extrude, and unite. The verbs are predictable and the naming style is uniform throughout the set, making the interface highly navigable.

    Tool Count4/5

    While 32 tools is above the typical 3-15 range, it is appropriate for a comprehensive CAD modeling server. Each tool serves a specific function spanning part lifecycle, inspection, sketching, feature creation, boolean operations, and patterning. The count is justified by the breadth of NX modeling capabilities.

    Completeness4/5

    The tool surface covers part lifecycle (create/open/save/close), inspection (list faces/edges/sketches/bodies/features), sketch creation with primitives, feature creation (extrude, revolve, holes, shell, blend, chamfer), boolean unite, patterns, mirror, export, and undo. Missing delete and edit-parameter operations can be worked around via undo and recreation, so no major dead ends.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables 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
      -
    • A
      license
      B
      quality
      B
      maintenance
      Enables any MCP client to drive Autodesk Fusion 360 locally, with ~100 tools for modeling, assemblies, CAM, inspection, and verification, plus enhanced component targeting and explicit thread creation.
      108
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables safe, local Siemens NX automation through MCP, providing tools for part creation, sketching, extrusion, feature manipulation, measurement, save-as, and STEP export within a confined workspace.
      19
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to build and edit native CAD parts and assemblies, inspect saved geometry and measurements, retain revisions, run mechanism and interference checks, and export STEP/STL/GLB artifacts through MCP tools.
      MIT