onshape-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@onshape-mcpMake a rectangular plate with four corner fillets and a center hole, export STL"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
onshape-mcp
MCP server that drives OnShape CAD from Claude Code: parametric modeling (sketches, extrudes, revolves, fillets, patterns), FeatureScript queries, and STL export/verification — via the OnShape REST API.
One-time setup
uv sync --no-editable
uv run --no-editable onshape-mcp setup # writes ~/.config/onshape-mcp/.env (chmod 600); no-op if it exists
uv run --no-editable onshape-mcp doctor # auth smoke test against the live API (4 calls)Why
--no-editableeverywhere? macOS asynchronously marks files under.venvwith thehiddenflag here, and Python ≥3.13.8 skips hidden.pthfiles — editable installs silently stop importing minutes after a sync. Non-editable installs don't use.pthand are immune.
Related MCP server: MCP 3D Printer Server
Credentials
API keys come from https://dev-portal.onshape.com/keys (an access key +
secret key pair). Credentials live ONLY in ~/.config/onshape-mcp/.env,
created by onshape-mcp setup with permissions 600 (owner read/write
only) — never in project folders, never committed, never printed. See
.env.example for the variable names; the process
environment (ONSHAPE_ACCESS_KEY / ONSHAPE_SECRET_KEY) takes precedence
over the file if both exist.
Per-project registration
From the CAD project folder where you want the server available (replace
/path/to/onshape-mcp with wherever you cloned this repo):
/path/to/onshape-mcp/install.shor equivalently:
claude mcp add --scope project onshape -- \
uv run --quiet --no-editable --project /path/to/onshape-mcp onshape-mcpOr register it by hand in the project's .mcp.json:
{
"mcpServers": {
"onshape": {
"command": "uv",
"args": ["run", "--quiet", "--no-editable", "--project", "/path/to/onshape-mcp", "onshape-mcp"]
}
}
}(--project, not --directory: the server resolves this repo's venv but keeps
the caller's cwd. File-path tool params should be absolute paths regardless.)
Project-scoped servers show "Pending approval" on the first interactive
session — approve when prompted.
Usage cheatsheet (for the LLM driving the tools)
Typical build flow
create_document (parentId = folder id) -> documentId, workspaceId, partStudioElementId
import_cad (ABSOLUTE path to .zip/STEP) -> foreign CAD into an existing workspace [async, +quota]
set_variable (optional, e.g. wall_thk) -> use "#wall_thk" in later expressions
create_sketch (plane {"default":"TOP"}) -> featureId [one closed profile per sketch]
extrude (sketchFeatureId, NEW, depth) -> base solid
create_sketch + extrude REMOVE THROUGH_ALL [holes: skip native hole feature]
find_entities (EDGE, radiusBetween) -> transient ids for fillet/chamfer
fillet_or_chamfer (entityIds) -> check featureStatus == OK after EVERY feature
pattern / revolve / boolean_parts as needed
export_stl (ABSOLUTE path) -> compare_stl(candidate, reference) [mesh: 3D-print, verify]
export_step (ABSOLUTE path) -> editable STEP B-rep solid [CAD/prototyping; async, +quota]Iron rules
Transient IDs go stale after ANY mutation. Always call
find_entitiesimmediately before the tool call that consumes the ids. Feature IDs (from create_sketch/extrude/...) are stable — prefer them where accepted (extrude regions, pattern seeds, boolean bodies).Units: tool params and outputs are inches by default (
unitsparam to change). Dimension strings pass through:"1.53 in","25 mm","#wall_thk * 2". Angles are degrees.eval_featurescriptraw results are METERS/radians.featureStatus is the regen feedback loop:
OKproceed;ERRORmeans the feature was added but failed — fix parameters viaupdate_featureordelete_featureand retry. Check it after every modeling call.extrude REMOVE subtracts from ALL solids in the studio (defaultScope). Keep one part per studio unless you intend that.
One closed profile per sketch keeps extrude region selection unambiguous.
File paths must be ABSOLUTE (the server's cwd is not the project's).
Be frugal: ~2,500 API calls/YEAR. Don't poll, don't re-list needlessly; analyze_stl/compare_stl cost zero calls.
Quota warning
OnShape EDU/Free accounts have an annual API quota (~2,500 calls/user/year);
exhaustion returns 402 and no backoff fixes it. This server keeps a persistent
call counter at ~/.config/onshape-mcp/call_log and logs a running total to
stderr. Monitor usage in OnShape under My Account → Developer.
Development
uv run --no-editable pytest # offline tests (no API calls, no credentials needed)
uv run --no-editable onshape-mcp doctorLicense
MIT — see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
- platform7nOAuthtech.p7n
Connect Claude to your Platform7n workspaces — chat, links, and tasks. One-click OAuth.
Agent-first CAD: editable .kcad.ts source, deterministic review, OpenCASCADE kernel.
Give Claude only the Google Drive files you choose. Every action logged.
Run UX research from Claude — create card sort studies, list studies, pull headline stats.
Related MCP Servers
- FlicenseBqualityAmaintenanceEnables programmatic CAD modeling with Onshape's REST API, offering 45 tools for parametric sketches, feature management, assemblies, analysis, variables, and exports.48137-
- AlicenseNot gradedqualityDmaintenanceEnables users to connect Claude with various 3D printer management systems, allowing tasks like printer status monitoring, file management, print job control, and STL file manipulation.57 npmGPL 2.0
- AlicenseNot gradedqualityDmaintenanceEnables Claude to create 3D-printable CAD models using build123d, with tools for modeling, modification, analysis, and publishing to platforms like Thingiverse and GitHub.11Creative Commons Attribution Non Commercial No Derivatives 4.0 International
- FlicenseNot gradedqualityDmaintenanceEnables Claude to create and manipulate SolidWorks CAD models through natural language commands, automating part creation, sketching, and extrusion.10-