Skip to main content
Glama
JooSeunghyeon

kookmin-stock

Kookmin MCP Stock Agent

Kookmin University Assignment Β· "Boosting Impact with Hermes + Custom MCP Server"

We prove how work quality changes through 3 experiments by attaching a custom MCP server to the domestic stock recommendation Hermes agent created in the previous assignment.

🎯 What's Included

Output

Path

Description

MCP Server (Normal)

src/mcp_stock/server.py

FastMCP stdio, 6 tools

MCP Server (Broken Version)

src/mcp_stock/server_broken.py

Incorrect description / Timeout / Empty response

30-second Demo

src/experiments/exp1_demo.py

Sequence output for recording

Experiment β‘‘ Result Comparison

src/experiments/exp2_quality.py

NO MCP / GOOD / BROKEN comparison

Experiment β‘’ Pattern Comparison

src/experiments/exp3_orchestration.py

Single / Planner+Executor / Parallel

Presentation Slides (spec)

slides/slides.md

Paste into another AI to generate PPT

Result Outputs

results/exp2_*, results/exp3_*

Auto-generated tables, CSVs, logs

Related MCP server: pykrx-mcp

βš™οΈ Installation

Python 3.10+ (Test environment 3.13).

python -m venv .venv
source .venv/bin/activate
pip install -e .

▢️ Execution

# 1) MCP μ„œλ²„ 검증 (μ„œλ²„λŠ” stdio라 ν˜ΈμŠ€νŠΈκ°€ λΆ™μ–΄μ•Ό 의미 있음 β€” Ctrl+C둜 μ’…λ£Œ)
python -m mcp_stock.server

# 2) 30초 λ™μž‘ 데λͺ¨ (μ‹€μ œλ‘œ λŒλ €μ„œ λ…Ήν™”)
python -m experiments.exp1_demo
#  λ˜λŠ” ./demo/record_demo.sh

# 3) μ‹€ν—˜ β‘‘ 성곡/μ‹€νŒ¨ 비ꡐ β†’ results/exp2_* μžλ™ 생성
python -m experiments.exp2_quality

# 4) μ‹€ν—˜ β‘’ Orchestration 토큰 비ꡐ β†’ results/exp3_* μžλ™ 생성
python -m experiments.exp3_orchestration

πŸŽ₯ 30-Second Demo Recording

Actions by timecode are organized in demo/demo_script.md. The simplest path:

./demo/record_demo.sh         # QuickTime/Cmd+Shift+5 둜 ν™”λ©΄ λ…Ήν™”ν•˜λ©΄μ„œ μ‹€ν–‰
./demo/record_demo.sh --asciinema   # ν…μŠ€νŠΈ 캑처 (asciinema ν•„μš”)

πŸ§ͺ Experiment β‘  β€” MCP Server (6 Tools)

Tool

Input

Output

get_market_overview(date)

'today' / YYYY-MM-DD

{kospi:{close, changePct, tradingValueKrw}, kosdaq:{...}}

get_top_gainers(market, top_n)

KOSPI/KOSDAQ, 1..50

Top N stocks

get_stock_quote(ticker)

Code or Korean name

close / changePct / volume / per / pbr

get_recent_news(query, top_n)

Keyword or stock name

Headline + positivityScore

get_fundamentals(ticker)

Code or Korean name

per / pbr / eps / bps / roe

recommend_buys(market, top_n, criteria)

KOSPI/KOSDAQ

scoreBreakdown + rationale

Data: Naver Finance crawling single source (src/mcp_stock/sources/naver.py). Free, no key required.

  • Indices: polling.finance.naver.com/api/realtime/domestic/index/{KOSPI|KOSDAQ} JSON

  • Top Gainers: finance.naver.com/sise/sise_rise.naver?sosok={0|1} HTML

  • Stock Details / PERΒ·EPSΒ·PBRΒ·Dividends: finance.naver.com/item/main.naver?code=... (Stable emphasis tags like id="_per")

  • News by Stock: finance.naver.com/item/news_news.naver?code=...

  • Safe operation with automatic fallback snapshots during market holidays or Naver page changes.

πŸ§ͺ Experiment β‘‘ β€” Tool Success/Failure Quality Comparison

exp2_quality.py runs the same user questions across three environments and auto-generates tables and failure logs.

  • (a) NO MCP β€” 0 tools. LLM answers only with training data β†’ Hallucinations, lack of evidence.

  • (b) GOOD MCP β€” Normal custom server. 12 tool calls, cites 4 positive keywords.

  • (c) BROKEN MCP β€” As defined in server_broken.py:

    • get_top_gainers description incorrectly written as "Top losers" β†’ Model misselection

    • get_recent_news triggers TimeoutError after time.sleep(5)

    • get_fundamentals returns an empty dict

Results:

  • results/exp2_quality_table.md β€” Comparison table

  • results/exp2_failure_logs.md β€” Failed call traces + response body

  • results/exp2_summary.json β€” Original statistics

πŸ§ͺ Experiment β‘’ β€” 3 Orchestration Patterns

Pattern

Description

Token Characteristics

Response Time Characteristics

Single

Accumulate tool results in one loop

Input tokens ↑↑

Slowest

Planner + Executor

Planner creates sequence, executor summarizes results

Input tokens ↓

Medium

Parallel sub-agents

KOSPI / KOSDAQ / NEWS sub-agents run simultaneously

Input tokens ↓↓

Fastest

Results:

  • results/exp3_benchmark.csv β€” Wide CSV for bar charts

  • results/exp3_pattern_table.md β€” Table + Retrospective

  • results/exp3_summary.json β€” Full trace per pattern

πŸ€– LLM Integration β€” Hermes / Other Hosts

This repository is designed to produce tokens and traces via deterministic simulation even without LLM API keys. To attach to actual Hermes / Claude Desktop / Cursor:

1) Use as Hermes Host (Running experiments β‘‘β‘’ with a real LLM)

Simply fill in _callHermes() in src/experiments/runner/hermes_runner.py.

# TODO(user): replace this body with the real Hermes call.
import httpx
response = httpx.post(self.endpoint, headers=..., json=...)
return response.json()

After setting environment variables HERMES_ENDPOINT, HERMES_API_KEY, replace the AgentRunner instance with HermesRunner().

2) Use only tools in Claude Desktop / Cursor

Add to Claude Desktop's claude_desktop_config.json or Cursor MCP settings:

{
  "mcpServers": {
    "kookmin-stock": {
      "command": "python",
      "args": ["-m", "mcp_stock.server"],
      "cwd": "/path/to/Kookmin-University-MCP",
      "env": { "PYTHONPATH": "/path/to/Kookmin-University-MCP/src" }
    }
  }
}

πŸ“‘ Creating PPT

Paste slides/slides.md directly into another AI. Example prompt:

The following markdown is a 12-slide spec for a 5-minute presentation. Please create PowerPoint slides based on the # Slide N headers. Represent ### Visual blocks as mermaid diagrams or tables if possible, and put ### Speaker Notes into the slide notes area.

πŸ“€ Submission Flow

  1. Update results with python -m experiments.exp2_quality && python -m experiments.exp3_orchestration

  2. Record 30-second demo with ./demo/record_demo.sh β†’ demo/demo.mov

  3. GitHub push (Record repository URL in README and slide 6)

  4. Send GitHub URL + slides + demo video to kts123@kookmin.ac.kr (Deadline 5/14 23:59:59)

πŸ“ Directory Tree

.
β”œβ”€β”€ README.md
β”œβ”€β”€ pyproject.toml / requirements.txt
β”œβ”€β”€ demo/
β”‚   β”œβ”€β”€ demo_script.md
β”‚   └── record_demo.sh
β”œβ”€β”€ results/                 # μžλ™ 생성
β”œβ”€β”€ slides/slides.md
└── src/
    β”œβ”€β”€ mcp_stock/
    β”‚   β”œβ”€β”€ server.py
    β”‚   β”œβ”€β”€ server_broken.py
    β”‚   β”œβ”€β”€ data/ticker_map.py
    β”‚   β”œβ”€β”€ sources/naver.py        # 넀이버 금육 크둀러 (단일 데이터 μ†ŒμŠ€)
    β”‚   └── tools/{market, quote, news, fundamentals, recommend}.py
    β”œβ”€β”€ experiments/
    β”‚   β”œβ”€β”€ exp1_demo.py
    β”‚   β”œβ”€β”€ exp2_quality.py
    β”‚   β”œβ”€β”€ exp3_orchestration.py
    β”‚   └── runner/{agent_base, mock_runner, hermes_runner}.py
    └── utils/{logger, token_counter}.py

πŸ›Ÿ Troubleshooting

Symptom

Cause

Response

naver detail fetch failed for XXXXXX

Stock not on Naver page or structure changed

Uses automatic fallback snapshot β€” operates normally

httpx.ConnectError

Network offline

All tools operate safely with fallback snapshots

Korean characters broken

Terminal font

D2 Coding / Pretendard / SF Mono recommended

Call on holiday/weekend

Not a business day

Polling API returns the last closing price as is

Install Server
F
license - not found
A
quality
D
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to query real-time and historical Korean stock market data from KRX (Korea Exchange) including indices, stocks, ETFs, bonds, derivatives, and commodities via MCP tools and resources.
    62
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides Korean stock market data (KOSPI, KOSDAQ, KONEX) including prices, fundamentals, investor trading, short selling, and indices via MCP protocol, enabling natural language queries from AI agents like ChatGPT and Claude.
    3
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Provides Korean stock market data, including DART electronic disclosures and KRX trading information, enabling users to query company profiles, financial statements, and stock trade details via MCP clients.
    9
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that retrieves Korean stock fundamentals and financial data from OpenDART, enabling LLMs to access corporate disclosures, financial statements, and dividend information.
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

  • 7-factor stock scoring MCP server. US/HK/CN, 74 stocks. Free + Premium (USDC/Base). x402 ready.

  • Korean market data for AI agents: K-beauty/K-food products, Naver trends, stocks, real estate.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JooSeunghyeon/Kookmin-University-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server