Skip to main content
Glama
moony211

kiwoom-private-mcp-server

by moony211
README.md
# πŸ“Š kiwoom-private-mcp-server

ν‚€μ›€μ¦κΆŒ REST APIλ₯Ό ν™œμš©ν•˜μ—¬ 주식 κ³„μ’Œ 정보 및 보유 μ’…λͺ©μ˜ 평가 ν˜„ν™©μ„ μ‘°νšŒν•  수 μžˆλŠ” 개인용 Model Context Protocol (MCP) μ„œλ²„μž…λ‹ˆλ‹€. 
Claude Desktop, Cursor λ“± LLM ν΄λΌμ΄μ–ΈνŠΈμ™€ μ—°λ™ν•˜μ—¬ AIκ°€ 직접 투자 μžμ‚° ν˜„ν™©μ„ νŒŒμ•…ν•˜κ³  μ„Ήν„° 적합도 뢄석 등을 μˆ˜ν–‰ν•  수 μžˆλ„λ‘ λ•μŠ΅λ‹ˆλ‹€.

---

## πŸš€ μ£Όμš” κΈ°λŠ₯ (MCP Tools)

* **`get_accounts`**: μ‚¬μš©μžκ°€ μ •μ˜ν•œ ν‚€μ›€μ¦κΆŒ κ³„μ’Œ λͺ©λ‘κ³Ό 각 κ³„μ’Œλ³„ νƒ€κ²Ÿ μ„Ήν„° 정보λ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€.
* **`get_account_balance`**: νŠΉμ • κ³„μ’Œμ˜ 총 평가 μžμ‚°, κ°œλ³„ 보유 μ’…λͺ©μ˜ 평가 κΈˆμ•‘, 비쀑, 평단가 및 수읡λ₯ μ„ μ‘°νšŒν•©λ‹ˆλ‹€. (μ‹€μ œ μ„œλ²„ API 연동 및 λͺ¨μ˜ Mock 쑰회 지원)

---

## πŸ› οΈ μš”κ΅¬ 사항 및 기술 μŠ€νƒ

* **Python**: `3.10` 이상
* **μ˜μ‘΄μ„± 도ꡬ**:
  * [**uv**](https://github.com/astral-sh/uv): Rust 기반으둜 개발된 μ΄ˆκ³ μ† 파이썬 νŒ¨ν‚€μ§€/ν”„λ‘œμ νŠΈ κ΄€λ¦¬μž
  * `mcp`: Anthropic Model Context Protocol SDK
  * `requests`: API HTTP 톡신 라이브러리
  * `python-dotenv`: 둜컬 ν™˜κ²½ λ³€μˆ˜(`.env`) λ‘œλ“œ 라이브러리

---

## πŸ“¦ μ„€μΉ˜ 및 둜컬 μ„€μ •

### 1. `uv` 도ꡬ μ„€μΉ˜ (Rust 기반의 μ΄ˆκ³ μ† νŒ¨ν‚€μ§€ λ§€λ‹ˆμ €)
터미널(PowerShell λ˜λŠ” bash)μ—μ„œ μ•„λž˜ λͺ…λ Ήμ–΄λ₯Ό μ‹€ν–‰ν•˜μ—¬ `uv`λ₯Ό μ„€μΉ˜ν•©λ‹ˆλ‹€.

* **Windows (PowerShell)**:
  ```powershell
  powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  ```
* **macOS / Linux**:
  ```bash
  curl -LsSf https://astral.sh/uv/install.sh | sh
  ```
* **κΈ°μ‘΄ pipλ₯Ό μ‚¬μš©ν•˜λŠ” 경우**:
  ```bash
  pip install uv
  ```

### 2. κ°€μƒν™˜κ²½ ꡬ좕 및 νŒ¨ν‚€μ§€ μ„€μΉ˜
ν”„λ‘œμ νŠΈ 루트 λ””λ ‰ν† λ¦¬μ—μ„œ λ‹€μŒ λͺ…령을 μ‚¬μš©ν•˜μ—¬ μ˜μ‘΄μ„±μ„ μ΄ˆκ³ μ†μœΌλ‘œ λ™κΈ°ν™”ν•©λ‹ˆλ‹€.
```bash
# κ°€μƒν™˜κ²½(.venv) 생성
uv venv

# pyproject.toml에 μ •μ˜λœ νŒ¨ν‚€μ§€ μ„€μΉ˜ 및 둜컬 ν”„λ‘œμ νŠΈ λΉŒλ“œ
uv pip install -e .
```

### 3. ν™˜κ²½ μ„€μ • 파일 ꡬ성
둜컬 λ³΄μ•ˆ 및 κ³„μ’Œ 정보 맀핑을 μœ„ν•΄ μ„€μ • ν…œν”Œλ¦Ώ νŒŒμΌλ“€μ„ λ³΅μ‚¬ν•˜μ—¬ μ‹€μ œ μ„€μ • νŒŒμΌμ„ μž‘μ„±ν•©λ‹ˆλ‹€. (이 νŒŒμΌλ“€μ€ `.gitignore`에 λ“±λ‘λ˜μ–΄ κΉƒ κ΄€λ¦¬μ—μ„œ λ°°μ œλ©λ‹ˆλ‹€.)

1. **ν™˜κ²½ λ³€μˆ˜ 파일 (`.env`) 생성**:
   `.env.example` νŒŒμΌμ„ λ³΅μ‚¬ν•˜μ—¬ `.env` νŒŒμΌμ„ λ§Œλ“€κ³  킀움 API 인증에 ν•„μš”ν•œ AppKey 및 SecretKeyλ₯Ό μž…λ ₯ν•©λ‹ˆλ‹€.
   ```bash
   cp .env.example .env
   ```
   * `KIWOOM_USE_MOCK=false`둜 μ„€μ •ν•˜λ©΄ μ‹€μ œ 킀움 API μ„œλ²„μ—μ„œ μ‹€μ‹œκ°„ 정보λ₯Ό κ°€μ Έμ˜΅λ‹ˆλ‹€. `true`일 경우 λ‚΄μž₯된 λͺ¨μ˜ 포트폴리였 정보λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.

2. **κ³„μ’Œ λ§€ν•‘ μ„€μ • 파일 (`accounts_config.json`) 생성**:
   `accounts_config.json.example` νŒŒμΌμ„ λ³΅μ‚¬ν•˜μ—¬ `accounts_config.json` νŒŒμΌμ„ λ§Œλ“€κ³  μ‚¬μš© 쀑인 κ³„μ’Œ λ²ˆν˜Έμ™€ 각 κ³„μ’Œλ³„λ‘œ λΆ€μ—¬ν•˜κ³ μž ν•˜λŠ” νƒ€κ²Ÿ 투자 μ„Ήν„°λͺ…을 μž…λ ₯ν•©λ‹ˆλ‹€.
   ```bash
   cp accounts_config.json.example accounts_config.json
   ```

---

## πŸ’» μ‹€ν–‰ 및 연동 κ°€μ΄λ“œ

### 1. 둜컬 단독 ν…ŒμŠ€νŠΈ
`uv`λ₯Ό 톡해 FastMCP μ„œλ²„λ₯Ό λͺ…λ Ήμ€„μ—μ„œ 직접 ꡬ동해 기동 μ—λŸ¬κ°€ μ—†λŠ”μ§€ κ²€μ¦ν•©λ‹ˆλ‹€.
```bash
uv run mcp_server.py
```
* μ„œλ²„κ°€ μ •μƒμ μœΌλ‘œ κΈ°λ™λ˜λ©΄ `mcp.server.fastmcp` 엔진이 μž‘λ™ν•˜λ©° μž…μΆœλ ₯ λŒ€κΈ° μƒνƒœλ‘œ μ§„μž…ν•©λ‹ˆλ‹€.

### 2. Claude Desktop 연동 μ„€μ •
Claude Desktop μ•±μ—μ„œ 이 μ„œλ²„λ₯Ό 인식할 수 μžˆλ„λ‘ μ„€μ • 파일(`config.json`)에 μ•„λž˜μ™€ 같이 μΆ”κ°€ν•©λ‹ˆλ‹€.

* **μ„€μ • 파일 μœ„μΉ˜**: `C:\Users\<μ‚¬μš©μžλͺ…>\AppData\Roaming\EasyConnect\config.json` λ˜λŠ” `%APPDATA%\Claude\claude_desktop_config.json`
* **μ„€μ • μΆ”κ°€ λ‚΄μš© (Windows μ˜ˆμ‹œ)**:
```json
{
  "mcpServers": {
    "kiwoom-private-mcp-server": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "c:/Users/moony/home_document/kiwoom-rest-api/kiwoom-private-mcp-server",
        "mcp_server.py"
      ]
    }
  }
}
```

### 3. Cursor IDE 연동 μ„€μ •
1. Cursor μ„€μ • (`Settings` -> `Features` -> `MCP`)으둜 μ΄λ™ν•©λ‹ˆλ‹€.
2. `+ Add New MCP Server` λ²„νŠΌμ„ λˆ„λ¦…λ‹ˆλ‹€.
3. λ‹€μŒκ³Ό 같이 μž…λ ₯ν•©λ‹ˆλ‹€:
   * **Name**: `kiwoom-private-mcp-server`
   * **Type**: `command`
   * **Command**: `uv run --directory c:/Users/moony/home_document/kiwoom-rest-api/kiwoom-private-mcp-server mcp_server.py`

---

## πŸ”’ λ³΄μ•ˆ 주의 사항
* λ³Έ ν”„λ‘œμ νŠΈλŠ” 개인 투자 κ³„μ’Œ 및 λ―Όκ°ν•œ API 인증 정보(`AppKey`, `SecretKey`)λ₯Ό λ‹€λ£Ήλ‹ˆλ‹€.
* μ ˆλŒ€ **`.env`** 파일과 **`accounts_config.json`** νŒŒμΌμ„ Public GitHub μ €μž₯μ†Œμ— 컀밋/ν‘Έμ‹œν•˜μ§€ μ•Šλ„λ‘ κ°λ³„νžˆ μœ μ˜ν•΄ μ£Όμ‹­μ‹œμ˜€. (기본적으둜 `.gitignore`κ°€ λ°©μ–΄ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.)

TDQS

B3.3/5.0

Scored across 2 tools

Disambiguation5/5

The two tools, get_account_balance and get_accounts, have clearly distinct purposes: one retrieves detailed holdings and balance for a specific account, while the other lists all accounts with their metadata. There is no overlap or ambiguity.

Naming Consistency5/5

Both tool names follow a consistent verb_noun snake_case pattern (get_account_balance, get_accounts). The naming is predictable and clearly indicates the action and resource.

Tool Count2/5

With only two tools, the server is well below the typical 3-15 tool range for a comprehensive service. While the tools are focused, a trading platform like Kiwoom would typically require many more operations (e.g., placing orders, history), making the tool set feel incomplete.

Completeness2/5

The tool set only covers reading account info (list and balance). For a securities trading server, obvious operations like order management, stock search, and transaction history are missing. This leaves significant gaps that would hinder agent workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues