Skip to main content
Glama
PyNet Bridge

PyNet Bridge

by RAEN-DT

🐍 PyNet 平台桥接器 (MCP)

PyNet 平台桥接器 (MCP) 是一个执行层,允许 AI 模型实时控制 Autodesk 工具。

它连接了自然语言 → Python → Autodesk 桌面工具(Navisworks、Revit、AutoCAD),使 AI 能够自主生成、执行和优化 BIM 工作流程。

支持的集成包括 Navisworks Manage、Revit 和 AutoCAD。

该桥接器充当 AI 逻辑与 Autodesk 桌面 API 之间的连接纽带,允许使用自然语言进行动态 UI 创建、脚本执行和 BIM 流程自动化。

🔄 工作原理

  1. 用户用自然语言描述任务。

  2. AI 生成 Python 脚本。

  3. PyNet Bridge 验证并发送脚本。

  4. PyNet 插件在 Autodesk 内部执行脚本。

  5. 结果返回给 AI。

这就是将 AI 从聊天机器人转变为 BIM 执行引擎的关键。


Related MCP server: A2A MCP Server

🚀 PyNet Bridge 的强大之处

  • AI → 行动: 将 AI 生成的代码转化为 Navisworks/Revit 内部的实际操作

  • 实时执行: 无需离开 BIM 环境即可立即运行脚本

  • 动态 UI 创建: 让 AI 随时创建工具、按钮和工作流程

  • 可靠的通信: 快速且稳定的本地 IPC

  • 模型感知自动化: 直接在实时 BIM 模型上运行


🛠️ 安装

✅ 选项 A — 自动安装程序(推荐)

打开 PowerShell 并运行:

irm https://raw.githubusercontent.com/rafa2403nunez-droid/PyNetBridge/main/install.ps1 | iex

这将自动执行以下操作:

  1. 检查是否安装了 Python 3.10+

  2. 从 PyPI 安装 pynet-mcp-bridge(通过 uv 或 pip)

  3. 自动检测并配置所有已安装的 AI 客户端:

    • Claude Desktop(标准版和 Microsoft Store 版本)

    • Claude Code(VS Code 扩展 / CLI)

    • Cline(VS Code 扩展)

    • Roo Code(VS Code 扩展)

pynet-mcp-bridge 软件包包含:

软件包

用途

pynet-mcp-bridge

通过 PyNET 将 AI 模型与 Autodesk Navisworks 连接的 MCP 服务器

mcp[cli]

模型上下文协议 (MCP) SDK 和 CLI 工具

fastmcp

高级 MCP 服务器框架

psutil

系统进程检测(查找正在运行的 Autodesk 实例)

安装后请重启您的 AI 客户端以应用更改。

📦 Python 库入门包(可选)

安装推荐的 Python 库,以便使用 PyNET 进行 Navisworks/Revit 脚本编写:

irm https://raw.githubusercontent.com/rafa2403nunez-droid/PyNetBridge/main/install-libraries.ps1 | iex

这将安装:

库

用途

pandas

数据分析与处理

plotly

交互式图表与可视化

matplotlib

静态绘图与图表

dash

基于 Python 的 Web 仪表板

这些是 允许的 Python 导入 中列出的第三方库。标准库模块(json、sys、re 等)已包含在 Python 中。

先决条件

  • PyNet Platform 插件已安装在 Navisworks/Revit 中。

  • Python 3.10 或更高版本 → python.org

    ⚠️ 暂不支持 Python 3.14。 pythonnet 运行时目前支持 Python 3.7 到 3.13。如果您遇到提及不支持的 ABI 版本的 System.NotSupportedException,请安装 Python 3.12 或 3.13 并配置 PyNet 使用它。

  • uv → docs.astral.sh/uv

  • Git → git-scm.com — VS Code 扩展(Claude Code、Cline、Roo Code)正常运行所必需。

  • 对于 Cline / Roo Code:VS Code → code.visualstudio.com


🔧 选项 B — 手动安装

1. 安装软件包:

uv tool install pynet-mcp-bridge

或使用 pip:

pip install pynet-mcp-bridge

2. 配置 Claude Desktop:

将以下内容添加到您的 claude_desktop_config.json 中:

  • 标准版:%APPDATA%\Claude\claude_desktop_config.json

  • Microsoft Store 版:%LOCALAPPDATA%\Packages\Claude_*\LocalCache\Roaming\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "pynet-bridge": {
      "command": "pynet-bridge",
      "args": []
    }
  }
}

