
Onshape
io.github.gpambrozio由 GitHub 帳號 gpambrozio 發布v0.3.0更新於 Oct 29, 2026
Drive Onshape CAD from an assistant: documents, sketches, solid features, assemblies and exports.
概覽
把助理連接到 Onshape CAD,可建立文件、繪製草圖與建模、組合件、量測並匯出 STL/STEP 檔案。
- 可以做什麼
- 登入並管理 Onshape 憑證,查看狀態與登出
- 列出、搜尋、建立、更新和刪除文件、工作區、元素與版本
- 建立零件工作室:草圖、伸長、孔、圓角、陣列、變數、量測與驗證
- 組合零件:實例、結合、關係、BOM 與質量屬性
- 匯出 STL/STEP、工程圖和著色渲染圖(以圖片回傳)
- 透過通用請求工具呼叫其他 Onshape REST 端點
- 適用情境
- 適合想用對話方式設計或修改 Onshape CAD 模型的情境,例如繪製支架草圖、加入特徵、檢查尺寸、組合零件,或產出可列印的匯出檔與渲染圖。
- 執行需求
- 透過 npx 在本機執行,需要 Node 20 或更新版本。需要 Onshape 帳號,可透過首次使用時的瀏覽器登入、API 金鑰組(ONSHAPE_ACCESS_KEY 與 ONSHAPE_SECRET_KEY)或 OAuth 應用程式驗證。需要連線到 Onshape API 主機的網路;輸出目錄等設定皆為選用。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Onshape,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Onshape MCP server
Drive Onshape CAD from an AI assistant. 93 tools for documents, part studios, sketching, solid features, assemblies, drawings, measurement and export — and no setup beyond installing it: the first tool call that needs Onshape opens a browser and asks you to connect.
The assistant sketches it, extrudes it, fillets the edges, measures the result, renders it back into the conversation, and exports an STL you can print.
Install
Claude Code
Claude Desktop — download onshape-mcp-<version>.mcpb from the
latest release and
double-click it. Nothing else to install.
Cursor, VS Code, Windsurf, Zed and other MCP clients — add the server to the client's MCP config:
The file differs per client: ~/.cursor/mcp.json (Cursor), .vscode/mcp.json
(VS Code), ~/.codeium/windsurf/mcp_config.json (Windsurf), ~/.config/zed/settings.json
under context_servers (Zed).
Node 20 or newer is required. npx fetches the package on first run.
Signing in
Nothing to configure. The first tool call that needs Onshape starts a sign-in and asks your client to show you the link; clients that support MCP's URL elicitation render it as a prompt, and the rest get the URL in the reply. The page that opens links straight to the key page for your Onshape stack and takes the pasted pair; tick Read, Write and Delete when you create the key so every tool here works. Keys are verified against Onshape, then stored in your OS keychain.
Your credentials never pass through the assistant, the model or this project's
authors — the exchange happens between your browser and a server bound to
127.0.0.1 in this process, which is exactly why MCP has URL elicitation.
Other ways in, if you prefer:
onshape_login— start the same flow deliberately.onshape_set_api_key— paste a key pair you already have.- OAuth 2.0 —
onshape_loginwithmethod: "oauth", for an app you registered at the Onshape developer portal with redirect URLhttp://localhost:8471/oauth/callback. Tokens refresh automatically. - Environment variables — set
ONSHAPE_ACCESS_KEYandONSHAPE_SECRET_KEYfor unattended installs, andONSHAPE_MCP_AUTO_LOGIN=0to stop the server ever opening a browser.
An existing onshape-cli credential at
~/.onshape/credentials.json is picked up automatically.
onshape_auth_status shows what is in use (redacted); onshape_logout forgets it.
Tools
All names are prefixed onshape_, and every tool returns {"ok": true, "result": …}
or {"ok": false, "error": …, "detail": …}.
Worth knowing:
- Units are inches and degrees throughout, except STL exports, which are millimetres by default because that is what slicers assume.
- Feature tools validate by default. Onshape answers
200for a feature that fails to regenerate, so each tool re-reads the feature state and fails loudly instead.update_featurealso fails when the edit puts another feature into ERROR; errors that were already there before the edit are listed invalidation.preexistingErrorsinstead. Passvalidate: falseto skip it. - Assemblies:
assembly_matejoins Part Studio mate connectors directly ({path: [instance id], connector: "FabC_0.mcPinion"}, asget_assemblylists them),insert_instancetakesfixed: trueto ground an instance, andassembly_relationcouples mates as gear, rack and pinion, screw or linear.set_mate_valuesdrives mates in inches and degrees and fails when Onshape ignores a value, which it does for mates with limits enabled. - Part Studio writes acknowledge applied changes. Creation replies include
creationApplied: true; updates includeupdateApplied: trueafter the POST completes. Validation errors do not undo the change: inspect the model before retrying. A failed POST does not establish whether the server applied a change. Large replies retain the feature ID and validation outcome inline, with the full response insaved_to. If that file cannot be saved,responseStorageErrorreports the storage problem without changing the write/validation outcome.validate: falseis reported asvalidationSkipped: true. - Renders come back as images.
shaded_viewandget_thumbnailreturn the PNG inline as well as writing it, so the model can see the part. - Big reads spill to disk. Anything over
ONSHAPE_MCP_MAX_RESPONSE_BYTES(default 200 kB) is written to a file and summarised, keeping a feature tree from swallowing the context window. onshape_requestreaches any REST endpoint the dedicated tools miss.
Configuration
Every setting is optional.
Secrets go to the OS keychain (service onshape-mcp) when one is available, and
the config file then holds only non-secret metadata. Without a keychain the file
holds the secret and is written 0600 inside a 0700 directory.
Onshape account limits
These come from Onshape, not from this server:
- Free accounts can only create public documents — pass
public: truetoonshape_create_document. - Deleting needs a key with delete permission. Without it Onshape answers
403 Invalid API key state; re-create the key at cad.onshape.com/user/developer/apiKeys with Delete ticked. - An instance can only be fixed when it is inserted. There is no public
call to fix or unfix one later; insert it again with
fixedand delete the old one. - Mate values need API version 10. Older versions accept a write and ignore
it;
get_mate_valuesandset_mate_valuesuse v10. - The variable-table endpoint 404s on some accounts.
onshape_set_variableandonshape_get_variablesfall back toassignVariablefeatures, which work everywhere;result.route/result.sourcesays which path was taken. Setting a name that already has a Variable feature rewrites that feature in place.
Development
Layout: src/auth (credential store, keychain, login flows, OAuth, elicitation),
src/api (REST wrappers), src/builders (Onshape BTM feature payloads),
src/tools (the MCP surface), src/server.ts (registration and the auth gate).
Contributions welcome — see CONTRIBUTING.md. Security reports: SECURITY.md.
Licence
MIT. Portions derived from onshape-cli
— see NOTICE.
Not affiliated with, endorsed by, or supported by Onshape or PTC. "Onshape" is a trademark of PTC Inc.
來源:README.md,提交 63f39d1
工具
0版本歷史
2- v0.3.0最新Oct 29, 2026
- v0.1.2Sep 22, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分