KIS REST API MCP Server

by migusdn
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Integrates with Python 3.13+ as the required runtime environment for the MCP server, as indicated by both the badge and requirements section.

  • Uses Shields.io badges to display Python version requirements and license information in the README.

Korea Investment & Securities REST API MCP (Model Context Protocol)

This is an MCP (Model Context Protocol) server that uses the REST API of Korea Investment & Securities (KIS) to search for stock trading and price information. It provides various financial transaction functions such as domestic and overseas stock trading, price search, and account management.

✨ Key Features

  • 🇰🇷 Domestic stock trading
    • Real-time current price inquiry
    • Buy/Sell Order
    • Check balance
    • View household information
    • Check order history
  • 🌏 Foreign stock trading
    • Support for major markets including the US, Japan, China, Hong Kong, and Vietnam
    • Real-time current price inquiry
    • Buy/Sell Order
  • Features
    • Fast response with asynchronous processing
    • Real-time price and transaction information
    • Stable error handling
    • Scalable design

⚠️ Note

This project is still in development and is an unfinished project. Please test it thoroughly before using it for actual investment.

  • Any and all losses and liabilities arising from the use of this project are entirely the responsibility of the user.
  • When using the API, you must comply with the Korea Investment & Securities Terms of Use.
  • Caution is required when using a real account, and sufficient testing with a mock investment account is recommended.
  • Be sure to check the restrictions regarding API call limits.

Requirements

  • Python >= 3.13
  • uv (Python packaging tool)

Installation

# 1. Install uv if not already installed pip install uv # 2. Create and activate virtual environment uv venv source .venv/bin/activate # Linux/MacOS # or .venv\\Scripts\\activate # Windows # 3. Install dependencies uv pip install -e . # 4. Set environment variables export KIS_APP_KEY="앱키" export KIS_APP_SECRET="시크릿키" export KIS_ACCOUNT_TYPE="VIRTUAL" # 또는 "REAL" export KIS_CANO="계좌번호"

Functions

Domestic Stock Trading

  • inquery_stock_price - Inquire about current stock price
    • symbol : stock code (e.g. "005930") (string, required)
    • Returns: Current price, previous day's price, rate of increase or decrease, trading volume, etc.
  • order_stock - Stock buy/sell order
    • symbol : stock code (string, required)
    • quantity : Order quantity (number, required)
    • price : order price (0: market price) (number, required)
    • order_type : Order type ("buy" or "sell") (string, required)
  • inquery_balance - Inquire account balance
    • Returns: Holdings, valuation, profit and loss status, etc.
  • inquery_order_list - Inquire daily order history
    • start_date : Search start date (YYYYMMDD) (string, required)
    • end_date : End date of search (YYYYMMDD) (string, required)
  • inquery_order_detail - Inquire order details
    • order_no : order number (string, required)
    • order_date : Order date (YYYYMMDD) (string, required)
  • inquery_stock_ask - Inquire stock price information
    • symbol : stock code (string, required)
    • Returns: Ask/Buy price, bid quantity, etc.

Overseas Stock Trading

  • order_overseas_stock - Overseas stock buy/sell order
    • symbol : stock code (e.g. "AAPL") (string, required)
    • quantity : Order quantity (number, required)
    • price : order price (number, required)
    • order_type : Order type ("buy" or "sell") (string, required)
    • market : Market code (string, required)
      • "NASD": NASDAQ
      • "NYSE": New York
      • "AMEX": Amex
      • "SEHK": Hong Kong
      • "SHAA": Shanghai, China
      • "SZAA": Shenzhen, China
      • "TKSE": Japan
      • "HASE": Hanoi, Vietnam
      • "VNSE": Ho Chi Minh City, Vietnam
  • inquery_overseas_stock_price - Inquire about current overseas stock prices
    • symbol : stock code (string, required)
    • market : Market code (string, required)

Resources

Configuration

Set your API key and account information via environment variables:

  • KIS_APP_KEY : Korea Investment & Securities App Key
  • KIS_APP_SECRET : Korea Investment & Securities Secret Key
  • KIS_ACCOUNT_TYPE : Account type ("REAL" or "VIRTUAL")
  • KIS_CANO : Account number

Trading Hours

Domestic stocks:

  • Regular hours: 09:00 ~ 15:30
  • After-hours single price: 15:40 ~ 16:00

Foreign stocks:

  • US (NASDAQ/New York): 22:30 ~ 05:00 (Korean time)
  • Japan: 09:00 ~ 15:10
  • China: 10:30 ~ 16:00
  • Hong Kong: 10:30 - 16:00
  • Vietnam: 11:15 - 16:15

Error Handling

Major errors that can occur when calling the API:

  • Authentication error: Invalid API key or secret key
  • Insufficient funds: When the order amount is greater than the account balance
  • Time limit: Outside trading hours
  • Order Limit: If the order quantity or amount exceeds the limit.

About

  • Scalable design
  • Fast response with asynchronous processing
  • Real-time price and transaction information
  • Stable error handling

License

MIT License

-
security - not tested
F
license - not found
-
quality - not tested

A Model Context Protocol server for interacting with Korea Investment & Securities (KIS) REST API, enabling domestic and foreign stock trading, price checks, and account management.

  1. ✨ 주요 기능
    1. ⚠️ 주의사항
      1. Requirements
        1. Installation
          1. Functions
            1. Domestic Stock Trading
            2. Overseas Stock Trading
          2. Resources
            1. Configuration
            2. Trading Hours
          3. Error Handling
            1. About
              1. License
                ID: m998nlg0yv