# vespo92/solidworksmcp-ts architecture

> Architecture diagram of the GitHub repository vespo92/solidworksmcp-ts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vespo92/solidworksmcp-ts
- Repository: https://github.com/vespo92/solidworksmcp-ts

## Overview

SolidWorks MCP Server exposes CAD automation to MCP clients over stdio. The main workflow is client request → registered tool → SolidWorks API → COM or generated VBA execution. Separate tool domains cover modeling/sketches, drawings/export, analysis, and VBA/macros; resource features add design tables, PDM, templates, and persisted state. The README documents complexity-based routing; excerpts show API-to-COM loading and macro execution, but do not expose every registration or routing call, so those links are documented rather than inferred from imports.

Main entry points: [`src/index.ts`](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/index.ts) (MCP Server), [`src/solidworks/api.ts`](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/solidworks/api.ts) (SolidWorks API), [`src/resources/design-table.ts`](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/resources/design-table.ts) (Design Tables), [`src/resources/pdm.ts`](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/resources/pdm.ts) (PDM)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["MCP Entry"]
  node_server["MCP Server<br/>[index.ts]"]
end

subgraph group_cad["CAD Operations"]
  node_modeling["Modeling<br/>[modeling.ts]"]
  node_sketch["Sketch<br/>[sketch.ts]"]
  node_drawing["Drawing<br/>[drawing.ts]"]
  node_export["Export<br/>[export.ts]"]
  node_analysis["CAD Analysis<br/>[analysis.ts]"]
  node_vba["VBA Tools<br/>[vba.ts]"]
  node_native_macro["Native Macros<br/>[native-macro.ts]"]
  node_recorder["Macro Recorder<br/>[recorder.ts]"]
end

subgraph group_execution["Execution"]
  node_api["SolidWorks API<br/>[api.ts]"]
  node_complexity["Complexity Routing"]
  node_macro_generator["VBA Generator<br/>[macro-generator.ts]"]
  node_winax["COM Bridge<br/>[winax-loader.ts]"]
  node_macro_runner["Macro Runner<br/>[run-macro2.ts]"]
end

subgraph group_resources["Resources and State"]
  node_design_table["Design Tables<br/>[design-table.ts]"]
  node_pdm["PDM<br/>[pdm.ts]"]
  node_templates["Templates"]
  node_resource_base["Resource Base<br/>[base.ts]"]
  node_state[("Resource State<br/>[store.ts]")]
  node_database[("SQL Connections<br/>[connection.ts]")]
end

node_client(("MCP Client"))

node_client -->|"sends requests"| node_server
node_server -->|"registers tools"| node_modeling
node_server -->|"registers tools"| node_sketch
node_server -->|"registers tools"| node_drawing
node_server -->|"registers tools"| node_export
node_server -->|"registers tools"| node_analysis
node_server -->|"registers tools"| node_vba
node_server -->|"registers tools"| node_native_macro
node_server -->|"runs resource"| node_design_table
node_server -->|"runs resource"| node_pdm
node_server -->|"persists state"| node_state
node_modeling -->|"calls API"| node_api
node_sketch -->|"calls API"| node_api
node_drawing -->|"calls API"| node_api
node_export -->|"calls API"| node_api
node_analysis -->|"calls API"| node_api
node_native_macro -->|"calls API"| node_api
node_api -->|"loads bridge"| node_winax
node_api -->|"runs macro"| node_macro_runner
node_server -.->|"routes by complexity"| node_complexity
node_complexity -.->|"generates VBA"| node_macro_generator
node_design_table -->|"executes against"| node_api
node_pdm -->|"executes against"| node_api
node_server -->|"registers tools"| node_templates
node_templates -->|"uses API"| node_api
node_design_table -->|"extends"| node_resource_base
node_pdm -->|"extends"| node_resource_base
node_server -.->|"supports recording"| node_recorder
node_design_table -->|"queries SQL"| node_database

