ntopology-mcp
ntopology-mcp
nTop(旧称 nTopology)向けの MCP サーバーです。ノートブックのブロックグラフを直接読み取り・編集し、nTop Automate を通じてヘッドレスで実行し、生成されたジオメトリを測定します。
nTop は公式 MCP サーバーを提供していますが、これは別の問題を解決します。nTop のドキュメントを検索するものです。このサーバーはユーザーのファイルを操作します。両者は補完的です。向こうは「トポロジー最適化をどう設定するか」に答え、こちらは設定して実行します。
文書化された自動化パス(nTop Automate)では、GUI でノートブックを手作業で構築し、いくつかの入力を変数として公開し、スクリプトからそれらを変化させることを想定しています。これはパラメータスイープをカバーします。ブロックの追加、入力の配線変更、グラフの再構築はできません。このサーバーは、.ntop ファイルをそのまま、つまり JSON ブロックグラフを保持するコンテナとして扱うことで、それを実現します。
ツール
ツール | 説明 |
| バージョン、セクション、ブロック数と値の数、ルートが評価する内容を表示 |
| 型付きシグネチャ、配線、リテラル値を持つブロック。フィルタ可能、デフォルト 200 件 |
| 未接続の入力、重複 ID、ルートの欠落、値のないリテラル、 |
| スカラー、ファイルパス、ベクトル、ポイント、ブール、列挙型を変更 |
| ブロックの 1 つの入力スロットを再配線 |
| 型付きシグネチャから計算ブロックを追加 |
| 定数を追加 |
| ルートを選択した出力に向け、到達不能なものをすべて削除 |
|
|
| nTop インストール内に存在するブロックシグネチャを検索 |
| 体積、面積、境界ボックス、開いたエッジと非多様体エッジの数、連結成分 |
|
|
| nTop が同梱するサンプルノートブックとリファレンスページを検索 |
| このマシンでサーバーが見つけられるものを報告 |
Related MCP server: Onshape MCP Server
要件
nTop がインストールされていること。Windows 上の 5.54.2 で検証済み。
run_notebookには nTop Automate ライセンスが必要。これは GUI シートとは別にライセンスされます。それ以外はすべてライセンスなしで動作します。サーバーを実行するには Node.js 20+ が必要。テストスイートは 21+ が必要で、
node --testがグロブを受け入れます。
インストール
git clone https://github.com/sohumsuthar/ntopology-mcp.git
cd ntopology-mcp
npm install
npm run build設定
MCP クライアント設定に追加します:
{
"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 は、nTop がデフォルトの Windows の場所にある場合は省略可能です。NTOPCL_PATH は ntopcl.exe を直接指すことができます。最初に environment を呼び出して、サーバーが見つけたものを確認してください。
例
既存の最適化を別の設計空間に再ターゲットし、1 つの出力チェーンに切り詰めて実行します:
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編集ツールは書き込む前に検証し、エラーがあるグラフの保存を拒否するため、生成されたものはすべてチェック済みです。このサーバーが書き込んでいないノートブック(たとえば nTop GUI で編集されたもの)では、run_notebook に時間を費やす前に validate_graph を実行してください。
ノートブック形式
.ntop 形式は nTop によって文書化されていません。以下は 5.54.2 で書き出されたファイルを調べて導出されたもので、パーサーは実際のノートブックをバイト単位で往復させることで検証されています。
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, contentmain セクションには 2 つの子があります。fn(ブロックグラフの JSON)と leaves(すべてのリテラル値を保持する index セクションを持つオブジェクトコンテナ)です。func が空でないブロックは何かを計算し、func が空のブロックはリテラルです。入力は生成ブロックを ID で参照し、0 と -1 はどちらも未接続を意味します。
知っておくべき動作
これらは実際のデバッグ時間を消費するもので、可能な場合は validate_graph またはツールの説明に組み込まれています。
list<T>パラメータは、正確に 1 つのcore.list<T>ブロックから供給される必要があります。2 つの暗黙的なものをリストスロットに直接配線すると、nTop はロード時に「ファイルを読み込めません」という一般的なメッセージでファイル全体を拒否し、何も指定しません。validate_graphは、実際に発生する形式、つまりlist<T>パラメータを持つブロックで宣言されたパラメータ数を超えて接続されたエッジを検出します。余分な末尾の未接続入力スロットは正常です。ブロックバージョンがオプションパラメータを獲得すると、nTop 自身がそれらを出力するため、エラーではありません。
plane<point,vector,vector>は原点と平面を張る 2 つのベクトルを受け取ります。法線はそれらの外積であり、2 番目の引数ではありません。offset_implicitは直感とは逆です。正のオフセットは侵食します。凸エッジの丸め(モルフォロジー的なオープニング)はoffset(+r)の後にoffset(-r)です。boolean_unionのブレンド列挙型:1は接合部に材料を追加、2は除去、0はハードユニオンです。implicit_to_meshv2.4.0 の 3 番目の入力は最小フィーチャサイズです。5 mm に設定すると、5 mm のプレートは静かに消えます。バージョンサフィックスは重要です。 バイナリにはブロックのすべての履歴リビジョンが含まれていますが、nTop は現在のものだけを登録します。古いリビジョンは、ライセンスのないツールキットと同じ「Unknown block … Toolkit or Connector that is not installed」メッセージで失敗するため、古いシグネチャはライセンスの欠落とまったく同じに見えます。
search_blocksは名前の最新リビジョンを最初に返します。それを優先し、バージョンなしの裸の形式は疑ってかかってください。未接続の入力は
-1(Empty)であり、0(None)ではありません。必須入力の0は nTop がファイルのロードを拒否します。しかし-1も普遍的に安全ではありません。一部のオプション入力はInput at N is Empty but optionalで拒否し、リテラルを供給する必要があります。周囲のノートブックがすでに行っていることに合わせ、validate_graphと試行実行で残りを解決してください。ntopcl -oは、グラフ自身のoutputキー(set_outputが設定)で指定されたブロックを報告します。ルートグループの入力はノートブック出力ではありません。set_outputがないとOutput path specified, but can't find output in notebook.が返ります。時系列を公開する結果ブロックは 1 からインデックスされ、ステップ 1 は答えではなく非物理的な初期化であることがよくあります。それを読み取ると、エラーなしでもっともらしいナンセンスが生成されます。
最適化中に領域を保持するには、
fe_region_by_implicitから供給されるpassive_region_constraint<region>を使用し、最適化制約リストに追加します。Initial Density 入力は何も固定しません。nTop はそれを開始推測のみとして文書化しています。
nTop は独自の例を同梱しています - 最初に読んでください
nTop は約 100 の動作するサンプルノートブックを
C:\ProgramData Topology\documentation\ExtendedBlockDocs\ に、完全な HTML リファレンスページを
block-documentationlocks\ にインストールします。find_example は両方を検索します。サンプルノートブックは、ブロックの配線、リテラルの形状、プロパティパスを数秒で解決します。同じことをエラーメッセージから逆解析するには数時間かかります。推測する前にそこを確認してください。
リテラル値の形状
リテラル値は型ごとに保存され、形状は一様ではありません:
型 | 値 |
|
|
| そのようなオブジェクトの配列 |
|
|
|
|
|
|
|
|
間違った形状はロード時に Leaf failed to deserialize with block/variable <name> で失敗します。
ブロックシグネチャ
nTop はブロックシグネチャを ASCII 文字列として独自のバイナリ内に保存します。登録されなくなったリビジョンも含みます。search_blocks は実行時にインストールからそれらを抽出し、各名前の最新リビジョンを最初に並べます。このリポジトリにはシグネチャデータは含まれていません — シグネチャは nTop のものであり、このサーバーはライセンスされたインストールから読み取るもので、再配布しません。
制限事項
コンテナ形式はリバースエンジニアリングされており、nTop 5.54.2 に対してのみ検証されています。
inspect_notebookは各ファイルが記録するバージョンを報告します。他のバージョンは未検証として扱い、バックアップを保持してください。編集ツールは
outputを指定しない限りその場で書き込みます。検証に失敗するグラフの書き込みは拒否しますが、編集がモデルにとって意味的に正しいかどうかは判断できません。run_notebookには nTop Automate ライセンスが必要です。ない場合、ntopclはログイン後に終了し、エラーが表示されます。実際には Windows のみです。nTop がそこで実行されるためです。
開発
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テストは自己完結型で、nTop を必要としません。2 つのスイートは、より多くのものを与えると拡張されます:
NTOP_TEST_NOTEBOOKS— セミコロン区切りの.ntopパス。バイト単位で往復します。これは指定したパスに依存し、nTop がインストールされているかどうかには依存しません。リポジトリにはノートブックが同梱されていないため、上記の往復の主張は、信頼するのではなく、自分のファイルで再検証する必要があります。カタログスイートは、実際のインストールが見つかった場合にそれをスキャンし、それ以外はスキップします。
ライセンス
MIT — LICENSE を参照してください。
nTop とは提携しておらず、承認も受けていません。「nTop」および「nTopology」はそれぞれの所有者の商標です。
Available Tools
14 toolsadd_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
Scored across 14 tools
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.
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.
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.
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
Related MCP Connectors
Control Unreal Engine to browse assets, import content, and manage levels and sequences. Automate…
Manage SysML2 projects; check, evaluate, verify, query, document and diagram models.
Geometry and CAD file metadata extraction for STL, OBJ, PLY, PCD, LAS/LAZ, glTF/GLB.
Formula-backed WorkPaper tools for workbook readback, input edits, and JSON persistence.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables automated control of Ansys Workbench, Mechanical, and MAPDL through scripted journals and batch processing for simulation workflows.107MIT
- FlicenseNot gradedqualityDmaintenanceEnables programmatic CAD modeling with Onshape through document discovery, parametric sketching, feature management, and gear creation.-
- AlicenseNot gradedqualityDmaintenanceEnables building and modifying parametric solid models in a local SOLIDWORKS installation via the COM API.MIT
- FlicenseNot gradedqualityBmaintenanceEnables 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-