inventor-mcp:把 Autodesk Inventor 2025 接到 DeepSeek Harness

前言

在 DSH 裏做機械設計相關的 agent,常見做法是寫腳本間接調 CAD,或讓人工在 Inventor 裏逐步操作。前者往往只能覆蓋少量接口,後者難以閉環驗收。inventor-mcp 是 StarvastPact 維護的工作流類 bundle:通過 MCP 把正在運行的 Autodesk Inventor 暴露給 DSH agent,提供 66 個 stdio 工具,支持參數化建模、裝配、工程圖與導出,並可用截圖和模型檢查自行覈對結果。

這是什麼

inventor-mcp(倉庫名 dsh-inventor-mcp,當前 bundle 版本 1.2.0)面向 DeepSeek Harness,簡介爲將 Autodesk Inventor 2025 作爲 MCP server 接入 DSH。它不包含 Inventor 建模引擎源碼,而是 DSH 側的接入層:用 cordis.patch.yml 配置 MCP client、run_inventor_mcp.py 作啓動器,底層建模能力來自 PyPI 包 inventor-mcp-server(MIT,上游 cenitu/inventor-mcp-server)。要求 DSH >=0.2.0,通過 @deepseek-ai/dsh-mcp-client 接入。

核心功能

README 中歸納的能力如下(完整工具列表見倉庫 docs/DETAIL.md、docs/TOOLS.md):

能力 說明
參數化建模 用戶參數(如 rim_od = 110 mm),草圖尺寸用表達式驅動
零件/鈑金/裝配 迴轉、拉伸切除、圓角倒角、鈑金展開、約束裝配
自檢 capture_view 渲染視圖回傳;inspect_model 報告體積、包圍盒、面數等
出圖與導出 create_drawing 出 PDF 工程圖;export_step / export_flat_pattern 等
標準件 瀏覽 Content Center,按規格生成螺栓、型鋼等

傳輸方式爲 MCP stdio,需在已運行的 Inventor 實例上工作。文檔中的示例:agent 用本 bundle 建參數化 V 帶輪(16 個用戶參數、3 個全約束草圖),修改 groove_angle 或 rim_od 後體積可在給定 mm³ 範圍內復現。MCP 層單位均爲 mm(底層 COM 爲 cm,在包內轉換)。

前置條件

  • Windows(Inventor 僅 Windows)
  • Autodesk Inventor 2019 或更高(開發與實測爲 Inventor 2025,中文版、GB 標準、毫米單位)
  • Python 3.12+(inventor-mcp-server 要求)
  • 已安裝 DSH
  • Inventor 至少啓動過一次(完成許可證激活)

安裝與啓用

在 Windows PowerShell 中按倉庫 README 步驟操作(安裝腳本會把 Python 寫成絕對路徑,並將啓動器路徑寫入 args):

# 1. 裝依賴
pip install --upgrade inventor-mcp-server pywin32

# 2. 在本倉庫目錄下運行安裝腳本(必須)
.\install.ps1

# 3. 註冊到 DSH(在 DSH 會話裏讓 agent 執行,或手動運行)
#    plugin_manager install_bundle <本倉庫絕對路徑>

裝好後在 DSH 會話裏先連上 Inventor:

connect()            # 連上正在運行的 Inventor(沒有就啓動一個)

list_instances 可查看當前連接的 Inventor 數量及各自打開的文檔。

install.ps1 會把 cordis.patch.yml 的 args 指向 run_inventor_mcp.py。啓動器依次嘗試:導入 inventor_mcp_server 成功則直接運行(推薦);否則掃描 runtime/ext/*/inventor_mcp_server/server.py 作離線備選。pip install inventor-mcp-server 是唯一必須的依賴;runtime/ 供無外網或 pip 受限環境,本倉庫默認不提交。

無 Inventor 時可做冒煙驗證:

python tests\smoke.py

該腳本檢查 Python 版本、模塊導入、MCP stdio 握手是否返回 66 個工具、配置結構等;CI 在 Python 3.12/3.13/3.14 上運行同一套。

典型用法

README 給出的快速開始流程如下,可在 DSH agent 中按工具調用復現:

connect()
create_document(kind="part", name="法蘭", material="Steel, Mild")
create_sketch("XY")
draw_closed_profile([[0,0],[60,0],[60,10],[40,10],[40,40],[0,40]])
revolve(axis="Y", angle=360, operation="join")
inspect_model()                 # 體積、包圍盒、特徵樹
capture_view(views="iso")       # 渲染成圖片,模型自己看
save_document(path="D:/parts/flange.ipt")

經過上面的步驟,agent 可完成從建文檔、草圖、迴轉到檢查與存盤的一條龍流程,並用視圖截圖做視覺驗收。

適用場景與注意

適合在 DSH 中做機械零件/裝配自動化、參數化迭代、出圖導出,且環境爲 Windows + 已授權 Inventor 的團隊。插件以當前 DSH 主進程權限運行,MCP server 須由 DSH 主進程啓動,才能通過 COM 連上桌面會話中的 Inventor;在沙盒 shell 裏直接 Dispatch("Inventor.Application") 可能得到 0x80080005。安裝前應閱讀倉庫源碼與 MIT 許可證,確認依賴與路徑符合本機策略。

已知限制還包括:若 Inventor 爲手工打開,首次可能需先 connect();多實例用 list_instances 與 instance= 區分;僅支持 Windows 與已授權 Inventor。

社區目錄 SkillHub 插件頁 與 GitHub 倉庫相互獨立索引;DSH 生態側重「一切皆插件」,目錄站與 DeepSeek / 幻方無官方從屬關係。源碼與 issue 見 StarvastPact/inventor-mcp。

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