Skip to main content
Glama

cadkit — Onshape MCP

A 2 inch pipe flange, generated by Claude Opus 4.8.

Two Model Context Protocol servers for driving Onshape from an LLM:

  • cadkit — the focus of this fork. A part-modeling server built around one idea: every part should come out idiomatic, fully-defined, and variable-driven — the way a careful human models, not a pile of absolute coordinates. One sketch carries its entities, geometric constraints, and driving dimensions; it's grounded to the origin and parameterized by variables; downstream features select edges and faces by meaning (concave edge, cylindrical face) rather than by transient ids that break when topology shifts.

  • onshape_mcp — the upstream server this repo forked from (hedless/onshape-mcp), kept intact. Broader and assembly-focused (mates, instances, interference, export). Reach for it when you're assembling parts rather than authoring one.

Why two servers? onshape_mcp is wide; cadkit is opinionated. cadkit deliberately emits a narrower, stricter shape of geometry so that what you get back is parametric and editable, not just present. See PLAN.md for the thesis and roadmap.

Why cadkit models the way it does

A few hard-won principles are baked into the tools (the full list is in PLAN.md):

  • Grounded + dimensioned, or it warns. cad_sketch_close reports whether the sketch is grounded to the origin and dimensioned; require_well_formed=true refuses to ship an under-defined sketch instead of letting the solver place it unpredictably.

  • Variables drive geometry, but only where they earn it. A dimension, an extrude depth, a hole diameter, a fillet radius — all accept a number or an expression / #variable. Use a variable when a value travels beyond one sketch or is derived (#leg_len - #thick); use a geometric constraint (equal, symmetric) when the relationship lives between entities; use a literal for a true one-off.

  • Select by meaning, not by id. cad_find_edges / cad_find_faces return deterministic ids chosen by geometry (concave edges for fillets, a cylindrical face by radius), so a feature keeps referring to the right thing after the model changes.

Related MCP server: Forge

The cadkit tools (35)

Group

Tools

Document / studio

cad_document_create, cad_part_studio_create

Sketch session

cad_sketch_begin → cad_sketch_line · cad_sketch_circle · cad_sketch_arc · cad_sketch_fillet · cad_sketch_mirror · cad_sketch_pattern · cad_sketch_rectangle · cad_sketch_polyline · cad_sketch_slot → cad_sketch_constrain · cad_sketch_dimension · cad_sketch_analyze (DOF report / auto-dimension, offline) → cad_sketch_close

Variables

cad_set_variable (update-or-create; no duplicates), cad_get_variables

Features

cad_extrude, cad_revolve, cad_fillet, cad_chamfer, cad_shell, cad_hole (simple / counterbore / countersink), cad_plane (offset datum plane)

Pattern / mirror

cad_mirror, cad_pattern (linear + circular) — feature-based: repeat whole features, not faces

Inspection / lifecycle / I/O

cad_measure (count/volume/bbox in one eval), cad_delete_feature, cad_suppress, cad_edit_feature, cad_export (STL/STEP/…), cad_api_calls (running quota counter)

Semantic selection

cad_find_edges (circular / concave / convex / linear / extreme / on-plane), cad_find_faces (planar-by-normal / cylindrical / largest / smallest / extreme / adjacent-to-extreme / on-plane)

A sketch is one session: cad_sketch_begin(plane=… | face=<id>), add entities, add geometric constraints + driving dimensions, then cad_sketch_close. cad_pattern / cad_mirror take the featureIds of the features to repeat (e.g. an extrude or hole) plus a direction/axis/plane.

A small example (L-bracket, parametric)

cad_set_variable("leg", "2 in"); cad_set_variable("thick", "0.25 in")
sk = cad_sketch_begin(plane="Front")
#   draw the L profile with cad_sketch_polyline / line, then:
cad_sketch_constrain("ground_origin", a="ln1.start")   # pin to origin
cad_sketch_dimension(kind="length", target="ln1", value="#leg")
# ... fully define ...
cad_sketch_close(require_well_formed=true)              # refuses if under-defined
cad_extrude(sketchFeatureId=sk, depth="#thick", operation="NEW")

Variable-driven centers (no bolt-circle macro needed)