3. 配置 Claude Code (VS Code 扩展):

添加到 %USERPROFILE%\.claude.json:

{
  "mcpServers": {
    "pynet-bridge": {
      "type": "stdio",
      "command": "pynet-bridge",
      "args": []
    }
  }
}

4. 配置 Cline:

添加到 %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json:

{
  "mcpServers": {
    "pynet-bridge": {
      "type": "stdio",
      "command": "pynet-bridge",
      "args": []
    }
  }
}

5. 配置 Roo Code:

添加到 %APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\mcp_settings.json:

{
  "mcpServers": {
    "pynet-bridge": {
      "type": "stdio",
      "command": "pynet-bridge",
      "args": []
    }
  }
}

🛠️ 可用的 MCP 工具

这些工具允许 AI 完全控制 PyNet 环境,从 UI 创建到脚本执行和系统监控。 连接后,AI 将能够访问全套 PyNet 工具:

🧠 暴露给 AI 的核心能力

🔍 系统与连接

  • list_active_instances:扫描系统以查找具有活动 PyNet 连接的正在运行的 Autodesk 进程。

  • check_plugin_status:握手 ping 以验证插件监听器是否响应。

🏗️ 模块 (选项卡) 管理

  • get_pynet_ui_layout:获取完整的 UI 结构(ButtonsModules 和 ScriptButtons)。

  • create_pynet_module:在功能区中创建一个新的自定义选项卡 (ButtonsModule)。

  • delete_pynet_module:永久删除模块及其所有内容。

🔘 按钮管理

  • get_buttons_data:列出特定模块 ID 的所有脚本按钮。

  • deploy_script_button:将新的 ScriptButton 安装到特定模块中(名称、脚本、图标、工具提示)。

  • update_script_button:更新现有 ScriptButton 的元数据或将其移动到另一个模块。

  • delete_script_button:按 ID 从模块中永久删除 ScriptButton。

💻 执行与控制台控制

  • send_command:在 PyNet 引擎中直接执行脚本(目标 PID、脚本名称、内容)。

  • get_output_window_status:检查输出窗口当前是否可用/可见。

  • configure_output_window:切换 PyNet 日志/输出窗口的可见性。


🛡️ 安全的 AI 执行

PyNet Bridge 包含一个内置的验证层,确保所有 AI 生成的脚本在执行前都是安全且受控的。

✔ 防止不安全的操作 ✔ 阻止未经授权的系统访问 ✔ 保证与 BIM 模型的受控交互

AI 依然强大,但处于安全边界内

从 v1.1.1 开始,MCP 服务器包含一个内置的静态分析器,在脚本到达 Autodesk 主机之前对其进行验证。所有脚本都在桥接器级别进行解析和检查 — 被拒绝的脚本永远不会离开 MCP 服务器。

允许的 CLR 程序集

仅允许通过 clr.AddReference 使用以下 .NET 引用:

  • 通用: System, System.Windows.Forms, System.Drawing, System.Collections.Generic

  • Navisworks: Autodesk.Navisworks.Api, .ComApi, .Interop.ComApi, .Clash

  • Revit: RevitAPI, RevitAPIUI

  • AutoCAD / Civil 3D: AcMgd, AcCoreMgd, AcDbMgd, AecBaseMgd, AecPropDataMgd, AeccDbMgd

  • PyNet 插件: Raen.Core.Pynet.*, Raen.{Product}.Pynet.*(任何版本 — 例如 Raen.Core.Pynet.Resources, Raen.Navisworks.Pynet.2024, Raen.Civil3D.Pynet.2026)

允许的 Python 导入

clr, sys, json, re, time, datetime, pathlib, typing, threading, collections, xml, pandas, plotly, matplotlib, dash, webbrowser, psutil, functools

允许的 Python 子模块

某些模块仅在子模块级别允许,以防止访问危险的同级模块:

允许

阻止

原因

http.server

http.client, http.cookiejar

允许本地 HTTP 服务,阻止出站请求

阻止的 Python 导入

os, subprocess, shutil, socket, ctypes, pickle, importlib, urllib, signal, multiprocessing, tempfile, glob, inspect, code, codeop

阻止的调用

eval, exec, compile, __import__, getattr, setattr, delattr, globals, locals, vars, breakpoint, open

