
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 分