click node_server "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/index.ts"
click node_modeling "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/modeling.ts"
click node_sketch "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/sketch.ts"
click node_drawing "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/drawing.ts"
click node_export "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/export.ts"
click node_analysis "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/analysis.ts"
click node_vba "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/vba.ts"
click node_native_macro "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/native-macro.ts"
click node_recorder "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/macro/recorder.ts"
click node_api "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/solidworks/api.ts"
click node_complexity "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/adapters/feature-complexity-analyzer.ts"
click node_macro_generator "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/adapters/macro-generator.ts"
click node_winax "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/adapters/winax-loader.ts"
click node_macro_runner "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/solidworks/run-macro2.ts"
click node_design_table "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/resources/design-table.ts"
click node_pdm "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/resources/pdm.ts"
click node_templates "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/template-manager.ts"
click node_resource_base "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/resources/base.ts"
click node_state "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/state/store.ts"
click node_database "https://github.com/vespo92/solidworksmcp-ts/blob/main/src/db/connection.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_client toneBlue
class node_modeling,node_sketch,node_drawing,node_export,node_analysis,node_vba,node_native_macro,node_recorder toneAmber
class node_api,node_complexity,node_macro_generator,node_winax,node_macro_runner toneMint
class node_design_table,node_pdm,node_templates,node_resource_base,node_state,node_database toneRose
```

## Components

### MCP Entry

- [MCP Server](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/index.ts): `src/index.ts`

### CAD Operations

- [Modeling](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/modeling.ts): `src/tools/modeling.ts`
- [Sketch](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/sketch.ts): `src/tools/sketch.ts`
- [Drawing](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/drawing.ts): `src/tools/drawing.ts`
- [Export](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/export.ts): `src/tools/export.ts`
- [CAD Analysis](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/analysis.ts): `src/tools/analysis.ts`
- [VBA Tools](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/vba.ts): `src/tools/vba.ts`
- [Native Macros](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/native-macro.ts): `src/tools/native-macro.ts`
- [Macro Recorder](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/macro/recorder.ts): `src/macro/recorder.ts`

### Execution

- [SolidWorks API](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/solidworks/api.ts): `src/solidworks/api.ts`
- [Complexity Routing](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/adapters/feature-complexity-analyzer.ts): `src/adapters/feature-complexity-analyzer.ts`
- [VBA Generator](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/adapters/macro-generator.ts): `src/adapters/macro-generator.ts`
- [COM Bridge](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/adapters/winax-loader.ts): `src/adapters/winax-loader.ts`
- [Macro Runner](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/solidworks/run-macro2.ts): `src/solidworks/run-macro2.ts`

### Resources and State

- [Design Tables](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/resources/design-table.ts): `src/resources/design-table.ts`
- [PDM](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/resources/pdm.ts): `src/resources/pdm.ts`
- [Templates](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/tools/template-manager.ts): `src/tools/template-manager.ts`
- [Resource Base](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/resources/base.ts): `src/resources/base.ts`
- [Resource State](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/state/store.ts): `src/state/store.ts`
- [SQL Connections](https://github.com/vespo92/solidworksmcp-ts/blob/main/src/db/connection.ts): `src/db/connection.ts`

### Other components

- **MCP Client**

## Connections

- MCP Client → MCP Server: sends requests (evidence: `README.md`)
- MCP Server → Modeling: registers tools (evidence: `README.md`)
- MCP Server → Sketch: registers tools (evidence: `README.md`)
- MCP Server → Drawing: registers tools (evidence: `src/index.ts`)
- MCP Server → Export: registers tools (evidence: `src/index.ts`)
- MCP Server → CAD Analysis: registers tools (evidence: `src/index.ts`)
- MCP Server → VBA Tools: registers tools (evidence: `src/index.ts`)
- MCP Server → Native Macros: registers tools (evidence: `src/index.ts`)
- MCP Server → Design Tables: runs resource (evidence: `src/index.ts`)
- MCP Server → PDM: runs resource (evidence: `src/index.ts`)
- MCP Server → Resource State: persists state (evidence: `src/index.ts`)
- Modeling → SolidWorks API: calls API (evidence: `src/tools/modeling.ts`)
- Sketch → SolidWorks API: calls API (evidence: `src/tools/sketch.ts`)
- Drawing → SolidWorks API: calls API (evidence: `src/tools/drawing.ts`)
- Export → SolidWorks API: calls API (evidence: `src/tools/export.ts`)
- CAD Analysis → SolidWorks API: calls API (evidence: `src/tools/analysis.ts`)
- Native Macros → SolidWorks API: calls API (evidence: `src/tools/native-macro.ts`)
- SolidWorks API → COM Bridge: loads bridge (evidence: `src/solidworks/api.ts`)
- SolidWorks API → Macro Runner: runs macro (evidence: `src/solidworks/api.ts`)
- MCP Server → Complexity Routing: routes by complexity (evidence: `README.md`)
- Complexity Routing → VBA Generator: generates VBA (evidence: `README.md`)
- Design Tables → SolidWorks API: executes against (evidence: `src/resources/design-table.ts`)
- PDM → SolidWorks API: executes against (evidence: `src/resources/pdm.ts`)
- MCP Server → Templates: registers tools (evidence: `src/index.ts`)
- Templates → SolidWorks API: uses API (evidence: `src/tools/template-manager.ts`)
- Design Tables → Resource Base: extends (evidence: `src/resources/design-table.ts`)
- PDM → Resource Base: extends (evidence: `src/resources/pdm.ts`)
- MCP Server → Macro Recorder: supports recording (evidence: `README.md`)
- Design Tables → SQL Connections: queries SQL (evidence: `src/resources/design-table.ts`)
