Skip to main content
Glama
solidworks-mcp

solidworks-mcp

by rdolan5

solidworks-mcp-2

CI License: MIT Python 3.11-3.13

An MCP (Model Context Protocol) connector that drives SOLIDWORKS 2025 and SOLIDWORKS CAM 2025 through COM automation, so an MCP client like Claude can model parts and assemblies, produce drawings, and generate real, posted G-code — with real geometry, real mass properties, and real files on disk, not a simulation of any of those things.

It is a ground-up rebuild of the solidwprks-mcp predecessor concept: one dedicated STA worker thread owns every COM object, clients get opaque session handles instead of raw pointers, every dimensional value has an explicit unit convention, and 13 grouped MCP tools give ~122 modeling/CAM operations their own typed Pydantic schema instead of one giant generic surface. See docs/architecture.md for the full design.

Status

Code-complete for this release: 474 tests passing against a fake-COM layer, ruff/mypy clean, and — unusually for a project at this stage — live-verified against a real, licensed SOLIDWORKS 2025 + SOLIDWORKS CAM 2025 installation. That pass found and fixed 9 real bugs the fake-COM suite alone had not caught, and it honestly documents 2 remaining live-flakiness issues. See "Verified" below and docs/verification/VERIFICATION.md for the full, unedited report.

Related MCP server: solidworks-mcp

Install

Requires 64-bit Windows and, to actually connect to SOLIDWORKS, a licensed SOLIDWORKS 2025 (revision 33.x) installation. The package itself installs and its non-live test suite runs on any OS.

git clone https://github.com/rdolan5/solidworks-mcp-2.git
cd solidworks-mcp-2
uv sync

or with plain pip:

python -m venv .venv
.venv\Scripts\pip install -e .

Verify the install (no SOLIDWORKS process launched):

uv run solidworks-mcp --doctor

Configure Claude Desktop

Add to claude_desktop_config.json's mcpServers:

{
  "mcpServers": {
    "solidworks": {
      "command": "C:\\path\\to\\solidworks-mcp-2\\.venv\\Scripts\\solidworks-mcp.exe",
      "args": ["--workspace", "C:\\Users\\you\\Documents\\SOLIDWORKS-MCP"]
    }
  }
}

Configure Claude Code

claude mcp add solidworks -- C:\path\to\solidworks-mcp-2\.venv\Scripts\solidworks-mcp.exe --workspace C:\Users\you\Documents\SOLIDWORKS-MCP

Full step-by-step (both clients, troubleshooting) in docs/configuring-claude.md.

Tool catalog

~40 MCP tools total: 13 grouped tools (each dispatching on a typed operation field to one of ~122 capability-module functions) plus 27 standalone tools for connection, generic COM access, document lifecycle, and CAM connection. Every operation name below is exactly the string you pass as payload.operation; the authoritative, always-current mapping is src/solidworks_mcp/specs.py's TOOL_OPS table.

Grouped tool

Operations

Docs

solidworks_reference_geometry

plane, axis, coordinate_system(_numeric), point

docs/cad-tools.md

solidworks_sketch

begin, exit, add_entities, fillet, chamfer, offset, convert_entities, mirror, add_relation, add_dimension

docs/cad-tools.md

solidworks_feature

extrude(_cut), revolve(_cut), sweep(_cut), loft(_cut), boundary, fillet, chamfer, shell, draft, rib, wrap, dome, hole_wizard, simple_hole, thread, mounting_boss, mirror, delete, modify

docs/cad-tools.md

solidworks_pattern

linear, circular, mirror, curve_driven, sketch_driven, table_driven, fill

docs/cad-tools.md

solidworks_body

combine, split, move_copy, cavity, indent, scale, list, delete

docs/cad-tools.md

solidworks_parametric

get/set_dimension, add_equation, add_global_variable, list/delete_equation, link_dimensions

docs/cad-tools.md

solidworks_material

apply, get, custom_density, get_density, color

docs/cad-tools.md

solidworks_configuration

add, activate, list, delete, set_config_dimension, get/delete/insert_design_table

docs/cad-tools.md

solidworks_analyze

bounding_box, mass_properties, measure, section_properties, check_geometry, interference, draft_analysis, thickness_analysis

docs/cad-tools.md

solidworks_assembly

insert_component(s), mate, fix, float, move/rotate_component, replace_component, pattern/mirror_components, interference, clearance, explode, collapse, bom

docs/assemblies.md

solidworks_drawing

