Why Would You Do This?
Imagine telling an AI βput a 10mm countersunk hole in the top faceβ and watching it happen in SolidWorks β no menu diving, no macro hacking, no YouTube tutorial rabbit holes at 1 AM. Thatβs what a SolidWorks MCP server gives you.
MCP (Model Context Protocol) is an open standard that lets AI tools like Claude Code talk to external software. A SolidWorks MCP server translates natural-language intent into real CAD operations on a running SolidWorks session.
Hereβs the catch: SolidWorks only runs on Windows, but if youβre like most developers, youβre doing your real work in WSL Ubuntu. Claude Code lives in your terminal, your terminal lives in WSL, and SolidWorks lives on the Windows host. This guide is about connecting those two worlds.
The Architecture
Understanding the split is key to not losing your mind during setup:
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Windows Host β
β β
β SolidWorks β COM API β MCP Server β HTTP :8765β
β β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β network (via WSL gateway)
ββββββββββββββββββββββββ΄βββββββββββββββββββββββββββ
β WSL Ubuntu β
β β
β Claude Code β connects to http://<host>:8765 β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
The MCP server must run on Windows because it talks to SolidWorks through the COM API β a Windows-only technology. Claude Code runs in WSL Ubuntu and connects to that server over HTTP across the WSL network boundary. Two operating systems, one pipeline.
What You Need
On the Windows side:
- Windows 10/11 with WSL 2 and Ubuntu installed
- SolidWorks 2024+ installed, licensed, and launchable
- Python 3.10+ for Windows (from python.org or the Microsoft Store β not your WSL Python)
- Git for Windows (or use
gitfrom within WSL to clone, then access via/mnt/c/)
On the WSL Ubuntu side:
- Claude Code installed (
npm install -g @anthropic-ai/claude-code) - curl for testing the connection (already installed on most Ubuntu setups)
Important: You need Python installed on both sides. The Windows Python runs the MCP server (COM needs native Windows). The WSL Python is irrelevant for SolidWorks β donβt try to run the MCP server from inside WSL. It will not find SolidWorks.
Step 1: Pick Your MCP Server
Several open-source SolidWorks MCP servers exist. Here are the main ones:
| Server | Language | Approach |
|---|---|---|
| SolidPilot (eyfel/mcp-server-solidworks) | Python + C# | Feature-level IR, compiles intent down to SolidWorks ops. Supports 2D drawing β 3D reconstruction. |
| Solidworks-MCP (alisamsam) | Python | Direct natural-language to SolidWorks control via COM. |
| SW_MCP (tylerstoltz) | C# (.NET) | Native C# SDK, targets SolidWorks 2020+. |
| SolidworksMCP-python (andrewbartels1) | Python | Python-based automation with COM bridge. |
This guide uses the Python-based approach. The concepts apply to all of them β only the install commands and entry point change.
Step 2: Clone and Install the Server (on the Windows Side)
Open PowerShell or Windows Terminal (not your WSL terminal):
# Clone the server
git clone https://github.com/alisamsam/Solidworks-MCP.git
cd Solidworks-MCP
# Create a virtual environment using Windows Python
python -m venv .venv
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
Most SolidWorks MCP servers depend on pywin32 to talk to the COM API. If the install fails:
pip install pywin32
python Scripts\pywin32_postinstall.py -install
WSL users β donβt clone here from inside WSL. You can access Windows files from WSL via
/mnt/c/, but running the MCP server through that path adds filesystem overhead and often breaks COM. Clone natively on Windows.
Step 3: Expose the MCP Server Over HTTP
This is the step that makes the WSL bridge work. By default, most MCP servers use stdio (stdin/stdout) transport β great when the client and server are on the same OS, useless when theyβre split across WSL and Windows.
You need to wrap the server with an HTTP transport so Claude Code in WSL can reach it over the network.
On Windows (PowerShell):
# Install the MCP proxy
pip install mcp-proxy
# Launch SolidWorks first, then start the server on port 8765
# Bind to 0.0.0.0 so WSL can reach it
mcp-proxy --host 0.0.0.0 --port 8765 -- python server.py
You should see output confirming the server is listening. Leave this terminal open β it needs to stay running.
Quick sanity check from WSL:
# Find your Windows host IP from inside WSL
WIN_HOST=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
echo "Windows host IP: $WIN_HOST"
# Test that the port is reachable
curl -s -o /dev/null -w "%{http_code}" http://$WIN_HOST:8765/mcp
If you get a response (even a 4xx β thatβs fine, it means the port is open), the bridge is working. If you get connection refused, check:
- Windows Firewall β you may need to allow inbound connections on port 8765. Open Windows Defender Firewall β Advanced Settings β Inbound Rules β New Rule β Port β TCP 8765 β Allow.
- Is the MCP server still running in that PowerShell window?
- Is SolidWorks open? The COM connection fails if SolidWorks isnβt running.
Step 4: Configure Claude Code in WSL
Now switch to your WSL Ubuntu terminal. First, grab the Windows host IP:
WIN_HOST=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
Then register the MCP server with Claude Code:
claude mcp add --transport http solidworks http://$WIN_HOST:8765/mcp
This writes the server config into Claude Codeβs settings. You can also add it manually by editing ~/.claude.json or your projectβs .mcp.json:
{
"mcpServers": {
"solidworks": {
"type": "http",
"url": "http://172.x.x.1:8765/mcp"
}
}
}
Replace 172.x.x.1 with your actual Windows host IP.
Heads up: The WSL gateway IP can change between reboots. If your connection suddenly stops working after a restart, re-check the IP with
cat /etc/resolv.conf. For a stable setup, consider setting a static IP for your WSL adapter or using the Windows hostname (e.g.,http://$(hostname).local:8765/mcpβ though mDNS in WSL can be flaky).
Step 5: Verify the Connection
In your WSL terminal:
claude mcp list
You should see:
solidworks: β Connected (http)
Tools: create_sketch, extrude_boss, create_hole, save_part, ...
If it shows β:
| Symptom | Fix |
|---|---|
| Connection refused | Check firewall, verify MCP server is running on Windows |
| Timeout | Wrong IP β re-check cat /etc/resolv.conf |
| COM error in PowerShell | SolidWorks isnβt running, or 32/64-bit Python mismatch |
url but no type error | Add "type": "http" to your .mcp.json entry |
Step 6: Start Designing with Natural Language
Open Claude Code in WSL and go:
> Create a new SolidWorks part with a 50mm Γ 30mm Γ 10mm rectangular block,
then add a 5mm through-hole centered on the top face.
Claude will use the MCP tools to create the sketch, extrude the block, add the hole, and cut through β all on the SolidWorks instance running on your Windows desktop. Youβll see it happen in real time on the Windows side.
Step 7: Add a SolidWorks Skill (You Really Should)
The MCP server gives Claude the tools β create a sketch, extrude, cut, fillet. But tools alone donβt make Claude good at CAD. SolidWorks has decades of conventions, constraints, and gotchas that a language model doesnβt inherently know. Thatβs where a skill comes in.
A skill is a markdown file (typically SKILL.md or a file under .claude/skills/) that gives Claude persistent, domain-specific instructions. Think of it as a cheat sheet thatβs always loaded into context. Without one, Claude will make rookie SolidWorks mistakes: using the wrong units (the COM API works in meters, not millimeters), guessing parameter counts on 15-parameter API calls, extruding before constraining a sketch, or building features in an order that breaks the parametric tree.
The good news: you donβt have to write one from scratch. The community has already published skills specifically for SolidWorks.
Option A: Install a Community SolidWorks Skill
Several purpose-built SolidWorks skills exist on GitHub. Here are the ones worth knowing about:
solidworks-api-skill β A Claude Code skill focused on writing correct SolidWorks API automation code. It encodes the parameter signatures, COM gotchas, and constant enums (swConst) that Claude would otherwise guess wrong. Covers sketches, extrusions, revolves, cuts, patterns, mates, materials, and STEP export. Built from a real shield-machine cutterhead modeling project, so the pain points are battle-tested.
Key things this skill teaches Claude:
- SolidWorks API uses meters internally, not millimeters (
1 mm = 0.001) - Methods like
FeatureExtrusion2take 10β15 parameters with mixed types β the skill provides the exact signatures - Late-binding COM calls fail with >12 parameters β the skill documents workarounds
swConstenums likeswDocPART,swEndCondBlind,swPlaneTopinstead of magic numbers
Install it in your WSL terminal:
# Clone and copy the skill file
git clone https://github.com/guoleizhen717/solidworks-api-skill.git /tmp/sw-skill
mkdir -p ~/.claude/skills/solidworks-api
cp /tmp/sw-skill/SKILL.md ~/.claude/skills/solidworks-api/SKILL.md
text-to-cad β A broader library of CAD/CAM agent skills. While not SolidWorks-specific (it uses CadQuery/OpenCascade under the hood), it includes skills for STL export, DXF generation, DfAM (Design for Additive Manufacturing) printability checks, and even Bambu Labs printer integration. Useful as a complement to a SolidWorks-specific skill if your workflow goes all the way to the printer.
Install via the skills CLI:
npx skills add earthtojake/text-to-cad
Or for Claude Code specifically:
claude plugin marketplace add earthtojake/text-to-cad
claude plugin install cad@text-to-cad
cad-skill (flowful-ai) β A Claude Code skill for parametric 3D-printable model generation. Focuses on a describe β model β export STL β preview β iterate loop. It uses CadQuery rather than SolidWorks directly, but the design patterns (fully constrain before extruding, build large-to-small, validate before export) overlap heavily.
Install it:
git clone https://github.com/flowful-ai/cad-skill ~/.claude/skills/parametric-3d-printing
Option B: Write Your Own Custom Skill
Community skills cover API patterns and general CAD discipline, but they donβt know your workflow β your templates, naming conventions, default units, or print settings. A custom skill fills that gap.
Create .claude/skills/solidworks-custom.md in your project directory (inside WSL):
mkdir -p .claude/skills
Then write the rules that match how you work:
# SolidWorks β Project-Specific Rules
## Units and Templates
- Default to MMGS (millimeters, grams, seconds) for all new parts.
- Use the company part template at
C:\ProgramData\SolidWorks\templates\custom-part.prtdot
- Save after every major feature, not just at the end.
## Sketch Discipline
- Every sketch must be fully constrained (black lines, not blue)
before extruding or cutting.
- Use construction geometry (centerlines) for symmetry instead of
manually mirroring dimensions.
- Place sketches on standard planes (Front, Top, Right) or existing
flat faces.
## Feature Tree
- Build large to small: base extrude β cuts β fillets β chamfers.
- Name features descriptively ("Base Plate", "Mounting Hole Left"),
never leave default names.
## File Paths and Naming
- Always use Windows paths for saves:
C:\Users\me\Documents\SolidWorks\project\PROJ-001-part-v1.SLDPRT
- Never use WSL paths β SolidWorks can't access /home/.
- Convention: PROJ-XXX-description-vN.SLDPRT
## 3D Print Export
- STL tolerance: 0.02mm deviation, 5Β° angle.
- Minimum wall: 1.2mm (3 perimeters at 0.4mm nozzle).
- Minimum hole diameter: 2mm for clean FDM prints.
- Orient largest flat face on build plate.
## Error Handling
- On COM drops, tell the user to restart SolidWorks and the MCP
server. Don't silently retry.
- On sketch over-constraint (red lines), remove the most recently
added constraint.
Combining Skills: The Recommended Stack
The best setup layers multiple skills:
-
Community API skill (solidworks-api-skill) β teaches Claude the correct API signatures, parameter types, unit conversions, and COM workarounds. This prevents the low-level βwrong number of argumentsβ crashes.
-
Your custom skill β teaches Claude your project conventions, templates, naming, and print-specific rules. This prevents the βtechnically correct but useless for my workflowβ problem.
-
(Optional) CAD/printing skill (text-to-cad or cad-skill) β adds printability checks, STL validation, and slicer-aware design rules. Useful if your output goes directly to a printer.
Claude loads all skills in its context, and they stack β the API skill tells it how to call FeatureExtrusion2, your custom skill tells it when and why, and the print skill tells it what to check before exporting.
How Skills and MCP Servers Actually Work Together
This is the part that confuses people: you donβt need to configure anything to make a skill βtalk toβ an MCP server. Theyβre two separate inputs to Claude that combine automatically at runtime.
Hereβs what happens when you type βcreate a 50mm mounting bracketβ in Claude Code:
1. Claude reads your prompt
β
2. Claude's context already includes:
βββ Skill: "SolidWorks API uses meters. 50mm = 0.05.
β Fully constrain sketches. Build large β small."
βββ MCP tools: create_sketch(), extrude_boss(), create_hole(), save_part()
β
3. Claude plans the approach (informed by the skill):
"Set units β sketch on Top plane β constrain β extrude 0.05m β save"
β
4. Claude calls MCP tools in sequence:
create_sketch(plane="Top") β add_rectangle(50mm) β
add_constraints() β extrude_boss(depth=0.05) β save_part()
β
5. Each tool call goes over HTTP to the Windows MCP server
β
6. The MCP server executes the COM call in SolidWorks
The skill shapes how Claude thinks about the task. The MCP server gives Claude the hands to do it. They donβt communicate with each other β they both communicate with Claude.
To set this up, you just need two things in place:
1. The MCP server registered (from Step 4):
// .mcp.json
{
"mcpServers": {
"solidworks": {
"type": "http",
"url": "http://172.x.x.1:8765/mcp"
}
}
}
2. The skill file installed (from earlier in this step):
# Community skill
~/.claude/skills/solidworks-api/SKILL.md
# Your custom skill (optional, in project dir)
.claude/skills/solidworks-custom.md
Thatβs it. No linking, no glue code, no config that says βuse this skill with that server.β Claude sees both and uses them together. The skill prevents Claude from making dumb calls; the MCP server executes the smart ones.
Why This Matters
Without any skill, hereβs what happens when you ask Claude to βcreate a 50mm bracket with two M4 mounting holesβ:
- Claude calls
FeatureExtrusion2with the wrong number of parameters β COM error - Even if the call works, it passes
0.05expecting millimeters, but the API uses meters β your bracket is 50 meters wide - It adds holes before the face they belong on exists in the feature tree β rebuild failure
- It doesnβt save β one COM hiccup and everything is lost
- It exports STL with default tolerance β the file is either 200MB or looks like a polygon from 1997
With the API skill, the calls are correct. With your custom skill, the workflow makes sense. With the print skill, the output is actually printable. Three layers, each solving a different class of problem.
WSL-Specific Gotchas
File paths cross the boundary. When you tell Claude to save a file, use Windows paths (C:\Users\you\Documents\parts\bracket.SLDPRT), not WSL paths. SolidWorks doesnβt know what /home/you/ means. If you want to access the saved file from WSL later, remember it lives at /mnt/c/Users/you/Documents/parts/bracket.SLDPRT.
The gateway IP changes. WSL 2 uses a virtual network adapter. The IP assigned to your Windows host (from WSLβs perspective) changes on reboot. Script it:
# Add to your .bashrc or .zshrc
export WINDOWS_HOST=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
Donβt run the MCP server in WSL. It will install, it will start, it will find zero SolidWorks instances and fail with a cryptic COM error. The COM API is Windows-native. The server must run on the Windows side.
32-bit vs 64-bit Python on Windows. This trips up everyone. SolidWorks is 64-bit, so you need 64-bit Windows Python. Check from PowerShell:
python -c "import struct; print(struct.calcsize('P') * 8)"
It should print 64. If it prints 32, uninstall and reinstall the 64-bit version.
Keep SolidWorks in the foreground. Some COM operations silently fail when SolidWorks is minimized. Keep it visible β ideally on a second monitor so you can watch Claude work.
WSL clock drift. WSLβs clock can drift from Windows, which occasionally causes TLS or timestamp issues. If things get weird, sync it:
sudo hwclock -s
The Startup Checklist
Every time you sit down to use this setup:
- Launch SolidWorks on Windows
- Start the MCP server in PowerShell:
mcp-proxy --host 0.0.0.0 --port 8765 -- python server.py - Open WSL Ubuntu and run
claudein your project directory - Verify:
claude mcp listshowssolidworks: β Connected - Design away
If you want to automate steps 1β2, you can create a Windows batch script or a PowerShell script that launches both and drop it in your Startup folder.
The Bigger Picture for 3D Printing
If youβre a 3D printing nerd like me, this setup is a game-changer. The workflow becomes:
- Describe the part you need to Claude (from your WSL terminal)
- Claude designs it in SolidWorks on the Windows side via MCP
- Export as STL directly from SolidWorks
- Access the STL from WSL at
/mnt/c/..., slice, and print
No more fumbling with TinkerCAD for quick functional parts. No more manually modeling the same parametric bracket for the 50th time. Describe it, let Claude build it, tweak the parameters if needed, and send it to the printer.
This is especially powerful for parametric designs β tell Claude βmake the bracket 5mm wider and add M4 mounting holesβ and it modifies the existing part instead of starting over.
Wrapping Up
The WSL + Windows split adds one layer of complexity (the HTTP bridge), but once itβs wired up, you get the best of both worlds: your comfortable Linux dev environment in WSL and the full power of SolidWorks on the Windows host, with Claude Code orchestrating between them.
Setup takes about 20 minutes. The firewall rule is the part most people forget. After that, it just works β describe a part, watch it appear in SolidWorks, iterate with natural language, export, and print.
Now go print something you designed with words.