kookmin-stock
Provides tools to fetch stock market data (market overview, gainers, quotes, news, fundamentals, recommendations) from Naver Finance.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@kookmin-stock get the market overview for today"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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) |
| FastMCP stdio, 6 tools |
MCP Server (Broken Version) |
| Incorrect description / Timeout / Empty response |
30-second Demo |
| Sequence output for recording |
Experiment β‘ Result Comparison |
| NO MCP / GOOD / BROKEN comparison |
Experiment β’ Pattern Comparison |
| Single / Planner+Executor / Parallel |
Presentation Slides (spec) |
| Paste into another AI to generate PPT |
Result Outputs |
| 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 |
| 'today' / YYYY-MM-DD |
|
| KOSPI/KOSDAQ, 1..50 | Top N stocks |
| Code or Korean name | close / changePct / volume / per / pbr |
| Keyword or stock name | Headline + |
| Code or Korean name | per / pbr / eps / bps / roe |
| 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}JSONTop Gainers:
finance.naver.com/sise/sise_rise.naver?sosok={0|1}HTMLStock Details / PERΒ·EPSΒ·PBRΒ·Dividends:
finance.naver.com/item/main.naver?code=...(Stable emphasis tags likeid="_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_gainersdescription incorrectly written as "Top losers" β Model misselectionget_recent_newstriggersTimeoutErroraftertime.sleep(5)get_fundamentalsreturns an empty dict
Results:
results/exp2_quality_table.mdβ Comparison tableresults/exp2_failure_logs.mdβ Failed call traces + response bodyresults/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 chartsresults/exp3_pattern_table.mdβ Table + Retrospectiveresults/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 Nheaders. Represent### Visualblocks as mermaid diagrams or tables if possible, and put### Speaker Notesinto the slide notes area.
π€ Submission Flow
Update results with
python -m experiments.exp2_quality && python -m experiments.exp3_orchestrationRecord 30-second demo with
./demo/record_demo.shβdemo/demo.movGitHub push (Record repository URL in README and slide 6)
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 |
| Stock not on Naver page or structure changed | Uses automatic fallback snapshot β operates normally |
| 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 |
Available Tools
6 toolsget_fundamentalsB
Return PER, PBR, EPS, BPS, ROE and dividend yield for a ticker.
Inputs: ticker (required).
get_market_overviewA
Return KOSPI and KOSDAQ index close, daily change percent, and trading value.
Args: date: 'today' or YYYY-MM-DD. Non-business days fall back to the most recent trading day automatically. Returns: {asOf, kospi:{close, changePct, tradingValueKrw}, kosdaq:{...}, source}
Inputs: date.
get_recent_newsA
Return recent Naver finance news headlines about a ticker or keyword.
Each item carries a positivityScore (sum of catalyst-keyword matches
minus negative-keyword matches) plus the matched keywords.
Args: query: ticker code, Korean stock name, or free-text keyword. top_n: 1..20.
Inputs: query (required), top_n. Returns: result
get_stock_quoteB
Return the most recent close, change percent, volume, PER and PBR for a ticker.
Args: ticker: 6-digit code (e.g. '005930') or Korean name (e.g. 'μΌμ±μ μ').
Inputs: ticker (required).
get_top_gainersA
Return the top N stocks ranked by daily change percent (descending).
Args: market: 'KOSPI' or 'KOSDAQ'. top_n: 1..50. Returns: List of {ticker, name, changePct, close, asOf}.
Inputs: market, top_n. Returns: result
recommend_buysA
Composite buy-recommendation tool.
Combines top gainers + per-ticker quote, news positivity, and fundamentals
into a ranked list. Each entry includes a transparent scoreBreakdown and
a Korean-language rationale so the LLM can quote the reasoning.
Args: market: 'KOSPI' or 'KOSDAQ'. top_n: 1..10. criteria: optional override of {minPositivityScore, maxPer, minRoe}.
Inputs: market, top_n, criteria. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: fundamentals, market overview, news, stock quote, top gainers, and a composite recommendation. No overlap or ambiguity.
Most tools follow a 'get_' prefix verb_noun pattern (e.g., get_fundamentals, get_market_overview). The exception is recommend_buys, which is still verb_noun but lacks the prefix, creating a minor inconsistency.
With 6 tools covering fundamental data, market overview, news, quotes, top gainers, and a recommend feature, the count is well-scoped for a stock information server.
The tool surface covers core stock information needs (fundamentals, quotes, news, top gainers, overview, and a composite recommendation). Minor gaps like historical prices or sector data are not critical for the stated purpose.
Related MCP Connectors
A Model Context Protocol server exposing real-time and historical Colombo Stock Exchange (CSE) data to AI agents and LLM applications. Provides quotes and OHLCV price history, full financial statements (income, balance sheet, cash flow), pre-computed technicals (moving averages, RS ratings, volume signals), macroeconomic indicators, corporate actions, and rule-based screening across CSE stocks and sector indices, everything needed to build CSE-aware trading assistants, research tools, and market-analysis agents. This is the official MCP server of www.ceyloncharts.com
Official Intrinio MCP server. US stock prices, options and fundamentals for AI agents.
Financial data MCP server for Claude, ChatGPT, Cursor and Codex. Real-time stock quotes, financial statements, options flow, SEC filings, insider trades, 13F holdings, macro data and market news from gloom.sh, the open-source Bloomberg Terminal alternative.
Hosted MCP server for Indian NSE/BSE stock research: 59 tools for quotes, financials and ratios, peers, shareholding and pledge, filings with extracted facts, screens, F&O and FII/DII context. Source and freshness on every answer; no buy/sell calls.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables 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.27 npm1MIT

pykrx-mcpofficial
AlicenseNot gradedqualityDmaintenanceProvides 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.57 PyPI3MIT- AlicenseAqualityDmaintenanceProvides 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.9MIT
- AlicenseNot gradedqualityDmaintenanceAn 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