SolidWorks MCP Server — 让 Claude AI 通过自然语言控制 SolidWorks。61 个工具:草图、特征、曲线、装配、翼型导入、 分析、导出。支持 SW 2023-2025。SolidWorks MCP Server — Control SolidWorks with natural language via Claude AI. 61 tools: sketch, feature, curve, assembly, airfoil import, analysis & export. Supports SW 2023–2025.
SolidWorks MCP Server 🔧
Automate SolidWorks using natural language through Claude AI and the Model Context Protocol (MCP)
🎯 What is This?
SolidWorks MCP Server is a Model Context Protocol 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:
- "Create a new part, draw an airfoil sketch, and loft it into a wing"
- "Import this XYZ curve file and convert it to a sketch"
- "Assemble these two parts with coincident and concentric mates"
- "Export the active document as STEP and take a screenshot"
- "Run a self-review: check bounding box and export preview images"
✨ Features
- ✅ 61 Tools — sketches, features, curves, assemblies, analysis, export, review
- ✅ SolidWorks 2023–2025 Compatible with version-aware API fallbacks
- ✅ Auto-detects SolidWorks installation via Windows registry
- ✅ Airfoil import — download UIUC airfoils, import DAT/XYZ curves
- ✅ Multi-unit support — mm, cm, inch, meter, foot
- ✅ Assembly automation — add components, mates, interference check
- ✅ Self-review system — automated screenshot + pass/fail evaluation
- ✅ Modular architecture — 17 automation modules, clean separation of concerns
- ✅ Robust error handling — cascading fallback chains for COM API
- ✅ JSON configuration — easy to customize without touching code
🛠️ Available Tools (61 total)
| Category | Tools |
|----------|-------|
| Connection (2) | connect_solidworks, get_solidworks_info |
| Documents (6) | create_new_part, create_new_assembly, open_document, save_document, close_document, get_document_info, list_open_documents |
| Sketches (8) | create_sketch, create_sketch_on_face, close_sketch, get_sketch_status, draw_line, draw_circle, draw_rectangle, draw_arc, draw_polygon, draw_spline |
| Sketch Tools (3) | add_dimension, add_relation, rotate_sketch |
| Features (6) | extrude_sketch, cut_extrude, revolve, sweep, loft, shell |
| Feature Modifiers (4) | fillet_edges, chamfer_edges, draft, mirror, linear_pattern |
| Reference Geometry (2) | create_reference_plane, create_axis |
| Curves (4) | import_curve_xyz, translate_curve, copy_curve, curve_to_surface |
| Airfoil (4) | download_airfoil, download_airfoil_via_browser, import_airfoil_dat, save_airfoil_xyz |
| Assembly (4) | add_component, add_mate, add_mate_from_selection, list_mates |
| Selection (2) | select_by_name, get_selection |
| Analysis (4) | get_mass_properties, get_bounding_box, measure_distance, interference_check |
| Export & Review (3) | export_document, take_screenshot, run_review |
| Appearance (1) | set_appearance_enhanced |
| Utilities (3) | set_units, execute_python, list_features, get_feature_tree |
📋 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
git clone https://github.com/XD4REAL/solidworks-mcp.git
cd solidworks-mcp
2. Install Dependencies
pip install -r requirements.txt
3. Configure Claude
Claude Code (C:\Users\YOUR_NAME\.claude\.mcp.json):
{
"mcpServers": {
"solidworks": {
"command": "python",
"args": ["D:\\path\\to\\solidworks-mcp\\solidworks_mcp_server.py"]
}
}
}
Claude Desktop (C:\Users\YOUR_NAME\AppData\Roaming\Claude\claude_desktop_config.json):
{
"mcpServers": {
"solidworks": {
"command": "python",
"args": ["C:\\path\\to\\solidworks-mcp\\solidworks_mcp_server.py"]
}
}
}
4. Launch
- Open SolidWorks first
- Restart Claude Desktop or Claude Code
- Start designing! 🎉
📁 Project Structure
solidworks-mcp/
├── solidworks_mcp_server.py # Entry point
├── solidworks_com.py # Raw COM helpers (legacy)
├── solidworks_simulation.py # Simulation module
├── solidworks_mcp/ # Main package
│ ├── __init__.py # Package exports (v3.0.0)
│ ├── server.py # MCP server & tool definitions (61 tools)
│ ├── config.py # Configuration management
│ ├── config.json # Default settings
│ ├── constants.py # SolidWorks constants & enums
│ ├── automation/ # Core automation (17 modules)
│ │ ├── base.py # Connection management
│ │ ├── documents.py # Document operations
│ │ ├── sketches.py # Sketch primitives
│ │ ├── sketches_advanced.py # Advanced sketch (airfoil import, splines)
│ │ ├── features.py # Basic features (extrude, cut, fillet, etc.)
│ │ ├── features_advanced.py # Advanced features (loft, sweep, mirror, etc.)
│ │ ├── curves.py # XYZ curve import & manipulation
│ │ ├── airfoil.py # Airfoil download & DAT import
│ │ ├── assembly.py # Assembly operations & mates
│ │ ├── reference.py # Reference geometry (planes, axes)
│ │ ├── selection.py # Entity selection utilities
│ │ ├── analysis.py # Mass properties & measurements
│ │ ├── export.py # File export (STEP, STL, IGES)
│ │ ├── screenshot.py # View capture
│ │ └── review.py # Self-review & evaluation
│ └── utils/ # Utility modules
│ ├── units.py # Unit conversion system
│ └── sw_finder.py # Auto-detect SolidWorks
├── scripts/ # VBA helper scripts
│ └── *.vbs # VBScript examples
├── requirements.txt
├── .gitignore
├── .env.example
└── DEVELOPMENT_ROADMAP.md
⚙️ Configuration
Edit solidworks_mcp/config.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 |
Environment Variables (.env)
Copy .env.example to .env and configure:
| Variable | Description |
|----------|-------------|
| SOLIDWORKS_EXE_PATH | Override auto-detected SW path |
| DEFAULT_UNIT | Default unit (mm, inch, etc.) |
| LOG_LEVEL | Logging level (DEBUG, INFO, WARNING, ERROR) |
🔧 SolidWorks 2025 Compatibility
This server includes special handling for SolidWorks 2025 API changes:
- Extrusion fallback chain:
FeatureExtrusion3→FeatureExtrusion2→FeatureBossSimple - Late-binding COM support for SW 2024 (some advanced features require manual execution)
- Safe property access for
feat.Name,feat.GetTypeName2(),IsSuppressed2() - Registry-based SolidWorks auto-detection
Known SW COM Limitations
| API | Status | Alternative |
|-----|--------|-------------|
| InsertProtrusionBlend2 | Returns None | Manual loft |
| InsertMirrorFeature | Returns None | Manual mirror |
| CreateSpline | Not available | XYZ curve import + Convert Entities |
| InsertDome | Not available | Manual dome |
| SketchUseEdge2 | ✅ Available | — |
| CreateLine2 | ✅ Available | — |
🤝 Contributing
Contributions welcome!
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -m "Add my feature" - Push:
git push origin feature/my-feature - Open a Pull Request
📄 License
MIT License — see LICENSE for details.
👤 Authors
- Original author: Samsaam Ali Baig (@alisamsam)
- Enhanced by: XD4REAL — added 39 tools (airfoil, curves, assembly, analysis, review, advanced features)
⭐ If this project helps you, please give it a star!