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

by migusdn

25 stars
367 downloads
Not rated
GitHub

About

Provides stock trading and market data using the Korea Investment & Securities (KIS) REST API.

Details

Author
migusdn
GitHub stars
25
Downloads
367
Categories
Developer Tools, Other, Finance, API

- 166 REST APIs across 8 groups (stock, bond, futures, etc.)
- Catalog-based tools: list-kis-api-specs, get-kis-api-spec, call-kis-api
- Convenience tools for frequently used domestic/overseas stock functions
- Automatic account number and token caching
- Safety gate blocks trading APIs by default
- Supports stdio, sse, streamable-http transports
- Lightweight catalog mode reduces MCP tool context usage

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name 한국투자증권 REST API MCP (Model Context Protocol)
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install dependencies with uv sync, create a .env file with KIS_APP_KEY, KIS_APP_SECRET, KIS_CANO, KIS_ACNT_PRDT_CD, and optionally KIS_ENABLE_TRADING for order APIs. Run with uv run python server.py. Configuration can also be provided via command-line arguments. Supports stdio, sse, and streamable-http transports.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "\ud55c\uad6d\ud22c\uc790\uc99d\uad8c rest api mcp (model context protocol)": {
            "KIS_MCP_Server": {
                "command": "uv",
                "args": [
                    "venv"
                ]
            }
        }
    }
}

McpServers

{
    "KIS_MCP_Server": {
        "command": "uv",
        "args": [
            "venv"
        ]
    }
}

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

Python 3.13+
License: MIT

<a href="https://glama.ai/mcp/servers/@migusdn/KIS_MCP_Server">
KIS REST API Server MCP server
</a>

한국투자증권(KIS) REST API를 MCP 도구로 호출하는 서버입니다. 국내/해외 주식 조회, 계좌 조회, 주문 관련 API를 카탈로그 기반 범용 도구와 자주 쓰는 편의 도구로 제공합니다.

주의

이 프로젝트는 개인/커뮤니티가 운영하는 비공식 오픈소스 프로젝트이며 한국투자증권, KIS Developers, true friend 한국투자 Open API와 제휴·후원·승인·공식 배포 관계가 없습니다.
본 프로젝트의 설치, 설정, API 호출, 계좌 조회, 주문 실행, 투자 판단 및 그 결과로 발생하는 손실·장애·보안 문제 등 사용상의 모든 책임은 사용자에게 있습니다.
실제 거래 전 한국투자증권 공식 문서와 입력값을 직접 확인하세요.

주요 기능

- API 카탈로그 기반 호출
- 8개 그룹, 166개 REST API 제공
- API 그룹/ID, 경로, HTTP 메서드, TR_ID 후보, 요청 파라미터 확인
- 파라미터별 한글 라벨, 입력 가이드, 예시값, 주요 코드값 제공
- 전체 목록: API_CATALOG.md
- 국내주식
- 현재가, 기간/일별 시세, 호가, 업종지수, 기본정보 조회
- 잔고, 투자계좌 자산현황, 매수가능금액, 매도가능수량 조회
- 주문/주문내역/정정취소 가능 주문 조회
- 해외주식
- 미국, 일본, 중국, 홍콩, 베트남 시장 코드 지원
- 현재가, 잔고, 체결기준 현재잔고, 통화별 증거금, 매수가능금액 조회
- 시장/매수매도 방향에 따른 주문 TR_ID 자동 선택
- 실행/운영
- stdio, sse, streamable-http transport 지원
- .env 또는 명령줄 인자 기반 설정
- 계좌번호, 계좌상품코드, 인증값 자동 보완
- 앱키와 계좌 타입 기준 토큰 캐시
- 알 수 없는 요청 파라미터 기본 거부
- 주문/정정/취소 API 기본 차단

안전 기본값

주문/정정/취소처럼 계좌 상태를 바꾸는 API는 기본적으로 차단됩니다.

KIS_ENABLE_TRADING=true

위 값을 명시적으로 설정한 경우에만 상태 변경 API가 실행됩니다. 조회 API만 사용하는 경우에는 설정하지 마세요.

요구 사항

- Python >= 3.13
- uv

설치

설치는 INSTALL.md를 기준으로 진행하세요. LLM이나 MCP 클라이언트가 설정할 때도 이 파일을 우선 읽으면 됩니다.

INSTALL.md에는 다음 내용이 포함되어 있습니다.

- uv 기반 의존성 설치
- .env 생성과 KIS_APP_KEY, KIS_APP_SECRET, KIS_CANO, KIS_ACNT_PRDT_CD 설정
- Codex CLI, Claude Code, Claude Desktop, 일반 MCP 클라이언트 등록 예시
- 컨텍스트 절약용 KIS_MCP_TOOLSET=catalog 설정
- 잔고, 매수가능금액, 현재가 조회용 call-kis-api 예시

빠른 로컬 준비:

pip install uv
uv sync
cp .env.example .env
chmod 600 .env

그 다음 .env에 아래 값을 설정합니다. 자세한 값 설명과 클라이언트별 등록 명령은 INSTALL.md를 참고하세요.

KIS_APP_KEY="발급받은 앱키"
KIS_APP_SECRET="발급받은 시크릿키"
KIS_ACCOUNT_TYPE="REAL"   # REAL 또는 VIRTUAL
KIS_CANO="계좌번호 앞 8자리"
KIS_ACNT_PRDT_CD="01"
KIS_MCP_TOOLSET="catalog"

실행

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.