SolidWorks MCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
SolidWorks MCP
English | 简体中文
Engineering-hardened fork. This repository is a fork of
hjbaard/SolidWorks-MCP, focused on modular architecture, reproducible development and CI. The modelling engine and tool surface come from upstream; method bodies are unchanged. The default modelling and drawing standard is GB (Chinese national standards), with ISO as an explicit fallback. SeeDocs/MODELING-STANDARDS.md,Docs/ENGINEERING.md,Docs/ARCHITECTURE.mdandUPSTREAM.md.
Let an AI agent (Claude, or any other MCP client) model real parametric parts and assemblies in your own SolidWorks — and check its own work. Every modelling call returns the measured volume, mass and bounding box, so the agent can compare the result with the spec and correct itself instead of guessing that it "looks about right".
Why this server
It verifies, not just generates. Features report measured geometry; dimensions and mates are measured back after the rebuild.
Fully defined sketches. Every sketch is constrained the way a designer would: dimensions from the origin, relations only where the geometry is exactly horizontal, vertical or on the origin. Tools return their dimensions by role (
width@Sketch1), so the part stays editable, in SolidWorks or through the agent.Real CAD, not just primitives. Extrude, revolve, sweep, loft and splines; holes, counterbores, slots and pockets on any face; rounded polygon corners; GB-standard holes from the Hole Wizard (ISO fallback); real GB/T 196/197 metric threads; fillets, chamfers, shells, patterns, mirrors, ribs, equations and materials. Assemblies with mates and interference checks. STEP/STL/3MF export and screenshots. Engraved and embossed text. Work on existing parts: list, delete, suppress and reorder features; read, extrude and cut a person's sketches; import STEP. Colours per part or component. Joints with concentric and angle mates, checked over their range. Printability checks and dimensioned drawings. Planes at any offset or angle. Several bodies per part, combined and split. Variable fillets and full rounds. Free sketches with tangent arcs and splines. 88 tools in total.
It fails loud. A call that cannot do what was asked returns
{ok: false, error}with the cause, never silently wrong geometry.A fixed, typed tool surface. There is no "run arbitrary code" tool; the agent can only do what the tools allow.
Tested against real SolidWorks. Upstream reported 754 tests; this fork adds CI, modularity guards and 401 unit tests, with 360 SolidWorks integration tests for feature geometry and hand calculations.
Local. It talks to your running SolidWorks over COM; the server itself makes no network calls.
Related MCP server: SolidWorks-MCP
Quickstart
Install uv.
Start SolidWorks and leave it open (the server attaches to the running instance — it does not launch one).
Clone this fork and create the environment:
git clone https://github.com/zmf678/solidworks-mcp-pro.git cd solidworks-mcp-pro uv syncRegister the server with your MCP client.
Claude Code:
claude mcp add solidworks -- C:\path\to\solidworks-mcp-pro\.venv\Scripts\python.exe -m solidworks_mcp.serverClaude Desktop (
claude_desktop_config.json) or any other client:{ "mcpServers": { "solidworks": { "command": "C:\\path\\to\\solidworks-mcp-pro\\.venv\\Scripts\\python.exe", "args": ["-m", "solidworks_mcp.server"] } } }This fork is not published to PyPI or the public MCP Registry.
uvx solidworks-mcpinstalls the upstream project, not this fork.Ask for a part, for example:
Design a 100 × 80 × 8 mm mounting plate with a Ø16 mm centre bore, four counterbored M5 holes 12 mm from the corners and R5 corners. Check the volume against your own calculation, then export a fine STL.
Guidelines for agents
The server hands every MCP client short modelling guidelines when it connects
(conventions, verify each step, known pitfalls). The full guide is the resource
solidworks://guide: recipes for holes, ribs, threads and assemblies, 3D-print
advice, and how to reverse-engineer a part from a mesh (STL/3MF). The same text
is in src/solidworks_mcp/guide.md.
The Chinese guide is the solidworks://guide-zh resource
(src/solidworks_mcp/guide.zh-CN.md).
Requirements and compatibility
Windows, with SolidWorks installed, licensed and running.
Python 3.11+ (uv fetches one if needed).
A Y-up part template, SolidWorks' standard. Since SOLIDWORKS 2025 new parts can also be Z-up; the tools build in the Y-up frame and refuse a Z-up part with a message that says so. Choosing Y-up in the New Document dialog is not used for parts made through the API: make a Y-up part, save it as a
.prtdot, and set that file as the part template under Tools > Options > System Options > Default Templates.Tested on SOLIDWORKS 2026 (3DEXPERIENCE R2026x). The API calls it uses exist since SOLIDWORKS 2020 SP2, so 2020–2025 should work, but that is untested. To check your installation, run this with SolidWorks open:
uv run solidworks-mcp --selftestIt builds a few small parts, compares each with a hand calculation and closes them unsaved. Please paste its output in a compatibility report, whether it worked or not.
Status: early (0.x). It works end-to-end, but tool names and conventions may still change. See CHANGELOG.md.
Troubleshooting
Start with the selftest:
uv run solidworks-mcp --selftestshows your SolidWorks release, language and templates, and which tool areas work. Add its output to a bug report."No running SolidWorks found" / connection fails — SolidWorks must be running before you start the server or run a script; it attaches to the active instance via
GetActiveObjectand does not launch one.First call is slow or
EnsureModuleerrors — the first COM call generates the makepy typelib wrappers under your tempgen_pyfolder. Let it finish; if it gets into a bad state, delete thegen_pycache and retry. Early binding is mandatory on this build (see Architecture).A feature returns
{ok: false, error: ...}— that is by design: every tool fails loud with a readable message rather than silently producing wrong geometry. Read the message; it names the likely cause.Only tested against SOLIDWORKS 2026 (3DEXPERIENCE R2026x). On other builds the verified enum values or method signatures may differ — re-run
scripts/introspect_api.pyto inspect your installed typelib.
Documentation
Document | Audience | What it covers |
中文读者 | 中文项目说明、快速开始、GB 标准 | |
中文读者 | 中文文档索引 | |
everyone | Documentation index | |
contributors | Standards, definition of done, module boundaries | |
everyone | GB modelling/drawing standard, mapping, non-claims | |
contributors | Request flow, layers, mixin composition, adding a tool | |
contributors | Test layers, commands, coverage, CI matrix | |
maintainers | Versioning, changelog, release and hotfix process | |
users | Supported versions, selftest, compatibility reports | |
maintainers | Upstream sync, dependencies, security, module ownership | |
contributors | Development setup, checks, PR rules | |
everyone | Private vulnerability reporting and scope | |
maintainers | Fork relationship and upstream sync procedure |
Development
Clone the repository, then create the pinned environment:
uv sync --extra devTo run the MCP server from this checkout instead of the console script, point your client at the venv's Python:
{
"mcpServers": {
"solidworks": {
"command": "C:\\path\\to\\solidworks-mcp-pro\\.venv\\Scripts\\python.exe",
"args": ["-m", "solidworks_mcp.server"]
}
}
}Run the verification scripts
With SolidWorks open:
uv run python scripts\probe_connection.py # M0
uv run python scripts\m1_block.py # M1
uv run python scripts\m2_parametric.py # M2
uv run python scripts\test_mcp_server.py # M3 (full MCP loop over stdio)
uv run python scripts\m5_demo_bracket.py # M5 (3D-print bracket, every step verified)scripts/introspect_api.py regenerates/inspects the installed typelib and prints
verified enum values — run it if SolidWorks is upgraded and signatures change.
Tests and checks
uv run pytest -m "not solidworks" # fast unit layer, no SolidWorks
uv run pytest # all tests, needs a running SolidWorks
uv run pytest -m solidworks # integration layer only
uv run ruff check src tests # lint
uv run ruff format --check src tests # formatting
uv run mypy # core-module type checkTwo layers: pure unit tests (units, selector/direction parsing, polygon
cleaning, the component-placement maths, and that every MCP tool forwards its
arguments to the right session method) run anywhere; integration tests
(solidworks marker) drive a running SolidWorks and verify each feature's
volume — or each component's placement — against a hand calc. They auto-skip if
SolidWorks isn't reachable.
The engineering rules, definition of done and module boundaries are in
Docs/ENGINEERING.md. The request flow and mixin map are
in Docs/ARCHITECTURE.md.
Tools
The server speaks MCP over stdio.
Part tools
Tool | Purpose |
| Is SolidWorks reachable? revision, server version, active/current part |
| Create a new empty part (becomes current) |
| Sketch rectangle + extrude; returns mass properties |
| Cylinder by revolving a profile 360° about an axis (Y axis) |
| Disc/puck/flange: circle extruded along +Z, centred at (x, y) (holes/patterns compose) |
| Cone/frustum by revolve (top Ø = 0 → full cone) |
| Revolve any closed |
| Sweep a round profile along a 2D path with rounded bends (pipes, tubes, rods), or along a spline through the points with |
| Sweep any closed cross-section along a 2D path (rails, gaskets, trim, channels); |
| Loft/blend 2+ polygon or round profiles on stacked parallel planes (transitions, adapters, a leg thick at the knee) |
| Loft through 2+ closed sketches on any planes, in order, so a loft runs in any direction |
| Straight rib / gusset in a plane parallel to Front at |
| Extrude any closed polygon |
| A reference plane offset from a plane, or turned about a model axis; its offset or angle a dimension; gives its origin and axes |
| Extrude a polygon drawn on any plane (3D points on it), merged with the part |
| The part's solid bodies: name, volume, bounding box |
| Add, subtract or intersect bodies of the part ( |
| Split the part into two bodies along a plane |
| Extrude a smooth closed spline through points (free-form/organic outlines) |
| Cut a circular through-hole at (x, y) through the depth axis |
| Counterbored screw hole (flush cap-head / heat-set insert) on +Z |
| Real, printable GB/T 196/197 metric thread (e.g. |
| Round hole on ANY planar face at a 3D point, through or blind (side holes, heat-set insert holes); the face through the point is used |
| GB (default) or ISO hole from SolidWorks' Hole Wizard tables: clearance (GB/T 5277, ISO 273 fallback), counterbore (GB/T 70.1), countersink (GB/T 70.3) or tapped; |
| Round boss (standoff, peg) grown out of ANY planar face |
| Polygon pad/ledge grown out of ANY planar face (3D points on the face) |
| Engrave text into ANY planar face, or emboss it: labels, version numbers; the position is two dimensions |
| Cut a polygon pocket/slot from the +Z face (blind or through), optionally turned about a pivot |
| Cut a polygon pocket on ANY face (3D points on the face) |
| Cut a polygon drawn on the Front/Top/Right plane or a plane by name, through all both ways or |
| Pocket a face leaving a rim along its outline (I-beam web, tray, frame); rim and depth are dimensions |
| Cut a straight slotted hole (obround) on the +Z face at any angle |
| Extrude a stadium (rounded tab, lug, link) between two points, the round ends centred on them |
| Round edges ( |
| Round a rib's top off completely between its two closest opposite sides |
| Chamfer edges at 45° ( |
| Hollow to a wall thickness; open a face ( |
| Repeat a feature N times along |
| Repeat a feature N times around an axis (bolt circle) |
| Mirror features (copies follow their seeds) or the whole body about the Front/Top/Right plane, or a plane by name, moved |
| Change a named driving dim (e.g. |
| Add a global equation or variable linking dims (e.g. |
| Add or replace a list of equations with one rebuild |
| List the equations (value, global, broken) / delete one by name or index |
| Cross-sections of an STL/3MF mesh as polygon loops, ready to use as profiles; needs no SolidWorks |
| Compare the part's cross-sections with a reference mesh (area and extent differences) |
| A sketch read back in model coordinates: lines, arcs, circles, splines, its dimensions, fully defined or not |
| Sketch an outline of lines, arcs and splines on any plane, fully defined: tangent where it flows, dimensioned from the origin |
| Build on an existing sketch by name (one a person drew): extrude it blind or up to the next face, or cut it blind or through all |
| Every dimension in the part, or those whose name or feature holds |
| The part's history in tree order (name, type, suppressed); flags features that fail to rebuild and sketches that are not fully defined |
| Undo a step: delete a feature with its sketch; refuses (and names them) while other features depend on it, unless |
| Take a feature out but keep it and its dimensions (try a variant); |
| Assign a material (e.g. |
| Force rebuild, report errors |
| Volume, mass, density, surface area, centre of mass, bounding box |
| Tight part bounding box (min/max/size, mm) |
| Inspect faces (normal/area/centre; a cylinder's axis, radius and centre, also of a component in an assembly) and edges (type/length/ends/axis) by index, narrowed to a face, a feature, a box or a length |
| For a print direction: overhanging faces (area, worst lean, centre), islands and edge stretches that start in the air, bed contact, height; with |
| STEP/STL/IGES/Parasolid/3MF (silent; verifies file). STL/3MF tessellation: |
| PNG/JPG/TIF from a standard view ( |
| 2D drawing as PDF or editable |
| Save to / open a native |
| Close the current part or assembly; without one, SolidWorks' active document if it is saved |
| The open documents (path, type, unsaved changes) / make one current again, also one never saved |
Assembly tools
Tool | Purpose |
| Create a new empty assembly (becomes the current document) |
| Open / save a native |
| Insert a part, or a |
| Name, path, fixed, position, rotation and bounding box of every component (its own extent, also when turned), and the mates with their dimensions and errors |
| Remove a component from the assembly, with its mates |
| Put another file in a component's place, keeping its position and, where they find their faces, its mates |
| Move/rotate a component; the transform is read back and verified |
| Mate two faces (by direction, or |
| Step a joint through its range: overlapping pairs and chosen distances per step, the smallest distance and where it occurs, the components that moved |
| What a component covers in a plane over a joint's range: its outline, with a margin, in the coordinates of the part to cut from |
| Delete a mate, or suppress it (and bring it back) |
| Component pairs whose solids overlap, with the volume in mm³ (touching faces don't count) |
| Smallest distance between two components, to a point (with the nearest point, and whether the point is in the material), or to an axis |
| Tight bounding box of the whole assembly (min/max/size, mm) |
export and screenshot work on assemblies too.
Faces are selected by direction in the component's own frame (+x, -z, …),
so a selector keeps meaning the same face however the component is turned. Add
:inner (e.g. +y:inner) for the cavity side of a hollow part — the inside of a
room wall instead of its outer skin.
All linear dimensions are millimetres; the server converts to/from the SolidWorks-internal metre/radian units at the boundary.
Architecture
src/solidworks_mcp/
server.py CLI entry point and public re-exports
app.py FastMCP instance, connect-time instructions, guide, dispatch
tools/ MCP tool declarations by domain (88 tools)
core.py lifecycle and connection
solids.py extrusion, revolve, sweep, loft, planes, ribs
features.py holes, threads, face features, cuts, fillets, patterns, shells
sketch.py sketch reading and person-authored sketches
inspection.py dimensions, equations, history, materials, bodies, printability
io.py documents, export, screenshots, drawings
assembly.py assemblies, components, mates, interference, motion
com_worker.py one dedicated STA thread; all COM calls serialised through it
binding.py early-binding plumbing (wrap raw dispatches in generated classes)
constants.py enum values read from the installed typelib (verified)
units.py mm<->m, deg<->rad
errors.py SolidWorksError -> agent-facing {ok:false,error}
mesh_tools.py pure STL/3MF sectioning helpers
region_tools.py pure swept-region helpers
sketch_constraints.py pure sketch DoF planner
session/
__init__.py composes SolidWorksSession from the domain mixins
core.py connection, documents, guarded calls, COM-thread helpers
geometry.py default planes, face/edge selection, extrude helper
sketching.py sketch drawing and polygon/constraint helpers
solids.py box, profile, spline, disc, cylinder, cone, revolve
sweeps.py sweeps, lofts and ribs
holes.py holes, counterbores, threads, Hole Wizard
face_features.py features on planar faces (holes, bosses, pads, text)
cuts.py profile cuts, pockets, slots
fillets.py fillets, variable fillets, full rounds
chamfers_shells.py chamfers and shells
mirrors.py body and feature mirrors
patterns_planes.py linear/circular patterns and reference planes
parameters.py dimensions, equations and dimension listings
feature_history.py feature tree, suppression, reordering
person_sketch.py reading and building on person-authored sketches
materials.py appearance and material assignment
inspection.py mass properties, faces, edges, bodies
printability.py overhang, island and thin-wall analysis
mesh_io.py mesh sectioning/comparison
export_io.py export, screenshots, drawings
assembly_core.py assembly documents, components, transforms
assembly_mates.py mates and mate measurement
assembly_analysis.py interference, distance, motion, swept regionsThe 6,646-line upstream session.py was split into 23 domain mixins; the public
SolidWorksSession class and all 88 tool names are unchanged. The flat
server.py tool list was split into seven domain modules under tools/. See
Docs/ARCHITECTURE.md for the request flow and the
extension guide.
Two non-obvious design decisions, both load-bearing:
Early binding is mandatory. On this build
GetActiveObjectreturns a dispatch whoseGetTypeInfo()fails, soEnsureDispatch/CastTocannot infer types and pure late binding breaks (IModelDoc2.FirstFeature→DISP_E_MEMBERNOTFOUND). We generate makepy wrappers from the installed typelib and wrap each raw dispatch in the right interface class; calls then go by dispid viaInvokeTypes, bypassing name resolution. Seebinding.py.A dedicated COM thread. COM is STA and thread-affine. The MCP server runs on asyncio, so all COM work is pinned to one worker thread (
com_worker.py) that handlers post to and await — actively enforcing the "one COM session, single-threaded" rule that does not hold automatically in an async server.
Status and roadmap
Proven end-to-end against SOLIDWORKS 2026 (3DEXPERIENCE R2026x):
Milestone | What it proves | State |
M0 | COM connection to a running SolidWorks | ✅ |
M1 | new part → sketch rectangle → extrude → mass properties (volume matches hand calc) | ✅ |
M2 | change a named dimension → rebuild → volume changes predictably | ✅ |
M3 | full agent loop via the MCP server: build → measure → correct → export STEP/STL + screenshot | ✅ |
M4 | revolve, sweep, loft, profiles, holes/pockets/counterbores, slots, fillet/chamfer, shell, patterns, equations, materials, save/open | 🚧 ongoing |
M5 | end-to-end 3D-print part: build a functional mounting bracket through the full loop → verify every dimension → export a fine STL (scripts/m5_demo_bracket.py) | ✅ |
M6 | assemblies: insert and position components, mate them, check interference — every placement and mate measured back (tests/test_assembly.py) | ✅ |
See Docs/PROGRESS.md for the detailed log and roadmap.
Feedback and contributions are welcome. Read
CONTRIBUTING.md, then open an issue or a pull request. For
security problems use the private reporting route in SECURITY.md.
Known limitations
Geometry so far: boxes, cylinders/cones (revolve), arbitrary extruded profiles, holes, polygon pockets/slots (
cut_profile), fillets, chamfers, shells, linear + circular patterns (bolt circles); plus equations, materials, geometry inspection, and save/open of.sldprt, holes + pockets on any planar face (model→sketch transform), round flanges (disc + bore + bolt circle), and slotted holes (cut_slot, obround at any angle — the first arc-based sketch), general revolves (add_revolved_profile: any(r,z)profile → shafts, vases, rings), swept pipes/tubes (add_swept_pipe: a round profile along a rounded 2D path), and lofts (add_lofted_solid: blend stacked polygon profiles → transitions/adapters), free-form extrusions (add_extruded_spline: a smooth closed spline → organic/aesthetic outlines), and non-circular sweeps (add_swept_profile: any cross-section along a path → rails, gaskets, trim), and mirrors (add_mirror: features or the whole body about a plane through the part).Selection: plane walk, face-by-normal/direction (
_planar_face_by_normal,+z/…, with:innerfor the cavity side of a hollow part), and edge selection by axis or explicit index (_select_edges).list_faces/list_edgeslet an agent inspect geometry before selecting.Assemblies (M6): components, transforms, mates and interference detection. Component patterns, in-context features, configurations, drawings and Simulation (FEA) are out of scope.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Parametric 3D CAD for AI agents: build print-ready parts, check them, export STL, 3MF or STEP.
CAD in ChatGPT and Claude: editable parts, STEP/STL/drawings, in-chat 3D, automatic checks.
Text-to-CAD: build exact STEP or 3MF/STL on the server, each stated requirement measured.
A browser 3D CAD for your AI: it scripts real-size models, uCAD builds them and returns pictures.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to build, measure, verify, and correct parametric SolidWorks parts and assemblies locally via the COM API, supporting operations like sketching, extruding, modeling, dimensioning, material assignment, export, and assembly mating.MIT
- AlicenseAqualityAmaintenanceLet AI agents build, measure and verify parametric parts and assemblies in your own running SolidWorks (Windows, COM). 46 tools, every step measured.88862 PyPI35MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents such as Claude to drive SolidWorks through its COM API using natural language, creating parts and assemblies, sketching geometry, and adding features without clicking menus. Also supports running arbitrary API scripts and verifying results through model reports, rendered views, interference checks, and exports.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents on Windows to build parts from JSON recipes, create and verify whole assemblies in a single call, check mass, center of mass, mates and interference, produce drawings with BOM, balloons and sections, work with sheet metal, and import/export STEP, IGES, PDF and DXF files. All edits run with automatic backups and verified rollback so user files are never left broken.2MIT