Skip to main content
Glama
ntopology-mcp

ntopology-mcp

by sohumsuthar

ntopology-mcp

An MCP server for nTop (formerly nTopology) that reads and edits notebook block graphs directly, runs them headlessly through nTop Automate, and measures the geometry that comes out.

nTop ships an official MCP server, and it solves a different problem: it searches nTop's documentation. This one operates on your files. The two are complementary — theirs answers "how would I set up a topology optimization", this one sets one up and runs it.

The documented automation path (nTop Automate) expects you to build a notebook by hand in the GUI, expose a few inputs as variables, and vary those from a script. That covers parameter sweeps. It does not let you add a block, rewire an input, or restructure a graph. This server does, by treating the .ntop file as what it is: a container holding a JSON block graph.

Tools

Tool

Description

inspect_notebook

Version, sections, block and value counts, and what the root evaluates

read_graph

Blocks with typed signatures, wiring and literal values; filterable, 200 by default

validate_graph

Dangling inputs, duplicate ids, missing root, literals with no value, extra edges past a list<T> parameter

set_literal_value

Change a scalar, file path, vector, point, boolean or enum

set_input

Rewire one input slot of a block

add_block

Add a computed block from a typed signature

add_literal

Add a constant

prune_graph

Point the root at chosen outputs and drop everything unreachable

run_notebook

Execute through ntopcl, returning structured errors, warnings and per-block timings

search_blocks

Search the block signatures present in your nTop installation

mesh_stats

Volume, area, bounding box, open and non-manifold edge counts, components, facet orientation

set_output

Choose which block ntopcl -o reports as the notebook output

find_example

Search nTop's own shipped example notebooks and reference pages

environment

Report what the server can find on this machine

Related MCP server: Onshape MCP Server

Requirements

  • nTop installed. Verified against 5.54.2 on Windows.

  • nTop Automate licence for run_notebook. This is licensed separately from the GUI seat; everything else works without it.

  • Node.js 20+ to run the server. The test suite needs 21+, where node --test accepts a glob.

Install

git clone https://github.com/sohumsuthar/ntopology-mcp.git
cd ntopology-mcp
npm install
npm run build

Configuration

Add to your MCP client config:

{
  "mcpServers": {
    "ntopology": {
      "command": "node",
      "args": ["C:\\path\\to\\ntopology-mcp\\dist\\index.js"],
      "env": {
        "NTOP_INSTALL_ROOT": "C:\\Program Files\\nTopology\\nTopology"
      }
    }
  }
}

NTOP_INSTALL_ROOT is optional if nTop is at the default Windows location. NTOPCL_PATH can point at ntopcl.exe directly. Call environment first to confirm what the server found.

Example

Retarget an existing optimization at a different design space, cut it down to one output chain, and run it:

read_graph         notebook=bracket.ntop filter=file_path
set_literal_value  notebook=bracket.ntop blockId=477 value={"val": "C:/parts/wedge.step"}
prune_graph        notebook=bracket.ntop rootInputs=[900] output=bracket_run.ntop
run_notebook       notebook=bracket_run.ntop
mesh_stats         path=C:/parts/result.stl listComponents=true

The editing tools validate before they write and refuse to save a graph with errors, so anything they produce is already checked. Run validate_graph on notebooks this server did not write - one edited in the nTop GUI, say - before spending minutes on run_notebook.

The notebook format

The .ntop format is not documented by nTop. What follows was derived by inspecting files written by 5.54.2, and the parser is verified by round-tripping real notebooks byte for byte.

file     : "MAGIC%$1" u64 sectionCount u64 reserved
           sectionCount * { name[16], u64 endOffset }
           80 zero bytes, then sections laid out in table order
section  : "MAGIC@@9" type[16] name[16] u64 contentLength 80 zero bytes, content

The main section holds two children: fn, the block graph as JSON, and leaves, an object container whose index section carries every literal value. A block with a non-empty func computes something; a block with an empty func is a literal. Inputs reference the producing block by id, with 0 and -1 both meaning unconnected.

Behaviour worth knowing

These cost real debugging time and are encoded in validate_graph or in tool descriptions where possible:

  • A list<T> parameter must be fed by exactly one core.list<T> block. Wiring two implicits straight into the list slot makes nTop reject the entire file at load with a generic "unable to load your file", naming nothing. validate_graph catches the form this produces in practice: connected edges past the declared parameter count on a block that has a list<T> parameter.

  • Extra trailing unconnected input slots are normal. nTop emits them itself when a block version gains an optional parameter, so they are not an error.

  • plane<point,vector,vector> takes an origin and two vectors that span the plane. The normal is their cross product, not the second argument.

  • offset_implicit is inverted from intuition: a positive offset erodes. Rounding convex edges (a morphological opening) is offset(+r) then offset(-r).

  • boolean_union's blend enum: 1 adds material at the joint, 2 removes it, 0 is a hard union.

  • implicit_to_mesh v2.4.0's third input is Min Feature Size. Set it to 5 mm and a 5 mm plate silently disappears.

  • The version suffix is load-bearing. The binaries contain every historical revision of a block, but nTop registers only the current one. An old revision fails with the same "Unknown block … Toolkit or Connector that is not installed" message as an unlicensed toolkit, so a stale signature looks exactly like a missing licence. search_blocks returns the newest revision of a name first; prefer it, and treat a bare unversioned form with suspicion.

  • An unconnected input is -1 (Empty), not 0 (None). 0 on a required input makes nTop refuse to load the file. But -1 is not universally safe either: some optional inputs reject it with Input at N is Empty but optional and must be fed a literal. Match what the surrounding notebook already does, and let validate_graph and a trial run settle the rest.

  • ntopcl -o reports the block named by the graph's own output key, which set_output sets. The root group's inputs are not notebook outputs; without set_output you get Output path specified, but can't find output in notebook.

  • ntopcl exits 0 even when a block fails: it logs [E] and still prints "nTop successfully built". Never judge a run by its exit code alone - run_notebook reports success only when the exit code is 0, no error lines appeared, and the build line is present.

  • An inside-out mesh is silently fatal. Inward-facing normals make nTop's tet mesher fail with a generic "Volume meshing errors" naming nothing, while the mesh is watertight, manifold and correctly sized. mesh_stats reports inverted for exactly this case.

  • Result blocks that expose time series are indexed from 1, and step 1 is often a non-physical initialisation rather than the answer. Reading it produces plausible-looking nonsense with no error.

  • Preserving a region during optimization uses passive_region_constraint<region> fed by fe_region_by_implicit, added to the optimization constraint list. The Initial Density input does not freeze anything — nTop documents it as a starting guess only.

nTop ships its own examples - read them first

nTop installs roughly 100 working example notebooks at C:\ProgramData Topology\documentation\ExtendedBlockDocs\ and full HTML reference pages under block-documentationlocks\. find_example searches both. An example notebook settles a block's wiring, literal shapes and property paths in seconds, where reverse-engineering the same thing from error messages takes hours. Check there before guessing.

Literal value shapes

Literal values are stored per type and the shapes are not uniform:

Type

Value

real

{"isFinite":true,"units":{"length":1},"val":0.005} (SI - metres)

point

array of three such objects

text

{"string":"inlet"} - not {"val":...}

choice

{"choices":["Full Analysis","Potential Flow"],"selected":0}

file_path

{"val":"C:/path/to/file.step"}

unit_length_enum

{"id":"mm"}

A wrong shape fails at load with Leaf failed to deserialize with block/variable <name>.

Block signatures

nTop stores its block signatures as ASCII strings inside its own binaries, including revisions that are no longer registered. search_blocks extracts them from your installation at runtime and orders the newest revision of each name first. No signature data is included in this repository — the signatures are nTop's, and this server reads them from your licensed install rather than redistributing them.

Limitations

  • The container format is reverse-engineered and verified only against nTop 5.54.2. inspect_notebook reports the version each file records; treat other versions as unverified and keep backups.

  • Editing tools write in place unless you pass output. They refuse to write a graph that fails validation, but they cannot know whether an edit is semantically right for your model.

  • run_notebook needs an nTop Automate licence. Without one, ntopcl exits after login and the error is surfaced.

  • Windows only in practice, since that is where nTop runs.

Development

npm run check         # type-check src and test
npm test              # build, then run the test suite
npm run format:check  # Prettier is enforced by config, not by CI

Tests are self-contained and do not require nTop. Two suites widen given more to work with:

  • NTOP_TEST_NOTEBOOKS — semicolon-separated .ntop paths, round-tripped byte for byte. This is gated on the paths you supply, not on nTop being installed. No notebooks ship with the repository, so the round-trip claim above is one you should re-verify against your own files rather than take on trust.

  • The catalog suite scans a real installation when one is found, and skips otherwise.

License

MIT — see LICENSE.

Not affiliated with or endorsed by nTop. "nTop" and "nTopology" are trademarks of their respective owner.

Available Tools

14 tools
add_blockA

Add a computed block. Give the full typed signature from search_blocks. Inputs are source block ids in parameter order; use 0 for an unconnected optional input. A list parameter takes exactly one core.list block.

Inputs: func (required), name (required), type (required), inputs (required), +3 more.

add_literalC

Add a literal block holding a constant. Value shape follows nTop: a length scalar is {"isFinite":true,"units":{"length":1},"val":0.005} in metres, a point is an array of three such objects, an enum is {"enum":0}.

Inputs: name (required), type (required), value (required), notebook (required), +2 more.

environmentB

Report whether ntopcl and an nTop installation were found, and how many block signatures are visible.

Inputs: no named parameters.

find_exampleA

Search nTop's own shipped documentation for a block: working example notebooks and HTML reference pages. Consult this BEFORE reverse-engineering a block's wiring - nTop ships 100+ example .ntop files that show the correct inputs, literal shapes and property paths.

Inputs: query (required), documentationRoot.

inspect_notebookA

Summarise a .ntop notebook: nTop version it was written by, its sections, how many blocks and literal values it holds, and what the root block evaluates.

Inputs: notebook (required).

mesh_statsA

Measure an STL: volume, surface area, bounding box, watertightness and connected components. Use this to check what a notebook actually produced.

Inputs: path (required), listComponents.

prune_graphA

Point the root block at the given outputs and drop every block no longer reachable. Use this to cut a large notebook down to one chain before running it.

Inputs: notebook (required), rootInputs (required), output.

read_graphA

List the blocks in a notebook with their typed signatures, wiring and literal values. Use filter to narrow by block name or signature.

Inputs: notebook (required), limit, filter.

run_notebookB

Execute a notebook headlessly through nTop Automate (ntopcl) and return its errors, warnings and per-block timings. Requires an nTop Automate licence.

Inputs: notebook (required), save, timeoutMs, inputsJson, +1 more.

search_blocksA

Search the block signatures present in the installed nTop binaries. Returns the exact typed signature strings that add_block needs, newest revision of each name first. The binaries retain retired revisions, and nTop rejects those with the same error it gives an unlicensed toolkit - so prefer the highest [version] and distrust a bare unversioned form.

Inputs: query (required), limit, installRoot.

set_inputA

Rewire one input slot of a block to a different source block. Use 0 to disconnect.

Inputs: slot (required), blockId (required), notebook (required), sourceId (required), +1 more.

set_literal_valueC

Set the value of a literal block - a scalar, file path, vector, point, boolean or enum. Writes in place unless output is given.

Inputs: value (required), blockId (required), notebook (required), output.

set_outputA

Choose which block ntopcl reports as the notebook output. Required before run_notebook's outputJson will produce anything - nTop reads the graph's own output key, not the root group's inputs, and answers "can't find output in notebook" when it is unset. Pass -1 to clear.

Inputs: blockId (required), notebook (required), output.

validate_graphA

Check a notebook for problems that stop it loading or building: dangling inputs, duplicate ids, literals with no value, and list parameters wired with several inline edges instead of a core.list block.

Inputs: notebook (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 14 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: adding literals vs. setting their values, reading the graph vs. inspecting the notebook, validating vs. running, searching blocks vs. finding examples. No two tools appear to do the same thing, so an agent can reliably pick the right one.

    Naming Consistency4/5

    The vast majority of tools follow a consistent verb_noun snake_case pattern (add_literal, search_blocks, set_output). Two exceptions break the pattern: 'mesh_stats' is a noun_noun compound and 'environment' is a bare noun, which slightly reduces predictability but does not cause real confusion.

    Tool Count5/5

    14 tools is well within the sweet spot for a domain-specific server. Each tool addresses a distinct step in the notebook lifecycle—inspection, editing, validation, execution, and analysis—earning its place without bloat or obvious omission.

    Completeness4/5

    The tool surface covers the core workflow: read/inspect/validate, add and modify blocks/literals, rewire inputs, set outputs, run, and check results. Minor gaps exist (e.g., no explicit block deletion, no direct 'save notebook' tool), but existing tools like prune_graph and set_input can work around these without agent failure.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables building and modifying parametric solid models in a local SOLIDWORKS installation via the COM API.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables control of a live SOLIDWORKS session through the Windows COM API, providing native sketch, feature, body, reference-geometry, view, probe, and export operations, along with transactional CAD plans, parametric sketches, multibody tools, and deterministic raster-to-sketch vectorization pipelines.
      1
      -