阻止的属性访问

__builtins__, __subclasses__, __globals__, __code__

任何违反这些规则的脚本都会立即被拒绝并显示描述性错误消息,且永远不会发送到插件。


📂 项目结构

  • pynet_mcp/:核心 MCP 服务器逻辑 (FastMCP)。

  • pyproject.toml:软件包配置和依赖管理。


📥 入门指南

在几分钟内开始构建自主 BIM 工作流程。

安装桥接器,连接您的 AI 客户端,并将自然语言转化为模型中的实际操作。


❓ 常见问题解答

对安装、配置或使用有疑问?查看完整的常见问题解答页面:

👉 PyNet 常见问题解答


🔗 此 MCP 如何融入生态系统

此 MCP 是一个模块化系统的一部分,旨在实现跨 Autodesk 工具的 AI 驱动 BIM 自动化。

此存储库旨在与以下内容协同工作:

  • PyNet Platform → 通过 Python.NET 在 Navisworks、Revit 和 Civil 3D 中执行脚本。

  • PyNet Library → 通过 Python 脚本库为 AI 提供上下文。

这些组件共同实现了:

自然语言 → AI → Python 脚本 → PyNet → Autodesk → BIM 操作

组件

存储库

用途

PyNet Platform

rafa2403nunez-droid/PyNet

Navisworks、Revit 和 Civil 3D 插件 — 托管 Python.NET 引擎

PyNet Bridge (MCP)

本存储库

MCP 服务器 - 将 AI 模型连接到 PyNET,并包含安全的脚本验证

PyNet Library

rafa2403nunez-droid/PyNetLibrary

脚本参考库和 AI 上下文

📄 许可证

本项目采用 MIT 许可证授权。


Available Tools

24 tools
check_plugin_statusB
Read-only

Handshake ping to verify the plugin listener is responsive.

Inputs: pid (required). Returns: result

configure_output_windowC
Destructive

Toggles the visibility of the PyNet log/output window.

Inputs: pid (required), is_available (required). Returns: result

create_pynet_moduleC
Destructive

Creates a new custom Tab (ButtonsModule) in the Ribbon.

Inputs: pid (required), name (required). Returns: result

delete_pynet_moduleC
Destructive

Permanently deletes a module and all its contents.

Inputs: pid (required), module_id (required). Returns: result

delete_script_buttonB
Destructive

Permanently removes a ScriptButton from a module by Id.

Inputs: pid (required), button_id (required), module_id (required). Returns: result

deploy_script_buttonB
Destructive

Installs a new ScriptButton into a specific module (Name, Script, Icon, Tooltip).

Inputs: pid (required), name (required), module_id (required), script_Path (required), +2 more. Returns: result

get_buttons_dataA
Read-only

Lists all script buttons for a specific module ID.

Inputs: pid (required), module_id (required). Returns: result

get_output_window_statusB
Read-only

Checks if the output window is currently available/visible.

Inputs: pid (required). Returns: result

get_pynet_ui_layoutC
Read-only

Fetches the full UI structure (ButtonsModules and ScriptButtons).

Inputs: pid (required). Returns: result

list_active_instancesA
Read-only

Scans the system for running host processes (Autodesk, Rhino, AVEVA UE, PyNET for Tekla/Presto) with an active PyNet IPC pipe.

Inputs: no named parameters. Returns: result

send_commandB
Destructive

Direct script execution in the PyNet engine (Target PID, Script Name, Content).

Inputs: pid (required), content (required), timeout (required), script_name (required). Returns: result

send_command_by_pathA
Destructive

Executes a script file directly by path in the PyNet engine, without sending content inline.

Inputs: pid (required), timeout (required), file_path (required), script_name (required). Returns: result

update_script_buttonB
Destructive

Updates metadata for an existing ScriptButton or moves it to another module.

Inputs: pid (required), name (required), tooltip (required), button_id (required), +4 more. Returns: result

viewer_clearA
Read-only

Clears highlights and ghosting in the open viewer.

Inputs: no named parameters. Returns: result

viewer_fitA
Read-only

Fits the camera to all models in the open viewer.

Inputs: no named parameters. Returns: result

viewer_get_propertiesA
Read-only

Reads element properties (name, model, psets) from the loaded package's properties.json.

Pass one or more pnt_ids to get their full properties (including psets) directly.

