# Korea Stock MCP Server [๐Ÿ‡ฐ๐Ÿ‡ท ํ•œ๊ตญ์–ด](#korea-stock-mcp-server) | [๐Ÿ‡บ๐Ÿ‡ธ English](#english-version) ํ•œ๊ตญ ์ฃผ์‹ ๋ถ„์„์„ ์œ„ํ•œ MCP ์„œ๋ฒ„์ž…๋‹ˆ๋‹ค. DART(์ „์ž๊ณต์‹œ์‹œ์Šคํ…œ)์™€ KRX(ํ•œ๊ตญ๊ฑฐ๋ž˜์†Œ) ๊ณต์‹ API๋ฅผ ํ†ตํ•ด ์ฃผ๊ฐ€ ์ •๋ณด์™€ ๊ณต์‹œ ์ž๋ฃŒ ๊ธฐ๋ฐ˜์˜ AI๋ถ„์„์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค. > ๐Ÿ’ฌ **๊ฐœ์„  ์š”์ฒญ & ํ”ผ๋“œ๋ฐฑ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค!** > ์‚ฌ์šฉํ•˜๋ฉด์„œ ๋ถˆํŽธํ•œ ์ ์ด๋‚˜ ๊ฐœ์„  ์•„์ด๋””์–ด๊ฐ€ ์žˆ์œผ์‹œ๋ฉด ํŽธํ•˜๊ฒŒ ์ด๋ฉ”์ผ ์ฃผ์„ธ์š”. > ๋น ๋ฅด๊ฒŒ ํ™•์ธํ•˜๊ณ  ๋ฐ˜์˜ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. > ๐Ÿ“ง wowlxx28@gmail.com ## ๐ŸŽฏ ์ฃผ์š” ๊ธฐ๋Šฅ - ๐Ÿ” **๊ณต์‹œ๊ฒ€์ƒ‰** - ํšŒ์‚ฌ๋ณ„, ๊ธฐ๊ฐ„๋ณ„ ๊ณต์‹œ ๊ฒ€์ƒ‰ - ๐Ÿ“Š **๊ณต์‹œ ๋ฐ์ดํ„ฐ** - ๊ณต์‹œ๋ณด๊ณ ์„œ ์›๋ณธํŒŒ์ผ ํŒŒ์‹ฑํ•œ ๋ฐ์ดํ„ฐ ์ œ๊ณต - ๐Ÿ’ผ **์žฌ๋ฌด์ œํ‘œ ๋ถ„์„** - XBRL ๊ธฐ๋ฐ˜ ์ƒ์„ธ ์žฌ๋ฌด ๋ฐ์ดํ„ฐ - ๐Ÿ“ˆ **์ฃผ์‹ ๋ฐ์ดํ„ฐ** - KRX(์ฝ”์Šคํ”ผ/์ฝ”์Šค๋‹ฅ) ์ผ๋ณ„ ์ฃผ๊ฐ€์ •๋ณด, ์ข…๋ชฉ ๊ธฐ๋ณธ์ •๋ณด ## โšก ๋น ๋ฅธ ์‹œ์ž‘ ### 1๏ธโƒฃ API KEY ๋ฐœ๊ธ‰ ๋จผ์ € DART์™€ KRX์˜ API KEY๋ฅผ ๋ฐœ๊ธ‰๋ฐ›์•„์•ผ ํ•ฉ๋‹ˆ๋‹ค. #### ๐Ÿ“ DART API KEY ๋ฐœ๊ธ‰ 1. **ํšŒ์›๊ฐ€์ž…**: [OPEN DART](https://opendart.fss.or.kr) ํšŒ์›๊ฐ€์ž… 2. **ํ‚ค ์‹ ์ฒญ**: [์ธ์ฆํ‚ค ์‹ ์ฒญ ํŽ˜์ด์ง€](https://opendart.fss.or.kr/uss/umt/EgovMberInsertView.do)์—์„œ API KEY ์‹ ์ฒญ 3. **ํ‚ค ํ™•์ธ**: [์˜คํ”ˆAPI ์ด์šฉํ˜„ํ™ฉ](https://opendart.fss.or.kr/mng/apiUsageStatusView.do)์—์„œ ๋ฐœ๊ธ‰๋œ API KEY ํ™•์ธ #### ๐Ÿ“ˆ KRX API KEY ๋ฐœ๊ธ‰ 1. **ํšŒ์›๊ฐ€์ž…**: [KRX OPEN API](https://openapi.krx.co.kr/contents/OPP/MAIN/main/index.cmd)์—์„œ ํšŒ์›๊ฐ€์ž… ๋ฐ ๋กœ๊ทธ์ธ 2. **ํ‚ค ์‹ ์ฒญ**: ๋งˆ์ดํŽ˜์ด์ง€ โ†’ API ์ธ์ฆํ‚ค ์‹ ์ฒญ์—์„œ ์‹ ์ฒญ 3. **์„œ๋น„์Šค ์‹ ์ฒญ**: ์Šน์ธ ํ›„ ์„œ๋น„์Šค์ด์šฉ โ†’ ์ฃผ์‹ ๋ฉ”๋‰ด๋กœ ์ด๋™ 4. **API ์ด์šฉ์‹ ์ฒญ**: ๋‹ค์Œ 6๊ฐœ ํ•ญ๋ชฉ์—์„œ ๊ฐ๊ฐ "API ์ด์šฉ์‹ ์ฒญ" ํด๋ฆญ - ์œ ๊ฐ€์ฆ๊ถŒ ์ผ๋ณ„๋งค๋งค์ •๋ณด - ์ฝ”์Šค๋‹ฅ ์ผ๋ณ„๋งค๋งค์ •๋ณด - ์ฝ”๋„ฅ์Šค ์ผ๋ณ„๋งค๋งค์ •๋ณด - ์œ ๊ฐ€์ฆ๊ถŒ ์ข…๋ชฉ๊ธฐ๋ณธ์ •๋ณด - ์ฝ”์Šค๋‹ฅ ์ข…๋ชฉ๊ธฐ๋ณธ์ •๋ณด - ์ฝ”๋„ฅ์Šค ์ข…๋ชฉ๊ธฐ๋ณธ์ •๋ณด > โฑ๏ธ **์Šน์ธ๊นŒ์ง€ ์•ฝ 1์ผ ์†Œ์š”๋ฉ๋‹ˆ๋‹ค.** 5. **ํ‚ค ํ™•์ธ**: ์Šน์ธ ํ›„ ๋งˆ์ดํŽ˜์ด์ง€ โ†’ API ์ธ์ฆํ‚ค ๋ฐœ๊ธ‰๋‚ด์—ญ์—์„œ API KEY ํ™•์ธ ### 2๏ธโƒฃ Claude Desktop ์„ค์ • 1. **Claude Desktop** ์‹คํ–‰ 2. **์„ค์ •** โ†’ **๊ฐœ๋ฐœ์ž** โ†’ **๊ตฌ์„ฑํŽธ์ง‘** ํด๋ฆญ 3. `claude_desktop_config.json` ํŒŒ์ผ์— ๋‹ค์Œ ๋‚ด์šฉ ์ถ”๊ฐ€: ```json { "mcpServers": { "korea-stock-mcp": { "command": "npx", "args": ["-y", "korea-stock-mcp@latest"], "env": { "DART_API_KEY": "", "KRX_API_KEY": "" } } } } ``` 4. **์žฌ์‹œ์ž‘**: Claude Desktop์„ ์žฌ์‹œ์ž‘ํ•˜์—ฌ ์„ค์ • ์ ์šฉ > ์ด์ œ Claude์—์„œ ํ•œ๊ตญ ์ฃผ์‹ ๋ฐ์ดํ„ฐ ๋ถ„์„์„ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ## ๋Œ€์šฉ๋Ÿ‰ ๊ณต์‹œ ๋ฌธ์„œ ์ฒ˜๋ฆฌ ์ผ๋ถ€ ๊ณต์‹œ๋ณด๊ณ ์„œ(์‚ฌ์—…๋ณด๊ณ ์„œ, ๋ถ„๊ธฐ๋ณด๊ณ ์„œ ๋“ฑ)๋Š” ์ˆ˜ MB์— ๋‹ฌํ•˜๋Š” ๋Œ€์šฉ๋Ÿ‰ XML ๋ฌธ์„œ์ž…๋‹ˆ๋‹ค. ์ด๋Ÿฐ ๋ฌธ์„œ๋ฅผ ํ•œ ๋ฒˆ์— ๋ชจ๋‘ ์ฒ˜๋ฆฌํ•˜๋ฉด AI ์‘๋‹ต ํ•œ๋„๋ฅผ ์ดˆ๊ณผํ•˜๊ฑฐ๋‚˜ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ### ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋‚˜์š”? ๋ฌธ์„œ ํฌ๊ธฐ์— ๋”ฐ๋ผ ์ž๋™์œผ๋กœ ์ฒ˜๋ฆฌ ๋ฐฉ์‹์ด ๋‹ฌ๋ผ์ง‘๋‹ˆ๋‹ค. - **์†Œ์šฉ๋Ÿ‰ ๋ฌธ์„œ (1MB ๋ฏธ๋งŒ)**: ๋ฌธ์„œ ์ „์ฒด๋ฅผ ๋ฐ”๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. - **๋Œ€์šฉ๋Ÿ‰ ๋ฌธ์„œ (1MB ์ด์ƒ)**: ๋ฌธ์„œ ์ „์ฒด ๋Œ€์‹  **๋ชฉ์ฐจ(TOC)**๋ฅผ ๋จผ์ € ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. Claude๊ฐ€ ๋ชฉ์ฐจ๋ฅผ ๋ณด๊ณ  ์งˆ๋ฌธ๊ณผ ๊ด€๋ จ๋œ ์„น์…˜์„ ์ž๋™์œผ๋กœ ์„ ํƒํ•ด ๋‚ด์šฉ์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค. ### ์œ ์ € ์•ˆ๋‚ด > **๋ณ„๋„๋กœ ์กฐ์ž‘ํ•  ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.** Claude๊ฐ€ ๋Œ€์šฉ๋Ÿ‰ ๋ฌธ์„œ๋ฅผ ์ž๋™์œผ๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. ๋ฌธ์„œ๊ฐ€ ํฌ๋ฉด Claude๊ฐ€ ์ž๋™์œผ๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค: 1. ๋ฌธ์„œ ๋ชฉ์ฐจ๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. 2. ์งˆ๋ฌธ๊ณผ ๊ด€๋ จ๋œ ์„น์…˜์„ ์ž๋™์œผ๋กœ ์„ ํƒํ•ด ๋‚ด์šฉ์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค. 3. ๋‹ต๋ณ€ ํ›„ ๋‚˜๋จธ์ง€ ์„น์…˜ ๋ชฉ๋ก์„ ์•ˆ๋‚ดํ•˜๋ฏ€๋กœ, ์ถ”๊ฐ€๋กœ ๊ถ๊ธˆํ•œ ์„น์…˜์ด ์žˆ์œผ๋ฉด ์š”์ฒญํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ์‹œ: - "์‚ฌ์—…๋ณด๊ณ ์„œ์—์„œ ๋งค์ถœ ํ˜„ํ™ฉ ์•Œ๋ ค์ค˜" โ†’ Claude๊ฐ€ ๋งค์ถœ ๊ด€๋ จ ์„น์…˜์„ ์ž๋™ ์„ ํƒ - "๋ฐฉ๊ธˆ ๋ชฉ์ฐจ์—์„œ 3๋ฒˆ ์„น์…˜๋„ ์กฐํšŒํ•ด์ค˜" โ†’ ํŠน์ • ์„น์…˜ ์ง์ ‘ ์š”์ฒญ ๊ฐ€๋Šฅ ### ๐Ÿ’ก ๋ณต์žกํ•œ ์งˆ๋ฌธ์€ ๋‹จ๊ณ„๋ณ„๋กœ ๋‚˜๋ˆ ์„œ ์งˆ๋ฌธํ•˜์„ธ์š” ํ•œ ๋ฒˆ์— ์›ํ•˜๋Š” ๋‹ต์„ ์–ป์ง€ ๋ชปํ•  ๋•Œ๋Š”, ์งˆ๋ฌธ์„ ์—ฌ๋Ÿฌ ๋‹จ๊ณ„๋กœ ๋‚˜๋ˆ„๋ฉด ๋” ์ •ํ™•ํ•œ ๊ฒฐ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, "์ธ๋ฒคํ…Œ๋ผ์˜ ์ฆ๊ถŒ์‹ ๊ณ ์„œ์—์„œ ์™ธ๊ตญ์ธ ๋ฐฐ์ • ๋‚ด์—ญ ์•Œ๋ ค์ค˜"๊ฐ€ ํ•œ ๋ฒˆ์— ์•ˆ ๋œ๋‹ค๋ฉด: 1. "์ธ๋ฒคํ…Œ๋ผ์˜ ๊ณ ์œ ๋ฒˆํ˜ธ(corp_code) ์•Œ๋ ค์ค˜" 2. "๊ทธ ํšŒ์‚ฌ์˜ ์ฆ๊ถŒ๋ฐœํ–‰ ๊ด€๋ จ ๊ณต์‹œ ๋ชฉ๋ก ๋ณด์—ฌ์ค˜" 3. "ํ•ด๋‹น ๊ณต์‹œ ๋ณธ๋ฌธ์„ ๊ฐ€์ ธ์™€์ค˜" 4. "์™ธ๊ตญ์ธ ๋ฐฐ์ • ๋‚ด์—ญ์„ ์ฐพ์•„์ค˜" ์ด๋ ‡๊ฒŒ ๋‹จ๊ณ„๋ณ„๋กœ ์ง„ํ–‰ํ•˜๋ฉด ๊ฐ ๋‹จ๊ณ„์˜ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•˜๋ฉด์„œ ์›ํ•˜๋Š” ์ •๋ณด์— ๋„๋‹ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. --- ## ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋„๊ตฌ ### DART (์ „์ž๊ณต์‹œ์‹œ์Šคํ…œ) 1. **get_disclosure_list** - ๊ณต์‹œ๊ฒ€์ƒ‰ - ๊ณต์‹œ ์œ ํ˜•๋ณ„, ํšŒ์‚ฌ๋ณ„, ๋‚ ์งœ๋ณ„ ๊ณต์‹œ๋ณด๊ณ ์„œ ๊ฒ€์ƒ‰ 2. **get_corp_code** - ๊ณ ์œ ๋ฒˆํ˜ธ ์กฐํšŒ - DART ๋“ฑ๋ก ๊ณต์‹œ๋Œ€์ƒํšŒ์‚ฌ์˜ ๊ณ ์œ ๋ฒˆํ˜ธ, ํšŒ์‚ฌ๋ช…, ์ข…๋ชฉ์ฝ”๋“œ ์ œ๊ณต - ํšŒ์‚ฌ๋ช…(`corp_name`) ๋˜๋Š” ์ข…๋ชฉ์ฝ”๋“œ(`stock_code`) ์ค‘ ํ•˜๋‚˜๋กœ ์กฐํšŒ ๊ฐ€๋Šฅ - ํšŒ์‚ฌ๋ช… ๊ฒ€์ƒ‰ ์‹คํŒจ ์‹œ ์ข…๋ชฉ์ฝ”๋“œ๋กœ ์žฌ์‹œ๋„ ์•ˆ๋‚ด 3. **get_disclosure** - ๊ณต์‹œ๋ณด๊ณ ์„œ ์›๋ฌธ - DART API๋ฅผ ํ†ตํ•œ ๊ณต์‹œ๋ณด๊ณ ์„œ ์›๋ณธํŒŒ์ผ ํŒŒ์‹ฑ - ๋Œ€์šฉ๋Ÿ‰ ๋ฌธ์„œ์˜ ๊ฒฝ์šฐ ๋ชฉ์ฐจ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋ฉฐ, `section_id`๋กœ ํŠน์ • ์„น์…˜ ์กฐํšŒ ๊ฐ€๋Šฅ 4. **get_financial_statement** - ์žฌ๋ฌด์ œํ‘œ - ์ƒ์žฅ๋ฒ•์ธ ๋ฐ ์ฃผ์š” ๋น„์ƒ์žฅ๋ฒ•์ธ XBRL ์žฌ๋ฌด์ œํ‘œ - ์ •๊ธฐ๋ณด๊ณ ์„œ ๋‚ด ๋ชจ๋“  ๊ณ„์ •๊ณผ๋ชฉ ๋ฐ์ดํ„ฐ ์ œ๊ณต ### KRX (ํ•œ๊ตญ๊ฑฐ๋ž˜์†Œ) 1. **get_stock_base_info** - ์ข…๋ชฉ ๊ธฐ๋ณธ์ •๋ณด - ์ฝ”์Šคํ”ผ, ์ฝ”์Šค๋‹ฅ, ์ฝ”๋„ฅ์Šค ์ƒ์žฅ ์ข…๋ชฉ ๊ธฐ๋ณธ ์ •๋ณด - ์ข…๋ชฉ๋ช…, ์ข…๋ชฉ์ฝ”๋“œ, ์‹œ์žฅ๊ตฌ๋ถ„ ๋“ฑ ๊ธฐ๋ณธ ๋ฐ์ดํ„ฐ 2. **get_stock_trade_info** - ์ผ๋ณ„ ๋งค๋งค์ •๋ณด - ์ฝ”์Šคํ”ผ, ์ฝ”์Šค๋‹ฅ, ์ฝ”๋„ฅ์Šค ์ข…๋ชฉ๋ณ„ ์ผ๋ณ„ ๊ฑฐ๋ž˜ ๋ฐ์ดํ„ฐ - ์ฃผ๊ฐ€, ๊ฑฐ๋ž˜๋Ÿ‰, ์‹œ๊ฐ€์ด์•ก ๋“ฑ ์ƒ์„ธ ๊ฑฐ๋ž˜ ์ •๋ณด 3. **get_market_type** - ์‹œ์žฅ๊ตฌ๋ถ„ ์กฐํšŒ - ์ข…๋ชฉ์ฝ”๋“œ๋กœ ํ•ด๋‹น ์ข…๋ชฉ์˜ ์‹œ์žฅ๊ตฌ๋ถ„(์ฝ”์Šคํ”ผ/์ฝ”์Šค๋‹ฅ/์ฝ”๋„ฅ์Šค) ์กฐํšŒ - ์ฃผ์‹ ๋ฐ์ดํ„ฐ ์กฐํšŒ ์‹œ ํ•„์š”ํ•œ ์‹œ์žฅ ์ •๋ณด ์ œ๊ณต ### ๊ธฐํƒ€ ๋„๊ตฌ 1. **get_today_date** - ์˜ค๋Š˜ ๋‚ ์งœ ์กฐํšŒ - ํ˜„์žฌ ๋‚ ์งœ๋ฅผ YYYYMMDD ํ˜•์‹์œผ๋กœ ์ œ๊ณต - AI์˜ ์ •ํ™•ํ•œ ๋‚ ์งœ ์กฐํšŒ๋ฅผ ์œ„ํ•œ ๋„๊ตฌ ## ์‹ค์ œ ์‚ฌ์šฉ ์˜ˆ์‹œ ### ๐Ÿ“Š ์žฌ๋ฌด ๋ถ„์„ ์˜ˆ์ œ **ํ”„๋กฌํ”„ํŠธ**: "์‚ผ์–‘์‹ํ’ˆ์˜ 2023๋…„, 2024๋…„ 1~4๋ถ„๊ธฐ, 2025๋…„ 1,2๋ถ„๊ธฐ ๋งค์ถœ, ์˜์—…์ด์ต ์กฐ์‚ฌํ•ด์ฃผ๊ณ  ์„ฑ์žฅ๋ฅ ๋„ ์กฐ์‚ฌํ•ด์ค˜" โ†’ [์‚ผ์–‘์‹ํ’ˆ ๋ถ„์„ ๊ฒฐ๊ณผ ๋ณด๊ธฐ](./example/์‚ผ์–‘์‹ํ’ˆ.md) **ํ”„๋กฌํ”„ํŠธ**: "์—์ดํ”ผ์•Œ์˜ 23๋…„ 1๋ถ„๊ธฐ๋ถ€ํ„ฐ 25๋…„ 2๋ถ„๊ธฐ๊นŒ์ง€์˜ ๋งค์ถœ, ์˜์—…์ด์ต ์„ฑ์žฅ๊ณผ ์ฃผ๊ฐ€, ์‹œ๊ฐ€์ด์•ก ํ๋ฆ„์„ ์กฐ์‚ฌํ•ด์ค˜" โ†’ [์—์ดํ”ผ์•Œ ๋ถ„์„ ๊ฒฐ๊ณผ ๋ณด๊ธฐ](./example/์—์ดํ”ผ์•Œ.md) ### ๐Ÿข ๊ธฐ์—… ๋ถ„์„ ์˜ˆ์ œ **ํ”„๋กฌํ”„ํŠธ**: "HJ์ค‘๊ณต์—…์€ ๋ญ˜ ํ•ด์„œ ๋ˆ์„ ๋ฒ„๋Š” ํšŒ์‚ฌ์ธ์ง€๋ž‘ ์‚ฌ์—…๋ถ€๋ฌธ๋ณ„ ๋งค์ถœ๊นŒ์ง€ ๊ฐ™์ด ์•Œ๋ ค์ค˜" โ†’ [HJ์ค‘๊ณต์—… ๋ถ„์„ ๊ฒฐ๊ณผ ๋ณด๊ธฐ](./example/HJ์ค‘๊ณต์—….md) ### ๐Ÿ“‘ ๊ณต์‹œ ๋ถ„์„ ์˜ˆ์ œ **ํ”„๋กฌํ”„ํŠธ**: "Get the foreign allocation details for an IPO (e.g., Inventera / 0007J0)" โ†’ [์ธ๋ฒคํ…Œ๋ผ IPO ์™ธ๊ตญ์ธ ๋ฐฐ์ • ๋ถ„์„ ๊ฒฐ๊ณผ ๋ณด๊ธฐ](./example/์ธ๋ฒคํ…Œ๋ผ.md) ## API ๋ฐ์ดํ„ฐ ์†Œ์Šค - **DART (์ „์ž๊ณต์‹œ์‹œ์Šคํ…œ)**: ์ƒ์žฅ๊ธฐ์—… ๊ณต์‹œ ์ •๋ณด ๋ฐ ์žฌ๋ฌด์ œํ‘œ - **KRX (ํ•œ๊ตญ๊ฑฐ๋ž˜์†Œ)**: ์ข…๋ชฉ ๊ธฐ๋ณธ์ •๋ณด ๋ฐ ์ผ๋ณ„ ๋งค๋งค์ •๋ณด ## ๋กœ์ปฌ ๊ฐœ๋ฐœ ๋ฐ ํ…Œ์ŠคํŠธ ์†Œ์Šค๋ฅผ ์ˆ˜์ •ํ•˜๋ฉด์„œ ๋ฐ”๋กœ ํ…Œ์ŠคํŠธํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ### 1๏ธโƒฃ ์˜์กด์„ฑ ์„ค์น˜ ```bash npm install ``` ### 2๏ธโƒฃ ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ • ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ์— `.env` ํŒŒ์ผ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค: ```bash DART_API_KEY=your_dart_api_key KRX_API_KEY=your_krx_api_key ``` ### 3๏ธโƒฃ MCP Inspector ์‹คํ–‰ ```bash npm run inspect ``` ํ„ฐ๋ฏธ๋„์— ์ถœ๋ ฅ๋˜๋Š” ์ฃผ์†Œ(`http://localhost:6274` ๋“ฑ)๋ฅผ ๋ธŒ๋ผ์šฐ์ €์—์„œ ์—ด๋ฉด MCP Inspector UI๊ฐ€ ์—ด๋ฆฝ๋‹ˆ๋‹ค. Inspector์—์„œ **Connect** ๋ฒ„ํŠผ์„ ํด๋ฆญํ•œ ํ›„, ์ขŒ์ธก ํˆด ๋ชฉ๋ก์—์„œ ์›ํ•˜๋Š” ํˆด์„ ์„ ํƒํ•ด ์ง์ ‘ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ### 4๏ธโƒฃ ์†Œ์Šค ์ˆ˜์ • ํ›„ ์žฌํ…Œ์ŠคํŠธ `src/` ํŒŒ์ผ์„ ์ˆ˜์ •ํ•˜๊ณ  ์ €์žฅํ•˜๋ฉด ์„œ๋ฒ„๊ฐ€ ์ž๋™์œผ๋กœ ์žฌ์‹œ์ž‘๋ฉ๋‹ˆ๋‹ค. Inspector์—์„œ **Reconnect** ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์ฆ‰์‹œ ๋ฐ˜์˜๋ฉ๋‹ˆ๋‹ค. > **์ฐธ๊ณ **: Node.js 18 ์ด์ƒ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ## ๊ธฐ์—ฌํ•˜๊ธฐ ๊ธฐ์—ฌ๋ฅผ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค! Pull Request๋ฅผ ๋ณด๋‚ด์ฃผ์„ธ์š”. 1. ์ด ์ €์žฅ์†Œ๋ฅผ ํฌํฌํ•˜์„ธ์š” 2. ๊ธฐ๋Šฅ ๋ธŒ๋žœ์น˜๋ฅผ ๋งŒ๋“œ์„ธ์š” (`git checkout -b feature/AmazingFeature`) 3. ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์ปค๋ฐ‹ํ•˜์„ธ์š” (`git commit -m 'Add some AmazingFeature'`) 4. ๋ธŒ๋žœ์น˜์— ํ‘ธ์‹œํ•˜์„ธ์š” (`git push origin feature/AmazingFeature`) 5. Pull Request๋ฅผ ์—ด์–ด์ฃผ์„ธ์š” ## ๋ผ์ด์„ ์Šค ISC ๋ผ์ด์„ ์Šค ## ์ง€์› - ๐Ÿ› ์ด์Šˆ๊ฐ€ ์žˆ๋‹ค๋ฉด GitHub Issues์— ๋“ฑ๋กํ•ด์ฃผ์„ธ์š” - โญ ์œ ์šฉํ•˜๋‹ค๋ฉด ์Šคํƒ€๋ฅผ ๋ˆŒ๋Ÿฌ์ฃผ์„ธ์š”! ## ๋ฉด์ฑ… ์กฐํ•ญ ๋ณธ ๋„๊ตฌ๋Š” ์ •๋ณด ์ œ๊ณต ๋ชฉ์ ์ด๋ฉฐ, ํˆฌ์ž ์กฐ์–ธ์ด ์•„๋‹™๋‹ˆ๋‹ค. ๋ชจ๋“  ํˆฌ์ž ๊ฒฐ์ •์€ ๋ณธ์ธ ์ฑ…์ž„์ž…๋‹ˆ๋‹ค. --- # English Version MCP Server for Korean stock analysis. Enables AI-powered analysis of stock prices and disclosure data through official APIs from DART (Data Analysis, Retrieval and Transfer System) and KRX (Korea Exchange). > ๐Ÿ’ฌ **Feedback & Feature Requests Welcome!** > If you have any ideas for improvement or issues while using this tool, feel free to email me. > I'll review and address them as quickly as possible. > ๐Ÿ“ง wowlxx28@gmail.com ## ๐ŸŽฏ Key Features - ๐Ÿ” **Disclosure Search** - Search corporate disclosures by company and date - ๐Ÿ“Š **Disclosure Data** - Provides parsed data from original disclosure reports - ๐Ÿ’ผ **Financial Statement Analysis** - Detailed financial data based on XBRL - ๐Ÿ“ˆ **Stock Data** - KRX (KOSPI/KOSDAQ) daily stock prices and basic stock information ## โšก Quick Start ### 1๏ธโƒฃ API KEY Registration You need to obtain API KEYs from both DART and KRX. #### ๐Ÿ“ DART API KEY Registration 1. **Sign Up**: Register at [OPEN DART](https://opendart.fss.or.kr) 2. **Request Key**: Apply for API KEY at [Authentication Key Application Page](https://opendart.fss.or.kr/uss/umt/EgovMberInsertView.do) 3. **Check Key**: Verify issued API KEY at [Open API Usage Status](https://opendart.fss.or.kr/mng/apiUsageStatusView.do) #### ๐Ÿ“ˆ KRX API KEY Registration 1. **Sign Up**: Register and login at [KRX OPEN API](https://openapi.krx.co.kr/contents/OPP/MAIN/main/index.cmd) 2. **Request Key**: Apply for API authentication key in My Page โ†’ API Authentication Key Application 3. **Service Application**: After approval, go to Service Use โ†’ Stock menu 4. **API Usage Application**: Click "API Usage Application" for each of the following 6 items - Securities Daily Trading Information - KOSDAQ Daily Trading Information - KONEX Daily Trading Information - Securities Basic Information - KOSDAQ Basic Information - KONEX Basic Information > โฑ๏ธ **Approval takes approximately 1 day.** 5. **Key Verification**: After approval, check API KEY in My Page โ†’ API Authentication Key Issuance History ### 2๏ธโƒฃ Claude Desktop Setup 1. Launch **Claude Desktop** 2. Go to **Settings** โ†’ **Developer** โ†’ **Edit Configuration** 3. Add the following content to `claude_desktop_config.json`: ```json { "mcpServers": { "korea-stock-mcp": { "command": "npx", "args": ["-y", "korea-stock-mcp@latest"], "env": { "DART_API_KEY": "", "KRX_API_KEY": "" } } } } ``` 4. **Restart**: Restart Claude Desktop to apply settings > You can now start analyzing Korean stock data with Claude. ## Large Disclosure Document Handling Some disclosure reports (annual reports, quarterly reports, etc.) are large XML documents of several MB. Processing such documents all at once can exceed AI response limits or cause errors. ### How does it work? The processing method changes automatically depending on document size. - **Small documents (under 1MB)**: Returns the entire document immediately. - **Large documents (1MB or more)**: Returns a **Table of Contents (TOC)** instead of the full document. Claude reads the TOC and automatically selects and fetches the sections relevant to your question. ### User Guide > **No manual action required.** Claude handles large documents automatically. When a document is large, Claude automatically: 1. Checks the document's table of contents. 2. Selects and fetches the sections relevant to your question. 3. After answering, lists the remaining sections โ€” so you can request any other section you're curious about. Examples: - "Show me the revenue overview from the annual report" โ†’ Claude auto-selects the revenue-related section - "Also fetch section 3 from the TOC you just showed" โ†’ You can request a specific section directly ### ๐Ÿ’ก Break Complex Questions into Steps If you can't get the answer you want in one shot, try breaking your question into smaller steps for more accurate results. For example, instead of "Show me the foreign investor allocation details from Inventera's securities registration statement", try: 1. "Get the corp_code for Inventera" 2. "Search for securities issuance disclosures for that company" 3. "Fetch the document content for that disclosure" 4. "Find the foreign investor allocation table" This way, you can verify each step's output and guide Claude toward the exact information you need. --- ## Available Tools ### DART (Data Analysis, Retrieval and Transfer System) 1. **get_disclosure_list** - Disclosure Search - Search disclosure reports by type, company, and date 2. **get_corp_code** - Corporate Code Inquiry - Provides unique codes, company names, and stock codes of DART-registered disclosure companies - Search by company name (`corp_name`) or stock code (`stock_code`) - If name search fails (e.g. non-Korean input), suggests retrying with stock code 3. **get_disclosure** - Disclosure Report Content - Parse original disclosure report files through DART API - For large documents, returns a TOC; use `section_id` to fetch a specific section 4. **get_financial_statement** - Financial Statements - XBRL financial statements for listed and major unlisted companies - Provides all account data from periodic reports ### KRX (Korea Exchange) 1. **get_stock_base_info** - Basic Stock Information - Basic information for KOSPI, KOSDAQ, and KONEX listed stocks - Basic data including stock names, codes, and market classifications 2. **get_stock_trade_info** - Daily Trading Information - Daily trading data for KOSPI, KOSDAQ, and KONEX stocks - Detailed trading information including stock prices, trading volume, and market capitalization 3. **get_market_type** - Market Type Inquiry - Query market classification (KOSPI/KOSDAQ/KONEX) by stock code - Provides market information needed for stock data queries ### Other Tools 1. **get_today_date** - Today's Date Inquiry - Provides current date in YYYYMMDD format - Tool for AI's accurate date inquiry ## Real Usage Examples ### ๐Ÿ“Š Financial Analysis Examples **Prompt**: "Investigate Samyang Foods's sales and operating profit for Q1-Q4 2023, Q1-Q4 2024, and Q1-Q2 2025, and also check growth rates" โ†’ [See Samyang Foods Analysis Results](./example/samyang-foods.md) **Prompt**: "Investigate APR's sales and operating profit growth from Q1 2023 to Q2 2025, along with stock price and market cap trends" โ†’ [See APR Analysis Results](./example/apr.md) ### ๐Ÿข Corporate Analysis Examples **Prompt**: "Tell me what HJ SHIPBUILDING & CONSTRUCTION does to make money and include sales by business segment" โ†’ [See HJ Shipbuilding & Construction Analysis Results](./example/hj-shipbuilding.md) ### ๐Ÿ“‘ Disclosure Analysis Examples **Prompt**: "Get the foreign allocation details for an IPO (e.g., Inventera / 0007J0)" โ†’ [See Inventera IPO Foreign Allocation Analysis Results](./example/inventera.md) ## API Data Sources - **DART (Data Analysis, Retrieval and Transfer System)**: Listed company disclosure information and financial statements - **KRX (Korea Exchange)**: Basic stock information and daily trading information ## Local Development & Testing How to test while modifying the source code. ### 1๏ธโƒฃ Install dependencies ```bash npm install ``` ### 2๏ธโƒฃ Set up environment variables Create a `.env` file in the project root: ```bash DART_API_KEY=your_dart_api_key KRX_API_KEY=your_krx_api_key ``` ### 3๏ธโƒฃ Run MCP Inspector ```bash npm run inspect ``` Open the URL printed in the terminal (e.g. `http://localhost:6274`) in your browser to open the MCP Inspector UI. Click **Connect** in the Inspector, then select any tool from the left panel to call it directly. ### 4๏ธโƒฃ Re-test after modifying source When you save a file under `src/`, the server restarts automatically. Click **Reconnect** in the Inspector to pick up the changes immediately. > **Note**: Node.js 18 or higher is required. ## Contributing Contributions are welcome! Please send us a Pull Request. 1. Fork this repository 2. Create a feature branch (`git checkout -b feature/AmazingFeature`) 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) 4. Push to the branch (`git push origin feature/AmazingFeature`) 5. Open a Pull Request ## License ISC License ## Support - ๐Ÿ› If you have issues, please register them in GitHub Issues - โญ If you find it useful, please give it a star! ## Disclaimer This tool is for informational purposes only and is not investment advice. All investment decisions are your own responsibility.