Skip to main content
Glama
nx-ai-bridge

nx-ai-bridge

by qiuyekai

nx-ai-bridge

Let any AI tool drive Siemens NX (UG) modelling. 中文说明

⚠️ ALPHA - not yet verified on a real NX installation

The bridge (MCP server, CLI, mock) is tested on Windows, macOS and Linux. The part that runs inside NX was written without access to NX and has only been compiled and exercised against a stand-in for the NX Open API. Expect some tools to fail on real NX until the first self-check reports have been worked through. See Verification status.

Tell your AI assistant:

Install the plugin https://github.com/qiuyekai/nx-ai-bridge and draw an L-bracket with two holes in NX.

The assistant reads AGENTS.md, installs the bridge, asks you to start one journal inside NX, and then models directly in your NX window while you watch.

AI tool ──MCP (stdio)──▶ bridge (Python) ──127.0.0.1──▶ receiver journal inside NX ──▶ NX Open API
   └────── or CLI ───────┘
  • Any AI tool: an MCP server for Claude Code / Claude Desktop / Cursor / Codex / Gemini CLI / VS Code, and an identical command line interface for tools that can only run commands.

  • No installation inside NX: the receiver is a journal (Alt+F8). No NX Open author licence, no compiled DLL, no administrator rights. Windows-side setup is a folder copy.

  • The AI can see and verify: every modelling step returns the body's volume and bounding box; screenshot returns a picture of the NX window.

  • Errors the AI can act on: structured JSON with NX's original error text; failed steps are rolled back.

  • Escape hatch: run_journal executes NX Open code written by the AI; nx_api_lookup lets it explore the API of the running NX version without documentation.

Related MCP server: CadKitty

Supported versions

NX

target NX 10.0; the code avoids newer APIs and adapts at run time, NX 11/12/1xxx/2xxx should need little work - untested

OS (NX side)

Windows 10 or newer

Python (bridge)

3.10+ (or just uv, which fetches Python itself)

AI tools

anything that speaks MCP over stdio, or can run shell commands

Quick start (Windows with NX)

git clone https://github.com/qiuyekai/nx-ai-bridge.git
cd nx-ai-bridge
powershell -ExecutionPolicy Bypass -File install.ps1

install.ps1 needs no administrator rights. It locates NX, copies the receiver to %USERPROFILE%\.nx-ai-bridge\nx_receiver, prepares Python and prints the configuration for your AI tool. No Python on the machine? install.ps1 -InstallUv puts uv into your user profile.

Then the one manual step, inside NX:

  1. Start NX and open or create a part.

  2. Press Alt+F8 (menu Tools > Journal > Play...).

  3. Select %USERPROFILE%\.nx-ai-bridge\nx_receiver\NxAiBridgeReceiver.cs and click Run.

  4. A small "NX AI Bridge" window appears. Leave it open - closing it stops the receiver.

Configure your AI tool

install.ps1 prints the exact command for your machine. The generic form, using uv straight from GitHub:

claude mcp add nx -- uvx --from git+https://github.com/qiuyekai/nx-ai-bridge nx-ai-bridge serve

.cursor/mcp.json, claude_desktop_config.json, ~/.gemini/settings.json:

{
  "mcpServers": {
    "nx": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/qiuyekai/nx-ai-bridge", "nx-ai-bridge", "serve"]
    }
  }
}
[mcp_servers.nx]
command = "uvx"
args = ["--from", "git+https://github.com/qiuyekai/nx-ai-bridge", "nx-ai-bridge", "serve"]
{
  "servers": {
    "nx": { "type": "stdio", "command": "uvx", "args": ["--from", "git+https://github.com/qiuyekai/nx-ai-bridge", "nx-ai-bridge", "serve"] }
  }
}
nx-ai-bridge tools
nx-ai-bridge call nx_status
nx-ai-bridge call create_block length=100 width=50 height=20
nx-ai-bridge call create_hole '{"position": [50, 25, 20], "diameter": 10, "through": true}'

Every call prints a JSON envelope and exits with code 1 on failure.

A PyPI release (pip install nx-ai-bridge / uvx nx-ai-bridge) will follow once the receiver has been verified on real NX.

Try it without NX

Works on any OS; the mock receiver fakes NX with simple geometry:

git clone https://github.com/qiuyekai/nx-ai-bridge.git && cd nx-ai-bridge
NX_AI_BRIDGE_TRANSPORT=mock uv run nx-ai-bridge demo --part /tmp/bracket.prt

Tools

All lengths are millimetres, all angles degrees. nx-ai-bridge tools <name> shows the parameters of a tool.

group

tools

basics

nx_status · get_model_info (features, bounding box, volume) · run_journal (arbitrary NX Open code) · nx_api_lookup · nx_batch

parts

new_part · open_part · save_part · save_part_as · close_part

primitives

create_block · create_cylinder · create_cone · create_sphere

sketch

create_sketch (principal plane, custom plane or planar face) · sketch_line · sketch_circle · sketch_rectangle · sketch_arc

features

extrude · revolve · create_hole · edge_blend · chamfer · shell

booleans

boolean_unite · boolean_subtract · boolean_intersect

manage

list_features · delete_feature · list_expressions · set_expression · undo · list_edges · list_faces

export

export_step · export_stl · screenshot (PNG; the MCP server returns the image)

Every tool answers with

{"ok": true, "result": {"feature": "BLOCK(1)", "body": "B1", "volume": 32000, "bbox": [0, 0, 0, 80, 40, 10]}}

or, on failure, with NX's own error message so the AI can correct itself:

{"ok": false, "error": {"code": "NX_ERROR", "message": "Tool body completely outside target body.",
                        "nx_error": {"type": "NXOpen.NXException", "error_code": 670030, "message": "..."}}}

Two modes

live (default)

batch

how

you play the receiver journal in NX

NX_AI_BRIDGE_TRANSPORT=batch; the bridge starts run_journal.exe itself

NX window

yes - you watch the AI work

none

speed

instant

one NX start per call (use nx_batch to run many steps at once)

screenshots

yes

no

output

your open part

.prt files on disk

Two transports exist for live mode and are chosen automatically: a TCP socket on 127.0.0.1 and, as a fallback, polling a request folder (%USERPROFILE%\.nx-ai-bridge\ipc). Details: docs/protocol.md.

Self-check

Because the NX side was written blind, the project ships a self-check that replaces days of manual testing with two clicks. If you have NX, running it is the most valuable contribution you can make:

powershell -ExecutionPolicy Bypass -File selfcheck.ps1

Then play %USERPROFILE%\.nx-ai-bridge\nx_receiver\NxAiBridgeSelfCheck.cs in NX (Alt+F8) and answer one question. You get a single file, nx-ai-bridge-selfcheck-<time>.json (a copy lands on your Desktop). Please attach it to a GitHub issue. It contains: NX version and install path, whether run_journal.exe works under your licence, which transport works, whether NX stays responsive while the receiver runs, the result of every tool with the original NX error, analytic volume checks of a reference bracket, and a listing of NX Open member names (no geometry or personal files of yours; the report does include your Windows user name inside file paths).

Verification status

component

status

bridge: MCP server, CLI, transports, mock

✅ automated tests on Windows / macOS / Linux, Python 3.10 and 3.12

receiver kernel: JSON, TCP + folder transport, run-time compiler, fallback logic, batch runner, self-check report

✅ compiled with the .NET Framework C# 5 compiler and run end-to-end in CI - without NX

all tool handlers compile

✅ against a hand-written stand-in for NX Open, which proves syntax only

journal loads and runs inside NX 10

❌ not verified

every modelling tool on real NX

❌ not verified

NX stays interactive while the receiver runs

❌ not verified

batch mode with run_journal.exe

❌ not verified

Findings from real machines are collected in docs/nx10-notes.md.

