CLI & MCP server for KRX (Korea Exchange) Open API — query Korean stock market data (KOSPI, KOSDAQ, ETF, bonds, derivatives) from terminal or AI agents
krx-cli has 11 tools with mostly complete schemas and descriptions. Strengths: all tools have descriptions (50-300 chars), input parameters are typed with enums where appropriate (endpoint, action, sort_direction), and parameter descriptions are present. Weaknesses: tool names lack action verbs (krx_stock, krx_etp, krx_bond, krx_derivative, krx_commodity, krx_esg are all noun-only; should be get_krx_stock, query_krx_stock, etc.), output schemas are not documented in descriptions, and error handling guidance is minimal. The krx_watchlist tool is the only one with a clear action verb (manage). Six tools (krx_stock through krx_esg) are nearly identical in structure and description, suggesting potential consolidation. No tool annotations (readOnlyHint/destructiveHint) are visible in the code.
Query KRX bond market data. Available endpoints: - bon_bydd_trd: 채권 일별 거래 현황 Common response fields: ISU_CD(종목코드), ISU_NM(종목명), CLSPRC(종가), FLUC_RT(등락률) Notes: - Date format: YYYYMMDD (e.g., 20260310) - Data is T-1 (previous trading day) - All response values are strings - Rate limit: 10,000 calls/day - IMPORTANT: When querying a specific stock, ALWAYS pass 'isuCd' to filter. Without it, all stocks in the market are returned. - Full market listings can exceed the result size limit. Use 'fields' to select only needed columns, or 'limit'+'offset' for pagination. If the response contains '_truncated', follow its instructions to retrieve remaining data.
Query KRX commodity market data. Available endpoints: - cmdt_bydd_trd: 상품 일별 거래 현황 Common response fields: ISU_CD(종목코드), ISU_NM(종목명), CLSPRC(종가), FLUC_RT(등락률) Notes: - Date format: YYYYMMDD (e.g., 20260310) - Data is T-1 (previous trading day) - All response values are strings - Rate limit: 10,000 calls/day - IMPORTANT: When querying a specific stock, ALWAYS pass 'isuCd' to filter. Without it, all stocks in the market are returned. - Full market listings can exceed the result size limit. Use 'fields' to select only needed columns, or 'limit'+'offset' for pagination. If the response contains '_truncated', follow its instructions to retrieve remaining data.
Query KRX derivative market data. Available endpoints: - drvprod_bydd_trd: 파생상품 일별 거래 현황 Common response fields: ISU_CD(종목코드), ISU_NM(종목명), CLSPRC(종가), FLUC_RT(등락률) Notes: - Date format: YYYYMMDD (e.g., 20260310) - Data is T-1 (previous trading day) - All response values are strings - Rate limit: 10,000 calls/day - IMPORTANT: When querying a specific stock, ALWAYS pass 'isuCd' to filter. Without it, all stocks in the market are returned. - Full market listings can exceed the result size limit. Use 'fields' to select only needed columns, or 'limit'+'offset' for pagination. If the response contains '_truncated', follow its instructions to retrieve remaining data.
Tool names lack action verbs. Six tools (krx_stock, krx_etp, krx_bond, krx_derivative, krx_commodity, krx_esg) use noun-only names. LLMs infer intent from verb-noun patterns; 'krx_stock' is ambiguous (get? create? delete?). Rename to query_krx_stock, get_krx_stock_data, or fetch_krx_stock.
Output schemas not documented. Tool descriptions explain inputs but do not specify what fields are returned. LLMs cannot plan downstream calls or extract data without knowing response structure. Add 'Returns: { field1: type, field2: type, ... }' to each description.
No tool annotations visible. Tools lack readOnlyHint, destructiveHint, or idempotentHint metadata. krx_watchlist performs writes (add/remove) but is not marked destructive. Agents cannot distinguish safe reads from state-modifying calls.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | D | 51 | <=2025-11-25 | v2 |
Query KRX ESG market data. Available endpoints: - esg_bydd_trd: ESG 일별 거래 현황 Common response fields: ISU_CD(종목코드), ISU_NM(종목명), CLSPRC(종가), FLUC_RT(등락률) Notes: - Date format: YYYYMMDD (e.g., 20260310) - Data is T-1 (previous trading day) - All response values are strings - Rate limit: 10,000 calls/day - IMPORTANT: When querying a specific stock, ALWAYS pass 'isuCd' to filter. Without it, all stocks in the market are returned. - Full market listings can exceed the result size limit. Use 'fields' to select only needed columns, or 'limit'+'offset' for pagination. If the response contains '_truncated', follow its instructions to retrieve remaining data.
Query KRX ETP (Exchange Traded Products) market data. Available endpoints: - etp_bydd_trd: ETF/ETN 일별 거래 현황 Common response fields: ISU_CD(종목코드), ISU_NM(종목명), CLSPRC(종가), FLUC_RT(등락률) Notes: - Date format: YYYYMMDD (e.g., 20260310) - Data is T-1 (previous trading day) - All response values are strings - Rate limit: 10,000 calls/day - IMPORTANT: When querying a specific stock, ALWAYS pass 'isuCd' to filter. Without it, all stocks in the market are returned. - Full market listings can exceed the result size limit. Use 'fields' to select only needed columns, or 'limit'+'offset' for pagination. If the response contains '_truncated', follow its instructions to retrieve remaining data.
Get a comprehensive market summary including KOSPI/KOSDAQ indices, stock statistics (advancing/declining/unchanged), top 5 gainers/losers, and total trading volume/value. This tool combines data from 4 API endpoints in a single call — ideal for getting a quick market overview. Returns: - kospiIndex: KOSPI series index data - kosdaqIndex: KOSDAQ series index data - stockStats: { advancing, declining, unchanged, totalVolume, totalValue } - topGainers: Top 5 stocks by change rate - topLosers: Bottom 5 stocks by change rate
Check daily API call usage. KRX API has a 10,000 calls/day limit. Use this to monitor remaining quota before making bulk queries.
Query response field schemas for KRX API endpoints. Returns field names and descriptions for each endpoint. Use this to discover available fields before querying data.
Search KRX stocks by name. Returns matching stock codes (ISU_CD), short codes (ISU_SRT_CD), names (ISU_NM), and market (KOSPI/KOSDAQ). Use this to resolve a stock name to its code before querying market data.
Query KRX stock market data (KOSPI/KOSDAQ stocks). Available endpoints: - stk_bydd_trd: 주식 일별 거래 현황 - stk_isulist: 주식 종목 리스트 Common response fields: ISU_CD(종목코드), ISU_NM(종목명), MKT_NM(시장구분), CLSPRC(종가), FLUC_RT(등락률) Notes: - Date format: YYYYMMDD (e.g., 20260310) - Data is T-1 (previous trading day) - All response values are strings - Rate limit: 10,000 calls/day - IMPORTANT: When querying a specific stock, ALWAYS pass 'isuCd' to filter. Without it, all stocks in the market are returned. - Full market listings can exceed the result size limit. Use 'fields' to select only needed columns, or 'limit'+'offset' for pagination. If the response contains '_truncated', follow its instructions to retrieve remaining data.
Manage a persistent watchlist of stocks. Actions: - add: Search by name and add to watchlist - remove: Remove by name or stock code (exact match) - list: Show all watchlist entries - show: Fetch current prices for all watchlist stocks The watchlist is stored locally at ~/.krx-cli/watchlist.json.
Six tools are nearly identical (krx_stock, krx_etp, krx_bond, krx_derivative, krx_commodity, krx_esg). They share the same parameter schema and description template. Consider consolidating into a single query_krx_market_data(market_type: enum) tool to reduce cognitive load and maintenance burden.
Error handling lacks recovery guidance. Tool descriptions mention rate limits and data truncation but do not explain what the LLM should do if a call fails (retry? call krx_rate_limit first? adjust parameters?). Add actionable error messages and recovery steps.