SolidWorks MCP Server
by Zerionn
README.md
# SolidWorks MCP Server š§
> Automate SolidWorks using natural language through Claude AI and the Model Context Protocol (MCP)
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/downloads/)
[](https://www.solidworks.com/)
[](https://modelcontextprotocol.io/)
---
## šÆ What is This?
**SolidWorks MCP Server** is a production-ready [Model Context Protocol](https://modelcontextprotocol.io/) server that lets Claude AI control SolidWorks through natural language. Instead of manually clicking through menus, you simply tell Claude what to design ā and it builds it for you.
**Example prompts you can use:**
- *"Create a new part, draw a circle with radius 30mm and extrude it 15mm"*
- *"Add a fillet of 2mm to all edges"*
- *"Draw a hexagon and cut extrude it 10mm"*
- *"List all features in the current part"*
---
## ⨠Features
- ā
**22 Tools** covering parts, sketches, features, and utilities
- ā
**SolidWorks 2023ā2025 Compatible** with version-aware API fallbacks
- ā
**Auto-detects SolidWorks** installation via Windows registry
- ā
**Multi-unit support** ā mm, cm, inch, meter, foot
- ā
**Modular architecture** ā clean, extensible Python package
- ā
**Robust error handling** ā cascading fallback chains for COM API
- ā
**JSON configuration** ā easy to customize without touching code
- ā
**Comprehensive logging** ā full debug output for troubleshooting
---
## š ļø Available Tools
| Category | Tool | Description |
|----------|------|-------------|
| **Connection** | `connect_solidworks` | Connect to running SolidWorks instance |
| **Connection** | `get_solidworks_info` | Get version and installation info |
| **Documents** | `create_new_part` | Create a new part document |
| **Documents** | `create_new_assembly` | Create a new assembly document |
| **Documents** | `open_document` | Open an existing SolidWorks file |
| **Documents** | `close_document` | Close the active document |
| **Documents** | `save_document` | Save the active document |
| **Documents** | `list_open_documents` | List all open documents |
| **Documents** | `use_active_document` | Work on the active document. Tools that change a document only act on the working document, set by this tool or by creating or opening one |
| **Parametric** | `add_dimension` | Add a driving dimension to the open sketch |
| **Parametric** | `add_sketch_relation` | Add a geometric relation between sketch entities |
| **Parametric** | `list_dimensions` | List dimensions, global variables and equations |
| **Parametric** | `set_dimension` | Change a dimension; restores it if the rebuild fails or SolidWorks does not apply it |
| **Parametric** | `add_equation` | Add a global variable or an equation |
| **Parametric** | `set_variable` | Change a global variable; restores it if the rebuild fails or a dimension does not take the value |
| **Assemblies** | `insert_component` | Insert a saved part or assembly with its origin at a position |
| **Assemblies** | `add_mate` | Relate two component faces: coincident, concentric, or parallel |
| **Assemblies** | `list_components` | List components with their position and rotation |
| **Assemblies** | `check_interference` | Check for components that overlap |
| **Sketches** | `create_sketch` | Create a sketch on a plane (Front/Top/Right) |
| **Sketches** | `close_sketch` | Exit the active sketch |
| **Sketches** | `draw_circle` | Draw a circle by center and radius |
| **Sketches** | `draw_rectangle` | Draw a rectangle by two corners |
| **Sketches** | `draw_line` | Draw a line exactly between two points. Ends join an existing point at the same position; a point that would move onto a nearby one is refused |
| **Sketches** | `draw_arc` | Draw an arc by center and angles |
| **Sketches** | `draw_polygon` | Draw a regular polygon (triangle, hex, etc.) |
| **Sketches** | `draw_centerline` | Draw a centerline, used as the axis of a revolve |
| **Features** | `extrude_sketch` | Boss-extrude the active sketch |
| **Features** | `revolve_sketch` | Revolve the sketch around its centerline, adding or cutting material |
| **Features** | `circular_pattern` | Repeat a feature around the axis of a round face |
| **Features** | `linear_pattern` | Repeat a feature along a model axis, or in a grid along two; refused if the copies change nothing |
| **Features** | `mirror_features` | Reflect features across a standard plane; refused if the copy changes nothing |
| **Features** | `shell` | Hollow the part, choosing the faces to remove by a point on each; refused if the walls do not fit |
| **Features** | `cut_extrude` | Cut-extrude to remove material |
| **Features** | `fillet_edges` | Add fillets to edges, chosen by a point on each edge or by the current selection |
| **Features** | `chamfer_edges` | Add chamfers to edges, chosen by a point on each edge or by the current selection |
| **Features** | `list_features` | List all features in the model |
| **Drawings** | `create_drawing` | Make a 2D drawing of a saved part with the configured template: front, top, right and isometric views at one scale (given, or the largest standard one that fits). Views, scale and layout are read back; on any mismatch the drawing is discarded |
| **Drawings** | `add_drawing_dimensions` | Insert the part's dimensions into the working drawing; reports how many, per view, with their values; refused if nothing new was inserted |
| **Export** | `export_pdf` | Export the working drawing to PDF; refuses to replace a file unless `overwrite`; reports path and size |
| **Export** | `export_step` | Export the working part or assembly to STEP (`.step`/`.stp`); refuses to replace a file unless `overwrite`; reports path, size and solids in the file |
| **Recipes** | `run_recipe` | Run a list of steps (existing tools with their arguments) in order in one call. Stops at the first error and reports which steps ran and the exact response of the one that failed. A step can save a result under a name (`save`) and later steps use it as `${name}`. Checked before running; only a list of allowed tools runs, never `save_document`, `close_document`, `open_document`, `use_active_document`, drawings or exports, and nothing is run as code. Returns a short summary, the saved names and the final volume |
| **Utilities** | `set_units` | Change default unit (mm/inch/cm/m/ft) |
---
## š Requirements
- **OS:** Windows 10 or Windows 11
- **SolidWorks:** 2023, 2024, or 2025 (must be installed and licensed)
- **Python:** 3.10 or higher
- **Claude:** Claude Desktop app or Claude Code
---
## ā” Quick Start
### 1. Clone the Repository
```bash
git clone https://github.com/Zerionn/solidworks-mcp.git
cd solidworks-mcp
```
### 2. Install Dependencies
```bash
pip install -r requirements.txt
```
### 3. Configure Claude Desktop
Add the following to your `claude_desktop_config.json`:
**Location:** `C:\Users\YOUR_NAME\AppData\Roaming\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"solidworks": {
"command": "python",
"args": ["C:\\path\\to\\solidworks-mcp\\solidworks_mcp_server.py"]
}
}
}
```
### 4. Launch
1. Open **SolidWorks** first
2. Restart **Claude Desktop**
3. In Claude, type: *"Connect to SolidWorks"*
4. Start designing! š
---
## š Project Structure
```
solidworks-mcp/
āāā solidworks_mcp_server.py # Entry point
āāā solidworks_mcp/ # Main package
ā āāā __init__.py # Package exports (v3.0.0)
ā āāā server.py # MCP server & tool definitions
ā āāā config.py # Configuration management
ā āāā recipes.py # run_recipe: validation, references, short summary
ā āāā config.json # Default settings
ā āāā constants.py # SolidWorks constants & enums
ā āāā automation/ # Core automation modules
ā ā āāā base.py # Connection management
ā ā āāā documents.py # Document operations
ā ā āāā sketches.py # Sketch operations
ā ā āāā drawings.py # Drawings, dimensions, PDF and STEP export
ā ā āāā features.py # Feature operations (SW 2025 fixed)
ā āāā utils/ # Utility modules
ā āāā units.py # Unit conversion system
ā āāā sw_finder.py # Auto-detect SolidWorks
āāā requirements.txt
āāā .gitignore
āāā DEVELOPMENT_ROADMAP.md # Future development plan
```
---
## āļø Configuration
Edit `solidworks_mcp/config.json` to customize behavior:
```json
{
"exe_path": "auto",
"default_unit": "mm",
"startup_timeout": 120,
"log_level": "INFO",
"default_extrude_depth": 10.0,
"default_fillet_radius": 2.0
}
```
| Setting | Default | Description |
|---------|---------|-------------|
| `exe_path` | `"auto"` | Path to SLDWORKS.exe or auto-detect |
| `default_unit` | `"mm"` | Default unit for all dimensions |
| `startup_timeout` | `120` | Seconds to wait for SW startup |
| `log_level` | `"INFO"` | Logging verbosity |
---
## š§ SolidWorks 2025 Compatibility
This server includes special handling for SolidWorks 2025 API changes:
- **Extrusion fallback chain:** `FeatureExtrusion3` ā `FeatureExtrusion2` ā `FeatureBossSimple`
- **Safe property access** for `feat.Name`, `feat.GetTypeName2()`, `IsSuppressed2()`
- **Registry-based** SolidWorks auto-detection
---
## š¤ Contributing
Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/my-feature`
3. Commit your changes: `git commit -m "Add my feature"`
4. Push to the branch: `git push origin feature/my-feature`
5. Open a Pull Request
---
## š License
This project is licensed under the **MIT License** ā see the [LICENSE](LICENSE) file for details.
---
## š¤ Author
**Samsaam Ali Baig**
- GitHub: [@alisamsam](https://github.com/alisamsam)
---
## š Acknowledgements
- [Anthropic](https://anthropic.com) for Claude AI and the MCP framework
- [SolidWorks](https://www.solidworks.com) COM API documentation
- Inspired by [ros2-claude-code-template](https://github.com/harunkurt/ros2-claude-code-template) by Harun KURT
---
ā **If this project helps you, please give it a star!**
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues