SolidWorks MCP Server
by hayward2007
README.md
# SolidWorks MCP Server ๐ง
**Claude์์ ์์ฐ์ด๋ก SolidWorks๋ฅผ ์กฐ์ํ๋ MCP ์๋ฒ**
**Control SolidWorks from Claude with natural language (Model Context Protocol)**
[](LICENSE)
[](https://www.python.org/downloads/)
[](https://www.solidworks.com/)
[](https://modelcontextprotocol.io/)
**[ํ๊ตญ์ด](#ํ๊ตญ์ด) ยท [English](#english)**
> ์ด ์ ์ฅ์๋ [alisamsam/Solidworks-MCP](https://github.com/alisamsam/Solidworks-MCP) (MIT, Samsaam Ali Baig)๋ฅผ ๋ฐํ์ผ๋ก Windows ์ํด๋ฆญ ์ค์น, SolidWorks 2025 COM ํธํ์ฑ ์์ , ํ๊ตญ์ด SolidWorks ์ง์์ ๋ํ ๋ฒ์ ์
๋๋ค.
>
> Based on [alisamsam/Solidworks-MCP](https://github.com/alisamsam/Solidworks-MCP) (MIT, Samsaam Ali Baig), with a one-click Windows installer, SolidWorks 2025 COM fixes and support for localized (e.g. Korean) SolidWorks.
---
## ํ๊ตญ์ด
### ๋ชฉ์ฐจ
1. [์๊ฐ](#์๊ฐ)
2. [์๋ณธ ๋๋น ๋ณ๊ฒฝ ์ฌํญ](#์๋ณธ-๋๋น-๋ณ๊ฒฝ-์ฌํญ)
3. [์๊ตฌ ์ฌํญ](#์๊ตฌ-์ฌํญ)
4. [๋น ๋ฅธ ์์](#๋น ๋ฅธ-์์)
5. [์ค์น ์คํฌ๋ฆฝํธ๊ฐ ํ๋ ์ผ](#์ค์น-์คํฌ๋ฆฝํธ๊ฐ-ํ๋-์ผ)
6. [์๋ ์ค์ ](#์๋-์ค์ )
7. [์ฌ์ฉ ๋ฐฉ๋ฒ](#์ฌ์ฉ-๋ฐฉ๋ฒ)
8. [Text-to-CAD ์์
ํ๋ฆ](#text-to-cad-์์
-ํ๋ฆ)
9. [๋๊ตฌ ๋ชฉ๋ก](#๋๊ตฌ-๋ชฉ๋ก)
10. [execute_python ๊ณ ๊ธ ์ฌ์ฉ](#execute_python-๊ณ ๊ธ-์ฌ์ฉ)
11. [์ค๊ณ ์ง์ ๋ฒ ์ด์ค](#์ค๊ณ-์ง์-๋ฒ ์ด์ค)
12. [์ค์ ํ์ผ config.json](#์ค์ -ํ์ผ-configjson)
13. [๋ฌธ์ ํด๊ฒฐ](#๋ฌธ์ -ํด๊ฒฐ)
14. [์
๋ฐ์ดํธ์ ์ ๊ฑฐ](#์
๋ฐ์ดํธ์-์ ๊ฑฐ)
15. [๋ก๋๋งต](#๋ก๋๋งต)
16. [ํ๋ก์ ํธ ๊ตฌ์กฐ](#ํ๋ก์ ํธ-๊ตฌ์กฐ)
17. [๋ผ์ด์ ์ค์ ํฌ๋ ๋ง](#๋ผ์ด์ ์ค์-ํฌ๋ ๋ง)
### ์๊ฐ
SolidWorks MCP Server๋ Claude ๊ฐ์ AI ์์ด์ ํธ๊ฐ SolidWorks๋ฅผ ์ง์ ์กฐ์ํ๊ฒ ํด ์ฃผ๋ [Model Context Protocol](https://modelcontextprotocol.io/) ์๋ฒ์์. ๋ฉ๋ด๋ฅผ ํด๋ฆญํ๋ ๋์ ๋ง๋ค๊ณ ์ถ์ ํ์์ ๋ง๋ก ์ค๋ช
ํ๋ฉด, Claude๊ฐ SolidWorks COM API๋ก ํํธ๋ฅผ ๋ง๋ค๊ณ ์ค์ผ์น๋ฅผ ๊ทธ๋ฆฌ๊ณ ํผ์ฒ๋ฅผ ์ถ๊ฐํด์.
- ๋๊ตฌ 31๊ฐ: ์ฐ๊ฒฐ, ๋ฌธ์, ์ค์ผ์น, ํผ์ฒ, ์ ํธ๋ฆฌํฐ, SolidWorks API๋ฅผ ์ง์ ์คํํ๋ `execute_python`, ๊ฒ์ฆ(Text-to-CAD), ์ค๊ณ ์ง์ ๊ฒ์
- ์์ด์ ํธ์ฉ ์์
๊ท์น(ํ ํฐ ์ ์ฝ, ์ค๊ณ ๊ทผ๊ฑฐ)์ด ๋งค ์ธ์
์๋ ์ ์ฉ๋ผ์
- SolidWorks 2023โ2025 ์ง์, ์ค์น ๊ฒฝ๋ก ์๋ ํ์ง(๋ ์ง์คํธ๋ฆฌ)
- ๋จ์: mm, cm, m, inch, ft (๊ธฐ๋ณธ mm)
- ๋์ ๋ก๊ทธ: `solidworks_mcp/solidworks_mcp.log`
### ์๋ณธ ๋๋น ๋ณ๊ฒฝ ์ฌํญ
| ๊ตฌ๋ถ | ๋ด์ฉ |
|---|---|
| ์ค์น ์ค๋ฅ ์์ | `requirements.txt`์์ PyPI์ ์๋ `asyncio-compat`๋ฅผ ๋บ์ด์. ์ด ์ค ๋๋ฌธ์ `pip install -r requirements.txt`๊ฐ ํญ์ ์คํจํ์ด์. |
| ์์ ์ค๋ฅ ์์ | `mcp>=1.0.0,<2`๋ก ๊ณ ์ ํ์ด์. mcp 2.x๋ ์๋ฒ๊ฐ ์ฐ๋ `Server.list_tools()` / `call_tool()` ๋ฐ์ฝ๋ ์ดํฐ๋ฅผ ์์ ์, ์ค์น๋๋ฉด ์๋ฒ๊ฐ `AttributeError`๋ก ๋ฐ๋ก ๊บผ์ ธ์. |
| ์ํด๋ฆญ ์ค์น | `setup_windows.bat` + `setup_mcp.py`: ๊ฐ์ํ๊ฒฝ ์์ฑ, ํจํค์ง ์ค์น, ์๋ฒ ์๊ฐ ์ง๋จ, Claude Desktop ์๋ ๋ฑ๋ก๊น์ง ํ ๋ฒ์ ํด์. |
| SolidWorks 2025 COM ํธํ์ฑ | `automation/base.py`์ `_com_value()`๋ฅผ ์ถ๊ฐํด์ ๋ค์์ ๊ณ ์ณค์ด์. `list_open_documents`("๊ตฌ์ฑ์์ด ์์ต๋๋ค" ์ค๋ฅ), `get_document_info`(`'int' object is not callable` ์ค๋ฅ), `list_features`(์ฒซ ํผ์ฒ 1๊ฐ๋ง ๋์ค๊ณ ์ต์ ์ํ๊ฐ ํญ์ false). |
| ํ๊ตญ์ด SolidWorks ์ง์ | `create_sketch`๊ฐ "Front Plane"๋ง ์ฐพ์์ ํ๊ตญ์ด UI(์ ๋ฉด/์๋ฉด/์ฐ์ธก๋ฉด)์์ ์คํจํ๋ ๋ฌธ์ ๋ฅผ ๊ณ ์ณค์ด์. ์ด๋ฆ์ผ๋ก ๋ชป ์ฐพ์ผ๋ฉด ๊ธฐ๋ณธ ํ๋ฉด ์์๋ก ์ค์ ์ด๋ฆ์ ์ฐพ์์. |
| ์ ์ฅ์ ์ ๋ฆฌ | `.env` ์ ์ธ(์๋ณธ์๋ API ํค๊ฐ ๋ค์ด ์์๊ณ , ์๋ฒ๋ ์ด ํ์ผ์ ์ฐ์ง ์์์), `.venv/` ๋ฌด์, `.bat` ํ์ผ ์ค๋ฐ๊ฟ(CRLF) ๊ณ ์ . |
| Text-to-CAD ๊ฒ์ฆ ๋๊ตฌ | `model_report`, `render_views`, `export_model`, `check_interference`๋ฅผ ์ถ๊ฐํ๊ณ , `execute_python`์ ๋์ฐ๋ฏธ ์ฃผ์
๊ณผ `report` ์ต์
์ ๋ฃ์์ด์. |
| ์ค๊ณ ์ง์ ๋ฒ ์ด์ค | `knowledge/` ๋
ธํธ 10๊ฐ์ `knowledge_search`, `knowledge_get` ๋๊ตฌ. |
| ์์ด์ ํธ ๊ฐ์ด๋ | ์์
ํ๋ฆ, ํ ํฐ ์ ์ฝ, ๊ทผ๊ฑฐ ๊ท์น์ ์๋ฒ instructions๋ก ๋งค ์ธ์
์๋ ์ ์ฉํด์. |
| ์ถ๋ ฅ ํ ํฐ ์ ๊ฐ | `execute_python` ๊ฒฐ๊ณผ ์ค๋ณต ์ ๊ฑฐ, JSON ์์ถ ์ถ๋ ฅ(ํ๊ธ์ `\u` ์ด์ค์ผ์ดํ ์์ด), ํธ๋ ์ด์ค๋ฐฑ์ ์คํฌ๋ฆฝํธ ๋ถ๋ถ๋ง ๋จ๊ฒจ์. |
### ์๊ตฌ ์ฌํญ
- Windows 10 / 11 (64๋นํธ)
- SolidWorks 2023โ2025 (์ค์น ๋ฐ ๋ผ์ด์ ์ค ํ์)
- Python 3.10 ์ด์: python.org ์ค์นํ ๋๋ Python Install Manager(`py`) ๋ชจ๋ ๋ผ์
- Claude Desktop ๋๋ Claude Code
- ์ฒ์ ์ค์นํ ๋ ์ธํฐ๋ท ์ฐ๊ฒฐ (pip ํจํค์ง ๋ค์ด๋ก๋)
๊ฒ์ฆ ํ๊ฒฝ: SolidWorks 2025 (revision 33.5.0, ํ๊ตญ์ด UI), Python 3.14.7, Claude Desktop (Windows, Microsoft Store/MSIX ์ค์นํ).
### ๋น ๋ฅธ ์์
1. **์ ์ฅ์ ๋ฐ๊ธฐ**
```powershell
git clone https://github.com/hayward2007/solidworks-mcp.git
cd solidworks-mcp
```
ZIP์ผ๋ก ๋ฐ์์ ์์ถ์ ํ์ด๋ ๋ผ์. ํด๋ ๊ฒฝ๋ก๊ฐ Claude ์ค์ ์ ๊ธฐ๋ก๋๋๊น, ๋์ค์ ํด๋๋ฅผ ์ฎ๊ธฐ๋ฉด ์ค์น๋ฅผ ๋ค์ ์คํํ์ธ์.
2. **Claude Desktop ์์ ํ ์ข
๋ฃ**: ์์
ํ์์ค ์ค๋ฅธ์ชฝ ์๋ ํธ๋ ์ด(**^** ์์ชฝ์ผ ์ ์์)์ Claude ์์ด์ฝ์ ์ฐํด๋ฆญํด์ **์ข
๋ฃ(Quit)** ๋ฅผ ๋๋ฅด์ธ์. ์ฐฝ๋ง ๋ซ์ผ๋ฉด ๋ฐฑ๊ทธ๋ผ์ด๋์์ ๊ณ์ ๋์๊ฐ์ ์ ์ค์ ์ ์ฝ์ง ์์์.
3. **`setup_windows.bat` ๋๋ธํด๋ฆญ** (๋๋ ํฐ๋ฏธ๋์์ `py setup_mcp.py`). Claude๊ฐ ์์ง ์คํ ์ค์ด๋ฉด ์คํฌ๋ฆฝํธ๊ฐ ์ข
๋ฃํ๋ผ๊ณ ์๋ ค ์ค์. ๋ง์ง๋ง์ `All set`์ด ๋์ค๋ฉด ๋์ด์์.
4. **SolidWorks๋ฅผ ์ด๊ณ Claude Desktop ์คํ** โ Claude์๊ฒ "SolidWorks์ ์ฐ๊ฒฐํด์ค"๋ผ๊ณ ๋งํ์ธ์.
Claude์ ์ค์ (Settings) โ ๊ฐ๋ฐ์(Developer)์์ `solidworks` ์๋ฒ๊ฐ running์ผ๋ก ๋ณด์ด๋ฉด ์ ์์ด์์.
### ์ค์น ์คํฌ๋ฆฝํธ๊ฐ ํ๋ ์ผ
1. Python 3.10 ์ด์์ ์ฐพ์์: `py` ๋ฐ์ฒ โ PATH์ `python` โ `%LOCALAPPDATA%\Python\pythoncore-3.*`, `%LOCALAPPDATA%\Programs\Python\Python3*`, `%ProgramFiles%\Python3*` ์์.
2. ํ๋ก์ ํธ ํด๋์ ๊ฐ์ํ๊ฒฝ `.venv`๋ฅผ ๋ง๋ค์ด์ (์ด๋ฏธ ์์ผ๋ฉด ๋ค์ ์จ์).
3. `requirements.txt`๋ฅผ ์ค์นํด์ (`mcp` 1.x, `pywin32`, `python-dotenv`, `Pillow`).
4. ์๋ฒ ์๊ฐ ์ง๋จ: Claude Desktop๊ณผ ๊ฐ์ ๋ฐฉ์(stdio)์ผ๋ก ์๋ฒ๋ฅผ ๋์์ MCP ์ด๊ธฐํ์ ๋๊ตฌ ๋ชฉ๋ก์ ํ์ธํด์.
5. Claude Desktop ์ค์ ํ์ผ์ `solidworks` ์๋ฒ๋ฅผ ๋ฑ๋กํด์. ๋ค๋ฅธ ์๋ฒ์ ์ค์ ์ ๊ทธ๋๋ก ๋๊ณ , ๋ฐ๊พธ๊ธฐ ์ ์ `claude_desktop_config.json.bak-๋ ์ง-์๊ฐ` ๋ฐฑ์
์ ๋ง๋ค์ด์. Microsoft Store(MSIX) ์ค์นํ์ ์ค์ ์์น๋ ํจ๊ป ๊ฐฑ์ ํด์.
6. ํ๋ฉด์ ๋์จ ๋ด์ฉ์ `setup_mcp.log`์ ์ ์ฅํด์.
์ฌ๋ฌ ๋ฒ ์คํํด๋ ์์ ํด์. ์ด๋ฏธ ๋ฑ๋ก๋ผ ์์ผ๋ฉด `already up to date`๊ฐ ๋์์.
### ์๋ ์ค์
#### 1) ํจํค์ง ์ค์น
```powershell
cd C:\๊ฒฝ๋ก\Solidworks-MCP
py -m venv .venv
.venv\Scripts\python.exe -m pip install -r requirements.txt
```
#### 2) Claude Desktop
Claude โ ์ค์ โ ๊ฐ๋ฐ์ โ **์ค์ ํธ์ง(Edit Config)** ์ผ๋ก ์ด๋ฆฌ๋ `claude_desktop_config.json`์ `mcpServers`์ ์ถ๊ฐํ์ธ์.
```json
{
"mcpServers": {
"solidworks": {
"command": "C:\\๊ฒฝ๋ก\\Solidworks-MCP\\.venv\\Scripts\\python.exe",
"args": ["C:\\๊ฒฝ๋ก\\Solidworks-MCP\\solidworks_mcp_server.py"]
}
}
}
```
์ค์ ํ์ผ ์์น:
- ์ผ๋ฐ ์ค์น: `%APPDATA%\Claude\claude_desktop_config.json`
- Microsoft Store/MSIX ์ค์น: `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`
`"command": "python"` ๋์ `.venv` ์์ `python.exe` ์ ์ฒด ๊ฒฝ๋ก๋ฅผ ์ฐ๋ ์ด์ : PATH์ `python`์ด Microsoft Store ๋ณ์นญ์ด๊ฑฐ๋ ํจํค์ง๊ฐ ์๋ ๋ค๋ฅธ ๋ฒ์ ์ผ ์ ์์ด์์์. ์ ์ฅํ ๋ค์๋ Claude๋ฅผ ํธ๋ ์ด์์ ์์ ํ ์ข
๋ฃํ๊ณ ๋ค์ ์คํํ์ธ์.
#### 3) Claude Code
```powershell
claude mcp add --scope user solidworks -- "C:\๊ฒฝ๋ก\Solidworks-MCP\.venv\Scripts\python.exe" "C:\๊ฒฝ๋ก\Solidworks-MCP\solidworks_mcp_server.py"
claude mcp list
```
### ์ฌ์ฉ ๋ฐฉ๋ฒ
1. SolidWorks๋ฅผ ๋จผ์ ์ด์ด ๋์ธ์. ๊บผ์ ธ ์์ผ๋ฉด `connect_solidworks`๊ฐ ์ง์ ์คํํ๊ณ ์ต๋ 120์ด ๊ธฐ๋ค๋ ค์.
2. Claude์๊ฒ ํ์ ๋งํฌ๋ก ์์ฒญํ์ธ์. ๊ธธ์ด๋ ๋ฐ๋ก ๋งํ์ง ์์ผ๋ฉด mm์์.
์์:
- "SolidWorks์ ์ฐ๊ฒฐํด์ค"
- "์ ํํธ๋ฅผ ๋ง๋ค๊ณ , ์๋ฉด์ ๋ฐ์ง๋ฆ 30mm ์์ ๊ทธ๋ ค์ 15mm ๋์ถํด์ค"
- "์ ๋ฉด์ 100ร50mm ์ฌ๊ฐํ์ ๊ทธ๋ฆฌ๊ณ 20mm ๋์ถํ ๋ค์, ๊ฐ์ด๋ฐ์ ์ง๋ฆ 10mm ๊ตฌ๋ฉ์ ๊ดํต ์ปทํด์ค"
- "ํผ์ฒ ๋ชฉ๋ก ๋ณด์ฌ์ค" / "์ด๋ฆฐ ๋ฌธ์ ๋ชฉ๋ก ๋ณด์ฌ์ค" / "ํ์ฌ ๋ฌธ์ ์ ๋ณด ์๋ ค์ค"
- "C:\์์
\bracket.SLDPRT๋ก ์ ์ฅํด์ค"
- "execute_python์ผ๋ก ํ์ฌ ํํธ์ ๋ถํผ์ ์ง๋์ ๊ณ์ฐํด์ค"
Claude๋ ๋ณดํต `create_sketch` โ `draw_*` โ `close_sketch` โ `extrude_sketch` ์์๋ก ๋๊ตฌ๋ฅผ ์จ์. ์ค์ผ์น๊ฐ ์ด๋ฆฐ ์ฑ๋ก ๋จ์ผ๋ฉด `get_sketch_status`๋ก ์ํ๋ฅผ ํ์ธํ ์ ์์ด์.
### Text-to-CAD ์์
ํ๋ฆ
์งง๊ฑฐ๋ ๋ชจํธํ ์์ฒญ๋ ์์ด์ ํธ๊ฐ ์ฌ์์ผ๋ก ์ ๋ฆฌํ๊ณ , ๋ชจ๋ธ์ ์ง์ ๋ณด๊ณ ์ฌ๋ฉด์ ๋น ๋ฅด๊ฒ ๋ฐ๋ณตํ๊ฒ ํ๋ ํ๋ฆ์ด์์. ์๋ฒ instructions(`solidworks_mcp/instructions.md`)๋ก ๋งค ์ธ์
์๋ ์ ์ฉ๋ผ์.
1. **์ฌ์ ์ ๋ฆฌ**: ๋ชฉ์ , ํฌ๊ธฐ, ์ฐ๊ฒฐ๋ถ, ํ์คยท๋์, ๊ณต์ ยท์ฌ๋ฃ๋ฅผ 10์ค ์ด๋ด๋ก ์ ๋ฆฌํด์. ๋ชจ๋ ์์น์ ๊ทผ๊ฑฐ๋ฅผ ๋ถ์ฌ์. ์์๋ [req] ์๊ตฌ ์ฌํญยท๊ธฐ์กด ํ์ > [std] ๊ท๊ฒฉ > [calc] ๊ณ์ฐ > [cat] ์นดํ๋ก๊ทธยทํ์ธ๋ ๋ฏธ์ค๋ฏธ ํ๋ฒ > [dfm] ๊ณต์ ๊ท์น > [heur] ๊ฒฝํ์น > [neutral] ๊ทผ๊ฑฐ๊ฐ ์์ ๋์ ์ค๋ฆฝ๊ฐ(๋์นญ, 1:1, ๊ฐ์ ๊ฐ๊ฒฉ, R10 ํ์ค์, ์ ์ mm)์ด์์.
2. **ํ์ํ ์ง์๋ง ์กฐํ**: `knowledge_search`๋ก ์ฐพ๊ณ `knowledge_get`์ผ๋ก ํ ์น์
๋ง ์ฝ์ด์.
3. **๋จ๊ณ๋ณ ๋ชจ๋ธ๋ง**: ๋จ๊ณ๋ง๋ค `execute_python` ํ ๋ฒ, ํ๋ผ๋ฏธํฐ๋ ์คํฌ๋ฆฝํธ ๋งจ ์์ ๋ฌ์.
4. **๋งค ๋จ๊ณ ๊ฒ์ฆ**: `model_report`(์ค๋ฅยท๋ฐ๋ยท์น์ยท์ง๋, ์ฝ 200ํ ํฐ). ์ค์ํ ๋จ๊ณ์์๋ง `render_views`(2ร2 ์ด๋ฏธ์ง ์ฝ 800ํ ํฐ). ์ด์
๋ธ๋ฆฌ๋ `check_interference`.
5. **ํ์ง ๊ฒ์ดํธ**: ์ฌ์์ฑ ์ค๋ฅ ์์, ์๋ํ ๋ฐ๋ ์, ์ฌ์ ์น์ ์ผ์น, ์๋์น ์์ ๊ฐ์ญ ์์, ๊ณต์ ๊ท์น ์ถฉ์กฑ. ํต๊ณผํด์ผ ๋ค์ ๋จ๊ณ๋ก ๋์ด๊ฐ์.
6. **์งง์ ๋ณด๊ณ **: ํต์ฌ ์น์์ ๊ทผ๊ฑฐ, ๊ฒ์ฆ ์์น, ๋ค์ ์ ํ์ง ์ต๋ 3๊ฐ.
ํ ํฐ ์ ์ฝ ์์ฝ: ์์ ํธ์ถ ์ฌ๋ฌ ๋ฒ ๋์ ๋จ๊ณ๋น ์คํฌ๋ฆฝํธ ํ๋, ํฐ ๋ฐ์ดํฐ๋ ์ถ๋ ฅํ์ง ์๊ธฐ, ์ด๋ฏธ์ง๋ ๋ง์ผ์คํค์์๋ง ์๊ฒ, ๋ค์ ์ธ ์ฝ๋๋ `store`์ ์ ์ฅ, ๊ฒ์ฆ๋ API ๋ ์ํผ(`knowledge_get("solidworks-api")`) ์ฌ์ฉ. ์์ธํ ๋ด์ฉ์ [knowledge/agent-guide.md](knowledge/agent-guide.md), ๊ทผ๊ฑฐ ๊ท์น์ [knowledge/design-policy.md](knowledge/design-policy.md)์ ์์ด์.
### ๋๊ตฌ ๋ชฉ๋ก
๊ธธ์ด ์ธ์๊ฐ ์๋ ๋๊ตฌ๋ ๋ชจ๋ ์ ํ ์ธ์ `unit`(mm, cm, m, inch, ft)์ ๋ฐ์์. ๋น์ฐ๋ฉด ๊ธฐ๋ณธ ๋จ์(๊ธฐ๋ณธ mm)๋ฅผ ์จ์.
| ๋ถ๋ฅ | ๋๊ตฌ | ํ๋ ์ผ | ์ฃผ์ ์ธ์ |
|---|---|---|---|
| ์ฐ๊ฒฐ | `connect_solidworks` | ์คํ ์ค์ธ SolidWorks์ ์ฐ๊ฒฐ (๊บผ์ ธ ์์ผ๋ฉด ์คํ) | - |
| ์ฐ๊ฒฐ | `get_solidworks_info` | ์ค์น ์ ๋ณด (๋ฒ์ , ๊ฒฝ๋ก, ํ
ํ๋ฆฟ) | - |
| ๋ฌธ์ | `create_new_part` | ์ ํํธ | - |
| ๋ฌธ์ | `create_new_assembly` | ์ ์ด์
๋ธ๋ฆฌ | - |
| ๋ฌธ์ | `open_document` | ํ์ผ ์ด๊ธฐ | `filepath` (ํ์) |
| ๋ฌธ์ | `save_document` | ์ ์ฅ (๊ฒฝ๋ก๋ฅผ ์ฃผ๋ฉด ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ์ ์ฅ) | `filepath` |
| ๋ฌธ์ | `close_document` | ํ์ฑ ๋ฌธ์ ๋ซ๊ธฐ | `save` (๊ธฐ๋ณธ false) |
| ๋ฌธ์ | `get_document_info` | ํ์ฑ ๋ฌธ์ ์ด๋ฆ, ๊ฒฝ๋ก, ์ข
๋ฅ | - |
| ๋ฌธ์ | `list_open_documents` | ์ด๋ฆฐ ๋ฌธ์ ๋ชฉ๋ก | - |
| ์ค์ผ์น | `create_sketch` | ๊ธฐ๋ณธ ํ๋ฉด์ ์ค์ผ์น ์์ | `plane`: Front / Top / Right (= ์ ๋ฉด / ์๋ฉด / ์ฐ์ธก๋ฉด) |
| ์ค์ผ์น | `create_sketch_on_face` | 3D ์ขํ๋ก ๊ณ ๋ฅธ ๋ฉด ์์ ์ค์ผ์น | `x`, `y`, `z` |
| ์ค์ผ์น | `draw_line` | ์ | `x1`, `y1`, `x2`, `y2` |
| ์ค์ผ์น | `draw_circle` | ์ | `x`, `y`, `radius` |
| ์ค์ผ์น | `draw_rectangle` | ๋ ๋ชจ์๋ฆฌ๋ก ์ฌ๊ฐํ | `x1`, `y1`, `x2`, `y2` |
| ์ค์ผ์น | `draw_arc` | ์ค์ฌยท๋ฐ์ง๋ฆยท์์/๋ ๊ฐ๋(ยฐ)๋ก ํธ | `cx`, `cy`, `radius`, `start_angle`, `end_angle` |
| ์ค์ผ์น | `draw_polygon` | ์ ๋ค๊ฐํ | `cx`, `cy`, `radius`, `sides` |
| ์ค์ผ์น | `close_sketch` | ์ค์ผ์น ์ข
๋ฃ | - |
| ์ค์ผ์น | `get_sketch_status` | ์ค์ผ์น ์ํ ์ง๋จ | - |
| ํผ์ฒ | `extrude_sketch` | ๋์ถ ๋ณด์ค | `depth`, `both_directions` |
| ํผ์ฒ | `cut_extrude` | ๋์ถ ์ปท | `depth`, `through_all`, `both_directions` |
| ํผ์ฒ | `fillet_edges` | ์ ํํ ๋ชจ์๋ฆฌ์ ํ๋ | `radius` |
| ํผ์ฒ | `chamfer_edges` | ์ ํํ ๋ชจ์๋ฆฌ์ ๋ชจ๋ฐ๊ธฐ | `distance`, `angle` |
| ํผ์ฒ | `list_features` | ํผ์ฒ ํธ๋ฆฌ ๋ชฉ๋ก (์ด๋ฆ, ์ข
๋ฅ, ์ต์ ์ฌ๋ถ) | - |
| ์ ํธ | `set_units` | ๊ธฐ๋ณธ ๋จ์ ๋ณ๊ฒฝ | `unit`: mm / cm / m / inch |
| ์ ํธ | `execute_python` | SolidWorks API๋ฅผ ์ฐ๋ Python ์ฝ๋ ์คํ (๋์ฐ๋ฏธ ์ฃผ์
) | `code`, `report` |
| ๊ฒ์ฆ | `model_report` | ํ์ฑ ๋ฌธ์ ์์ฝ: ์ฌ์์ฑ ์ค๋ฅ, ํผ์ฒ, ๋ฐ๋, ๊ฒฝ๊ณ ์์(mm), ๋ถํผ, ์ง๋, ์ฌ์ง | - |
| ๊ฒ์ฆ | `render_views` | ํ์ค ๋ทฐ๋ฅผ ์์ ๋ผ๋ฒจ ์ด๋ฏธ์ง ํ๋๋ก (์ค์ผ์นยทํ๋ฉด ์จ๊น, ์ฌ์ฉ์ ๋ทฐ ๋ณต์) | `views`, `size`(๊ธฐ๋ณธ 384), `hide_references` |
| ๊ฒ์ฆ | `export_model` | STEP, STL, 3MF, IGES, Parasolid ๋ฑ์ผ๋ก ์ฌ๋ณธ ์ ์ฅ | `format`(๊ธฐ๋ณธ step), `path` |
| ๊ฒ์ฆ | `check_interference` | ์ด์
๋ธ๋ฆฌ ๋ถํ ์ฌ์ด ๊ฐ์ญ ๋ถํผ(mmยณ) | - |
| ์ง์ | `knowledge_search` | ์ค๊ณ ์ง์ ๋ฒ ์ด์ค ๊ฒ์ (ํ๊ธยท์์ด ํค์๋) | `query`, `limit` |
| ์ง์ | `knowledge_get` | ์น์
ํ๋, ์ฃผ์ ์ ์ฒด, ๋๋ `index` | `id` |
`fillet_edges`์ `chamfer_edges`๋ ๋ชจ์๋ฆฌ๊ฐ ๋จผ์ ์ ํ๋ผ ์์ด์ผ ํด์. SolidWorks์์ ์ง์ ๊ณ ๋ฅด๊ฑฐ๋ `execute_python`์ผ๋ก ์ ํํ์ธ์.
### execute_python ๊ณ ๊ธ ์ฌ์ฉ
๊ธฐ๋ณธ ๋๊ตฌ๋ก ์ ๋๋ ์์
(๋กํํธ, ํจํด, ์ด์
๋ธ๋ฆฌ ๋ฉ์ดํธ, ์ง๋ ํน์ฑ, ์ด๋ฏธ์ง ์ ์ฅ ๋ฑ)์ `execute_python`์ผ๋ก SolidWorks API๋ฅผ ์ง์ ์ธ ์ ์์ด์.
- ์ธ ์ ์๋ ๋ณ์: `sw`(SldWorks.Application), `doc`(ํ์ฑ ๋ฌธ์), `automation`(์๋ฒ์ SolidWorksAutomation ๊ฐ์ฒด), `win32com`, `pythoncom`, `math`, `os`, `json`
- ์ฃผ์
๋๋ ๋์ฐ๋ฏธ: `val`, `call`, `arr`, `strings`, `byref_int`, `byref_bool`, `select`(SelectByID2), `plane("front"/"top"/"right")`(ํ๊ตญ์ด ํ๋ฉด ์ด๋ฆ ์๋), `feats()`, `feat(์ด๋ฆ)`, `active()`, `report()`, `render(๋ทฐ)`, `store`(ํธ์ถ ์ฌ์ด์ ์ ์ง๋๋ dict), `mm`(0.001), `deg`(ฯ/180)
- `print()` ์ถ๋ ฅ๊ณผ `result` ๋ณ์ ๊ฐ์ด ๊ฒฐ๊ณผ๋ก ๋์์์. `report: true`๋ก ๋ถ๋ฅด๋ฉด ์คํ ๋ค ๋ชจ๋ธ ์์ฝ์ด ๋ถ๊ณ , `render()`๋ ์ด๋ฏธ์ง๋ฅผ ๊ฒฐ๊ณผ์ ๋ถ์ฌ์.
- ์ฝ๋๋ ์ด PC์์ ๊ทธ๋๋ก ์คํ๋๋๊น, ๋ฏฟ์ ์ ์๋ ์์ฒญ์๋ง ์ฐ์ธ์.
SolidWorks 2025๋ late binding์ผ๋ก ์ฐ๊ฒฐ๋ผ์ COM ํธ์ถ์ ์ฃผ์ํ ์ ์ด ์์ด์.
1. **์ธ์ ์๋ ๋ฉค๋ฒ๋ ์ ๊ทผํ๋ ์๊ฐ ์คํ๋ผ์.** `GetTitle`, `GetType`, `FirstFeature`, `GetNextFeature`, `GetFirstDocument` ๊ฐ์ ๋ฉค๋ฒ ๋ค์ `()`๋ฅผ ๋ถ์ด๋ฉด "๊ตฌ์ฑ์์ด ์์ต๋๋ค"(member not found)๋ `'int' object is not callable` ์ค๋ฅ๊ฐ ๋์.
2. **์ธ์ ์๋ ๋ฉ์๋๊ฐ ์๋ฑํ๊ฒ ์คํ๋๋ฉด** ํธ์ถ ์ ์ `obj._FlagAsMethod("๋ฉ์๋์ด๋ฆ")`์ ๋ถ๋ฅด์ธ์.
3. **์ซ์ ๋ฐฐ์ด ์ธ์**๋ `win32com.client.VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_R8, ๊ฐ๋ชฉ๋ก)`์ผ๋ก ๋๊ธฐ์ธ์.
4. **ํ๊ตญ์ด SolidWorks**์์๋ ๊ธฐ๋ณธ ํ๋ฉด๊ณผ ์์ ์ด๋ฆ์ด `์ ๋ฉด`, `์๋ฉด`, `์ฐ์ธก๋ฉด`, `์์ `์ด์์. ํ์ค ๋ทฐ๋ ์ด๋ฆ ๋์ ๋ฒํธ๋ฅผ ์ฐ์ธ์. ์: `doc.ShowNamedView2("", 7)` (๋ฑ๊ฐ ๋ณด๊ธฐ).
```python
P = dict(w=60.0, h=40.0, t=8.0) # w, h [req]; t [neutral, R10]
sm = doc.SketchManager
select(doc, plane("top"), "PLANE") # ํ๊ตญ์ด UI์์๋ "์๋ฉด"์ ์ฐพ์์
call(sm, "InsertSketch", True)
call(sm, "CreateCenterRectangle", 0, 0, 0, P["w"] / 2 * mm, P["h"] / 2 * mm, 0)
call(sm, "InsertSketch", True)
result = report() # ์ค๋ฅ, ๋ฐ๋, ๊ฒฝ๊ณ ์์, ์ง๋
```
### ์ค๊ณ ์ง์ ๋ฒ ์ด์ค
์์ด์ ํธ๊ฐ `knowledge/` ํด๋์ Markdown ๋
ธํธ๋ฅผ ๊ฒ์ํด์ ์จ์. ํ ํฐ์ ์๋ผ๋ ค๊ณ ๋ณธ๋ฌธ์ ์์ด๋ก ์ฐ๊ณ , ํ๊ธ ํค์๋๋ ํ๊ทธ์ ๊ฒ์ ์ฌ์ ์ผ๋ก ์ฐ๊ฒฐํ์ด์.
| ์ฃผ์ | ํ์ผ | ๋ด์ฉ |
|---|---|---|
| ์์ด์ ํธ ๊ฐ์ด๋ | `agent-guide.md` | ์์
ํ๋ฆ, ํ ํฐ ์ ์ฝ, ํ์ง ๊ฒ์ดํธ, ๋ณด๊ณ ํ์ |
| ์ค๊ณ ์ ์ฑ
| `design-policy.md` | ๊ทผ๊ฑฐ ์์, ์ค๋ฆฝ ๊ธฐ๋ณธ๊ฐ(๋์นญยท1:1ยทํ์ค์), ์์ ์จ, ํ์ ๊ธฐ๋ณธ๊ฐ |
| ๊ธฐ์ด | `gears.md` | ์ข
๋ฅ ์ ์ , ์คํผยทํฌ๋ฆฌ์ปฌยท๋ฒ ๋ฒจยท์คํ์ด๋ด ๋ฒ ๋ฒจยท์ยท์ ์ฑ ๊ณต์, ๊ฐ๋, ๊ฒ์ฆ๋ ๋ชจ๋ธ๋ง ๋ฐฉ๋ฒ |
| ๋ฒ ์ด๋ง | `bearings.md` | ์ข
๋ฅ, 68xxยท69xxยท60xxยท62xx ์น์, ์๋ช
, ๋ผ์๋ง์ถค, ์๋ |
| ์ฒด๊ฒฐ | `fasteners.md` | ํผ์นยทํญ ๋๋ฆด, ISO 273 ๊ตฌ๋ฉ, ์นด์ดํฐ๋ณด์ด, ์ฒด๊ฒฐ ๊ธธ์ด, ํ ํฌ, ํ |
| ๊ณต์ฐจ | `fits-tolerances.md` | ISO 286 ๋ผ์๋ง์ถค ๊ฐ, IT ๋ฑ๊ธ, ISO 2768, 3D ํ๋ฆฐํ
๊ณต์ฐจ |
| ์ถยทํค | `shafts-keys.md` | ์ถ ์ค๊ณ์, ํค ์น์, ์ค๋
๋ง ํ, D์ปท |
| ์ฌ๋ฃ | `materials.md` | ๊ธ์ยทํ๋ผ์คํฑยท3D ํ๋ฆฐํ
์ฌ๋ฃ ๋ฌผ์ฑ |
| DFM | `dfm.md` | ๊ฐ๊ณต, ํ๊ธ, ์ฌ์ถ, FDMยทSLAยทSLS ๊ท์น |
| API ๋ ์ํผ | `solidworks-api.md` | ๊ฒ์ฆ๋ SolidWorks API ํธ์ถ (์ค์ผ์น, ๋กํํธ, ํจํด, ๊ตฌ์ฑ, ๋ฉ์ดํธ, ๊ฒ์ฌ) |
๋
ธํธ๋ฅผ ์ถ๊ฐํ๋ ค๋ฉด ๊ฐ์ ํ์(๋งจ ์ `title`, `tags`, `summary`์ `## ` ์น์
)์ผ๋ก `knowledge/`์ `.md` ํ์ผ์ ๋ฃ๊ณ Claude๋ฅผ ๋ค์ ์์ํ์ธ์. ์์น๋ฅผ ๋ฃ์ ๋๋ ์ถ์ฒ(๊ท๊ฒฉ ๋ฒํธ, ์นดํ๋ก๊ทธ)๋ฅผ ํจ๊ป ์ ์ด ์ฃผ์ธ์.
### ์ค์ ํ์ผ config.json
`solidworks_mcp/config.json`์ ๊ณ ์น๋ฉด ์ฝ๋๋ฅผ ๊ฑด๋๋ฆฌ์ง ์๊ณ ๋์์ ๋ฐ๊ฟ ์ ์์ด์. ๋ฐ๊พผ ๋ค์๋ Claude๋ฅผ ๋ค์ ์์ํ์ธ์.
| ํค | ๊ธฐ๋ณธ๊ฐ | ์ค๋ช
|
|---|---|---|
| `exe_path` | `"auto"` | `SLDWORKS.exe` ๊ฒฝ๋ก, `auto`๋ฉด ๋ ์ง์คํธ๋ฆฌ์์ ์ฐพ์ |
| `part_template`, `assembly_template`, `drawing_template` | `"auto"` | ์ ๋ฌธ์ ํ
ํ๋ฆฟ ๊ฒฝ๋ก |
| `startup_timeout` | `120` | SolidWorks ์คํ์ ๊ธฐ๋ค๋ฆฌ๋ ์๊ฐ(์ด) |
| `connection_retry_interval` | `5` | ์ฐ๊ฒฐ ์ฌ์๋ ๊ฐ๊ฒฉ(์ด) |
| `max_retries` | `3` | ์ฐ๊ฒฐ ์ฌ์๋ ํ์ |
| `default_unit` | `"mm"` | ๊ธฐ๋ณธ ๊ธธ์ด ๋จ์ |
| `log_level` | `"INFO"` | ๋ก๊ทธ ์์ค (DEBUG, INFO, WARNING, ERROR) |
| `log_file` | `"solidworks_mcp.log"` | ๋ก๊ทธ ํ์ผ ์ด๋ฆ (`solidworks_mcp` ํด๋ ์) |
| `default_extrude_depth`, `default_fillet_radius`, `default_chamfer_distance`, `default_circle_radius` | `10`, `2`, `2`, `25` | ์ธ์๋ฅผ ์๋ตํ์ ๋ ์ฐ๋ ๊ฐ(mm) |
### ๋ฌธ์ ํด๊ฒฐ
**Claude์ SolidWorks ๋๊ตฌ๊ฐ ์ ๋ณด์ฌ์**
1. Claude๋ฅผ ํธ๋ ์ด ์์ด์ฝ โ ์ข
๋ฃ(Quit)๋ก ์์ ํ ๋๊ณ ๋ค์ ์คํํ์ธ์.
2. ์ค์ โ ๊ฐ๋ฐ์์์ `solidworks` ์ํ๋ฅผ ํ์ธํ์ธ์.
3. `setup_mcp.log`์์ `could not update` ๊ฐ์ ๋ฉ์์ง๊ฐ ์๋์ง ๋ณด์ธ์.
4. Claude์ MCP ๋ก๊ทธ๋ฅผ ๋ณด์ธ์: `%APPDATA%\Claude\logs\mcp-server-solidworks.log` (MSIX ์ค์นํ์ `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\logs\`).
**`pip install -r requirements.txt`๊ฐ ์คํจํด์**: ์ด ์ ์ฅ์์ `requirements.txt`๋ฅผ ์ฐ๊ณ ์๋์ง ํ์ธํ์ธ์ (`asyncio-compat` ์์, `mcp<2`).
**์๋ฒ๊ฐ ๋ฐ๋ก ๊บผ์ง๊ณ ๋ก๊ทธ์ `'Server' object has no attribute 'list_tools'`๊ฐ ์์ด์**: mcp 2.x๊ฐ ์ค์น๋ ๊ฑฐ์์. `.venv\Scripts\python.exe -m pip install "mcp>=1,<2"`
**"๊ตฌ์ฑ์์ด ์์ต๋๋ค"(Member not found) ์ค๋ฅ**: ์ [execute_python ๊ณ ๊ธ ์ฌ์ฉ](#execute_python-๊ณ ๊ธ-์ฌ์ฉ)์ COM ๊ท์น์ ๋ณด์ธ์. ์ด ์ ์ฅ์์ ๊ธฐ๋ณธ ๋๊ตฌ๋ ์์ ๋ผ ์์ด์.
**์ฐ๊ฒฐ์ด ์ ๋ผ์**: SolidWorks๊ฐ ์คํ ์ค์ธ์ง, ๋ผ์ด์ ์ค๋ ์์ ๋ํ์์๊ฐ ๋ ์์ง ์์์ง ํ์ธํ์ธ์. `get_solidworks_info`๋ก ์ค์น๊ฐ ํ์ง๋๋์ง ๋ณด๊ณ , ์ ๋๋ฉด `config.json`์ `exe_path`์ ๊ฒฝ๋ก๋ฅผ ์ง์ ๋ฃ์ผ์ธ์.
**ํด๋๋ฅผ ์ฎ๊ฒผ์ด์**: `setup_windows.bat`์ ๋ค์ ์คํํ๋ฉด ๊ฒฝ๋ก๊ฐ ๊ฐฑ์ ๋ผ์.
### ์
๋ฐ์ดํธ์ ์ ๊ฑฐ
- ์
๋ฐ์ดํธ: `git pull` ํ `setup_windows.bat`์ ๋ค์ ์คํํ์ธ์ (์ ํจํค์ง๊ฐ ์ค์น๋ผ์).
- ์ ๊ฑฐ: Claude ์ค์ ํ์ผ์์ `solidworks` ํญ๋ชฉ์ ์ง์ฐ๊ณ `.venv` ํด๋๋ฅผ ์ญ์ ํ์ธ์. ์ค์น ์ ์ค์ ์ `claude_desktop_config.json.bak-*` ๋ฐฑ์
์ ์์ด์.
### ๋ก๋๋งต
SolidWorks ์ง์์ ๊ฐ์ฅ ๋จผ์ ํด์. ์งํ ์์:
- [x] **Text-to-CAD ๊ฒ์ฆ ๋ฃจํ**: `model_report`, `render_views`, `export_model`, `check_interference`, execute_python ๋์ฐ๋ฏธ
- [x] **์์ด์ ํธ ๊ฐ์ด๋**: ํ ํฐ ์ ์ฝ ๊ท์น๊ณผ ์ค๊ณ ๊ทผ๊ฑฐ ๊ท์น (์๋ฒ instructions)
- [x] **์ค๊ณ ์ง์ ๋ฒ ์ด์ค 1์ฐจ**: ์ค๊ณ ์ ์ฑ
, ๊ธฐ์ด, ๋ฒ ์ด๋ง, ์ฒด๊ฒฐ, ๊ณต์ฐจ, ์ถยทํค, ์ฌ๋ฃ, DFM, API ๋ ์ํผ
- [ ] **๋ถํ DB**: KS/ISO ํ์ค ๋ถํ ์น์ ํ์, ์ฌ์ฉ์๊ฐ ํ์ธํ ํ๊ตญ ๋ฏธ์ค๋ฏธ ํ๋ฒ ๋ฑ๋กยท๊ฒ์ (๋ฏธ์ค๋ฏธ ์ฌ์ดํธ๋ robots.txt์ ์ฝ๊ด์ด ์๋ ์์ง์ ๋ง์์ ํฌ๋กค๋งํ์ง ์์์)
- [ ] **๊ธฐ์ด ์์ฑ๊ธฐ**: ์คํผ, ํฌ๋ฆฌ์ปฌ, ๋ฒ ๋ฒจ, ์คํ์ด๋ด ๋ฒ ๋ฒจ (ํ๋ผ๋ฏธํฐ ๊ธฐ๋ฐ)
- [ ] **์ต์ ํ**: ํ ํด๋ก์ง ์ต์ ํ, ์ดยทCFD ํด์ (SOLIDWORKS Simulation, Flow Simulation API)
### ํ๋ก์ ํธ ๊ตฌ์กฐ
```
Solidworks-MCP/
โโโ setup_windows.bat # ์ํด๋ฆญ ์ค์น (๋๋ธํด๋ฆญ)
โโโ setup_mcp.py # ์ค์น ๋ก์ง: .venv, ํจํค์ง, ์๊ฐ ์ง๋จ, Claude ๋ฑ๋ก
โโโ solidworks_mcp_server.py # MCP ์๋ฒ ์ง์
์
โโโ requirements.txt
โโโ knowledge/ # ์ค๊ณ ์ง์ ๋ฒ ์ด์ค (Markdown ๋
ธํธ)
โโโ solidworks_mcp/
โ โโโ server.py # MCP ๋๊ตฌ ์ ์์ ์ฒ๋ฆฌ
โ โโโ instructions.md # ๋งค ์ธ์
์์ด์ ํธ์๊ฒ ์ฃผ๋ ์์
๊ท์น
โ โโโ verification.py # model_report, render_views, export_model, check_interference
โ โโโ knowledge.py # ์ง์ ๋ฒ ์ด์ค ๊ฒ์
โ โโโ com.py # late binding COM ๋์ฐ๋ฏธ (val, call, arr, plane ...)
โ โโโ config.py, config.json # ์ค์
โ โโโ constants.py # SolidWorks ์์
โ โโโ automation/ # base(์ฐ๊ฒฐ), documents, sketches, features
โ โโโ utils/ # ๋จ์ ๋ณํ, SolidWorks ์ค์น ํ์ง
โโโ scripts/ # ์๋ณธ ํ๋ก์ ํธ์ VBS ์์
โโโ solidworks_com.py, solidworks_simulation.py # ์๋ณธ ํ๋ก์ ํธ์ ์ด์ ๋ฒ์ ์คํฌ๋ฆฝํธ
โโโ DEVELOPMENT_ROADMAP.md # ์๋ณธ ํ๋ก์ ํธ์ ๊ฐ๋ฐ ๊ณํ
```
### ๋ผ์ด์ ์ค์ ํฌ๋ ๋ง
MIT ๋ผ์ด์ ์ค์์ ([LICENSE](LICENSE)). ์๋ณธ ํ๋ก์ ํธ: [alisamsam/Solidworks-MCP](https://github.com/alisamsam/Solidworks-MCP), Samsaam Ali Baig. ์๋ณธ ์ ์๊ถ ํ์์ ๋ผ์ด์ ์ค ๋ฌธ๊ตฌ๋ฅผ ์ ์งํด ์ฃผ์ธ์.
---
## English
### Contents
1. [Overview](#overview)
2. [Changes from the original](#changes-from-the-original)
3. [Requirements](#requirements)
4. [Quick start](#quick-start)
5. [What the installer does](#what-the-installer-does)
6. [Manual setup](#manual-setup)
7. [Usage](#usage)
8. [Text-to-CAD workflow](#text-to-cad-workflow)
9. [Tool reference](#tool-reference)
10. [Advanced: execute_python](#advanced-execute_python)
11. [Design knowledge base](#design-knowledge-base)
12. [Configuration (config.json)](#configuration-configjson)
13. [Troubleshooting](#troubleshooting)
14. [Updating and uninstalling](#updating-and-uninstalling)
15. [Roadmap](#roadmap)
16. [Project structure](#project-structure)
17. [License and credits](#license-and-credits)
### Overview
SolidWorks MCP Server is a [Model Context Protocol](https://modelcontextprotocol.io/) server that lets an AI agent such as Claude drive SolidWorks. Instead of clicking through menus, you describe the geometry you want and Claude builds it through the SolidWorks COM API: parts, sketches and features.
- 31 tools: connection, documents, sketches, features, utilities, `execute_python` for direct SolidWorks API access, verification (text-to-CAD) and design-knowledge search
- Agent working rules (token budget, design rationale) are applied automatically in every session
- SolidWorks 2023โ2025, installation auto-detected from the registry
- Units: mm, cm, m, inch, ft (default mm)
- Activity log: `solidworks_mcp/solidworks_mcp.log`
### Changes from the original
| Area | Change |
|---|---|
| Install fix | Removed `asyncio-compat` from `requirements.txt`. It does not exist on PyPI, so `pip install -r requirements.txt` always failed. |
| Startup fix | Pinned `mcp>=1.0.0,<2`. mcp 2.x removed the `Server.list_tools()` / `call_tool()` decorators this server uses, so the server crashed on startup with `AttributeError`. |
| One-click setup | `setup_windows.bat` + `setup_mcp.py` create the virtual environment, install packages, self-test the server and register it with Claude Desktop. |
| SolidWorks 2025 COM | Added `_com_value()` in `automation/base.py` and fixed `list_open_documents` ("Member not found"), `get_document_info` (`'int' object is not callable`) and `list_features` (returned only the first feature; suppression state was always false). |
| Localized SolidWorks | `create_sketch` only looked for "Front Plane", so it failed in non-English UIs (Korean: ์ ๋ฉด/์๋ฉด/์ฐ์ธก๋ฉด). It now falls back to the default planes' actual names. |
| Repository cleanup | `.env` removed (the original contained an API key; the server does not use it), `.venv/` ignored, CRLF line endings enforced for `.bat` files. |
| Text-to-CAD verification | Added `model_report`, `render_views`, `export_model`, `check_interference`; `execute_python` gets injected helpers and a `report` option. |
| Design knowledge base | 10 notes in `knowledge/` with `knowledge_search` and `knowledge_get`. |
| Agent guide | Workflow, token rules and rationale policy are sent as MCP server instructions in every session. |
| Fewer output tokens | No duplicated `execute_python` output, compact JSON without `\u` escapes, tracebacks trimmed to the script frames. |
### Requirements
- Windows 10 / 11 (64-bit)
- SolidWorks 2023โ2025, installed and licensed
- Python 3.10 or newer: the python.org installer or the Python Install Manager (`py`)
- Claude Desktop or Claude Code
- Internet access for the first install (pip packages)
Tested with SolidWorks 2025 (revision 33.5.0, Korean UI), Python 3.14.7 and Claude Desktop for Windows (Microsoft Store/MSIX build).
### Quick start
1. **Get the code**
```powershell
git clone https://github.com/hayward2007/solidworks-mcp.git
cd solidworks-mcp
```
A ZIP download works too. The folder path is written into Claude's config, so run the installer again if you move the folder later.
2. **Quit Claude Desktop completely**: right-click the Claude icon in the system tray (bottom-right, possibly under the **^** arrow) and choose **Quit**. Closing the window leaves it running in the background, and it will not read the new config.
3. **Double-click `setup_windows.bat`** (or run `py setup_mcp.py` in a terminal). If Claude is still running, the script asks you to quit it. You are done when it prints `All set`.
4. **Open SolidWorks, start Claude Desktop**, and ask Claude: "Connect to SolidWorks".
In Claude, Settings โ Developer should show the `solidworks` server as running.
### What the installer does
1. Finds Python 3.10+: the `py` launcher, then `python` on PATH, then `%LOCALAPPDATA%\Python\pythoncore-3.*`, `%LOCALAPPDATA%\Programs\Python\Python3*` and `%ProgramFiles%\Python3*`.
2. Creates a virtual environment in `.venv` inside the project folder (reuses a working one).
3. Installs `requirements.txt` (`mcp` 1.x, `pywin32`, `python-dotenv`, `Pillow`).
4. Self-test: starts the server over stdio, exactly like Claude Desktop does, and checks the MCP handshake and the tool list.
5. Registers the `solidworks` server in Claude Desktop's config. Other servers and settings are kept, and a `claude_desktop_config.json.bak-date-time` backup is written before any change. The Microsoft Store (MSIX) config location is updated too.
6. Saves everything it printed to `setup_mcp.log`.
It is safe to run again; an existing registration shows `already up to date`.
### Manual setup
#### 1) Install the packages
```powershell
cd C:\path\to\Solidworks-MCP
py -m venv .venv
.venv\Scripts\python.exe -m pip install -r requirements.txt
```
#### 2) Claude Desktop
Open Claude โ Settings โ Developer โ **Edit Config** and add this under `mcpServers` in `claude_desktop_config.json`:
```json
{
"mcpServers": {
"solidworks": {
"command": "C:\\path\\to\\Solidworks-MCP\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\Solidworks-MCP\\solidworks_mcp_server.py"]
}
}
}
```
Config file locations:
- Standard install: `%APPDATA%\Claude\claude_desktop_config.json`
- Microsoft Store/MSIX install: `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`
Use the full path to the `.venv` interpreter rather than `"command": "python"`: `python` on PATH may be the Microsoft Store alias or a different Python without the packages. After saving, quit Claude from the tray and start it again.
#### 3) Claude Code
```powershell
claude mcp add --scope user solidworks -- "C:\path\to\Solidworks-MCP\.venv\Scripts\python.exe" "C:\path\to\Solidworks-MCP\solidworks_mcp_server.py"
claude mcp list
```
### Usage
1. Open SolidWorks first. If it is not running, `connect_solidworks` starts it and waits up to 120 seconds.
2. Ask Claude in plain language. Lengths are in mm unless you say otherwise.
Examples:
- "Connect to SolidWorks"
- "Create a new part, draw a 30 mm radius circle on the Top plane and extrude it 15 mm"
- "Draw a 100 ร 50 mm rectangle on the Front plane, extrude it 20 mm, then cut a 10 mm hole through the center"
- "List the features" / "List open documents" / "Show the active document info"
- "Save it as C:\work\bracket.SLDPRT"
- "Use execute_python to compute the volume and mass of this part"
Claude typically chains `create_sketch` โ `draw_*` โ `close_sketch` โ `extrude_sketch`. If a sketch is left open, `get_sketch_status` shows its state.
### Text-to-CAD workflow
A loop that lets the agent turn short or vague requests into a spec, then build, look and measure, and iterate quickly. It is sent to the agent in every session as the server instructions (`solidworks_mcp/instructions.md`).
1. **Spec**: purpose, envelope, interfaces, loads/motion, process and material in at most ~10 lines. Every number gets a basis, in this order: [req] requirement or existing geometry > [std] standard > [calc] calculation > [cat] catalogue or user-verified MISUMI part > [dfm] process rule > [heur] rule of thumb > [neutral] a neutral value when nothing else applies (symmetry, 1:1, equal spacing, R10 preferred numbers, whole mm).
2. **Look up only what is needed**: `knowledge_search`, then `knowledge_get` for one section.
3. **Build in stages**: one `execute_python` call per stage, parameters at the top of the script.
4. **Verify every stage**: `model_report` (errors, bodies, box, mass; about 200 tokens), `render_views` only at milestones (2ร2 image about 800 tokens), `check_interference` for assemblies.
5. **Quality gate**: no rebuild errors, intended body count, dimensions match the spec, no unintended interference, process rules met, before moving on.
6. **Short report**: key dimensions with their basis, check numbers, at most 3 next options.
Token rules in short: one script per stage instead of many small calls, never print large data, small images only at milestones, keep reusable code in `store`, use the verified recipes (`knowledge_get("solidworks-api")`). Details: [knowledge/agent-guide.md](knowledge/agent-guide.md); rationale rules: [knowledge/design-policy.md](knowledge/design-policy.md).
### Tool reference
Every tool that takes lengths also accepts an optional `unit` (mm, cm, m, inch, ft); when omitted, the default unit (mm) is used.
| Category | Tool | What it does | Main arguments |
|---|---|---|---|
| Connection | `connect_solidworks` | Connect to the running SolidWorks (starts it if needed) | - |
| Connection | `get_solidworks_info` | Installation info (version, path, templates) | - |
| Documents | `create_new_part` | New part | - |
| Documents | `create_new_assembly` | New assembly | - |
| Documents | `open_document` | Open a file | `filepath` (required) |
| Documents | `save_document` | Save (Save As when a path is given) | `filepath` |
| Documents | `close_document` | Close the active document | `save` (default false) |
| Documents | `get_document_info` | Active document name, path and type | - |
| Documents | `list_open_documents` | Open documents | - |
| Sketches | `create_sketch` | Start a sketch on a default plane | `plane`: Front / Top / Right |
| Sketches | `create_sketch_on_face` | Sketch on the face found at a 3D point | `x`, `y`, `z` |
| Sketches | `draw_line` | Line | `x1`, `y1`, `x2`, `y2` |
| Sketches | `draw_circle` | Circle | `x`, `y`, `radius` |
| Sketches | `draw_rectangle` | Rectangle from two corners | `x1`, `y1`, `x2`, `y2` |
| Sketches | `draw_arc` | Arc from center, radius and start/end angles (ยฐ) | `cx`, `cy`, `radius`, `start_angle`, `end_angle` |
| Sketches | `draw_polygon` | Regular polygon | `cx`, `cy`, `radius`, `sides` |
| Sketches | `close_sketch` | Exit the active sketch | - |
| Sketches | `get_sketch_status` | Sketch diagnostics | - |
| Features | `extrude_sketch` | Boss-extrude | `depth`, `both_directions` |
| Features | `cut_extrude` | Cut-extrude | `depth`, `through_all`, `both_directions` |
| Features | `fillet_edges` | Fillet the selected edges | `radius` |
| Features | `chamfer_edges` | Chamfer the selected edges | `distance`, `angle` |
| Features | `list_features` | Feature tree (name, type, suppressed) | - |
| Utilities | `set_units` | Change the default unit | `unit`: mm / cm / m / inch |
| Utilities | `execute_python` | Run Python with SolidWorks API access (helpers injected) | `code`, `report` |
| Verification | `model_report` | Active document summary: rebuild errors, features, bodies, bounding box (mm), volume, mass, material | - |
| Verification | `render_views` | One small labelled image of standard views (sketches/planes hidden, user's view restored) | `views`, `size` (default 384), `hide_references` |
| Verification | `export_model` | Save a copy as STEP, STL, 3MF, IGES, Parasolid, ... | `format` (default step), `path` |
| Verification | `check_interference` | Interference volumes (mmยณ) between assembly components | - |
| Knowledge | `knowledge_search` | Search the design knowledge base (Korean or English keywords) | `query`, `limit` |
| Knowledge | `knowledge_get` | One section, a whole topic, or `index` | `id` |
`fillet_edges` and `chamfer_edges` work on edges that are already selected; select them in SolidWorks or with `execute_python`.
### Advanced: execute_python
For anything the basic tools do not cover (lofts, patterns, assembly mates, mass properties, image export, ...) use `execute_python` to call the SolidWorks API directly.
- Available names: `sw` (SldWorks.Application), `doc` (active document), `automation` (the server's SolidWorksAutomation object), `win32com`, `pythoncom`, `math`, `os`, `json`
- Injected helpers: `val`, `call`, `arr`, `strings`, `byref_int`, `byref_bool`, `select` (SelectByID2), `plane("front"/"top"/"right")` (localized plane names), `feats()`, `feat(name)`, `active()`, `report()`, `render(views)`, `store` (a dict kept between calls), `mm` (0.001), `deg` (ฯ/180)
- Whatever you `print()` and the value of `result` are returned. With `report: true` the model report is appended; `render()` attaches an image.
- The code runs as-is on this PC, so only use it with requests you trust.
SolidWorks 2025 is reached through late binding, which has a few COM pitfalls:
1. **Zero-argument members run as soon as you access them.** Adding `()` after members such as `GetTitle`, `GetType`, `FirstFeature`, `GetNextFeature` or `GetFirstDocument` raises "Member not found" or `'int' object is not callable`.
2. **If a method that takes arguments misbehaves**, call `obj._FlagAsMethod("MethodName")` before calling it.
3. **Pass numeric arrays** as `win32com.client.VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_R8, values)`.
4. **Localized SolidWorks** uses localized names for the default planes and origin (Korean: `์ ๋ฉด`, `์๋ฉด`, `์ฐ์ธก๋ฉด`, `์์ `). Use view IDs instead of view names, for example `doc.ShowNamedView2("", 7)` for isometric.
```python
P = dict(w=60.0, h=40.0, t=8.0) # w, h [req]; t [neutral, R10]
sm = doc.SketchManager
select(doc, plane("top"), "PLANE") # also finds the localized Top plane
call(sm, "InsertSketch", True)
call(sm, "CreateCenterRectangle", 0, 0, 0, P["w"] / 2 * mm, P["h"] / 2 * mm, 0)
call(sm, "InsertSketch", True)
result = report() # errors, bodies, box, mass
```
### Design knowledge base
The agent searches the Markdown notes in `knowledge/`. Notes are written in English to save tokens; Korean keywords are linked through tags and a search dictionary.
| Topic | File | Contents |
|---|---|---|
| Agent guide | `agent-guide.md` | workflow, token rules, quality gate, report format |
| Design policy | `design-policy.md` | basis ladder, neutral defaults (symmetry, 1:1, preferred numbers), safety factors, geometry defaults |
| Gears | `gears.md` | type selection; spur, helical, bevel, spiral bevel, worm, planetary formulas; strength; verified modeling recipe |
| Bearings | `bearings.md` | types, 68xx/69xx/60xx/62xx dimensions, life, fits, shoulders |
| Fasteners | `fasteners.md` | pitches and tap drills, ISO 273 holes, counterbores, engagement, torque, pins |
| Fits and tolerances | `fits-tolerances.md` | ISO 286 fit values, IT grades, ISO 2768, 3D printing allowances |
| Shafts and keys | `shafts-keys.md` | shaft sizing, key dimensions, retaining ring grooves, D-cuts |
| Materials | `materials.md` | metals, plastics and 3D printing materials |
| DFM | `dfm.md` | machining, sheet metal, injection moulding, FDM/SLA/SLS rules |
| API recipes | `solidworks-api.md` | verified SolidWorks API calls (sketches, lofts, patterns, configurations, mates, checks) |
To add a note, put a `.md` file in `knowledge/` with the same layout (`title`, `tags`, `summary` at the top, `## ` sections) and restart Claude. Give a source (standard number, catalogue) for every value.
### Configuration (config.json)
Edit `solidworks_mcp/config.json` to change behavior without touching code, then restart Claude.
| Key | Default | Description |
|---|---|---|
| `exe_path` | `"auto"` | Path to `SLDWORKS.exe`; `auto` reads the registry |
| `part_template`, `assembly_template`, `drawing_template` | `"auto"` | Templates for new documents |
| `startup_timeout` | `120` | Seconds to wait for SolidWorks to start |
| `connection_retry_interval` | `5` | Seconds between connection retries |
| `max_retries` | `3` | Connection retries |
| `default_unit` | `"mm"` | Default length unit |
| `log_level` | `"INFO"` | DEBUG, INFO, WARNING or ERROR |
| `log_file` | `"solidworks_mcp.log"` | Log file name (inside `solidworks_mcp`) |
| `default_extrude_depth`, `default_fillet_radius`, `default_chamfer_distance`, `default_circle_radius` | `10`, `2`, `2`, `25` | Values used when an argument is omitted (mm) |
### Troubleshooting
**The SolidWorks tools don't show up in Claude**
1. Quit Claude from the tray icon (Quit) and start it again.
2. Check the `solidworks` server under Settings โ Developer.
3. Look for `could not update` messages in `setup_mcp.log`.
4. Read Claude's MCP log: `%APPDATA%\Claude\logs\mcp-server-solidworks.log` (MSIX build: `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\logs\`).
**`pip install -r requirements.txt` fails**: make sure you are using this repository's `requirements.txt` (no `asyncio-compat`, `mcp<2`).
**The server exits immediately and the log shows `'Server' object has no attribute 'list_tools'`**: mcp 2.x got installed. Run `.venv\Scripts\python.exe -m pip install "mcp>=1,<2"`.
**"Member not found" errors**: see the COM rules in [Advanced: execute_python](#advanced-execute_python). The built-in tools in this repository are already fixed.
**It can't connect**: check that SolidWorks is running and that no license or startup dialog is open. Run `get_solidworks_info` to see whether the installation is detected; if not, set `exe_path` in `config.json`.
**You moved the folder**: run `setup_windows.bat` again to update the paths.
### Updating and uninstalling
- Update: `git pull`, then run `setup_windows.bat` again (installs new packages).
- Uninstall: remove the `solidworks` entry from Claude's config and delete the `.venv` folder. Your pre-install config is in the `claude_desktop_config.json.bak-*` backup.
### Roadmap
SolidWorks support comes first. Order of work:
- [x] **Text-to-CAD verification loop**: `model_report`, `render_views`, `export_model`, `check_interference`, execute_python helpers
- [x] **Agent guide**: token rules and design-rationale rules (server instructions)
- [x] **Design knowledge base v1**: design policy, gears, bearings, fasteners, fits, shafts and keys, materials, DFM, API recipes
- [ ] **Parts database**: KS/ISO standard part tables plus MISUMI Korea part numbers registered by the user (the MISUMI site's robots.txt and terms forbid automated collection, so it is not crawled)
- [ ] **Gear generators**: parametric spur, helical, bevel and spiral bevel gears
- [ ] **Optimization**: topology optimization, thermal and CFD studies (SOLIDWORKS Simulation and Flow Simulation APIs)
### Project structure
```
Solidworks-MCP/
โโโ setup_windows.bat # one-click installer (double-click)
โโโ setup_mcp.py # installer logic: .venv, packages, self-test, Claude registration
โโโ solidworks_mcp_server.py # MCP server entry point
โโโ requirements.txt
โโโ knowledge/ # design knowledge base (Markdown notes)
โโโ solidworks_mcp/
โ โโโ server.py # MCP tool definitions and handlers
โ โโโ instructions.md # working rules sent to the agent in every session
โ โโโ verification.py # model_report, render_views, export_model, check_interference
โ โโโ knowledge.py # knowledge base search
โ โโโ com.py # late-binding COM helpers (val, call, arr, plane, ...)
โ โโโ config.py, config.json # configuration
โ โโโ constants.py # SolidWorks constants
โ โโโ automation/ # base (connection), documents, sketches, features
โ โโโ utils/ # unit conversion, SolidWorks detection
โโโ scripts/ # VBS examples from the original project
โโโ solidworks_com.py, solidworks_simulation.py # earlier scripts from the original project
โโโ DEVELOPMENT_ROADMAP.md # the original project's development plan
```
### License and credits
MIT License ([LICENSE](LICENSE)). Original project: [alisamsam/Solidworks-MCP](https://github.com/alisamsam/Solidworks-MCP) by Samsaam Ali Baig. Please keep the original copyright notice and license text.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues