KIS REST API MCP Server

KIS REST API MCP Server

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.

Category
Visit Server

README

한국투자증권 REST API MCP (Model Context Protocol)

Python 3.13+ License: MIT

한국투자증권(KIS)의 REST API를 사용하여 주식 거래 및 시세 정보를 조회하는 MCP(Model Context Protocol) 서버입니다. 국내 및 해외 주식 거래, 시세 조회, 계좌 관리 등 다양한 금융 거래 기능을 제공합니다.

✨ 주요 기능

  • 🇰🇷 국내 주식 거래

    • 실시간 현재가 조회
    • 매수/매도 주문
    • 잔고 조회
    • 호가 정보 조회
    • 주문 내역 조회
  • 🌏 해외 주식 거래

    • 미국, 일본, 중국, 홍콩, 베트남 등 주요 시장 지원
    • 실시간 현재가 조회
    • 매수/매도 주문
  • 특징

    • 비동기 처리로 빠른 응답
    • 실시간 시세 및 체결 정보
    • 안정적인 에러 처리
    • 확장 가능한 설계

⚠️ 주의사항

이 프로젝트는 아직 개발 중인 미완성 프로젝트입니다. 실제 투자에 사용하기 전에 충분한 테스트를 거치시기 바랍니다.

  • 본 프로젝트를 사용하여 발생하는 모든 손실과 책임은 전적으로 사용자에게 있습니다.
  • API 사용 시 한국투자증권의 이용약관을 준수해야 합니다.
  • 실제 계좌 사용 시 주의가 필요하며, 모의투자 계좌로 충분한 테스트를 권장합니다.
  • API 호출 제한과 관련된 제약사항을 반드시 확인하시기 바랍니다.

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 - 주식 현재가 조회

    • symbol: 종목코드 (예: "005930") (string, required)
    • Returns: 현재가, 전일대비, 등락률, 거래량 등
  • order_stock - 주식 매수/매도 주문

    • symbol: 종목코드 (string, required)
    • quantity: 주문수량 (number, required)
    • price: 주문가격 (0: 시장가) (number, required)
    • order_type: 주문유형 ("buy" 또는 "sell") (string, required)
  • inquery_balance - 계좌 잔고 조회

    • Returns: 보유종목, 평가금액, 손익현황 등
  • inquery_order_list - 일별 주문 내역 조회

    • start_date: 조회 시작일 (YYYYMMDD) (string, required)
    • end_date: 조회 종료일 (YYYYMMDD) (string, required)
  • inquery_order_detail - 주문 상세 내역 조회

    • order_no: 주문번호 (string, required)
    • order_date: 주문일자 (YYYYMMDD) (string, required)
  • inquery_stock_ask - 호가 정보 조회

    • symbol: 종목코드 (string, required)
    • Returns: 매도/매수 호가, 호가수량 등

Overseas Stock Trading

  • order_overseas_stock - 해외 주식 매수/매도 주문

    • symbol: 종목코드 (예: "AAPL") (string, required)
    • quantity: 주문수량 (number, required)
    • price: 주문가격 (number, required)
    • order_type: 주문유형 ("buy" 또는 "sell") (string, required)
    • market: 시장코드 (string, required)
      • "NASD": 나스닥
      • "NYSE": 뉴욕
      • "AMEX": 아멕스
      • "SEHK": 홍콩
      • "SHAA": 중국상해
      • "SZAA": 중국심천
      • "TKSE": 일본
      • "HASE": 베트남 하노이
      • "VNSE": 베트남 호치민
  • inquery_overseas_stock_price - 해외 주식 현재가 조회

    • symbol: 종목코드 (string, required)
    • market: 시장코드 (string, required)

Resources

Configuration

환경 변수를 통해 API 키와 계좌 정보를 설정합니다:

  • KIS_APP_KEY: 한국투자증권 앱키
  • KIS_APP_SECRET: 한국투자증권 시크릿키
  • KIS_ACCOUNT_TYPE: 계좌 타입 ("REAL" 또는 "VIRTUAL")
  • KIS_CANO: 계좌번호

Trading Hours

국내 주식:

  • 정규장: 09:00 ~ 15:30
  • 시간외 단일가: 15:40 ~ 16:00

해외 주식:

  • 미국(나스닥/뉴욕): 22:30 ~ 05:00 (한국시간)
  • 일본: 09:00 ~ 15:10
  • 중국: 10:30 ~ 16:00
  • 홍콩: 10:30 ~ 16:00
  • 베트남: 11:15 ~ 16:15

Error Handling

API 호출 시 발생할 수 있는 주요 에러:

  • 인증 오류: API 키 또는 시크릿키가 잘못된 경우
  • 잔고 부족: 주문 금액이 계좌 잔고보다 큰 경우
  • 시간 제한: 거래 시간이 아닌 경우
  • 주문 제한: 주문 수량이나 금액이 제한을 초과한 경우

About

  • 확장 가능한 설계
  • 비동기 처리로 빠른 응답
  • 실시간 시세 및 체결 정보
  • 안정적인 에러 처리

License

MIT License

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured