Skip to main content
Glama
onshape-automation-mcp

onshape-automation-mcp

by spsDrop

onshape-automation-mcp

Browser-based Onshape MCP automator: exposes Model Context Protocol tools that act on your own logged-in Onshape session — no public-API quota, no keys.

Every tool in this project drives the Onshape web app through the logged-in Chrome tab via Chrome DevTools Protocol (CDP): keystrokes, clicks, DOM reads, and Runtime.evaluate. CDP is the primary mechanism. Only a handful of tools use Onshape's internal v14 app API directly — and those are all listed in the Architecture section below. The MCP never reads cookies, never logs in, never touches the public v9/v8 API.

Not an API wrapper. This is a single-user, single-tab automator that drives your own account through your own browser — not a scraping tool, not a public-document extractor.

What it does

Any MCP-compatible client (Hermes, Claude Desktop, MCP Inspector, etc.) can:

  • Discover documents, workspaces, part studios, unit/precision settings

  • Create new documents and part studios (account-level scope is intentionally limited to creation — deletions stay in Onshape and are done manually)

  • Sketch — rectangles, circles, lines, arcs, dimensions, constraints, on the top plane (viewport-pixel coords via take_screenshot)

  • Build parts — extrude, thicken, revolve, linearly/circularly pattern, boolean, fillet, chamfer, shell, hole, mirror, move face, plane, loft, sweep, enclose, rib, wrap, split, draft, body draft, cap, face blend, replace face, modify fillet, transform

  • Sheet metal — base feature, flange, face flange, fold, thickness change (reform is not_supported)

  • Variables — read, set, create variable studios

  • Analyze — features, parts, body details, bounding box, eval_featurescript (not_supported — no FeatureScript engine in the browser)

  • Screenshot the live viewport via CDP

Related MCP server: chrome-mcp

Architecture

agent (MCP client)
  │  stdio or HTTP POST /mcp
  ▼
MCP server (server.ts / http-server.ts)
  │  registry.ts — tool definitions + executeTool
  ▼
rateLimiter.ts — single-action-at-a-time queue (read: 1500ms, write: 3000ms spacing)
  │
  ▼
shim.ts — CDP (Bun WebSocket) → Runtime.evaluate in the logged-in tab
  │
  ▼
logged-in tab (cad.onshape.com)

Every tool runs through shim.ts as a CDP Runtime.evaluate — clicking the Feature toolbar, reading the DOM, dispatching keyboard shortcuts, simulating drags. Most tools never touch v14 at all:

Tier

Mechanism

Tools

Most tools (46)

Pure CDP/DOM — Runtime.evaluate + key/mouse events

Everything except the discovery/creation tools and the shortcut-resolution fallback tools below

7 direct v14 calls

Same-origin fetch() to /api/v14/* inside the tab

list_documents, get_document, list_workspaces, find_part_studios, get_unit_info, create_document, create_part_studio

8 shortcut-resolution fallbacks

CDP-first; fetch() to /api/v14/keyboardshortcuts/users/<id> only if the live DOM can't locate the control

create_sketch_line, create_sketch_arc, create_sketch_dimension, create_sketch_constraint, create_loft, create_sweep, create_enclose, create_rib

(create_sketch_circle hardcodes KeyC after a one-time verification against the v14 shortcut table — it does not call v14 at call time. eval_featurescript is not_supported by design — no FeatureScript engine is reachable from the browser.)

  • src/shim.ts — resolveTabId() (env or first cad.onshape.com tab), evaluate(), and v14() (in-page fetch; non-2xx and in-page failures become OnshapeError('api')).

  • src/rateLimiter.ts — one action in flight; failures do not wedge the queue.

  • src/tools/*.ts — one module per category; buildTools() in the registry merges them.

  • src/registry.ts — buildTools() = all real tools, 0 stubs.

Status

61 tools registered — tsc --noEmit clean.

Category

Tools

Count

Discovery

list_documents, get_document, list_workspaces, find_part_studios, get_unit_info, take_screenshot

6

Creation

create_document, create_part_studio

2

Sketch

create_sketch_rectangle, create_sketch_circle, create_sketch_line, create_sketch_arc, create_sketch_dimension, create_sketch_constraint, create_sketch_delete_entity, create_sketch_mirror, create_sketch_linear_pattern, create_sketch_circular_pattern, create_sketch_chamfer, create_sketch_fillet, delete_feature

13

Features

create_extrude, create_thicken, create_linear_pattern, create_circular_pattern, create_revolve

5

Body

create_fillet, create_chamfer, create_shell, create_hole, create_boolean, create_mirror, create_move_face, create_plane, create_loft, create_sweep, create_enclose, create_rib, create_wrap, create_split, create_draft, create_body_draft, create_cap, create_face_blend, create_replace_face, create_modify_fillet, create_transform

21

Sheet metal

create_sheet_metal_base_feature, create_sheet_metal_flange, create_sheet_metal_face_flange, create_sheet_metal_fold, create_sheet_metal_thickness_change, create_sheet_metal_reform (not_supported)

6

Analysis

get_features, get_parts, get_body_details, get_bounding_box, eval_featurescript (not_supported)

5

Variables

get_variables, set_variable, create_variable_studio

3

Quick start

1. Install

bun install

2. Start the server

bun run start        # stdio MCP server
bun run start:http   # HTTP on :8471 (POST /mcp, GET /health)
bun run typecheck

3. Drive a logged-in tab

Start any Chromium with remote debugging (e.g. --remote-debugging-port=9222), open cad.onshape.com, sign in manually. The automator never logs in — you own the session.

Heads-up about the CDP tab scan: the default tab lookup matches the first page whose URL contains cad.onshape.com. If you have several, set ONSHAPE_AUTOMATION_TAB explicitly (from http://127.0.0.1:9222/json/list).

Environment variables

Variable

Required

Purpose

ONSHAPE_AUTOMATION_TAB

no

Explicit tab id to drive. If unset, the first cad.onshape.com tab is used.

ONSHAPE_USER_ID

yes for the 7 direct v14 tools (list_documents, get_document, list_workspaces, find_part_studios, get_unit_info, create_document, create_part_studio) and for the 8 shortcut-resolution fallback tools

Your Onshape user id (24-char lowercase, [a-z0-9]{24}). Falls back to DOM resolution (document.title) for list_documents; fails with a clear error if neither works.

ONSHAPE_MCP_HOST

no

HTTP bind host (default 127.0.0.1).

ONSHAPE_MCP_PORT

no

HTTP bind port (default 8471).

ONSHAPE_MCP_TOKEN

no

If set, require Authorization: Bearer <token> on non-GET requests.

Limitations & Warnings

This is not a drop-in, production-ready replacement for the public API. Each tool drives a live application via DOM/CDP keystrokes and clicks, so:

  • UI-driven flows can break. Tools rely on live-DOM control discovery and never hardcode selectors. If Onshape renames a control, a tool fails with not_supported rather than silently misbehaving — that is the intended behavior.

  • Coordinates are viewport-relative. Sketch tools take viewport pixel coordinates (take_screenshot first to inspect). Tools are best-effort and unverified live.

  • Unverifiable steps raise errors. Any step that can't be verified — locating a control, committing a feature, detecting a new feature in the tree — throws not_supported with a reason instead of claiming success.

  • Shallow DOM surface. Tools read whatever the app exposes in the DOM (the feature tree, the Parts list, document structure). 3D geometry detection (bounding box, body details) is best-effort and may be incomplete; get_bounding_box / get_body_details are DOM-only and labeled as such.

  • eval_featurescript and create_sheet_metal_reform are not_supported by design (no FeatureScript engine in the browser; reform flow is not drivable reliably via CDP).

  • Account-level operations are out of scope. New document/part studio creation is supported; deletions/replacement/removal stay in Onshape and are done manually.

  • No test suite. This release ships with tsc --noEmit clean but no automated tests of the tools themselves. Verify against your own sandbox document.

Terms of use

Onshape's Terms of Use prohibit any robot, spider, scraper, or other automated means to access the Service for data mining or extraction — and separately prohibit scraping public documents. Onshape's own moderator (Jason_S, Feb 2020, in this discussion) confirmed that automating your own model is fine: "You would be manipulating your model, not trying to uncover trade secrets/exploit Onshape. Full speed ahead on the automation of your model."

This tool is designed around that scope: one logged-in user, one session, own model only. It never scrapes, never extracts data from public documents, never collects anything beyond what the user's own session already exposes. Do not use it to traverse other users' data or public documents.

Undocumented v14 app internals can break between Onshape app releases — this applies to the handful of direct v14 calls (and the keyboardshortcuts fallback), not to the CDP-driven tools. Do not rely on v14 for production-critical data extraction.

License

MIT. Copyright (c) 2026 Jesse Foltz.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP clients to drive a real, logged-in Chrome browser for web automation tasks like navigation, clicking, typing, and screenshotting.
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables MCP clients to drive a real Chromium browser for automation, including navigation, JavaScript execution, CDP commands, network capture, and multi-tab control.
      7
      29 PyPI
      GPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to control Chrome/Edge browsers via CDP, including page navigation, element interaction, snapshots, network debugging, script execution, and performance tracing.
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to drive the user's real Chrome over CDP with tools for tab management, page inspection, smart form interaction, disabled-control diagnostics, and screenshots while keeping one connection alive across multi-step agent loops.
      MIT