krx-cli 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -17
- package/SKILL.md +43 -1
- package/dist/cli.js +55382 -13176
- package/dist/cli.js.map +4 -4
- package/dist/mcp.js +48 -19
- package/dist/mcp.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -180,6 +180,7 @@ krx schema stock.stk_bydd_trd
|
|
|
180
180
|
| `--code <isuCd>` | 종목코드 필터 (ISU_CD) | - |
|
|
181
181
|
| `--sort <field>` | 결과 정렬 기준 필드 | - |
|
|
182
182
|
| `--asc` | 오름차순 정렬 (기본: 내림차순) | - |
|
|
183
|
+
| `--offset <n>` | 처음 N개 건너뛰기 (페이지네이션) | - |
|
|
183
184
|
| `--limit <n>` | 결과 개수 제한 | - |
|
|
184
185
|
| `--from <date>` | 기간 조회 시작일 (YYYYMMDD) | - |
|
|
185
186
|
| `--to <date>` | 기간 조회 종료일 (YYYYMMDD) | - |
|
|
@@ -291,16 +292,19 @@ mkdir -p ~/.claude/skills && cp SKILL.md ~/.claude/skills/krx-cli.md
|
|
|
291
292
|
mkdir -p ~/.cursor/skills && cp SKILL.md ~/.cursor/skills/krx-cli.md
|
|
292
293
|
```
|
|
293
294
|
|
|
294
|
-
## MCP 서버
|
|
295
|
+
## MCP 서버
|
|
295
296
|
|
|
296
|
-
CLI 외에 MCP(Model Context Protocol) 서버도 제공합니다.
|
|
297
|
+
CLI 외에 MCP(Model Context Protocol) 서버도 제공합니다. 두 가지 전송 방식을 지원합니다:
|
|
297
298
|
|
|
298
|
-
|
|
299
|
+
| 전송 방식 | 바이너리 | 지원 클라이언트 |
|
|
300
|
+
| --------------- | ----------- | --------------- |
|
|
301
|
+
| stdio | `krx-mcp` | Claude Desktop |
|
|
302
|
+
| Streamable HTTP | `krx serve` | ChatGPT 웹 |
|
|
299
303
|
|
|
300
304
|
API 키는 `krx auth set <key>`로 등록한 것이 자동으로 사용됩니다.
|
|
301
305
|
`krx-mcp`는 `npm install -g krx-cli`로 설치하면 함께 설치됩니다.
|
|
302
306
|
|
|
303
|
-
### Claude Desktop
|
|
307
|
+
### Claude Desktop (stdio)
|
|
304
308
|
|
|
305
309
|
설정 파일 위치:
|
|
306
310
|
|
|
@@ -317,24 +321,25 @@ API 키는 `krx auth set <key>`로 등록한 것이 자동으로 사용됩니다
|
|
|
317
321
|
}
|
|
318
322
|
```
|
|
319
323
|
|
|
320
|
-
|
|
324
|
+
설정 후 앱을 재시작하면 MCP 도구가 활성화됩니다.
|
|
321
325
|
|
|
322
|
-
|
|
326
|
+
### ChatGPT 웹 (Streamable HTTP)
|
|
323
327
|
|
|
324
|
-
|
|
325
|
-
- **Windows**: `%LOCALAPPDATA%\OpenAI\ChatGPT\mcp.json`
|
|
328
|
+
ChatGPT 웹은 원격 MCP 서버만 지원하므로, HTTP 서버를 실행한 뒤 ngrok으로 외부에 노출해야 합니다.
|
|
326
329
|
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
}
|
|
330
|
+
```bash
|
|
331
|
+
# 터미널 1: MCP 서버 실행
|
|
332
|
+
krx serve --port 3000 --host 0.0.0.0
|
|
333
|
+
|
|
334
|
+
# 터미널 2: ngrok으로 외부 노출
|
|
335
|
+
ngrok http 3000
|
|
335
336
|
```
|
|
336
337
|
|
|
337
|
-
|
|
338
|
+
1. ngrok 출력에서 `https://xxxx.ngrok.io` URL 복사
|
|
339
|
+
2. ChatGPT 웹 → Settings → Developer → MCP Server 추가
|
|
340
|
+
3. URL: `https://xxxx.ngrok.io/mcp`
|
|
341
|
+
|
|
342
|
+
Health check: `http://localhost:3000/health`
|
|
338
343
|
|
|
339
344
|
### 제공 Tool
|
|
340
345
|
|
package/SKILL.md
CHANGED
|
@@ -7,7 +7,7 @@ install: npm install -g krx-cli
|
|
|
7
7
|
binary: krx
|
|
8
8
|
metadata:
|
|
9
9
|
author: kyo504
|
|
10
|
-
version: "1.
|
|
10
|
+
version: "1.7.0"
|
|
11
11
|
invariants:
|
|
12
12
|
- Always use YYYYMMDD format for --date (e.g., 20260310)
|
|
13
13
|
- Data is T-1 (previous trading day), available from 2010 onwards
|
|
@@ -159,6 +159,14 @@ krx version # Show current version and check for updates
|
|
|
159
159
|
krx update # Update to the latest version (npm install -g krx-cli)
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
+
### MCP HTTP Server
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
krx serve # Start on http://127.0.0.1:3000/mcp
|
|
166
|
+
krx serve --port 8080 # Custom port
|
|
167
|
+
krx serve --host 0.0.0.0 # Bind to all interfaces (for ngrok)
|
|
168
|
+
```
|
|
169
|
+
|
|
162
170
|
### Schema (introspection)
|
|
163
171
|
|
|
164
172
|
```bash
|
|
@@ -174,6 +182,7 @@ krx schema index.kospi_dd_trd # Specific endpoint schema
|
|
|
174
182
|
--code <isuCd> Filter by stock code (ISU_CD)
|
|
175
183
|
--sort <field> Sort results by field name
|
|
176
184
|
--asc Sort ascending (default: descending)
|
|
185
|
+
--offset <n> Skip first N results (for pagination)
|
|
177
186
|
--limit <n> Limit number of results
|
|
178
187
|
--from <date> Start date for range query (YYYYMMDD)
|
|
179
188
|
--to <date> End date for range query (YYYYMMDD)
|
|
@@ -197,6 +206,39 @@ krx schema index.kospi_dd_trd # Specific endpoint schema
|
|
|
197
206
|
6 = Service not approved (category not activated)
|
|
198
207
|
```
|
|
199
208
|
|
|
209
|
+
## Handling Large Results
|
|
210
|
+
|
|
211
|
+
Full market listings (e.g., all KOSPI stocks) output 900+ rows with 15+ fields each. This can exceed context limits. Always narrow results using these strategies:
|
|
212
|
+
|
|
213
|
+
### Strategy 1: Select only needed fields (preferred)
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Instead of all fields, select only what's needed
|
|
217
|
+
krx stock list --date 20260310 --market kospi --fields ISU_NM,TDD_CLSPRC,FLUC_RT
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Strategy 2: Paginate with offset + limit
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Page 1: first 100 rows
|
|
224
|
+
krx stock list --date 20260310 --market kospi --limit 100
|
|
225
|
+
|
|
226
|
+
# Page 2: next 100 rows
|
|
227
|
+
krx stock list --date 20260310 --market kospi --offset 100 --limit 100
|
|
228
|
+
|
|
229
|
+
# Page 3: next 100 rows
|
|
230
|
+
krx stock list --date 20260310 --market kospi --offset 200 --limit 100
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Strategy 3: Filter to relevant subset
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Only stocks with >5% change
|
|
237
|
+
krx stock list --date 20260310 --market kospi --filter "FLUC_RT > 5"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
IMPORTANT: When the user asks for "all" data, prefer Strategy 1 (fields) first. If still too large, combine with Strategy 2 (pagination). Always tell the user the total count.
|
|
241
|
+
|
|
200
242
|
## Common Patterns
|
|
201
243
|
|
|
202
244
|
### Get KOSPI closing price for a specific date
|