A center moves with a variable only if a dimension references that variable. To place a hole at (#hx, #hy), dimension its center from the origin:

cir = cad_sketch_circle(center=[2, 1], radius=0.25)    # nominal spot; the dims drive it
cad_sketch_dimension(kind="diameter", entity=cir, value="#bore")
cad_sketch_dimension(kind="position", entity=cir+".center", value=["#hx", "#hy"])  # H + V dims

kind="position" emits a horizontal and a vertical distance from the origin (null skips an axis); kind="distance" with direction="horizontal"|"vertical" does the same between any two entities. A bolt circle is then just a circular pattern (cad_sketch_pattern / cad_pattern) of one hole whose seed sits on a construction circle dimensioned to #bcd — no dedicated feature required.

Install

Both servers live in this one repo and share the same Onshape client.

git clone https://github.com/saltyeg/cadkit-mcp.git
cd cadkit-mcp
python -m venv venv && source venv/bin/activate
pip install -e .

Credentials

You need an Onshape API access key + secret key from the Onshape Developer Portal. cadkit resolves them in this order:

  1. ONSHAPE_ACCESS_KEY / ONSHAPE_SECRET_KEY environment variables, else

  2. the onshape MCP server entry already in your ~/.claude.json (so if you've configured the onshape_mcp server, cadkit reuses those keys — you never paste them twice).

See .env.example for all supported variables.

OAuth2 (bring your own account)

cadkit also supports OAuth2 — authenticating as the user via their own Onshape account instead of API keys. This is the architecture behind the "bring-your-own-agent" model and the path to an App Store listing whose calls are exempt from the per-user annual quota. It's optional; API keys remain the default and nothing changes if you don't use it.

  1. Register a Connected desktop app (OAuth application) in the Onshape Developer Portal with:

    • Redirect URI http://localhost:8910/callback (must match exactly)

    • Scopes read, write, delete (OAuth2Read OAuth2Write OAuth2Delete)

  2. Put the issued credentials in .env (or your environment):

    ONSHAPE_OAUTH_CLIENT_ID=…
    ONSHAPE_OAUTH_CLIENT_SECRET=…
  3. Run the one-time browser handshake:

    cadkit-auth login     # opens the browser, stores tokens at ~/.cadkit/onshape_token.json
    cadkit-auth status    # show token + expiry;  cadkit-auth logout to revoke locally

Once a token is stored, the cadkit server prefers it over API keys automatically (with silent refresh). Caveat: until the app is published in the App Store it's a private OAuth app, so calls still count against the 2,500/yr quota exactly like API keys — OAuth buys the right architecture, not quota relief, until launch.

Register with Claude Code

Add to ~/.claude.json (or ~/.claude/mcp.json). The cadkit entry can omit keys if the onshape entry already has them:

{
  "mcpServers": {
    "onshape": {
      "command": "/abs/path/to/onshape-mcp/venv/bin/python",
      "args": ["-m", "onshape_mcp.server"],
      "env": { "ONSHAPE_ACCESS_KEY": "…", "ONSHAPE_SECRET_KEY": "…" }
    },
    "cadkit": {
      "command": "/abs/path/to/onshape-mcp/venv/bin/python",
      "args": ["-m", "cadkit_mcp.server"]
    }
  }
}

Use the absolute path to the venv's Python. Restart Claude Code after editing the config or after any change to the server code (a running server holds the old module until restart).

API quota — read this before testing

The Onshape free / standard / education-student tiers allow 2,500 successful API calls per user per year (limits doc). Only 2xx/3xx responses count — 4xx/5xx are free; 429 is a separate short-term burst limit; 402 means the annual budget is spent. A naive live test suite drains this fast.

cadkit's development practice is built around that constraint:

  • Offline-first tests. tests/test_cadkit_builders.py asserts on the JSON the builders emit — parameter ids, enum strings, constraint structure — with zero API calls. This catches the bug class that actually costs debugging time (a wrong/hidden parameterId).

  • cadkit_mcp/devkit.py — quota-frugal live helpers: ScratchStudio reuses one part studio across checks; measure_fs returns bbox / volume / count / sketch bbox / named variables in a single FeatureScript eval (SOLID-body filtered, inch-converted).

  • One on-demand live smoke (~6–8 calls), run by hand before a release — only for truths offline can't prove (a variable actually drives geometry; a concave edge actually fillets).

# offline builder tests — free, run anytime
venv/bin/python -m pytest tests/test_cadkit_builders.py -o addopts="" -q

Layout

cadkit_mcp/
├── server.py     # the cadkit tools + feature JSON builders
├── sketch.py     # SketchSession: entities, constraints, grounding, diagnostics
├── selection.py  # semantic edge/face finders (FeatureScript-backed)
├── quota.py      # successful-call counter behind cad_api_calls
├── hole_template.json  # 160-param native Hole feature template
└── devkit.py     # quota-frugal live verification helpers
onshape_mcp/       # inherited upstream server (assemblies, mates, export) — see git history
tests/            # offline builder tests (zero-API)
PLAN.md           # cadkit thesis + roadmap (P0–P3)

Roadmap

cadkit is ordered so the parametric core is correct before feature breadth — see PLAN.md. Shipped (P0–P2): the sketch session, idempotent variables, parametric scalars everywhere, extrude/revolve/fillet/chamfer/shell/hole, sketch-on-face, feature-based pattern/mirror, semantic edge/face selection, plus inspection/lifecycle/IO — cad_measure, cad_get_variables, cad_delete_feature, cad_suppress, cad_edit_feature, cad_export. In progress (P3): richer semantic selection (largest/smallest/extreme/adjacency/on-plane done; by-tag next) and sketch ergonomics (slots, center-point arcs, fillets, construction geometry done; in-sketch mirror live-verified; in-sketch pattern emits geometric copies). Deferred: cad_rollback, mass/COM in cad_measure, and tapped threads on the native Hole feature.

Notes

Not tested on assemblies yet, only individual parts

Credits

Forked from hedless/onshape-mcp; the onshape_mcp server and its assembly tooling are upstream's work. Built on the Model Context Protocol and the Onshape REST API. MIT License.

Available Tools

33 tools
cad_api_callsA

Report how many SUCCESSFUL Onshape API calls (2xx/3xx — the ones that count against the 2,500/user/yr budget) cadkit has made this session. Costs no API call. Check it before/after live work to keep quota spend visible.

Inputs: no named parameters.

cad_chamferB

Equal-distance chamfer on edges (deterministic ids from cad_find_edges). distance is inches (number) or an expression/#variable.

Inputs: documentId (required), workspaceId (required), elementId (required), edgeIds (required), +2 more.

cad_delete_featureC

Delete a feature by featureId.

Inputs: documentId (required), workspaceId (required), elementId (required), featureId (required).

cad_document_createC

Create a document and return documentId + the Main workspaceId.

Inputs: name (required), description.

cad_edit_featureB

Edit one stored parameter of an existing feature. Give parameterId (e.g. 'depth','radius','length') plus expression (number/#var for a quantity) OR value (enum/bool/string). Retarget a dimension to a #variable without rebuilding.

Inputs: documentId (required), workspaceId (required), elementId (required), featureId (required), +3 more.

cad_exportC

Export the part studio to a file format. format: STL/STEP/PARASOLID/GLTF/OBJ (default STEP). Optional partId to export a single part. Returns the translation result.

Inputs: documentId (required), workspaceId (required), elementId (required), format, +1 more.

cad_extrudeC

Extrude a sketch region. operation: NEW/ADD/REMOVE/INTERSECT. depth is inches (number) or an expression/#variable.

Inputs: documentId (required), workspaceId (required), elementId (required), sketchFeatureId (required), +3 more.

cad_filletC

Fillet edges (deterministic ids from cad_find_edges). radius is inches (number) or an expression/#variable.

Inputs: documentId (required), workspaceId (required), elementId (required), edgeIds (required), +2 more.

cad_find_edgesA

Find edges by geometry. kind: circular (radius+tol), concave/convex (inner/outer corners — concave is ideal for fillets), linear (axis X/Y/Z and/or through point), extreme (ALL edges furthest along axis — e.g. axis=Z max=false for the bottom edges, to fillet at once), on_plane (all edges lying in the plane axis=coordinate, e.g. axis=Z coordinate=0). Returns deterministic ids.

Inputs: documentId (required), workspaceId (required), elementId (required), kind (required), +6 more.

cad_find_facesC

Find faces by geometry. kind: planar_by_normal (normal=[x,y,z]), cylindrical (radius+tol), largest/smallest (by area — e.g. the big flat face to sketch on), extreme (the face furthest along axis — axis=Z max=true is the top face), adjacent_to_extreme (the faces bordering that extreme face), on_plane (the planar face lying in axis=coordinate, e.g. axis=Z coordinate=0). Returns deterministic ids.

Inputs: documentId (required), workspaceId (required), elementId (required), kind (required), +6 more.

cad_get_variablesA

List the cadkit variables in this part studio (name + authored expression, e.g. '#leg' = '2 in'). Reads the assignVariable features; one API call.

Inputs: documentId (required), workspaceId (required), elementId (required).

cad_holeA

Hole(s) at the given centers on a plane/face. diameter/depth accept numbers or #variables. plane is Front/Top/Right OR a face id (from cad_find_faces). style: 'simple' (default) | 'counterbore' (needs cboreDiameter + cboreDepth) | 'countersink' (needs csinkDiameter; csinkAngle default 90) — counterbore/countersink use the native Hole feature (proper callouts). Set up=true if the hole reports 'none intersected' (flips the drill direction). through=true for a through-all hole.

Inputs: documentId (required), workspaceId (required), elementId (required), plane (required), +11 more.

cad_measureB

Measure the part studio's solids in ONE FeatureScript eval: solid count, total volume (in^3), and the combined bounding box (min/max/size in inches). Quota-frugal.

Inputs: documentId (required), workspaceId (required), elementId (required).

cad_mirrorB

Mirror whole features across a plane. featureIds = the features to repeat (e.g. an extrude/hole featureId); planeId = Front/Top/Right or a face/plane id. operation matches the seed feature: NEW (default) for an additive boss, REMOVE when mirroring a hole/cut so the copy cuts.

Inputs: documentId (required), workspaceId (required), elementId (required), featureIds (required), +3 more.

cad_part_studio_createC

Create a Part Studio; returns elementId.

Inputs: documentId (required), workspaceId (required), name (required), elementId.

cad_patternA

Pattern whole features. kind=linear needs directionId (an edge) + spacing (number/#var) + count; kind=circular needs axisId (an edge) + count, evenly spaced over angle (default 360). featureIds = the features to repeat. operation matches the seed feature: NEW (default) for an additive boss, REMOVE when patterning a hole/cut so each copy cuts (NEW leaks a stray body for a cut).

Inputs: documentId (required), workspaceId (required), elementId (required), kind (required), +8 more.

cad_revolveB

Revolve a sketch region about an axis edge. angle in degrees (number/#var); omit angle for a full 360 revolve. operation: NEW/ADD/REMOVE/INTERSECT.

Inputs: documentId (required), workspaceId (required), elementId (required), sketchFeatureId (required), +4 more.

cad_set_variableA

Set a part-studio variable (assignVariable), update-or-create: re-setting the same name updates it in place instead of adding a duplicate. expression e.g. '2.4 in' or '#other*2'.

Inputs: documentId (required), workspaceId (required), elementId (required), name (required), +1 more.

cad_shellC

Hollow the solid by removing the given faces and leaving a wall. thickness is inches (number) or #variable; wall is inward.

Inputs: documentId (required), workspaceId (required), elementId (required), faceIds (required), +2 more.

cad_sketch_arcA

Add a center-point arc swept counterclockwise from start to end; returns entityId (points are .start / .end). Radius is set by start; the end snaps to that radius. Swap start/end for the complementary arc. construction=true for a reference arc.

Inputs: sessionId (required), center (required), start (required), end (required), +1 more.

cad_sketch_beginA

Open a sketch session on a standard plane (Front/Top/Right) OR an existing face (pass its deterministic id from cad_find_faces as face). Returns a sessionId.

Inputs: documentId (required), workspaceId (required), elementId (required), plane, +2 more.

cad_sketch_circleC

Add a circle; returns entityId. construction=true for a reference circle.

Inputs: sessionId (required), center (required), radius (required), construction.

cad_sketch_closeA

Post the sketch as one feature; returns its featureId plus diagnostics (grounded, dimensions, wellFormed). Set require_well_formed=true to refuse (without posting) a sketch that is ungrounded or has no driving dimensions.

Inputs: sessionId (required), require_well_formed.

cad_sketch_constrainA

Add a geometric constraint. type one of: coincident, horizontal, vertical, parallel, perpendicular, tangent, equal, concentric, pierce, midpoint, symmetric, fix, ground_origin. 'a'/'b'(/'c' for symmetry line) are entity/point ids like 'ln1' or 'ln1.start'. ground_origin grounds point 'a' to the part-studio origin.

Inputs: sessionId (required), type (required), a (required), b, +1 more.

cad_sketch_dimensionA

Add a driving dimension. kind: length (line), radius/diameter (circle), distance (entity+entity2), angle (line+line, value in degrees). value is inches (number) or an expression/#variable (e.g. '#base_len', '60 mm').

Inputs: sessionId (required), kind (required), entity (required), value (required), +1 more.

cad_sketch_filletA

Round the corner where two lines meet with a tangent arc of radius (inches). Trims both lines to the tangent points, drops the corner coincident, inserts the arc, and adds tangent constraints. Returns {arc, center, tangentPoints, radius}.

Inputs: sessionId (required), line1 (required), line2 (required), radius (required).

cad_sketch_lineB

Add a line; returns its entityId (points are .start / .end).

Inputs: sessionId (required), start (required), end (required), construction.

cad_sketch_mirrorA

Mirror sketch lines across an existing line entity (the axis — e.g. a construction line). Emits the reflected copies and a MIRROR constraint tying each copy to its original. Lines only for now. Returns {originalId: copyId}.

Inputs: sessionId (required), entityIds (required), axis (required).

cad_sketch_patternA

Repeat sketch lines/circles as geometric copies. kind=linear needs direction=[dx,dy] + spacing (inches between instances); kind=circular needs center=[cx,cy] + angle (degrees between instances). count is the total incl. the original. Copies are geometric (not a live-linked pattern). Returns {originalId: [copyIds...]}.

Inputs: sessionId (required), entityIds (required), kind (required), count (required), +4 more.

cad_sketch_polylineA

Add a chain of lines through points. Auto coincident-joins them; closed=True closes the loop; auto_hv applies horizontal/vertical to axis-aligned segments; ground_first grounds the first point to the origin if it is at (0,0). Returns the line ids.

Inputs: sessionId (required), points (required), closed, auto_hv, +1 more.

cad_sketch_rectangleB

Add a constrained rectangle; returns {bottom,right,top,left} line ids.

Inputs: sessionId (required), corner1 (required), corner2 (required).

cad_sketch_slotA

Add an obround (rounded slot) between two centre points, given width — a rectangle + a circle at each end; extruding unions them into a clean slot. Returns {sides, caps} ids.

Inputs: sessionId (required), center1 (required), center2 (required), width (required).

cad_suppressA

Suppress (suppressed=true) or unsuppress (false) a feature by featureId, leaving it in the tree.

Inputs: documentId (required), workspaceId (required), elementId (required), featureId (required), +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 33 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose (e.g., cad_extrude vs cad_revolve, cad_find_edges vs cad_find_faces). Sketch tools are all prefixed with cad_sketch_ and address different operations (line, circle, arc, etc.). No ambiguity between tools.

    Naming Consistency5/5

    All tools use the consistent 'cad_' prefix followed by a verb_noun pattern in snake_case (e.g., cad_sketch_begin, cad_extrude, cad_delete_feature). No mixing of conventions.

    Tool Count4/5

    33 tools is on the higher side, but the domain (CAD modeling) justifies the number. Each tool serves a specific function, and the count is still manageable for an agent. Slight over-scoping in sketching (12 tools) but not excessive.

    Completeness4/5

    The toolkit covers the full CAD workflow: document/part studio creation, sketching with constraints/dimensions, 3D operations (extrude, revolve, fillet, hole, shell, mirror, pattern), measurement, variables, and export. Minor gaps like advanced assembly or referencing are absent but not critical for basic modeling.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      MCP server to control FreeCAD from Claude — parametric modeling, sketches, CAM toolpaths, geometry inspection, and more via 33 tools.
      66
      GNU Lesser General Public v2.1 only
    • A
      license
      Not graded
      quality
      B
      maintenance
      A local MCP server that enables AI agents to create and edit parametric CAD models through natural language, using a validated operation graph that compiles to real geometry.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to convert natural language engineering prompts into editable parametric CAD models with deterministic parsing, validation, and edit support.
      5
      Apache 2.0
    • A
      license
      A
      quality
      D
      maintenance
      A parametric CAD workspace as an MCP server, enabling agents to create, edit, and manipulate 3D models through tools, with a live studio UI and STL/OBJ import/export.
      12
      58 npm
      4
      MIT