# kernelcad MCP server

Agent-first CAD: editable .kcad.ts source, deterministic review, OpenCASCADE kernel.

## Links
- Registry page: https://www.getdrio.com/mcp/com-kernelcad-kernelcad
- Repository: https://github.com/w1ne/kernelCAD-web

## Install
- Endpoint: https://mcp.kernelcad.com/mcp
- Auth: Not captured

## Setup notes
- Remote endpoint: https://mcp.kernelcad.com/mcp

## Tools
- lookup_authoring_skill - Return the kernelcad-authoring SKILL.md body — conventions for writing .kcad.ts scripts (imports, parameters, evaluation contract, common pitfalls).

Use this tool BEFORE generating CAD code if your MCP client does not list resources. Clients that do list resources should instead read `kernelcad://skills/authoring` directly — the contents are identical.

INPUT: none. OUTPUT: { uri, mimeType, text } where `text` is the SKILL.md body. Endpoint: https://mcp.kernelcad.com/mcp
- evaluate_script - Run a kernelCAD .kcad.ts script and report pass/fail + feature count + diagnostics. Pass either { file: "<path>" } or { code: "<inline source>" }. Endpoint: https://mcp.kernelcad.com/mcp
- list_features - List the features captured by a kernelCAD script — kind, id, params, inputs, transforms count, suppression. Pass either { file } or { code }. Endpoint: https://mcp.kernelcad.com/mcp
- list_assemblies - List assembly intent captured by a kernelCAD script: assemblies, parts, named connectors, fixed connections, joints, and aggregate assembly models. Pass either { file } or { code }. Endpoint: https://mcp.kernelcad.com/mcp
- inspect_assembly - Evaluate a kernelCAD script and return an agent-facing physical assembly inventory: named parts, bboxes, connectors, mates, disconnected solids, mechanical review facts, and a next-action prompt. Use before design_loop or after a visual rejection to make random/floating geometry explicit. Endpoint: https://mcp.kernelcad.com/mcp
- get_shape_info - Run + recompute a script, return volume/surfaceArea/bbox for one feature (default: last). Pass { file?, code?, feature_id? }. Endpoint: https://mcp.kernelcad.com/mcp
- list_topology - List the canonical face names available on a feature (top/bottom/left/right/front/back for box; top/bottom for cylinder; none for sphere or non-primitives) plus the total edge count. Pass { file?, code?, feature_id? }. Endpoint: https://mcp.kernelcad.com/mcp
- get_edges_of - Return the boundary edges of a named canonical face on an un-transformed primitive — index, centroid, length, isClosed. Pass { file?, code?, feature_id?, face_name: 'top' | ... }. Endpoint: https://mcp.kernelcad.com/mcp
- why_did_this_fail - Walk the upstream chain of a failing feature. Returns the diagnostics of the requested feature plus the diagnostics of every upstream feature in topological order (the requested feature is the last entry). Per-code hints are inline on every diagnostic — call list_diagnostic_codes for the full catalogue. Pass { file?, code?, feature_id? }. Endpoint: https://mcp.kernelcad.com/mcp
- set_param_value - Edit a param() default value in a kernelCAD script. Returns the modified code as text plus diagnostics from re-evaluating the result. Caller persists the new code via standard file-write tools (this tool has no side effects). Endpoint: https://mcp.kernelcad.com/mcp
- add_feature - Insert a new feature line into a kernelCAD script before the last top-level return statement. Returns the modified code as text plus diagnostics from re-evaluating the result. Side-effect-free. Primitives that accept faceLabels (box, cylinder, extrudeRect, extrudeCircle, extrudePolygon, extrudeRoundedRect) can receive `opts.faceLabels` in the inserted code — use `list_api` to see `featureKindFaceLabels` for the full value schema. Endpoint: https://mcp.kernelcad.com/mcp
- add_nurbs_surface - Insert a nurbsSurface(...) or surfaceFromCurves(...) call into the user's .kcad.ts. The returned Surface is captured but produces no Shape until you chain .thicken(t) or .toShape() (do that via add_feature on the binding name). Pass either { controls, degree, weights?, knots?, periodic? } for direct construction, OR { section_sketch_ids } for skinning. Returns the modified code + diagnostics. Slice-1 limitation: weights are accepted but currently ignored (TColStd_Array2OfReal not exposed in WASM bindings); surfaces are non-rational. Endpoint: https://mcp.kernelcad.com/mcp
- add_nurbs_curve - Insert a `nurbsCurve(controlPoints, opts?)` declaration into the user's .kcad.ts immediately before the last top-level return. The returned binding has type Curve3D (peer to Shape / Surface) — consume it via `add_variable_sweep` (spine input) or downstream Curve3D-accepting features. Pass `controlPoints` as a Vec3[] (mm, at least 2 points). Optional NURBS knobs: `degree` (default 3), rational `weights`, explicit `knots`, `closed`. Returns the modified code + diagnostics from re-evaluating. Side-effect-free. Endpoint: https://mcp.kernelcad.com/mcp
- add_surface_from_boundary - Insert a `surfaceFromBoundary([c1, c2, c3, c4], opts?)` declaration into the user's .kcad.ts immediately before the last top-level return. Fills the interior of 4 boundary Curve3D refs with a single NURBS face via OCCT BRepOffsetAPI_MakeFilling — the canonical Coons-patch primitive. The 4 curves walk an ordered loop: `curve_bindings[0]` = bottom, `[1]` = right, `[2]` = top, `[3]` = left; adjacent endpoints must coincide within 1e-6 mm or capture emits `feature.surface-from-boundary.corner-mismatch`. The result has type Surface — chain `.thicken(t)` or `.toShape()` via `add_feature` on the returned binding name. `opts.continuity` accepts a single grade ('C0' | 'C1' | 'C2') applied to all 4 edges or a length-4 array per edge; defaults to 'C0'. `opts.sampling` controls NbPtsOnCur (default 15). Validates every `curve_bindings[i]` is declared in the source via regex before inserting (fast structured error vs capture-time stack). Returns the modified code + diagnostics. Side-effect-free. Endpoint: https://mcp.kernelcad.com/mcp
- add_hermite_g2 - Insert a `hermiteG2(a, b)` declaration into the user's .kcad.ts immediately before the last top-level return. Builds a quintic Hermite Curve3D that interpolates two endpoints with matching positions, tangents, and (optional) curvatures — used to bridge two existing curves with G2 continuity. The returned binding has type Curve3D (peer to nurbsCurve / spline3d) — consume it via `add_variable_sweep` (spine input), `add_surface_from_boundary` (boundary curve), or downstream Curve3D-accepting features. Each endpoint is `{ point: Vec3, tangent: Vec3, curvature?: Vec3 }` in mm; tangent magnitude controls how aggressively the curve heads out of the endpoint (typical magnitude ~ chord length). Curvature defaults to [0, 0, 0] which makes the curve G1 only (lifted cubic Hermite). Returns the modified code + diagnostics. Capture-time emits `feature.hermite-g2.degenerate-tangent` if a tangent has magnitude < 1e-12 and `feature.hermite-g2.non-finite-input` on any NaN/Infinity. Side-effect-free. Endpoint: https://mcp.kernelcad.com/mcp
- add_path_spline - Insert a `.spline(points, opts?)` call into an existing PathBuilder chain on the named `chain_anchor` variable. The call is injected at the END of the chain, immediately before any `.close()` (or before the statement terminator if `.close()` has not yet been added). `points` is a `Vec2[]` (mm) with at least 2 entries; the path interpolates through every waypoint. `points[0]` must match the current pen position within 1e-6 mm or capture-time emits `feature.path.spline.degenerate-points`. Optional `tension` forwards to the underlying `makeBSplineApproximation` call (tightens or relaxes the smoothing tolerance). Use for organic 2D outlines (eyewear brow, ergonomic handle silhouettes, sneaker midsole) authored from measured waypoints. Returns the modified code + diagnostics from re-evaluating. Side-effect-free. Endpoint: https://mcp.kernelcad.com/mcp
- trace_from_image - Trace pixel-space features from a reference photo into normalized [0..1] waypoints the agent can map to mm via a known scale anchor and feed to path().spline / path().nurbsSegment. Three backends are dispatched behind the scenes: `opencv` (deterministic; uniform-bg silhouette only), `vision-llm` (Claude vision; named points/cluttered backgrounds; caller-supplied ANTHROPIC_API_KEY), and `hybrid` (opencv silhouette + LLM-labeled named points). Default backend is `auto` — the tool picks based on the image's corner-color stddev. Accuracy honesty: opencv contour is geometrically exact; vision-LLM is typically 5–10% off on dense landmarks. Per-feature `confidence` is reported. Caller pays for any vision-LLM API spend via their own ANTHROPIC_API_KEY. Pair with the `kernelcad-trace-from-image` skill for the conversion-to-mm pipeline. Endpoint: https://mcp.kernelcad.com/mcp
- add_path_nurbs_segment - Insert a `.nurbsSegment(controlPoints, opts?)` call into an existing PathBuilder chain on the named `chain_anchor` variable. The call is injected at the END of the chain, immediately before any `.close()`. `controlPoints` is a `Vec2[]` (mm) — at least `degree + 1` entries; `controlPoints[0]` must match the current pen position within 1e-6 mm; the pen ends at `controlPoints[N-1]`. Optional `degree` defaults to 3; `weights` for rational NURBS (strictly positive); `knots` for an explicit clamped knot vector (length must equal `controlPoints.length + degree + 1`). Use for explicit B-spline outlines where the control net is the natural mental model (NURBS round-tripping, programmatic profile generation). Returns the modified code + diagnostics. Side-effect-free. Endpoint: https://mcp.kernelcad.com/mcp
- add_path_hermite_g2 - Insert a `.hermiteG2(a, b)` call into an existing PathBuilder chain on the named `chain_anchor` variable. The call is injected at the END of the chain, immediately before any `.close()`. Each endpoint is `{ point: Vec2, tangent: Vec2, curvature?: Vec2 }` in mm. `a.point` must match the current pen position within 1e-6 mm; the pen ends at `b.point`. `curvature` defaults to `[0, 0]` (degrades to G1 / lifted cubic Hermite); pass matching curvatures on both endpoints for G2-continuous blends (eyewear bridge ↔ brow transitions, sneaker midsole transitions). Tangent magnitude is the first derivative, NOT unit length — typical magnitude is the chord length between endpoints. Returns the modified code + diagnostics. Side-effect-free. Endpoint: https://mcp.kernelcad.com/mcp
- add_variable_sweep - Insert a `variableSweep(spine, sections, opts?)` declaration into the user's .kcad.ts immediately before the last top-level return. The result is a Shape — chain `.translate(...)`, `.union(...)`, etc. via `add_feature`. `spine_binding` references an existing variable (Curve3D / Sketch / Vec3[]) in the source; each `sections[i].profile_binding` references an existing Sketch. Sections must be strictly increasing in `t` and span [0, 1]; first t=0, last t=1. Validates every binding exists in the source via regex before inserting (fast structured error vs capture-time stack). Returns the modified code + diagnostics. Side-effect-free. Endpoint: https://mcp.kernelcad.com/mcp
- add_sketch_text - Insert a sketch.text(...) call into a kernelCAD script before the last top-level return statement. Returns the modified code as text plus diagnostics from re-evaluating the result. Side-effect-free. The emitted sketch is chainable: pair with subsequent .extrude(...) / cut(...) edits to land an engraved or raised text feature. Default font is the runtime-bundled Liberation Sans; pass `font` as a `.ttf` path to load a custom font. Endpoint: https://mcp.kernelcad.com/mcp
- emboss_text - Insert a `<shape>.embossText({ text, face, size, depth, align?, anchor?, rotation?, scaleMode? })` chained call into a kernelCAD script before the last top-level return. Use for engraved brand text on faces (Ray-Ban temple, CE mark, model number). `depth > 0` raises text out of the face; `depth < 0` engraves text into the face. Side-effect-free; returns modified code plus diagnostics from re-evaluating. The emitted feature lowers via replicad drawText → sketchOnFace → extrude → fuse|cut. Endpoint: https://mcp.kernelcad.com/mcp
- project_curve - Insert a `<shape>.projectCurve({ curve, face, scaleMode?, asEdge? })` chained call into a kernelCAD script. Wraps a 2D closed curve onto a 3D face along the face normal; pair with `.extrude(d)` / `.cut(...)` for engraved logos or label inserts on curved bodies. `asEdge: true` is captured but currently deferred at lower time (BRepProj_Projection not bundled). Side-effect-free; returns modified code plus diagnostics. Endpoint: https://mcp.kernelcad.com/mcp
- add_pattern_feature - Insert a Shape.patternLinear / .patternCircular / .patternGrid call into a kernelCAD script before the last top-level return. Pass structured args (kind + the matching spec object). Returns the modified code plus diagnostics from re-evaluating. Side-effect-free. The pattern feature is a single editable unit; pattern-instance face refs resolve via `<sourceId>_pattern_<i>` on the pattern feature's lineage. Geometric note: pattern is implemented as cumulative boolean union of transformed source copies — additive features (boxes, ribs, fins, spokes) pattern cleanly; patterning a subtractive feature (hole, cutout) only preserves the per-instance void when adjacent bodies are disjoint. Endpoint: https://mcp.kernelcad.com/mcp
- remove_feature - Remove a single line from a kernelCAD script identified by a substring match. Returns the modified code plus diagnostics from re-evaluating. Refuses to remove the line containing the return statement. Side-effect-free. Endpoint: https://mcp.kernelcad.com/mcp
- list_edges - List edges of a kernelCAD shape with optional EdgeQuery filter. Returns each edge's id, midpoint, direction, length, curveType, convex, dihedralAngleDeg, and boundary status. Use this to discover what edges are available before calling fillet/chamfer. Pass either { file } or { code }; query is an optional EdgeQuery object. Endpoint: https://mcp.kernelcad.com/mcp
- list_faces - List faces of a kernelCAD shape with optional FaceQuery filter. Returns each face's id, centroid, normal, surfaceType, area, and label. Use for face introspection before shell/face references. Pass either { file } or { code }; query is an optional FaceQuery object. Endpoint: https://mcp.kernelcad.com/mcp
- list_face_labels - List user-applied labels visible in a script: both sketch-segment labels (path().label('rim')) and creating-op faceLabels (box(..., { faceLabels: { ... } })). Each result includes its source so the agent can disambiguate. Lets agents discover the label vocabulary on a shape before referencing labels in fillet/chamfer/shell. Endpoint: https://mcp.kernelcad.com/mcp
- get_face_lineage - Walk the HistoryMap of a lowered feature and return the chain of lineage entries that produced a named face ref. Inputs: feature_id ("auto" for last) and ref (string selector "name.slot" or a structured FaceRef / EdgeRef). Returns { chain, usedFallback }. Ships create/modify ops in this slice; split/delete classification is deferred. Endpoint: https://mcp.kernelcad.com/mcp
- list_api - List the kernelCAD script-runtime surface: global functions (box, path, selectEdges, helix, etc), Shape methods (fillet, sweep, lower, etc), Sketch methods (extrude, revolve, sweep), PathBuilder methods, EdgeQuery/FaceQuery key sets, and featureKindFaceLabels (which globals accept opts.faceLabels and valid value shapes). Use this to discover what is callable from a .kcad.ts script. Endpoint: https://mcp.kernelcad.com/mcp
- list_diagnostic_codes - Return the kernelCAD 26-code diagnostic catalogue with hint templates. Tiny one-shot call; useful for an agent that wants to pre-populate retry strategies. Hints are also inline on every emitted diagnostic — this tool just gives you the canonical list up front. Endpoint: https://mcp.kernelcad.com/mcp
- export_stl - Export the script geometry to a binary STL file. Pass either { file } or { code } plus a required { output_path }. Optional { feature_id } selects which feature to export (default: last). Returns { ok, output_path, byte_count, feature_count, diagnostics }. feature_count is the total features in the script, not the count contributing to the exported shape. The STL file is written server-side; suitable for passing directly to slicers, simulators, and viewers. Endpoint: https://mcp.kernelcad.com/mcp
- lookup_cookbook - Search the kernelCAD cookbook for canonical pattern snippets. Returns top-k snippets matching the natural-language query, ranked by BM25 over title/tags/keywords/trigger. Use when you need a canonical pattern for fillet-after-subtract, non-overlapping booleans, sketch-to-extrude flows, etc. Returns empty if no snippet scores above the relevance floor — proceed without cookbook help in that case. Endpoint: https://mcp.kernelcad.com/mcp
- params_list - List all parameters declared on the active session, with current values, defaults, and metadata. Read-only. Endpoint: https://mcp.kernelcad.com/mcp
- params_update - Edit one or more session parameters and re-lower the affected records. Validates every edit before applying any (atomic). Returns the updated shape, the list of records that re-lowered, and any soft warnings (e.g., named feature refs that became passthroughs because a boolean param gated their feature off). Endpoint: https://mcp.kernelcad.com/mcp
- solve_sketch - Solve a 2D sketch constraint set. Side-effect-free: pass { entities, constraints } and receive solved entities plus the original constraints. Entities are POINT, LINE, and CIRCLE records; constraints use the kernelCAD constraint vocabulary. Endpoint: https://mcp.kernelcad.com/mcp
- add_constraint - Append one validated sketch constraint to a constraint list. Side-effect-free: pass { constraints, constraint } and receive the updated list. Endpoint: https://mcp.kernelcad.com/mcp
- list_constraints - List supported sketch constraint types and echo the provided constraint list. Use before add_constraint or solve_sketch to discover the vocabulary. Endpoint: https://mcp.kernelcad.com/mcp
- add_connector - Register a v0.6 mate-style connector on a named part of the active assembly. Requires a prior evaluate_script that called kcad.assembly(...). Origin accepts a [x, y, z] tuple shorthand or a structured ConnectorOrigin ({ kind: "vec3" | "topology", ... }). Returns the registered connector's { partName, name, type }. Endpoint: https://mcp.kernelcad.com/mcp
- add_mate - Declare a typed mate between two named connectors on the active assembly. Connector refs are "<partName>.<connectorName>". Mate types: fastened, revolute, prismatic, cylindrical, planar, ball, pin_slot. Optional pose and limitsDeg/limitsMm expose articulated intent for solver/review tools. Endpoint: https://mcp.kernelcad.com/mcp
- list_mates - List the mate records declared on the active assembly. Read-only; reads arm.__mates() under the hood. Returns { mates: [{ name, a, b, type, pose?, limitsDeg?, limitsMm? }, ...] }. Endpoint: https://mcp.kernelcad.com/mcp
- validate_assembly - Run the mate-aware assembly validator (validateAssemblyWithMates) on the active assembly. Returns { status, diagnostics, partCount, jointCount } where diagnostics carry per-code hints agents use to recover. Endpoint: https://mcp.kernelcad.com/mcp
- solve_mates - Run the v0.6 mate-graph solver on the active assembly. Returns { status, poses, iterations? } where each pose is a serialized Transform ({ translation, rotateAxis, rotateDeg }). Optional poses overrides mate pose values by mate name. Endpoint: https://mcp.kernelcad.com/mcp
- review_cad - Run the deterministic CAD review loop: evaluate the script, validate the assembly/mate graph, check mate connectors touch modeled material, sample declared mate limits, optionally check interferences at sampled poses, report connector workspace bounds, and return a mechanism fitness verdict for agent self-review. Fitness includes repairMode: none, local-fix, parameter-tune, or topology-redesign. Endpoint: https://mcp.kernelcad.com/mcp
- design_loop - Run an agent CAD design loop over one or more attempt scripts: review each attempt with review_cad, continue past functional attempts that still have unresolved review warnings, return structured repair prompts, and optionally write a Studio-compatible build record JSON for visual replay. Endpoint: https://mcp.kernelcad.com/mcp
- flatten_pattern - Return the unfolded 2D flat-pattern of a bent sheet-metal Shape as a Region (outer polyline + holes + bend lines + sketch plane). Slice 1: at most 2 bends. Pass { file } or { code }; optional { featureId } to pick a specific Shape. Endpoint: https://mcp.kernelcad.com/mcp
- get_bend_table - List every sheetMetalBend in a script with its computed K-factor bend allowance, axis line, angle, radius, and parent sheetMetal thickness + kFactor. Pass { file } or { code }. Endpoint: https://mcp.kernelcad.com/mcp
- evaluate_sdf - Sample the signed distance from an in-script sdf.* field at a 3D point. Returns { distance, inside, aabb, kind }. Distance is in mm; negative = inside the surface, 0 = exactly on the surface, positive = outside. Use this to verify SDF composition before calling sdf.materialize (which is the expensive step). The script must bind the SdfField via sdf.bind('<name>', field) and pass that name as fieldName. Hint: pass either { file } or { code }, plus { fieldName, point: [x,y,z] }. Endpoint: https://mcp.kernelcad.com/mcp

## Resources
Not captured

## Prompts
Not captured

## Metadata
- Owner: com.kernelcad
- Version: 0.11.1
- Runtime: Streamable Http
- Transports: HTTP
- License: Not captured
- Language: Not captured
- Stars: Not captured
- Updated: May 25, 2026
- Source: https://registry.modelcontextprotocol.io
