Skip to main content
Glama

nTop MCP Server (ntop-mcp)

A Model Context Protocol (MCP) server for nTop (nTopology) combining lossless .ntop block graph editing, transactional authoring, local block-signature discovery, headless ntopcl execution/sweeps, GUI conflict safety, and mesh export/analysis (bridging cleanly with COMSOL & Abaqus workflows).

Highlights

  1. Direct .ntop Container & Transactional Block Graph Authoring

    • Lossless binary reader/writer for MAGIC%$1 / MAGIC@@9 .ntop files.

    • Human-friendly unit parsing ("10mm", "2.5cm", "45deg", {"value": 10, "unit": "mm"}) automatically converted to SI base units + GUI expression strings.

    • batch_edit_notebook: Apply dozens of graph edits atomically using $alias references, with graph validation and optional ntopcl pre-flight verification before writing to disk.

    • set_block_visibility: Control viewport show/hide, solo=True spotlighting, color (#RRGGBB / RGBA), transparency, and opacity.

    • promote_to_input: Turn GUI variables into Notebook Inputs (def.inputs) ready for ntopcl -j and run_parameter_sweep.

    • Multi-version Snapshots & Undo: Automatic timestamped backups under .ntop_history/ with list_notebook_snapshots and undo_notebook_edit.

    • GUI Conflict Safety & Auto-Reload: Detects running ntop.exe instances holding the target file, guards against unsaved GUI edits via nTop's Autosave timestamps, prevents accidental double-window launches (open_in_ntop_gui), and supports auto_reload_gui=True on edit/undo tools to safely refresh the GUI window in one step.

    • In-Place Custom Block Hot-Updates (package_custom_block): Packages any notebook branch into a reusable Custom Block .ntop while preserving its def.function UUID across updates, enabling nTop GUI's native File -> Import -> Custom Block -> Update workflow without closing the parent notebook.

  2. Verified Block Signature Catalog

    • build_block_catalog scans any folder of .ntop notebooks to build a local nTop 5.x signature database (block_catalog.json).

    • search_blocks searches built-in + locally scanned signatures with exact version suffixes and input slot types.

  3. nTop Automate (ntopcl), Non-Invasive Evaluation & Mesh Export

    • evaluate_block: Inspect any block's evaluated value or bounding box on a temp copy without modifying the original .ntop.

    • export_block_mesh: Non-invasively convert an implicit/mesh block to .stl, .3mf, or .obj via ntopcl and automatically inspect volume, surface area, bounding box, and watertightness.

    • generate_templates, run_notebook, run_notebook_async (+ job control), and run_parameter_sweep (Cartesian grid or DOE sets with CSV summary).

Related MCP server: OpenSCAD Design MCP

MCP Tools (36 Tools)

  • Environment & GUI: check_ntop_environment, set_workdir, list_ntop_files, open_in_ntop_gui

  • Inspection & Validation: inspect_notebook, list_notebook_variables, read_notebook_graph, validate_notebook_graph

  • Direct Graph Editing, Custom Blocks & Snapshots: set_notebook_literal, set_notebook_output, rewire_block_input, prune_notebook_graph, add_notebook_section, add_notebook_literal, add_notebook_block, add_notebook_variable, batch_edit_notebook, set_block_visibility, promote_to_input, package_custom_block, list_notebook_snapshots, undo_notebook_edit

  • Block Signature Catalog: build_block_catalog, search_blocks

  • Non-Invasive Evaluation & Export: evaluate_block, export_block_mesh

  • nTop Automate & Sweeps: generate_templates, run_notebook, run_notebook_async, get_job_status, list_jobs, cancel_job, run_parameter_sweep

  • Mesh & Table Analysis: analyze_mesh, read_export_table

  • Documentation: get_ntop_guide

Quick Start on Any PC

1. Clone & Install

Requires Python >= 3.10 and a local installation of nTop (ntopcl.exe / ntop.exe).

git clone https://github.com/heihei-ok/nTop-MCP-Server.git
cd nTop-MCP-Server
python -m venv .venv
# Windows PowerShell:
.\.venv\Scripts\Activate.ps1
pip install -e .

2. Configure Your MCP Client

Add ntop to your MCP config (mcp_config.json, Claude Desktop, Cursor, Antigravity, etc.):

{
  "mcpServers": {
    "ntop": {
      "command": "C:\\path\\to\\ntop-mcp\\.venv\\Scripts\\python.exe",
      "args": ["-m", "ntop_mcp.server"],
      "env": {
        "NTOP_CL_PATH": "C:\\Program Files\\nTopology\\nTopology\\ntopcl.exe",
        "NTOP_GUI_PATH": "C:\\Program Files\\nTopology\\nTopology\\ntop.exe",
        "NTOP_WORKDIR": "C:\\path\\to\\your\\ntop\\projects"
      }
    },
    "ntop-docs": {
      "url": "https://docs.ntop.com/mcp"
    }
  }
}

NTOP_CL_PATH and NTOP_GUI_PATH are optional if ntopcl.exe is already in PATH, D:\NTOP, or C:\Program Files\nTopology\nTopology.

Once connected, run build_block_catalog on a folder containing your local .ntop examples or custom block libraries to index verified block signatures for your exact installed nTop version.

4. Run Tests

pip install -e ".[dev]"
pytest -v tests

Optional live ntopcl integration tests can be enabled via environment variables: NTOP_TEST_SAMPLE, NTOP_TEST_TORUS, NTOP_TEST_HEX.

Available Tools

36 tools
add_notebook_blockC

Add a new compute block to an existing .ntop notebook and wire its inputs.

Inputs: func (required), inputs (required), block_type (required), notebook_path (required), +6 more. Returns: result

add_notebook_literalC

Add a new literal leaf block (real, integer, bool, *_enum, vector, point, file_path) to an .ntop notebook.

Supports human-friendly unit strings for real literals like "10mm", "45deg", or {"value": 10, "unit": "mm"}.

Inputs: value (required), leaf_type (required), notebook_path (required), name, +3 more. Returns: result

add_notebook_sectionC

Add a new named Section to an existing .ntop notebook.

Inputs: section_name (required), notebook_path (required), overwrite, description, +1 more. Returns: result

add_notebook_variableC

Add a promoted top-level variable (core.var<var_type>) in a specified notebook section.

Inputs: name (required), var_type (required), notebook_path (required), source_block_id (required), +5 more. Returns: result

analyze_meshA

Analyze an exported STL (binary/ASCII), OBJ, or 3MF mesh file.

Returns triangle/vertex counts, bounding box, surface area, signed/absolute volume, and topology checks (open boundary edges, non-manifold edges, watertightness).

Args: mesh_path: Path to a .stl, .obj, or .3mf file.

Inputs: mesh_path (required). Returns: result

batch_edit_notebookA

Atomically apply multiple graph edits (with $alias references) in a single transaction.

All operations run in memory first; the file is only saved if graph validation passes (and if verify_with_ntopcl=True, only if ntopcl evaluates verify_target with zero errors). Pass auto_reload_gui=True to automatically close the old nTop GUI window (if no unsaved Autosave edits) and reopen the updated file in a single clean window.

Supported op types: add_section, add_literal, add_block, add_variable, set_literal, rewire_input, set_output, set_visibility, promote_to_input.

Inputs: operations (required), notebook_path (required), overwrite, output_path, +4 more. Returns: result

build_block_catalogA

Scan a directory of .ntop files recursively to index verified local nTop block signatures.

Args: directory: Folder containing .ntop notebooks (e.g. C:\path\to\ntop_examples). save_path: Optional output JSON catalog path (defaults to block_catalog.json in package root). include_custom_blocks: If True, also include user_func_* custom blocks.

Inputs: directory (required), save_path, include_custom_blocks. Returns: result

cancel_jobC

Cancel/terminate a currently running background ntopcl job.

Inputs: job_id (required). Returns: result

check_ntop_environmentA

Check nTop installation (ntopcl/ntop GUI), version, working directory, and active jobs.

Inputs: no named parameters. Returns: result

evaluate_blockA

Non-invasively evaluate any block (scalar, implicit body, plane, etc.) via ntopcl.

Runs on an isolated temporary copy so your original .ntop file is never modified. Returns evaluated scalar values, bounding box, properties, and execution timing.

Inputs: target (required), notebook_path (required), inputs, timeout_seconds, +1 more. Returns: result

export_block_meshA

Non-invasively mesh an implicit/mesh block and export to .stl, .3mf, or .obj via ntopcl.

Never modifies your .ntop file. Automatically runs analyze_mesh on the exported mesh so you immediately get volume, surface area, bounding box, and watertightness — ready for COMSOL/Abaqus.

Args: notebook_path: Path to the source .ntop file. target: Block ID or unique name (e.g. "Final Flanges and Pipes"). export_path: Destination mesh path (.stl, .3mf, .obj, .ply). tolerance: Meshing tolerance (supports "1mm", "0.5mm", or SI float meters). unit: Export length unit ("mm", "cm", "m", "in"). sharpen: Enable sharp-edge preservation in Mesh from Implicit Body. simplify: Enable mesh simplification. inputs: Optional nTop Automate inputs dict/list. analyze: If True (default), analyze exported mesh geometry & watertightness. timeout_seconds: Optional timeout override in seconds.

Inputs: target (required), export_path (required), notebook_path (required), unit, +6 more. Returns: result

generate_templatesB

Run ntopcl -t to generate and return official input_template.json and output_template.json.

Args: notebook_path: Path to the .ntop notebook. output_dir: Optional directory to persist the generated JSON templates (uses a temp dir if omitted). timeout_seconds: Optional timeout override in seconds.

Inputs: notebook_path (required), output_dir, timeout_seconds. Returns: result

get_job_statusA

Get status, elapsed time, parsed logs, and output of a background ntopcl job.

Args: job_id: The job identifier returned by run_notebook_async. tail_lines: Number of recent stdout/stderr lines to return.

Inputs: job_id (required), tail_lines. Returns: result

get_ntop_guideA

Retrieve built-in nTop Automate and MCP workflow documentation.

Args: topic: One of list, ntopcl_cli, json_inputs, json_outputs, notebook_preparation, parameter_sweep, troubleshooting.

Inputs: topic. Returns: result

inspect_notebookA

Inspect an .ntop file's metadata, nTop version, sections, inputs, output block, and sub-functions.

Reads the .ntop binary container directly without starting ntopcl (instant).

Args: notebook_path: Path to the .ntop notebook.

Inputs: notebook_path (required). Returns: result

list_jobsA

List all submitted background ntopcl jobs and their current states.

Inputs: no named parameters. Returns: result

list_notebook_snapshotsB

List timestamped backup snapshots saved in .ntop_history/ for a notebook.

Inputs: notebook_path (required). Returns: result

list_notebook_variablesC

List all promoted variables (core.var<...>) in an .ntop notebook with their IDs, types, units, and values.

Args: notebook_path: Path to the .ntop notebook.

Inputs: notebook_path (required). Returns: result

list_ntop_filesB

List .ntop notebooks and related CAD/mesh/data files in a directory.

Args: directory: Target directory (defaults to current workdir). recursive: If True, search subdirectories recursively.

Inputs: directory, recursive. Returns: result

open_in_ntop_guiA

Launch or safely reload an .ntop notebook in the desktop nTop GUI with duplicate-window and unsaved-change protection.

Args: notebook_path: Path to the .ntop file. prevent_duplicate: If True (default), refuse to open a second window if this file is already open in ntop.exe. reload_if_open: If True, safely close existing ntop.exe window(s) for this file (after checking Autosave) and reopen cleanly. force_if_unsaved: Only used with reload_if_open=True; bypasses the Autosave unsaved-change guard.

Inputs: notebook_path (required), reload_if_open, force_if_unsaved, prevent_duplicate. Returns: result

package_custom_blockA

Package a notebook branch into a standalone reusable Custom Block .ntop for in-place GUI hot-updates.

When output_path already exists and preserve_existing_uuid=True, the Custom Block's internal function UUID is preserved so re-importing it (File -> Import -> Custom Block) inside an already-open parent notebook triggers nTop's native "Update Custom Block" prompt without closing the main window.

Args: notebook_path: Source .ntop file path. output_block: Block ID or unique name to set as the Custom Block's output. output_path: Destination .ntop path for the Custom Block. block_name: Display name of the Custom Block in nTop. input_targets: Optional list of variable IDs/names to promote to Custom Block inputs. description: Optional Custom Block description. prune: If True (default), prune blocks unrelated to output_block. preserve_existing_uuid: If True and output_path exists, preserve its existing def.function UUID for hot-update. verify_with_ntopcl: If True (default), run ntopcl -t to confirm valid Custom Block inputs & output.

Inputs: block_name (required), output_path (required), output_block (required), notebook_path (required), +5 more. Returns: result

promote_to_inputB

Promote an existing notebook variable (core.var<...>) into a Notebook Input (def.inputs).

Enables passing parameter values via ntopcl -j and run_parameter_sweep without breaking downstream wiring.

Inputs: target (required), notebook_path (required), overwrite, input_name, +4 more. Returns: result

prune_notebook_graphB

Prune blocks unreachable from the notebook output block and save to a new .ntop file.

Args: notebook_path: Source .ntop file path. output_path: Destination .ntop file path for the pruned notebook. output_target: Optional block ID or name to set as output before pruning.

Inputs: output_path (required), notebook_path (required), output_target. Returns: result

read_export_tableA

Read and summarize an exported CSV, TSV, or JSON table produced by nTop.

Args: file_path: Path to .csv, .tsv, or .json file. max_preview_rows: Maximum preview rows to return for CSV/TSV files.

Inputs: file_path (required), max_preview_rows. Returns: result

read_notebook_graphA

Read the block graph (IDs, functions, input wiring, literal values) of an .ntop notebook.

Args: notebook_path: Path to the .ntop notebook. filter_text: Optional substring filter matched against block ID, name, function, type, or section. section_name: Optional notebook section name filter (case-insensitive substring). variables_only: If True, return only promoted variable blocks (core.var<...>). include_leaves: If True, also include raw anonymous leaf blocks (func == ""). limit: Maximum number of blocks to return (default 150).

Inputs: notebook_path (required), limit, filter_text, section_name, +2 more. Returns: result

rewire_block_inputA

Rewire an input slot of a block to another block ID and/or update its expression string.

Args: notebook_path: Source .ntop file path. block_target: Block ID or unique block name to edit. input_index: 0-based index into the block's inputs array. new_instance_id: New source block ID to connect (or -1 to disconnect). expression: Optional expression string for this input slot. output_path: Optional destination .ntop file path. overwrite: If True and output_path is omitted, overwrite notebook_path in place (with timestamped snapshot).

Inputs: input_index (required), block_target (required), notebook_path (required), overwrite, +3 more. Returns: result

run_notebookA

Execute an .ntop notebook headlessly via nTop Automate (ntopcl).

Args: notebook_path: Path to the .ntop notebook. inputs: Either full nTop JSON schema ({"inputs": [...]}) or a simple dict ({"Length": 10.0}) auto-mapped onto the template. input_json_path: Optional path to an existing nTop input JSON file. output_json_path: Optional path where nTop should write its output JSON. working_dir: Optional working directory for execution and relative exports. include_properties: Pass -p to include top-level properties in output JSON. save_notebook: Pass -s to overwrite the .ntop file with computed results. trust_notebook: Pass --trustnotebook to permit Run Command blocks. max_threads: Limit CPU threads via -m. verbosity: Log verbosity 0 (errors), 1 (warnings+errors), 2 (full progress). custom_block_libraries: Mapping of {library_name: directory_path} for --custom-block-library. timeout_seconds: Maximum wait time in seconds.

Inputs: notebook_path (required), inputs, verbosity, max_threads, +8 more. Returns: result

run_notebook_asyncB

Submit a long-running nTop Automate (ntopcl) execution in the background and return a job_id.

Monitor progress with get_job_status(job_id) or cancel with cancel_job(job_id).

Inputs: notebook_path (required), inputs, verbosity, max_threads, +7 more. Returns: result

run_parameter_sweepA

Run a batch DOE / parameter sweep across multiple input sets using ntopcl.

Provide EITHER parameter_sets (list of explicit input dicts) OR parameter_grid (dict of {param_name: [v1, v2, ...]} expanded as a Cartesian product).

Args: notebook_path: Path to the .ntop notebook. parameter_sets: Explicit list of parameter dictionaries, one per run. parameter_grid: Cartesian grid dictionary of parameter value lists. output_dir: Directory to store run_000/, run_001/, ... and sweep_summary.csv. max_workers: Parallel ntopcl worker processes (default 1). max_threads_per_run: Pass -m to each ntopcl invocation. include_properties: Pass -p to include top-level properties in each output.json. trust_notebook: Pass --trustnotebook if needed. timeout_per_run: Timeout per individual run in seconds. export_csv: Write a consolidated sweep_summary.csv table.

Inputs: notebook_path (required), export_csv, output_dir, max_workers, +6 more. Returns: result

search_blocksA

Search verified nTop block signatures (function names, output types, input slots) across built-in & local catalog.

Args: query: Keyword substring (e.g. "shell", "boolean", "mesh", "export", "fe_"). category: Optional category filter (modeling, geometry, meshing_and_fe, export_import, math_and_fields, core, lattice). catalog_path: Optional custom catalog JSON path. limit: Maximum number of matches to return.

Inputs: limit, query, category, catalog_path. Returns: result

set_block_visibilityC

Control viewport visibility, solo mode, color (#RRGGBB or [r,g,b,a]), transparency, and opacity.

Inputs: targets (required), notebook_path (required), solo, color, +8 more. Returns: result

set_notebook_literalB

Update a literal value (scalar/real, integer, bool, enum, vector/point, text) inside an .ntop file.

Supports human-friendly unit strings for real values such as "10mm", "2.5cm", "45deg", or {"value": 10, "unit": "mm"} (automatically converted to SI meters/radians + display expression). Pass auto_reload_gui=True to safely close and reopen the nTop GUI window after saving (with Autosave guard).

Inputs: value (required), target (required), notebook_path (required), overwrite, +4 more. Returns: result

set_notebook_outputA

Assign the notebook's Output block so ntopcl -t and ntopcl -o can export its result.

Args: notebook_path: Source .ntop file path. target: Block ID or unique block name to designate as the notebook output. output_path: Optional destination .ntop file path. overwrite: If True and output_path is omitted, overwrite notebook_path in place (with timestamped snapshot).

Inputs: target (required), notebook_path (required), overwrite, output_path. Returns: result

set_workdirA

Set the default working directory for resolving relative .ntop and export paths.

Args: path: Directory path to set as working directory (created if it does not exist).

Inputs: path (required). Returns: result

undo_notebook_editB

Restore an .ntop notebook from its latest (or named) snapshot in .ntop_history/.

Saves the current state as a before_undo snapshot first so undo is itself reversible.

Inputs: notebook_path (required), snapshot_name, auto_reload_gui, force_if_unsaved. Returns: result

validate_notebook_graphB

Validate an .ntop notebook's block graph for dangling inputs, duplicate IDs, and Automate readiness.

Args: notebook_path: Path to the .ntop notebook.

Inputs: notebook_path (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 36 tools

    Disambiguation4/5

    Most tools target clearly distinct operations (inspect vs edit vs execute vs mesh-analyze vs catalog). The main overlap is that batch_edit_notebook subsumes single-op tools like set_notebook_literal, add_notebook_block, rewire_block_input, and set_notebook_output, which could cause an agent to hesitate between the atomic and batch variants. Descriptions generally clarify the boundary, so confusion is minor.

    Naming Consistency4/5

    Nearly all tools use snake_case with a verb_noun or verb_object pattern (read_notebook_graph, set_notebook_literal, run_notebook, analyze_mesh). A few deviations exist, like promote_to_input and open_in_ntop_gui, which use prepositions/less standard phrasing. Overall the pattern is predictable and readable.

    Tool Count3/5

    36 tools is heavy, above the comfortable range, but the domain genuinely spans notebook editing, GUI control, headless execution, async jobs, parameter sweeps, mesh export, and block cataloging. The set is organized into coherent clusters rather than being padded, though a few editing tools could be consolidated.

    Completeness4/5

    The surface covers reading, editing, validating, executing, sweeping, exporting, and analyzing notebooks and meshes thoroughly. The main gap is the absence of delete/remove operations for blocks, sections, and variables, plus no explicit cleanup for snapshots, but these are minor workarounds rather than dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables reading and editing nTop notebook block graphs, running them headlessly through nTop Automate, and measuring the resulting geometry.
      14
      5
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to perform high-performance 3D CAD design, ultra-fast multi-view rendering, immutable versioned project management, and geometry/mesh verification for 3D printing on Windows.
      17
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients such as Claude Desktop, Cursor, and Copilot to connect over MCP STDIO to CAD/CAE/CAM tooling for natural-language parametric shape synthesis, CSG script generation, solid watertightness validation, error analysis, and autonomous correction.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents on Windows to build parts from JSON recipes, create and verify whole assemblies in a single call, check mass, center of mass, mates and interference, produce drawings with BOM, balloons and sections, work with sheet metal, and import/export STEP, IGES, PDF and DXF files. All edits run with automatic backups and verified rollback so user files are never left broken.
      2
      MIT