Skip to main content
Glama
hayward2007

SolidWorks MCP Server

by hayward2007
README.md
# SolidWorks MCP Server ๐Ÿ”ง

**Claude์—์„œ ์ž์—ฐ์–ด๋กœ SolidWorks๋ฅผ ์กฐ์ž‘ํ•˜๋Š” MCP ์„œ๋ฒ„**
**Control SolidWorks from Claude with natural language (Model Context Protocol)**

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![SolidWorks 2023-2025](https://img.shields.io/badge/SolidWorks-2023--2025-red.svg)](https://www.solidworks.com/)
[![MCP](https://img.shields.io/badge/MCP-Compatible-green.svg)](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.