new_from_model, model_view, standard_3view, projected_view, section_view, detail_view, insert_dimensions, add_annotation, insert_bom, set_sheet_format, export

docs/drawings.md

solidworks_exchange

export, import

docs/cad-tools.md

solidworks_cam

list_machines, set_machine, set_post, define_stock, recognize_features, define/list_features, list_setups, generate_operation_plan, list_operations, set_operation_parameter, set_tool, generate_toolpaths, simulate, check_collisions, post_process, setup_sheet, techdb_query, save_cam_data

docs/cam.md

Standalone tools: solidworks_discover, solidworks_connect, solidworks_api/solidworks_batch/solidworks_array/solidworks_release, solidworks_api_load/solidworks_api_search, solidworks_active_document, solidworks_templates, solidworks_new_document/open_document/save, solidworks_rebuild, solidworks_inspect, solidworks_assembly_tree, solidworks_mass_properties, solidworks_sketch_begin (legacy convenience), solidworks_persistent_reference/resolve_reference, solidworks_modify_feature, solidworks_cam_connect/cam_status/cam_workflow (legacy low-level CAM dispatcher), solidworks_script, solidworks_job/ cancel_job.

Units and selection conventions

Every dimensional field accepts a value plus an optional unit, defaulting to millimetres for length and degrees for angle (SOLIDWORKS' COM API itself is always metres/radians/kilograms internally — this connector converts at the boundary in both directions). Full convention, including handle lifetime and document-targeting rules, in docs/units-and-conventions.md.

Safety model

  • Workspace sandboxing: every file-writing tool (solidworks_save, solidworks_exchange's export, CAM's post_process, drawing export) resolves its destination through Runtime.output_path, which rejects any path that resolves outside the configured --workspace directory (default ~/Documents/SOLIDWORKS-MCP). A relative path is resolved inside the workspace; an absolute path elsewhere on disk is refused.

  • --allow-scripts: solidworks_script executes arbitrary trusted Python on the COM apartment — full local code execution with the OS user's permissions, not a sandbox. It is only registered when the server is started with --allow-scripts; omit that flag (the default) to disable it entirely.

  • Generic API access is still full-trust local automation: solidworks_api/solidworks_batch expose the complete COM surface, including calls that can modify documents, run macros, or touch the local filesystem outside the workspace sandbox via COM's own file APIs (the sandbox is enforced at this connector's boundary, not inside SOLIDWORKS itself). Treat granting an MCP client access to this server as granting it the same trust you'd give a local automation script running as you.

  • CAM is never treated as proof of a license or of manufacturing correctness. An installed product, a registered add-in, or a successful API connection does not establish CAM license entitlement — see "CAM notes" below. A void COM return is documented as void, not silently reinterpreted as success.

--doctor

uv run solidworks-mcp --doctor

Prints installed SOLIDWORKS/SOLIDWORKS CAM versions, registered add-ins, and library paths as JSON, discovered from the Windows registry and filesystem — no SOLIDWORKS process is launched. Use it first when solidworks_connect or CAM tools aren't behaving as expected.

CAM notes

SOLIDWORKS CAM access requires the add-in to be installed and registered (discovered from the registry, never guessed) and, separately, a valid license — the connector's own cam.status() deliberately reports license: "unknown" even when the API connection succeeds, because an API connection is not license proof. License checks (solidworks_cam_workflow's license action) require an explicit vendor module name and are recorded per-module, not aggregated into a blanket "licensed" flag. Full detail, including the confirmed add-in identifier/entry point and the CAM operation table, in docs/cam.md.

Verified

docs/verification/VERIFICATION.md is a from-scratch run against a real, licensed SOLIDWORKS 2025 SP5.0 + SOLIDWORKS CAM 2025 installation — every number, error message, and G-code line in it is copied verbatim from an actual run, not fabricated:

Scenario

Result

Complex part

Partial pass (27/29 steps). Real mass 7.9877 g, volume 2.9584e-6 m³, bounding box 80x50x20mm, STEP/STL/SLDPRT written.

Assembly

Partial pass. 3 real components inserted/rebuilt/fixed, 4 real interferences detected before mating, [] after, real BOM rollup, SLDASM+STEP written.

Drawing

Full pass (9/9 steps). Standard 3-view, section view, detail view, model dimensions, PDF + DXF export, SLDDRW saved.

CAM → G-code

Core pipeline pass (8/10 steps). Real CAMWorks connection, 2 machinable features recognized, 225 lines of real G-code posted to a real .nc file.

That pass also found and fixed 9 real bugs in this codebase (wrong COM member names, ByRef/VARIANT marshalling, treating void-but-successful returns as failures, an unopened-referenced-file assembly-insert bug) — see the report for the full list with exact interfaces and members.

Known issues (not hidden)

  • FeatureLinearPattern5/FeatureCircularPattern5 (solidworks_pattern's linear/circular operations) consistently return Nothing against this SOLIDWORKS 2025 install despite a confirmed-correct signature and roughly a dozen parameter/selection variations tried. Open, unresolved blocker.

  • AddMate5 (solidworks_assembly's mate operation) is intermittently flaky in this headless COM automation context — selection sometimes reports zero selected objects immediately after component insertion, and the mate call itself sometimes returns an unknown error even with a verified selection. One isolated run did succeed with an identical call, confirming the API itself works; the flakiness wasn't fully root-caused in the time available.

  • CAM operation-collection enumeration (solidworks_cam's list_operations) has nothing to enumerate because generate_operation_plan returns None even though the plan demonstrably exists (toolpath generation and posting both succeed and produce real G-code). Only the introspection step is unverified.

See docs/verification/VERIFICATION.md's "Known gaps / confirmed blockers" section for the full detail on all three.

Examples

Worked, documented scripts under examples/ — adapted from the exact sequences run in live verification, not hypothetical code: complex_part_bracket.py, parametric_housing.py, gearbox_assembly.py, drawing_from_part.py, cam_mill_part_to_gcode.py.

Documentation

  • docs/architecture.md — STA worker/bridge/gateway/runtime design

  • docs/cad-tools.md — geometry/sketch/feature/pattern/body/parametric/material/configuration/analyze

  • docs/assemblies.md, docs/drawings.md, docs/cam.md

  • docs/units-and-conventions.md

  • docs/configuring-claude.md

  • docs/verification/VERIFICATION.md

Development

uv sync
uv run pytest -m "not live and not cam"
uv run ruff check
uv run mypy src

See CONTRIBUTING.md for test tiers, code style, and how to add a new operation. CHANGELOG.md covers what changed between the solidwprks-mcp predecessor concept and this release.

Available Tools

40 tools
solidworks_active_documentA
Read-onlyIdempotent

Return the active document handle, title, path and document type without changing it.

Inputs: no named parameters. Returns: object

solidworks_analyzeC
Destructive

solidworks_analyze: dispatches on payload.operation to one of the capability-module handlers for [bounding_box, check_geometry, draft_analysis, interference, mass_properties, measure, section_properties, thickness_analysis]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_apiA
Destructive

Invoke any exposed COM member. Use {$ref:handle}, {$variant:'I4',byref:true,value:0}, typed arrays with array:true, {$missing:true}, or {$bytes:base64}. Returns value and out_args. Get managers with action=get. Explicit action avoids confusing methods and properties. This is full API access: calls may modify documents, execute macros, or access local files.

Inputs: member (required), target (required), args, value, +1 more. Returns: object

solidworks_api_loadA
Destructive

Index a local vendor .tlb/.dll API library without registering it; find paths with discover.

Inputs: path (required). Returns: object

solidworks_arrayB
Read-onlyIdempotent

Read a page of an array returned as an object handle; preserves every item of large arrays.

Inputs: handle (required), limit, offset. Returns: object

solidworks_assemblyB
Destructive

solidworks_assembly: dispatches on payload.operation to one of the capability-module handlers for [bom, clearance, collapse, explode, fix, float, insert_component, insert_components, interference, mate, mirror_components, move_component, pattern_components, replace_component, rotate_component]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_assembly_treeA
Read-onlyIdempotent

Inspect assembly occurrences, parent relationships, suppression and transforms, with bounds.

Inputs: document, max_depth, max_components. Returns: object

solidworks_batchA
Destructive

Execute ordered API steps without interleaving. Reference earlier results with {$result:'step_id',path:['value','$ref']}. Stops at first error and reports completed steps; earlier mutations remain applied. This is not a rollback transaction.

Inputs: steps (required), background. Returns: object

solidworks_bodyA
Destructive

solidworks_body: dispatches on payload.operation to one of the capability-module handlers for [cavity, combine, delete, indent, list, move_copy, scale, split]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_camC
Destructive

solidworks_cam: dispatches on payload.operation to one of the capability-module handlers for [check_collisions, define_feature, define_stock, generate_operation_plan, generate_toolpaths, list_features, list_machines, list_operations, list_setups, post_process, recognize_features, save_cam_data, set_machine, set_operation_parameter, set_post, set_tool, setup_sheet, simulate, techdb_query]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_cam_connectA
Destructive

Attach to the installed SOLIDWORKS CAM add-in and GetCWApp API. Optional exact GUID/ProgID. Add-in presence is distinct from API/license availability; inspect returned status.

Inputs: identifier. Returns: object

solidworks_cam_statusA
Read-onlyIdempotent

Report observed CAM connection state; never treats an installed library as a license.

Inputs: no named parameters. Returns: object

solidworks_cam_workflowA
Destructive

Legacy low-level CAM action/args dispatcher retained for the small set of raw CAMService.workflow actions (active_document, machine, stock, set_machine, stock_box, recognize_features, operation_plan, toolpaths, postprocess, license) that back the typed solidworks_cam grouped tool's operations. Prefer solidworks_cam -- it exposes the full CAM operation surface (list_machines, define_stock, generate_operation_plan, set_tool, generate_toolpaths, post_process, ...) with proper per-operation schemas.

Inputs: action (required), args, background. Returns: object

solidworks_cancel_jobA
Destructive

Cancel a queued job only. A running native SOLIDWORKS call cannot be safely aborted.

Inputs: job_id (required). Returns: object

solidworks_configurationA
Destructive

solidworks_configuration: dispatches on payload.operation to one of the capability-module handlers for [activate, add, delete, delete_design_table, get_design_table, insert_design_table, list, set_config_dimension]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_connectA
Destructive

Attach to SOLIDWORKS 2025 (revision 33); launch=true may start it. Returns an app handle.

Inputs: launch, visible. Returns: object

solidworks_discoverA
Read-onlyIdempotent

Find installed SOLIDWORKS versions, CAM/add-in registrations and API libraries; no app launch.

Inputs: no named parameters. Returns: object

solidworks_drawingA
Destructive

solidworks_drawing: dispatches on payload.operation to one of the capability-module handlers for [add_annotation, detail_view, export, insert_bom, insert_dimensions, model_view, new_from_model, projected_view, section_view, set_sheet_format, standard_3view]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_exchangeC
Destructive

solidworks_exchange: dispatches on payload.operation to one of the capability-module handlers for [export, import]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_featureA
Destructive

solidworks_feature: dispatches on payload.operation to one of the capability-module handlers for [boundary, chamfer, delete, dome, draft, extrude, extrude_cut, fillet, hole_wizard, loft, loft_cut, mirror, modify, mounting_boss, revolve, revolve_cut, rib, shell, simple_hole, sweep, sweep_cut, thread, wrap]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_inspectB
Read-onlyIdempotent

Inspect bounded feature tree with feature types and error/warning codes.

Inputs: document, max_features. Returns: object

solidworks_jobA
Read-onlyIdempotent

Poll job state/result without entering the busy COM queue. Failed jobs may have partial effects.

Inputs: job_id (required). Returns: object

solidworks_mass_propertiesA
Read-onlyIdempotent

Compute model mass/volume/area and inertia using current material and configuration.

Inputs: document. Returns: object

solidworks_materialC
Destructive

solidworks_material: dispatches on payload.operation to one of the capability-module handlers for [apply, color, custom_density, get, get_density]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_modify_featureB
Destructive

Edit a feature's definition with AccessSelections/ModifyDefinition. Discover exact properties in its feature-data interface. Use generic API or scripts for indexed/method-based definitions.

Inputs: feature (required), properties (required), document, component. Returns: object

solidworks_new_documentA
Destructive

Create a part/assembly/drawing from an absolute existing template path; returns its handle.

Inputs: template (required). Returns: object

solidworks_open_documentB
Destructive

Open an absolute part(1), assembly(2), or drawing(3) path. Returns COM errors/warnings.

Inputs: path (required), document_type (required), read_only. Returns: object

solidworks_parametricB
Destructive

solidworks_parametric: dispatches on payload.operation to one of the capability-module handlers for [add_equation, add_global_variable, delete_equation, get_dimension, link_dimensions, list_equations, set_dimension]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_patternC
Destructive

solidworks_pattern: dispatches on payload.operation to one of the capability-module handlers for [circular, curve_driven, fill, linear, mirror, sketch_driven, table_driven]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_persistent_referenceA
Read-onlyIdempotent

Encode an entity's persistent reference for reacquiring it after edits or reopening its model.

Inputs: entity (required), document. Returns: object

solidworks_rebuildA
Destructive

Rebuild a model, reporting failure. Inspect features afterwards for individual error codes.

Inputs: force, document. Returns: object

solidworks_reference_geometryB
Destructive

solidworks_reference_geometry: dispatches on payload.operation to one of the capability-module handlers for [axis, coordinate_system, coordinate_system_numeric, plane, point]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_releaseA
Destructive

Release unneeded session handles on their COM apartment. Does not close documents.

Inputs: handles (required). Returns: object

solidworks_resolve_referenceB
Read-onlyIdempotent

Resolve a persistent reference in its original document; reports deleted/invalid entities.

Inputs: reference (required), document. Returns: object

solidworks_saveA
Destructive

Save/export by extension inside workspace (SLDPRT, SLDASM, STEP, STL, PDF, etc.). Format support depends on document type. For export options use API SaveAs with ExportData.

Inputs: path (required), document, overwrite. Returns: object

solidworks_scriptA
Destructive

Execute trusted Python on the COM apartment (--allow-scripts required). Globals: sw, cad, cam, gateway, call(obj,member,*args), workspace, parameters. Assign result. Supports loops, equations, advanced features, assemblies and arbitrary add-ins. Full local code execution, not a sandbox. Prints are captured. Background jobs allow lengthy CAD/CAM computation.

Inputs: source (required), background, parameters. Returns: object

solidworks_sketchC
Destructive

solidworks_sketch: dispatches on payload.operation to one of the capability-module handlers for [add_dimension, add_entities, add_relation, begin, chamfer, convert_entities, exit, fillet, mirror, offset]. Each operation has its own typed field set (see the tool's input schema); unspecified fields fall back to the module function's own default. Lengths/angles follow each field's documented unit convention (SI unless the function accepts a unit field).

Inputs: payload (required), document. Returns: object

solidworks_sketch_beginA
Destructive

Legacy convenience: create/select a 2D sketch on a plane and add a batch of simple entities in one call (line/circle/rectangle). For the full entity/relation/dimension set, use solidworks_sketch's operation dispatch (begin/add_entities/fillet/chamfer/... /exit).

Inputs: entities (required), plane_name (required), document. Returns: object

solidworks_templatesA
Read-onlyIdempotent

Read configured default part, assembly and drawing template paths.

Inputs: no named parameters. Returns: object

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 40 tools

    Disambiguation4/5

    Most tools are clearly distinct by domain (sketch, feature, pattern, assembly, etc.), and the dispatcher design groups related operations under a single tool. However, generic tools like solidworks_api and solidworks_script overlap with all other tools, and legacy tools (solidworks_sketch_begin, solidworks_cam_workflow) partially duplicate functionality, creating minor selection ambiguity.

    Naming Consistency4/5

    All tools share the 'solidworks_' prefix and use snake_case, with names clearly indicating their purpose. The pattern is consistent, though there is a mix of verb-led (connect, open, save) and noun-led (active_document, assembly_tree) names, and legacy tools like sketch_begin vs sketch and cam_workflow vs cam introduce slight inconsistency.

    Tool Count3/5

    With 40 tools, the count is above the typical 3–15 range and exceeds the 25+ heavy threshold. However, the domain (full CAD/CAM automation) is extensive, and many tools are dispatchers covering multiple operations, so the number is justifiable, though it feels heavy for an agent to navigate.

    Completeness5/5

    The tool set covers document lifecycle, sketching, features, patterns, assemblies, parametric equations, materials, configurations, analysis, drawings, CAM, and persistent references. The inclusion of generic API and script tools ensures no capability gap, making the surface effectively complete for the stated SOLIDWORKS automation purpose.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP bridge server for SolidWorks that enables AI assistants to control SolidWorks programmatically via COM automation.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI (e.g., Claude) to control SolidWorks via natural language, automating part creation, sketching, and feature operations through the Model Context Protocol.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      MCP server for controlling a live SOLIDWORKS session through the Windows COM API, enabling native CAD operations like sketches, features, bodies, views, and exports, plus transactional plans and vectorization.
      11
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables Claude or any MCP client to drive a live SOLIDWORKS session through its COM API, modeling parts, building assemblies with mates, checking interferences and machining feasibility, and exporting STEP or DXF files. It also exposes a local semantic index of the SOLIDWORKS API so the model can look up signatures, enums, and official examples before running arbitrary Python against the session.
      22
      2
      MIT