Security and limitations

  • run_journal executes arbitrary code inside NX with your user's privileges - that is its purpose. Only connect AI tools you trust, and review what they are about to run when working on valuable data. To disable it, delete %USERPROFILE%\.nx-ai-bridge\nx_receiver\handlers\run_journal.cs.

  • The receiver listens on 127.0.0.1 only and never opens a port to the network. There is no authentication: any program running under your Windows account can send it requests while the receiver window is open.

  • The receiver compiles its own source files (C#) at start-up with the compiler that is part of Windows and caches the result under %USERPROFILE%\.nx-ai-bridge\cache - the same mechanism NX uses to play journals. Anyone who can write to that folder can change what runs inside NX.

  • One request at a time; long NX operations block the queue.

  • AI-driven modelling makes mistakes. Work on copies, save often, and check results before relying on them.

Not affiliated with Siemens

This is an independent open-source project. It is not a Siemens product and is not endorsed by Siemens. "NX" and "Unigraphics" are trademarks of Siemens Industry Software Inc. You need your own valid NX licence; the project contains no Siemens files (no DLLs, no documentation). It works through NX's own journal mechanism and the NX Open API of your installation; whether and how you may automate NX is governed by your NX licence terms.

Repository layout

AGENTS.md            instructions for AI agents (install, use, troubleshoot)
install.ps1          Windows setup, no admin rights
selfcheck.ps1        self-check part 1 (outside NX)
nx_receiver/         runs inside NX
  NxAiBridgeReceiver.cs    the journal you play (a small loader)
  NxAiBridgeSelfCheck.cs   the self-check journal
  kernel/                  JSON, transports, run-time compiler, dispatcher, control window (no NX Open calls)
  nxlib/                   shared NX Open helpers
  handlers/                one small C# file per tool group, compiled individually, hot-reloaded
  vb/                      VB.NET versions of the two journals (fallback)
src/nx_ai_bridge/    MCP server, CLI, transports, mock receiver
tests/               tests incl. a stand-in for NX Open used by CI
docs/                protocol, design notes, NX 10 findings

Design rationale: docs/design.md.

Development

uv venv && uv pip install -e ".[dev]"
uv run pytest                      # no NX needed
python scripts/sync_loaders.py     # after editing the loader journals

License

MIT

Available Tools

38 tools
boolean_intersectB

Keep only the volume shared by the target body and the tool bodies. The tools are consumed.

Inputs: tools (required), target (required).

boolean_subtractB

Subtract tool bodies from the target body. The tools are consumed.

Inputs: tools (required), target (required).

boolean_uniteA

Unite (add) tool bodies to the target body. The tools are consumed.

Inputs: tools (required), target (required).

chamferB

Chamfer edges with a symmetric offset. Use list_edges to find edges. Units: millimetres (mm) and degrees.

Inputs: distance (required), edges, all_edges_of_body.

close_partA

Close the work part. Unsaved changes are discarded unless save=true.

Inputs: save.

create_blockA

Create a rectangular block. origin is the corner with the smallest x/y/z; the block extends length along +X, width along +Y, height along +Z. Units: millimetres (mm) and degrees.

Inputs: width (required), height (required), length (required), origin, +2 more.

create_coneB

Create a cone or truncated cone. origin is the centre of the base circle. Units: millimetres (mm) and degrees.

Inputs: height (required), base_diameter (required), origin, target, +3 more.

create_cylinderB

Create a cylinder. origin is the centre of the base circle; the cylinder grows along direction. Units: millimetres (mm) and degrees.

Inputs: height (required), diameter (required), origin, target, +2 more.

create_holeA

Drill a simple round hole into a body. position is the centre of the hole on the entry face; the hole goes along direction (pointing INTO the material). Implemented as a subtracted cylinder so the geometry is exact. Units: millimetres (mm) and degrees.

Inputs: diameter (required), position (required), body, depth, +2 more.

create_sketchA

Create an empty sketch on a principal plane, on an arbitrary plane, or on a planar face. Returns the sketch name used by sketch_* tools, extrude and revolve. Sketch coordinates are 2D (x, y) in the sketch plane: for XY the sketch x/y are absolute X/Y (normal +Z); for XZ they are absolute X/Z (normal -Y); for YZ they are absolute Y/Z (normal +X). The result reports origin, x_axis, y_axis and normal. Units: millimetres (mm) and degrees.

Inputs: face, name, plane, normal, +2 more.

create_sphereB

Create a sphere. Units: millimetres (mm) and degrees.

Inputs: diameter (required), center, target, boolean.

delete_featureB

Delete a feature (and features that depend on it).

Inputs: feature (required).

edge_blendA

Round (fillet) edges with a constant radius. Use list_edges to find edges. Units: millimetres (mm) and degrees.

Inputs: radius (required), edges, all_edges_of_body.

export_stepC

Export the work part as a STEP file (AP214).

Inputs: path (required).

export_stlB

Export solid bodies of the work part as a binary STL file.

Inputs: path (required), bodies, tolerance.

extrudeA

Extrude all curves of a sketch along the sketch normal (or direction). The curves must form closed loops to get a solid. Units: millimetres (mm) and degrees.

Inputs: sketch (required), distance (required), start, target, +2 more.

get_model_infoB

Summarise the work part: feature list, bodies with bounding box [xmin,ymin,zmin,xmax,ymax,zmax] (mm), volume (mm^3), surface area (mm^2) and centroid. Units: millimetres (mm) and degrees.

Inputs: include_features.

list_edgesA

List the edges of a body with id, type, length, end points and mid point. Ids are valid until the body changes.

Inputs: body.

list_expressionsA

List the expressions (parameters) of the work part with name, value and formula.

Inputs: no named parameters.

list_facesB

List the faces of a body with id, type, a point on the face, its normal/axis direction and bounding box.

Inputs: body.

list_featuresA

List all features of the work part in timestamp order.

Inputs: no named parameters.

new_partA

Create a new, empty millimetre part and make it the work part.

Inputs: path (required).

nx_api_lookupA

Search the NX Open .NET API that is actually loaded in the running NX (works offline, no docs needed). Give type (e.g. 'NXOpen.Features.ExtrudeBuilder') to list its members with signatures, and/or query to find types/members whose name contains the text. Use before writing run_journal code.

Inputs: type, limit, query.

nx_batchA

Run several tool calls in order as one unit. In batch mode (no NX window) this starts NX only once, which is much faster than separate calls. Returns one result per command.

Inputs: commands (required), stop_on_error.

nx_statusA

Check the connection to NX. Returns NX version, receiver mode (live/batch/mock), the work part path and whether it has unsaved changes. Call this first.

Inputs: no named parameters.

open_partA

Open an existing .prt file and make it the work part.

Inputs: path (required).

revolveB

Revolve all curves of a sketch about an axis given in ABSOLUTE coordinates. Units: millimetres (mm) and degrees.

Inputs: sketch (required), axis_direction (required), angle, target, +3 more.

run_journalA

ESCAPE HATCH: compile and run arbitrary NX Open code inside NX. Use it when no dedicated tool exists. The code must be a complete journal with a public static/shared Main method (C# class or VB Module). It may return a string from Main; text written to Console is captured too. Compile errors and NX exceptions are returned verbatim so you can fix the code and retry. WARNING: this executes arbitrary code with the user's privileges.

Inputs: code (required), args, language.

save_partA

Save the work part to its current file.

Inputs: no named parameters.

save_part_asB

Save the work part under a new file name; the new file becomes the work part.

Inputs: path (required).

screenshotA

Save a PNG image of the NX graphics window so you can SEE the model. The MCP server returns the image itself. Only available in live mode (batch mode has no graphics window).

Inputs: fit, path, view.

set_expressionA

Change an expression (parameter) and update the model. Give either a numeric value or a formula string.

Inputs: name (required), value, formula.

shellB

Hollow out a solid body leaving walls of the given thickness. Faces listed in remove_faces are opened. Units: millimetres (mm) and degrees.

Inputs: thickness (required), body, remove_faces.

sketch_arcA

Add a circular arc to a sketch, counter-clockwise from start_angle to end_angle (degrees, measured from the sketch x axis).

Inputs: center (required), radius (required), sketch (required), end_angle (required), +1 more.

sketch_circleC

Add a full circle to a sketch.

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

sketch_lineC

Add a straight line to a sketch.

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

sketch_rectangleB

Add an axis-aligned rectangle (four lines) to a sketch.

Inputs: sketch (required), corner1 (required), corner2 (required).

undoC

Undo the last modelling steps (each modifying tool call is one step).

Inputs: steps.

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 38 tools

    Disambiguation5/5

    Tools are cleanly separated by resource and action: primitives, sketch entities, booleans, lifecycle, inspection, and export are all distinct. run_journal and nx_batch are explicit meta-tools, and create_hole is a clearly described convenience distinct from boolean_subtract.

    Naming Consistency4/5

    All names use snake_case and mostly follow predictable patterns such as create_block, sketch_line, boolean_unite, list_edges, and export_step. Minor deviations like bare verbs (extrude, revolve, chamfer, shell, undo) and the nx_ prefix are readable and logical.

    Tool Count2/5

    At 38 tools, the surface is above the rubric's 25+ threshold and feels heavy for an agent-facing interface, even accounting for CAD breadth. Many tools are individually justified, but the set would benefit from grouping or progressive disclosure.

    Completeness4/5

    The set covers part lifecycle, primitives, sketching, core features, booleans, inspection, parameters, undo, and export, with run_journal as an escape hatch for gaps. Common CAD operations such as STEP import, transform/move, mirror/pattern, and assembly are missing, but agents can work around them via journals.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      C
      maintenance
      Enables AI agents to create and edit native KOMPAS-3D models from text descriptions, drawings, or PDFs, with parameterization, assemblies, drawings, and export to STEP, STL, and IGES.
      41
      12
      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
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables 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.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables natural-language control of Siemens NX 12 for 3D modeling, 2D drafting, tolerance annotation, process planning, read-back verification, and PDF export through a persistent NXOpen bridge.
      50
      GPL 3.0