Called with no pnt_ids, returns a paginated lightweight index (pnt_id, name, model) instead of every element — narrow it with model (exact model/discipline name, e.g. "Snowdon Towers Sample HVAC") and/or search (case-insensitive substring of the element name), and page through with limit/offset (default 200 per page, capped at 500). On a federated model the unfiltered index can have tens of thousands of entries — always pass model or search when you can, and use offset to page through the rest.

The data source is the .pnt's properties.json, NOT the viewer or IFC.

Inputs: limit, model, offset, search, +1 more. Returns: result

viewer_get_stateA
Read-only

Reads the viewer's last reported state: loaded models and the pnt_id of whatever the user currently has selected (click in the 3D view or the tree panel — null if nothing is selected). Use the returned pnt_id with viewer_get_properties for its details, or feed it into a clashes.json lookup to find what it clashes with.

Inputs: no named parameters. Returns: result

viewer_highlight_clashA
Destructive

Highlights a clash (element(s) A red, element(s) B green) and isolates the rest away.

Usually one pnt_id per side (a single clash pair), but either side accepts a list — e.g. one element (A) against every counterpart it clashes with (B), all shown at once.

Inputs: pnt_id_a, pnt_id_b. Returns: result

viewer_isolateA
Destructive

Isolates (hides everything except) the given pnt_ids in the open viewer.

Inputs: pnt_ids. Returns: result

viewer_isolate_modelsA
Destructive

Shows only the given model(s)/discipline(s) (by exact name, e.g. "Snowdon Towers Sample HVAC"), hiding every other loaded model. Cheaper than viewer_isolate for "just show me this discipline" requests — no need to resolve every element's pnt_id first. Get the exact model names from viewer_get_state's "models" list. Undo with viewer_clear.

Inputs: models. Returns: result

viewer_list_clashesA
Read-only

Reads the loaded package's clashes.json — the data source, NOT the viewer/IFC.

Returns each clash with the pnt_id identifiers needed to highlight it.

Inputs: no named parameters. Returns: result

viewer_load_packageB
Destructive

Loads a .pnt into the open viewer and returns a summary read from clashes.json.

Inputs: pnt_path (required). Returns: result

viewer_selectA
Destructive

Highlights a set of elements in the open viewer by pnt_id, in neutral colours (yellow / blue) with nothing else hidden — a plain "look at these" pointer.

Pass a list of pnt_ids in pnt_ids (group A). Optionally pass a second list in pnt_ids_b to highlight a second group in a distinct colour. Replaces any previous selection. Use viewer_list_clashes / viewer_get_properties to obtain pnt_ids. For a clash pair (red/green, with the rest of the model isolated away), use viewer_highlight_clash instead.

Inputs: pnt_ids, pnt_ids_b. Returns: result

viewer_statusA
Read-only

Reports whether a PyNet BIM Viewer is open in VS Code (port, package, data dir).

Inputs: no named parameters. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 24 tools

    Disambiguation4/5

    The viewer tools have the most potential for confusion (select vs highlight_clash vs isolate vs isolate_models vs clear), but the descriptions explicitly cross-reference each other and state when to prefer one over another, which resolves most of it. A few boundaries remain soft — check_plugin_status vs list_active_instances vs viewer_status all report 'is something alive', and configure_output_window vs get_output_window_status are near-mirror pairs — but they are separable.

    Naming Consistency4/5

    Nearly everything follows verb_noun (get_, create_, delete_, update_, deploy_, list_, send_, configure_, check_), with a clean viewer_ namespace for the 3D side. Minor deviations: the ribbon/button noun is inconsistent ('buttons' in get_buttons_data vs 'script_button' in deploy/update/delete_script_button, and get_pynet_ui_layout is a noun-first outlier), and some tools carry a domain prefix while others do not.

    Tool Count3/5

    24 tools is on the heavy side, and the surface spans four separate concerns (viewer control, ribbon/module management, IPC process discovery, script execution). The count is defensible given the breadth of the PyNet bridge, but a few low-value entries (viewer_fit, get_output_window_status) could be folded into neighbours.

    Completeness4/5

    Script buttons have full CRUD (deploy/update/delete/get_buttons_data), the viewer has load/state/properties/select/isolate/highlight/clear/fit, and execution has both inline and by-path variants. The main gap is module lifecycle: create_pynet_module and delete_pynet_module exist but there is no update/rename/reorder module tool, and there is no way to unload a package or detach from a running instance.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers