solidworks-mcp-server 3.0.9 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/CHANGELOG.md +175 -131
  2. package/LICENSE +20 -20
  3. package/README.md +195 -444
  4. package/dist/adapters/circuit-breaker.d.ts +84 -0
  5. package/dist/adapters/circuit-breaker.d.ts.map +1 -0
  6. package/dist/adapters/circuit-breaker.js +228 -0
  7. package/dist/adapters/circuit-breaker.js.map +1 -0
  8. package/dist/adapters/connection-pool.d.ts +83 -0
  9. package/dist/adapters/connection-pool.d.ts.map +1 -0
  10. package/dist/adapters/connection-pool.js +282 -0
  11. package/dist/adapters/connection-pool.js.map +1 -0
  12. package/dist/adapters/edge-adapter.d.ts +43 -0
  13. package/dist/adapters/edge-adapter.d.ts.map +1 -0
  14. package/dist/adapters/edge-adapter.js +417 -0
  15. package/dist/adapters/edge-adapter.js.map +1 -0
  16. package/dist/adapters/factory.d.ts +60 -0
  17. package/dist/adapters/factory.d.ts.map +1 -0
  18. package/dist/adapters/factory.js +212 -0
  19. package/dist/adapters/factory.js.map +1 -0
  20. package/dist/adapters/feature-complexity-analyzer.d.ts +102 -0
  21. package/dist/adapters/feature-complexity-analyzer.d.ts.map +1 -0
  22. package/dist/adapters/feature-complexity-analyzer.js +322 -0
  23. package/dist/adapters/feature-complexity-analyzer.js.map +1 -0
  24. package/dist/adapters/macro-generator.d.ts +30 -0
  25. package/dist/adapters/macro-generator.d.ts.map +1 -0
  26. package/dist/adapters/macro-generator.js +524 -0
  27. package/dist/adapters/macro-generator.js.map +1 -0
  28. package/dist/adapters/mock-solidworks-adapter.d.ts +92 -0
  29. package/dist/adapters/mock-solidworks-adapter.d.ts.map +1 -0
  30. package/dist/adapters/mock-solidworks-adapter.js +367 -0
  31. package/dist/adapters/mock-solidworks-adapter.js.map +1 -0
  32. package/dist/adapters/types.d.ts +376 -0
  33. package/dist/adapters/types.d.ts.map +1 -0
  34. package/dist/adapters/types.js +261 -0
  35. package/dist/adapters/types.js.map +1 -0
  36. package/dist/adapters/winax-adapter-enhanced.d.ts +55 -0
  37. package/dist/adapters/winax-adapter-enhanced.d.ts.map +1 -0
  38. package/dist/adapters/winax-adapter-enhanced.js +601 -0
  39. package/dist/adapters/winax-adapter-enhanced.js.map +1 -0
  40. package/dist/adapters/winax-adapter.d.ts +55 -0
  41. package/dist/adapters/winax-adapter.d.ts.map +1 -0
  42. package/dist/adapters/winax-adapter.js +667 -0
  43. package/dist/adapters/winax-adapter.js.map +1 -0
  44. package/dist/api/stainless-api.d.ts +29 -0
  45. package/dist/api/stainless-api.d.ts.map +1 -0
  46. package/dist/api/stainless-api.js +408 -0
  47. package/dist/api/stainless-api.js.map +1 -0
  48. package/dist/cache/manager.d.ts.map +1 -1
  49. package/dist/cache/manager.js +4 -3
  50. package/dist/cache/manager.js.map +1 -1
  51. package/dist/core/interfaces/core-abstractions.d.ts.map +1 -1
  52. package/dist/core/interfaces/core-abstractions.js.map +1 -1
  53. package/dist/db/connection.js +4 -4
  54. package/dist/db/connection.js.map +1 -1
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +86 -79
  57. package/dist/index.js.map +1 -1
  58. package/dist/knowledge/chromadb.d.ts.map +1 -1
  59. package/dist/knowledge/chromadb.js +5 -3
  60. package/dist/knowledge/chromadb.js.map +1 -1
  61. package/dist/macro/recorder.d.ts +1 -1
  62. package/dist/macro/recorder.d.ts.map +1 -1
  63. package/dist/macro/recorder.js +10 -10
  64. package/dist/macro/recorder.js.map +1 -1
  65. package/dist/resources/base.js +10 -10
  66. package/dist/resources/base.js.map +1 -1
  67. package/dist/resources/design-table.d.ts +10 -12
  68. package/dist/resources/design-table.d.ts.map +1 -1
  69. package/dist/resources/design-table.js +42 -39
  70. package/dist/resources/design-table.js.map +1 -1
  71. package/dist/resources/pdm.d.ts +44 -45
  72. package/dist/resources/pdm.d.ts.map +1 -1
  73. package/dist/resources/pdm.js +118 -79
  74. package/dist/resources/pdm.js.map +1 -1
  75. package/dist/resources/registry.d.ts +1 -1
  76. package/dist/resources/registry.d.ts.map +1 -1
  77. package/dist/resources/registry.js +1 -1
  78. package/dist/shared/constants/solidworks-constants.d.ts.map +1 -1
  79. package/dist/shared/constants/solidworks-constants.js +9 -9
  80. package/dist/shared/constants/solidworks-constants.js.map +1 -1
  81. package/dist/solidworks/api.d.ts +8 -3
  82. package/dist/solidworks/api.d.ts.map +1 -1
  83. package/dist/solidworks/api.js +599 -134
  84. package/dist/solidworks/api.js.map +1 -1
  85. package/dist/state/store.d.ts +1 -1
  86. package/dist/state/store.d.ts.map +1 -1
  87. package/dist/state/store.js +14 -14
  88. package/dist/state/store.js.map +1 -1
  89. package/dist/tools/analysis.d.ts +12 -2
  90. package/dist/tools/analysis.d.ts.map +1 -1
  91. package/dist/tools/analysis.js +141 -31
  92. package/dist/tools/analysis.js.map +1 -1
  93. package/dist/tools/diagnostics.d.ts +1 -1
  94. package/dist/tools/diagnostics.d.ts.map +1 -1
  95. package/dist/tools/diagnostics.js +2 -2
  96. package/dist/tools/diagnostics.js.map +1 -1
  97. package/dist/tools/drawing.d.ts +2 -2
  98. package/dist/tools/drawing.d.ts.map +1 -1
  99. package/dist/tools/drawing.js +94 -10
  100. package/dist/tools/drawing.js.map +1 -1
  101. package/dist/tools/enhanced-drawing.d.ts +1 -1
  102. package/dist/tools/enhanced-drawing.d.ts.map +1 -1
  103. package/dist/tools/enhanced-drawing.js +10 -13
  104. package/dist/tools/enhanced-drawing.js.map +1 -1
  105. package/dist/tools/export.d.ts +1 -1
  106. package/dist/tools/export.d.ts.map +1 -1
  107. package/dist/tools/export.js +88 -14
  108. package/dist/tools/export.js.map +1 -1
  109. package/dist/tools/extrusion-helper.d.ts +15 -0
  110. package/dist/tools/extrusion-helper.d.ts.map +1 -0
  111. package/dist/tools/extrusion-helper.js +61 -0
  112. package/dist/tools/extrusion-helper.js.map +1 -0
  113. package/dist/tools/macro-security.d.ts +2 -2
  114. package/dist/tools/macro-security.d.ts.map +1 -1
  115. package/dist/tools/macro-security.js +2 -2
  116. package/dist/tools/macro-security.js.map +1 -1
  117. package/dist/tools/modeling.d.ts +2 -2
  118. package/dist/tools/modeling.d.ts.map +1 -1
  119. package/dist/tools/modeling.js +6 -6
  120. package/dist/tools/modeling.js.map +1 -1
  121. package/dist/tools/native-macro.d.ts +1 -1
  122. package/dist/tools/native-macro.d.ts.map +1 -1
  123. package/dist/tools/native-macro.js +246 -239
  124. package/dist/tools/native-macro.js.map +1 -1
  125. package/dist/tools/sketch.d.ts +28 -28
  126. package/dist/tools/sketch.d.ts.map +1 -1
  127. package/dist/tools/sketch.js +202 -136
  128. package/dist/tools/sketch.js.map +1 -1
  129. package/dist/tools/template-manager.d.ts +5 -5
  130. package/dist/tools/template-manager.d.ts.map +1 -1
  131. package/dist/tools/template-manager.js +66 -65
  132. package/dist/tools/template-manager.js.map +1 -1
  133. package/dist/tools/vba-advanced.d.ts +10 -10
  134. package/dist/tools/vba-advanced.d.ts.map +1 -1
  135. package/dist/tools/vba-advanced.js +791 -708
  136. package/dist/tools/vba-advanced.js.map +1 -1
  137. package/dist/tools/vba-assembly.d.ts +10 -10
  138. package/dist/tools/vba-assembly.d.ts.map +1 -1
  139. package/dist/tools/vba-assembly.js +562 -500
  140. package/dist/tools/vba-assembly.js.map +1 -1
  141. package/dist/tools/vba-drawing.d.ts +12 -12
  142. package/dist/tools/vba-drawing.d.ts.map +1 -1
  143. package/dist/tools/vba-drawing.js +681 -572
  144. package/dist/tools/vba-drawing.js.map +1 -1
  145. package/dist/tools/vba-file-management.d.ts +12 -12
  146. package/dist/tools/vba-file-management.d.ts.map +1 -1
  147. package/dist/tools/vba-file-management.js +662 -589
  148. package/dist/tools/vba-file-management.js.map +1 -1
  149. package/dist/tools/vba-part.d.ts +10 -10
  150. package/dist/tools/vba-part.d.ts.map +1 -1
  151. package/dist/tools/vba-part.js +484 -426
  152. package/dist/tools/vba-part.js.map +1 -1
  153. package/dist/tools/vba.d.ts +361 -361
  154. package/dist/tools/vba.d.ts.map +1 -1
  155. package/dist/tools/vba.js +67 -81
  156. package/dist/tools/vba.js.map +1 -1
  157. package/dist/utils/config.js +2 -2
  158. package/dist/utils/config.js.map +1 -1
  159. package/dist/utils/environment.d.ts +243 -0
  160. package/dist/utils/environment.d.ts.map +1 -0
  161. package/dist/utils/environment.js +207 -0
  162. package/dist/utils/environment.js.map +1 -0
  163. package/dist/utils/logger.d.ts.map +1 -1
  164. package/dist/utils/logger.js +6 -6
  165. package/dist/utils/logger.js.map +1 -1
  166. package/dist/utils/solidworks-config.d.ts +39 -0
  167. package/dist/utils/solidworks-config.d.ts.map +1 -0
  168. package/dist/utils/solidworks-config.js +156 -0
  169. package/dist/utils/solidworks-config.js.map +1 -0
  170. package/package.json +84 -84
  171. package/scripts/setup.js +70 -70
  172. package/dist/application/services/command-bus.d.ts +0 -39
  173. package/dist/application/services/command-bus.d.ts.map +0 -1
  174. package/dist/application/services/command-bus.js +0 -88
  175. package/dist/application/services/command-bus.js.map +0 -1
  176. package/dist/application/services/event-bus.d.ts +0 -31
  177. package/dist/application/services/event-bus.d.ts.map +0 -1
  178. package/dist/application/services/event-bus.js +0 -83
  179. package/dist/application/services/event-bus.js.map +0 -1
  180. package/dist/application/services/query-bus.d.ts +0 -30
  181. package/dist/application/services/query-bus.d.ts.map +0 -1
  182. package/dist/application/services/query-bus.js +0 -59
  183. package/dist/application/services/query-bus.js.map +0 -1
  184. package/dist/application/services/tool-registry.d.ts +0 -53
  185. package/dist/application/services/tool-registry.d.ts.map +0 -1
  186. package/dist/application/services/tool-registry.js +0 -81
  187. package/dist/application/services/tool-registry.js.map +0 -1
  188. package/dist/application/use-cases/analysis/index.d.ts +0 -13
  189. package/dist/application/use-cases/analysis/index.d.ts.map +0 -1
  190. package/dist/application/use-cases/analysis/index.js +0 -17
  191. package/dist/application/use-cases/analysis/index.js.map +0 -1
  192. package/dist/application/use-cases/drawing/index.d.ts +0 -13
  193. package/dist/application/use-cases/drawing/index.d.ts.map +0 -1
  194. package/dist/application/use-cases/drawing/index.js +0 -17
  195. package/dist/application/use-cases/drawing/index.js.map +0 -1
  196. package/dist/application/use-cases/export/index.d.ts +0 -13
  197. package/dist/application/use-cases/export/index.d.ts.map +0 -1
  198. package/dist/application/use-cases/export/index.js +0 -17
  199. package/dist/application/use-cases/export/index.js.map +0 -1
  200. package/dist/application/use-cases/macro/index.d.ts +0 -13
  201. package/dist/application/use-cases/macro/index.d.ts.map +0 -1
  202. package/dist/application/use-cases/macro/index.js +0 -17
  203. package/dist/application/use-cases/macro/index.js.map +0 -1
  204. package/dist/application/use-cases/modeling/index.d.ts +0 -56
  205. package/dist/application/use-cases/modeling/index.d.ts.map +0 -1
  206. package/dist/application/use-cases/modeling/index.js +0 -385
  207. package/dist/application/use-cases/modeling/index.js.map +0 -1
  208. package/dist/index.refactored.d.ts +0 -7
  209. package/dist/index.refactored.d.ts.map +0 -1
  210. package/dist/index.refactored.js +0 -254
  211. package/dist/index.refactored.js.map +0 -1
  212. package/dist/infrastructure/config/configuration-manager.d.ts +0 -381
  213. package/dist/infrastructure/config/configuration-manager.d.ts.map +0 -1
  214. package/dist/infrastructure/config/configuration-manager.js +0 -566
  215. package/dist/infrastructure/config/configuration-manager.js.map +0 -1
  216. package/dist/infrastructure/container/service-locator.d.ts +0 -14
  217. package/dist/infrastructure/container/service-locator.d.ts.map +0 -1
  218. package/dist/infrastructure/container/service-locator.js +0 -38
  219. package/dist/infrastructure/container/service-locator.js.map +0 -1
  220. package/dist/infrastructure/logging/logger.d.ts +0 -24
  221. package/dist/infrastructure/logging/logger.d.ts.map +0 -1
  222. package/dist/infrastructure/logging/logger.js +0 -65
  223. package/dist/infrastructure/logging/logger.js.map +0 -1
  224. package/dist/infrastructure/solidworks/solidworks-adapter.d.ts +0 -43
  225. package/dist/infrastructure/solidworks/solidworks-adapter.d.ts.map +0 -1
  226. package/dist/infrastructure/solidworks/solidworks-adapter.js +0 -527
  227. package/dist/infrastructure/solidworks/solidworks-adapter.js.map +0 -1
  228. package/dist/presentation/mcp/request-handler.d.ts +0 -41
  229. package/dist/presentation/mcp/request-handler.d.ts.map +0 -1
  230. package/dist/presentation/mcp/request-handler.js +0 -100
  231. package/dist/presentation/mcp/request-handler.js.map +0 -1
  232. package/dist/presentation/transformers/error-transformer.d.ts +0 -16
  233. package/dist/presentation/transformers/error-transformer.d.ts.map +0 -1
  234. package/dist/presentation/transformers/error-transformer.js +0 -44
  235. package/dist/presentation/transformers/error-transformer.js.map +0 -1
  236. package/dist/presentation/transformers/response-transformer.d.ts +0 -24
  237. package/dist/presentation/transformers/response-transformer.d.ts.map +0 -1
  238. package/dist/presentation/transformers/response-transformer.js +0 -102
  239. package/dist/presentation/transformers/response-transformer.js.map +0 -1
  240. package/dist/tools/drawing-analysis.d.ts +0 -9
  241. package/dist/tools/drawing-analysis.d.ts.map +0 -1
  242. package/dist/tools/drawing-analysis.js +0 -239
  243. package/dist/tools/drawing-analysis.js.map +0 -1
package/README.md CHANGED
@@ -1,444 +1,195 @@
1
- # SolidWorks MCP Server
2
-
3
- <div align="center">
4
-
5
- [![CI](https://github.com/vespo92/SolidworksMCP-TS/actions/workflows/ci.yml/badge.svg)](https://github.com/vespo92/SolidworksMCP-TS/actions/workflows/ci.yml)
6
- [![npm version](https://badge.fury.io/js/solidworks-mcp-server.svg)](https://www.npmjs.com/package/solidworks-mcp-server)
7
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue?logo=typescript)](https://www.typescriptlang.org/)
8
- [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green?logo=anthropic)](https://modelcontextprotocol.com)
9
- [![Node.js](https://img.shields.io/badge/Node.js-20+-green?logo=node.js)](https://nodejs.org/)
10
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/vespo92/SolidworksMCP-TS/pulls)
12
- [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/vespo92/SolidworksMCP-TS/graphs/commit-activity)
13
-
14
- </div>
15
-
16
- A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with SolidWorks CAD software, providing automated design capabilities, macro recording, design tables with SQL integration, VBA generation, and PDM configuration management.
17
-
18
- ## 🎯 Quick Start
19
-
20
- ### ⚠️ Windows Users: Local Installation Required
21
-
22
- Due to the `winax` native module dependency, this package **cannot be installed via npm global install**. You must build it locally on your Windows machine.
23
-
24
- ### Installation Steps:
25
- ```bash
26
- # 1. Clone the repository to your Windows machine
27
- git clone https://github.com/vespo92/SolidworksMCP-TS
28
- cd SolidworksMCP-TS
29
-
30
- # 2. Install dependencies (this compiles winax for your system)
31
- npm install
32
-
33
- # 3. Build the TypeScript files
34
- npm run build
35
- ```
36
-
37
- ### Configure Claude Desktop
38
- After installation, add the local path to your Claude Desktop config (see detailed instructions below).
39
-
40
- Then in Claude Desktop:
41
- ```
42
- "Generate VBA to batch export all parts in my folder to STEP format"
43
- "Create a parametric design table for a configurable bracket"
44
- "Check for interferences in my assembly"
45
- ```
46
-
47
- ## 🚀 Key Features
48
-
49
- ### Core Capabilities
50
- - **Full SolidWorks Control** - Open, create, modify, and analyze CAD models
51
- - **Macro Recording & Playback** - Record operations and generate reusable macros
52
- - **Design Tables with SQL** - Create parametric designs driven by database data
53
- - **PDM Integration** - Configure and manage SolidWorks PDM vaults
54
- - **VBA Script Generation** - Generate VBA scripts from templates with AI assistance
55
- - **State Management** - Persistent resource states with auto-save
56
- - **Resource-Based Architecture** - Modular, extensible design pattern
57
-
58
- ### New in v2.1.0 - Comprehensive VBA Generation Suite
59
- ⚠️ **IMPORTANT: VBA script generation features are NOT WORKING in the current iteration and require additional testing**
60
- - 🔧 **Part Modeling VBA** - Advanced features, patterns, sheet metal, surfaces
61
- - 🏗️ **Assembly Automation** - Mates, components, interference analysis
62
- - 📐 **Drawing Generation** - Views, dimensions, annotations, tables
63
- - 📁 **File & PDM Operations** - Batch processing, custom properties, vault management
64
- - ⚙️ **Advanced Features** - Configurations, equations, simulation setup
65
- - 🎯 **100+ VBA Tools** - Generate production-ready VBA without coding knowledge
66
-
67
- ### Enterprise Features (v2.0)
68
- - 🎯 **Macro Recording System** - Record actions and export to VBA
69
- - 📊 **SQL-Driven Design Tables** - Connect to databases for parametric designs
70
- - 🗄️ **PDM Configuration** - Manage vault operations, workflows, and automation
71
- - 💾 **State Persistence** - Track and restore resource states
72
- - 🏗️ **Resource Registry** - Dynamic resource type management
73
- - 📝 **Enhanced Logging** - Comprehensive operation tracking
74
-
75
- ## 📋 Prerequisites
76
-
77
- - Windows 10/11
78
- - SolidWorks 2021-2025 (licensed installation)
79
- - Node.js 20 or higher
80
- - Claude Desktop
81
- - Optional: SQL Server or PostgreSQL for design tables
82
- - Optional: SolidWorks PDM for vault operations
83
-
84
- ## 🛠️ Installation
85
-
86
- ### 1. Install the MCP Server
87
-
88
- #### Local Installation (Required for Windows):
89
- ```bash
90
- # Clone to your Windows machine
91
- git clone https://github.com/vespo92/SolidworksMCP-TS
92
- cd SolidworksMCP-TS
93
-
94
- # Install and build
95
- npm install # Compiles winax native module for your system
96
- npm run build # Compiles TypeScript to JavaScript
97
- ```
98
-
99
- **Note:** The `npm install` step will compile the `winax` native module specifically for your Windows system. This is why global npm installation doesn't work - each Windows machine needs its own compiled version.
100
-
101
- ### 2. Configure Claude Desktop
102
-
103
- #### ⚠️ IMPORTANT: Windows Installation Issue
104
-
105
- Due to the nature of the `winax` native module (which provides COM/ActiveX support for Windows), the npm global installation method **will not work**. The `winax` module must be compiled locally for your specific Windows system.
106
-
107
- #### Required: Local Installation Method
108
-
109
- 1. **Download or clone this repository to your Windows machine**
110
- 2. **Install dependencies locally:**
111
- ```bash
112
- cd C:\path\to\SolidworksMCP-Final
113
- npm install # This will compile winax for your system
114
- npm run build # Build the TypeScript files
115
- ```
116
-
117
- 3. **Configure Claude Desktop to use the local installation:**
118
- ```json
119
- {
120
- "mcpServers": {
121
- "solidworks": {
122
- "command": "node",
123
- "args": ["C:\\path\\to\\SolidworksMCP-Final\\dist\\index.js"]
124
- }
125
- }
126
- }
127
- ```
128
-
129
- #### Why This Is Necessary
130
-
131
- - `winax` is a C++ native module that interfaces with Windows COM/ActiveX
132
- - Native modules cannot be pre-compiled for all Windows configurations
133
- - Each system needs its own compiled version matching its Node.js version and architecture
134
- - This is a limitation of native modules, not the MCP server itself
135
-
136
- #### Future Solutions (In Development)
137
-
138
- We're exploring options to simplify installation:
139
- - Pre-built binaries for common Windows configurations
140
- - Automatic winax installation script
141
- - Docker container with pre-configured environment
142
- - Electron-based standalone application
143
-
144
- ### 3. Environment Configuration
145
-
146
- Create a `.env` file for advanced configuration:
147
-
148
- ```env
149
- # SolidWorks Configuration
150
- SOLIDWORKS_PATH=C:/Program Files/SOLIDWORKS Corp/SOLIDWORKS
151
- SOLIDWORKS_VERSION=2024
152
-
153
- # Feature Flags
154
- ENABLE_MACRO_RECORDING=true
155
- ENABLE_PDM=true
156
-
157
- # Database Configuration (for Design Tables)
158
- SQL_CONNECTION=mssql://localhost:1433/solidworks_db
159
-
160
- # PDM Configuration
161
- PDM_VAULT=Engineering
162
-
163
- # State Management
164
- STATE_FILE=.solidworks-state.json
165
-
166
- # Logging
167
- LOG_LEVEL=info
168
- ```
169
-
170
- ## 🚀 Usage Examples
171
-
172
- ### Macro Recording
173
-
174
- ```
175
- "Start recording a macro called 'CreateBracket'"
176
- "Create a sketch on the front plane"
177
- "Add a rectangle 100mm x 50mm"
178
- "Extrude 25mm"
179
- "Stop recording and export to VBA"
180
- ```
181
-
182
- ### Design Tables with SQL
183
-
184
- ```
185
- "Create a design table for parametric box configurations from SQL database"
186
- "Use query: SELECT * FROM box_configurations"
187
- "Map columns: length, width, height to dimensions"
188
- "Generate all configurations"
189
- ```
190
-
191
- ### PDM Operations
192
-
193
- ```
194
- "Configure PDM vault 'Engineering' for automatic check-in/check-out"
195
- "Set up workflow transition from 'Work in Progress' to 'Released'"
196
- "Create folder structure with permissions for project team"
197
- ```
198
-
199
- ### Advanced VBA Generation (v2.1.0)
200
-
201
- #### Part Modeling
202
- ```
203
- "Generate VBA to create a parametric bracket with:
204
- - Reference planes offset by 50mm
205
- - Sweep feature along a 3D curve
206
- - Linear pattern with 5 instances
207
- - Sheet metal conversion with 2mm thickness"
208
- ```
209
-
210
- #### Assembly Automation
211
- ```
212
- "Generate VBA for assembly that:
213
- - Inserts components from a folder
214
- - Creates coincident and distance mates
215
- - Checks for interferences
216
- - Exports mass properties to Excel"
217
- ```
218
-
219
- #### Batch Operations
220
- ```
221
- "Generate VBA to process all files in C:\Parts that:
222
- - Opens each SLDPRT file
223
- - Updates custom properties (Part Number, Revision)
224
- - Exports to STEP format
225
- - Checks into PDM vault with comment"
226
- ```
227
-
228
- #### Drawing Automation
229
- ```
230
- "Generate VBA to create drawings that:
231
- - Creates standard 3-view layout
232
- - Adds section view A-A
233
- - Dimensions all features
234
- - Inserts BOM table
235
- - Exports to PDF"
236
- ```
237
-
238
- ## 🔧 Available Tools
239
-
240
- ### Macro Tools
241
- - `macro_start_recording` - Begin recording operations
242
- - `macro_stop_recording` - End recording and save
243
- - `macro_export_vba` - Export macro to VBA code ⚠️ **NOT WORKING - Requires additional testing**
244
- - `macro_execute` - Run recorded macro
245
-
246
- ### Design Table Tools
247
- - `design_table_create` - Create parametric design table
248
- - `design_table_refresh` - Update from SQL source
249
- - `design_table_add_config` - Add configuration
250
- - `design_table_export` - Export configurations
251
-
252
- ### PDM Tools
253
- - `pdm_configure` - Set up vault configuration
254
- - `pdm_checkin` - Check in files with comments
255
- - `pdm_checkout` - Check out for editing
256
- - `pdm_workflow` - Execute workflow transitions
257
- - `pdm_create_structure` - Set up folder hierarchy
258
-
259
- ### Resource Management
260
- - `resource_create` - Create new resource
261
- - `resource_list` - List all resources
262
- - `resource_get` - Get resource details
263
- - `resource_update` - Update resource properties
264
- - `resource_delete` - Remove resource
265
-
266
- ### Existing Tools
267
- All original tools remain available:
268
- - Modeling tools (create, modify, analyze)
269
- - Drawing tools (views, dimensions, annotations)
270
- - Export tools (STEP, IGES, STL, PDF, etc.)
271
- - VBA tools ⚠️ **NOTE: VBA script generation is NOT WORKING in the current iteration and requires additional testing**
272
- - Analysis tools (mass properties, interference)
273
-
274
- ## 📚 API Reference
275
-
276
- ### Resource Types
277
-
278
- #### Design Table Resource
279
- ```typescript
280
- {
281
- type: 'design-table',
282
- tableName: string,
283
- parameters: Array<{
284
- name: string,
285
- type: 'dimension' | 'feature' | 'configuration',
286
- dataType: 'number' | 'string' | 'boolean',
287
- sqlColumn?: string,
288
- formula?: string
289
- }>,
290
- dataSource?: {
291
- type: 'sql' | 'file' | 'api',
292
- connectionString?: string,
293
- query?: string
294
- }
295
- }
296
- ```
297
-
298
- #### PDM Configuration Resource
299
- ```typescript
300
- {
301
- type: 'pdm-configuration',
302
- vaultName: string,
303
- operations: {
304
- checkIn?: { enabled: boolean, comment?: string },
305
- checkOut?: { enabled: boolean, getLatestVersion?: boolean },
306
- workflow?: {
307
- enabled: boolean,
308
- transitions: Array<{
309
- name: string,
310
- fromState: string,
311
- toState: string
312
- }>
313
- }
314
- }
315
- }
316
- ```
317
-
318
- ## 🧪 Development
319
-
320
- ### Building from Source
321
-
322
- ```bash
323
- git clone https://github.com/vespo92/SolidworksMCP-TS
324
- cd solidworks-mcp-server
325
- npm install
326
- npm run build
327
- ```
328
-
329
- ### Running Tests
330
-
331
- ```bash
332
- npm test # Run all tests
333
- npm run test:unit # Unit tests only
334
- npm run test:integration # Integration tests
335
- ```
336
-
337
- ### Adding Custom Resources
338
-
339
- Create a new resource type:
340
-
341
- ```typescript
342
- import { SolidWorksResource } from './resources/base';
343
-
344
- export class CustomResource extends SolidWorksResource {
345
- readonly type = 'custom-type';
346
-
347
- async execute(api: SolidWorksAPI) {
348
- // Implementation
349
- }
350
-
351
- toVBACode(): string {
352
- // Generate VBA
353
- }
354
- }
355
- ```
356
-
357
- Register the resource:
358
-
359
- ```typescript
360
- resourceRegistry.register({
361
- type: 'custom-type',
362
- name: 'Custom Resource',
363
- schema: CustomSchema,
364
- factory: (id, name, props) => new CustomResource(id, name, props)
365
- });
366
- ```
367
-
368
- ## 🐛 Troubleshooting
369
-
370
- ### Macro Recording Issues
371
- - Ensure macro recording is enabled in environment
372
- - Check that actions are supported for recording
373
- - Verify VBA export permissions
374
-
375
- ### SQL Connection Problems
376
- - Verify connection string format
377
- - Check database permissions
378
- - Ensure SQL drivers are installed
379
-
380
- ### PDM Integration
381
- - Confirm PDM client is installed
382
- - Verify vault access permissions
383
- - Check network connectivity to PDM server
384
-
385
- ### State Management
386
- - Check write permissions for state file
387
- - Clear corrupted state with `resource_clear`
388
- - Verify auto-save is enabled
389
-
390
- ## 📊 Performance Considerations
391
-
392
- - **Batch Operations**: Use macro recording for repetitive tasks
393
- - **SQL Queries**: Optimize queries for large datasets
394
- - **State Storage**: Periodically clean old states
395
- - **PDM Operations**: Use batch check-in/check-out
396
-
397
- ## 🔒 Security
398
-
399
- - SQL connections use secure authentication
400
- - PDM credentials are not stored in state
401
- - Macro execution requires explicit permission
402
- - State files can be encrypted (configure in .env)
403
-
404
- ## 📄 License
405
-
406
- MIT License - see LICENSE file
407
-
408
- ## 🤝 Contributing
409
-
410
- We welcome contributions! Please see CONTRIBUTING.md for guidelines.
411
-
412
- ### Areas for Contribution
413
- - Additional resource types
414
- - Enhanced SQL integrations
415
- - More VBA templates
416
- - PDM workflow automation
417
- - Testing improvements
418
-
419
- ## 📞 Support
420
-
421
- - Issues: [GitHub Issues](https://github.com/vespo92/SolidworksMCP-TS/issues)
422
- - Discussions: [GitHub Discussions](https://github.com/vespo92/SolidworksMCP-TS/discussions)
423
-
424
- ## 🚀 Roadmap
425
-
426
- ### v2.1 (Q2 2024)
427
- - [ ] Real-time collaboration features
428
- - [ ] Cloud storage integration
429
- - [ ] Advanced simulation tools
430
- - [ ] Custom property management
431
-
432
- ### v2.2 (Q3 2024)
433
- - [ ] AI-powered design suggestions
434
- - [ ] Automated testing framework
435
- - [ ] Performance optimization tools
436
- - [ ] Extended PDM capabilities
437
-
438
- ## 📖 Changelog
439
-
440
- See [CHANGELOG.md](CHANGELOG.md) for version history.
441
-
442
- ---
443
-
444
- Built with ❤️ for the SolidWorks community
1
+ # SolidWorks MCP Server
2
+
3
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue?logo=typescript)](https://www.typescriptlang.org/)
4
+ [![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-green?logo=anthropic)](https://modelcontextprotocol.io)
5
+ [![Node.js](https://img.shields.io/badge/Node.js-20+-green?logo=node.js)](https://nodejs.org/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Windows](https://img.shields.io/badge/Windows-10%2F11-blue?logo=windows)](https://www.microsoft.com/windows)
8
+
9
+ A Node.js MCP server for automating SolidWorks via COM interop. Connects AI assistants (Claude Desktop, etc.) to SolidWorks for CAD automation tasks.
10
+
11
+ > **Project Status: Alpha / Experimental**
12
+ >
13
+ > This project is under active development. While the 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 rough edges, COM quirks, and incomplete functionality. Contributions and testing reports are very welcome.
14
+
15
+ ## How It Works
16
+
17
+ The server exposes SolidWorks operations as MCP tools over stdio. An intelligent routing layer handles a key limitation of Node.js COM bridges: methods with 13+ parameters often fail via direct COM calls.
18
+
19
+ - **Simple operations (12 params or fewer)** - Direct COM call via `winax`
20
+ - **Complex operations (13+ params)** - Auto-generated VBA macro executed by SolidWorks
21
+ - **Failed operations** - Automatic fallback with error context
22
+
23
+ ## Prerequisites
24
+
25
+ - **Windows 10/11** (required - COM interop is Windows-only)
26
+ - **SolidWorks 2021-2025** (licensed, installed)
27
+ - **Node.js 20+**
28
+ - An MCP-compatible client (Claude Desktop, etc.)
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ git clone https://github.com/vespo92/SolidworksMCP-TS.git
34
+ cd SolidworksMCP-TS
35
+
36
+ # Install dependencies (compiles winax native module for your system)
37
+ npm install
38
+
39
+ # Build TypeScript
40
+ npm run build
41
+ ```
42
+
43
+ > **Note:** The `winax` native module must be compiled locally on each Windows machine. Global npm installation does not work.
44
+
45
+ ## Configure Claude Desktop
46
+
47
+ Add to your `claude_desktop_config.json`:
48
+
49
+ ```json
50
+ {
51
+ "mcpServers": {
52
+ "solidworks": {
53
+ "command": "node",
54
+ "args": ["C:/path/to/SolidworksMCP-TS/dist/index.js"],
55
+ "env": {
56
+ "SOLIDWORKS_PATH": "C:\\Program Files\\SOLIDWORKS Corp\\SOLIDWORKS",
57
+ "ADAPTER_TYPE": "winax-enhanced"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ ## Available Tools
65
+
66
+ The server registers tools across these categories:
67
+
68
+ | Category | Tools | Status |
69
+ |----------|-------|--------|
70
+ | **Modeling** | create_part, create_extrusion, create_revolve, create_sweep, create_loft, create_fillet, create_chamfer, etc. | Partially tested |
71
+ | **Sketch** | create_sketch, add_line, add_circle, add_rectangle, add_arc, add_constraints, dimension_sketch | Basic ops verified |
72
+ | **Drawing** | create_drawing_from_model, add_drawing_view, add_section_view, add_dimensions, etc. | Untested |
73
+ | **Export** | export_file (STEP, IGES, STL, PDF, DWG, DXF), batch_export | Untested |
74
+ | **Analysis** | get_mass_properties, check_interference, measure_distance, check_geometry | Untested |
75
+ | **VBA Generation** | generate_vba_script, vba_sheet_metal, vba_configurations, vba_equations, etc. | Code generation works; execution untested |
76
+ | **Macro** | macro_start_recording, macro_stop_recording, macro_export_vba | Untested |
77
+
78
+ **"Partially tested"** means the tool has been run against SolidWorks at least once but not comprehensively. **"Untested"** means only mock/unit tests exist (if any).
79
+
80
+ ## Architecture
81
+
82
+ ```
83
+ MCP Protocol (stdio)
84
+ |
85
+ Tool Registry (index.ts)
86
+ |
87
+ Feature Complexity Analyzer --- routes by param count
88
+ | |
89
+ Direct COM (winax) VBA Macro Generator
90
+ | |
91
+ +--------------------+
92
+ |
93
+ SolidWorks COM API
94
+ ```
95
+
96
+ ### Key Design Decisions
97
+
98
+ - **COM parameter limit workaround**: SolidWorks API methods like `FeatureExtrusion3` take 20+ parameters. Node.js COM bridges choke on these. The complexity analyzer detects this and generates a VBA macro instead.
99
+ - **Never pass `null` to COM**: Use `undefined` for optional parameters. COM interprets `null` as `VT_NULL`, causing type mismatch errors (this was the root cause of SelectByID2 failures).
100
+ - **Feature tree traversal over SelectByID2**: `FeatureByPositionReverse()` + `GetTypeName2()` is more reliable for finding sketches than `SelectByID2`.
101
+ - **Winston logger only**: Never use `console.*` - it corrupts the JSON-RPC stdio transport.
102
+
103
+ ## Development
104
+
105
+ ```bash
106
+ npm run build # TypeScript compile
107
+ npm run dev # Hot-reload dev server (tsx watch)
108
+ npm run check # TypeScript + Biome lint in one command
109
+ npm run lint # Biome lint check
110
+ npm run lint:fix # Biome auto-fix
111
+ npm run format # Biome format
112
+ npm run typecheck # Type check without emit
113
+ ```
114
+
115
+ ## Testing
116
+
117
+ See [TESTING.md](TESTING.md) for the full testing guide.
118
+
119
+ ```bash
120
+ # Unit tests (mock adapter, no SolidWorks needed)
121
+ USE_MOCK_SOLIDWORKS=true npm test
122
+
123
+ # Watch mode
124
+ npm run test:watch
125
+ ```
126
+
127
+ **Current test status**: Unit tests exist for config and environment utilities. Most tool modules lack test coverage. Integration tests require a Windows machine with SolidWorks and have not been run in CI.
128
+
129
+ ## Known Issues & Limitations
130
+
131
+ - **No CI integration testing** - Tests only run against mocks. Real SolidWorks integration tests require a self-hosted Windows runner that doesn't exist yet.
132
+ - **winax compilation** - Must be compiled locally on each machine. No pre-built binaries.
133
+ - **Edge.js adapter** - Defined in architecture but not implemented.
134
+ - **PowerShell bridge** - Defined in architecture but not implemented.
135
+ - **Connection pooling / circuit breaker** - Referenced in code but not battle-tested.
136
+ - **Performance metrics are unverified** - No real benchmarking has been done.
137
+
138
+ ## What Has Worked
139
+
140
+ Based on development testing:
141
+
142
+ - Connecting to a running SolidWorks instance via COM
143
+ - Creating sketch planes and basic sketch geometry
144
+ - Simple extrusions with limited parameters
145
+ - Feature tree traversal for sketch selection
146
+ - VBA macro code generation (execution path needs more testing)
147
+
148
+ ## Roadmap
149
+
150
+ - [ ] Comprehensive integration test suite on real SolidWorks
151
+ - [ ] CI with self-hosted Windows runner
152
+ - [ ] Validate all modeling tools end-to-end
153
+ - [ ] Validate drawing and export tools
154
+ - [ ] Edge.js adapter for .NET runtime path
155
+ - [ ] PowerShell bridge as alternative COM path
156
+ - [ ] Performance benchmarking with real metrics
157
+
158
+ ## Contributing
159
+
160
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
161
+
162
+ Key areas where help is needed:
163
+
164
+ - **Testing against real SolidWorks** - The biggest gap. If you have SolidWorks, running tools and reporting results is extremely valuable.
165
+ - **COM interop edge cases** - Different SolidWorks versions behave differently.
166
+ - **Additional tool implementations** - Many SolidWorks API methods aren't exposed yet.
167
+
168
+ ## Troubleshooting
169
+
170
+ ### COM Registration Issues
171
+ ```powershell
172
+ regsvr32 "C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\sldworks.tlb"
173
+ ```
174
+
175
+ ### Build Issues
176
+ ```bash
177
+ rm -rf node_modules dist
178
+ npm install
179
+ npm run build
180
+ ```
181
+
182
+ ### Debug Logging
183
+ ```bash
184
+ ENABLE_LOGGING=true LOG_LEVEL=debug node dist/index.js
185
+ ```
186
+
187
+ ## License
188
+
189
+ MIT - See [LICENSE](LICENSE)
190
+
191
+ ## Acknowledgments
192
+
193
+ - [winax](https://github.com/nicedreams/node-activex) - COM bridge for Node.js
194
+ - [Anthropic MCP](https://modelcontextprotocol.io) - Model Context Protocol
195
+ - SolidWorks API documentation