KIS
- python
13
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"migusdn-kis_mcp_server": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run",
"--with",
"httpx",
"--with",
"mcp[cli]",
"--with",
"xmltodict",
"mcp",
"run",
"/path/to/your/project/server.py"
],
"env": {
"KIS_CANO": "YOUR_ACCOUNT_NUMBER",
"KIS_APP_KEY": "YOUR_APP_KEY",
"KIS_APP_SECRET": "YOUR_APP_SECRET",
"KIS_ACCOUNT_TYPE": "VIRTUAL"
}
}
}
}You can run a Model Context Protocol (MCP) server that interfaces with Korea Investment & Securities’ REST API to trade and fetch market data. This server enables domestic and overseas stock trading, quote retrieval, and account management with asynchronous, fast responses and robust error handling, making it practical for automated trading workflows and data integration.
How to use
To use the server, you set up an MCP client to communicate with the MCP server’s endpoints for domestic and overseas stock operations. You will log in with your API credentials, then perform actions such as querying current prices, placing orders, checking balances, and retrieving order histories. For overseas markets, you can submit buy/sell orders and fetch live price data across major markets. Your client will receive structured results for each action, including price, volume, and status information.
How to install
Prerequisites you need before installing: Python 3.13 or newer, and a tooling path for the MCP runner (uv). Follow these steps to set up the server.
-
Install the MCP runner tool if it isn’t already available on your system.
-
Create and activate a Python virtual environment.
-
Install the server’s dependencies in editable mode.
-
Start the MCP server using the provided command and supply your credentials via environment variables.
MCP Server Configuration
{
"mcpServers": {
"KIS MCP Server": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run",
"--with",
"httpx",
"--with",
"mcp[cli]",
"--with",
"xmltodict",
"mcp",
"run",
"/path/to/your/project/server.py"
],
"env": {
"KIS_APP_KEY": "your_app_key",
"KIS_APP_SECRET": "your_secret_key",
"KIS_ACCOUNT_TYPE": "VIRTUAL",
"KIS_CANO": "your_account_number"
}
}
}
}
Configuration and environment
Environmental variables control access to the API and specify your trading account details. The following variables are shown for running the MCP server: KIS_APP_KEY, KIS_APP_SECRET, KIS_ACCOUNT_TYPE, and KIS_CANO. Use real values for a production setup or placeholders for testing.
Notes on capabilities
The server supports domestic stock trading actions such as querying current prices, placing buy/sell orders, querying balances, and retrieving order histories. It also supports overseas stock trading with market-specific symbols and market codes, allowing you to place orders and fetch live prices for major markets.
Security and precautions
Treat all API keys and secrets as confidential. Use a virtual or sandbox account for testing before using real funds. Review the terms of service of Korea Investment & Securities and ensure you comply with trading hours and any API usage limits.
Troubleshooting
If you encounter authentication errors, verify that KIS_APP_KEY and KIS_APP_SECRET are correct. If you see insufficient balance or time restrictions, double-check your account type and trading hours. Enable detailed logging to diagnose API response errors and network issues.
Available tools
inquery_stock_price
Query the current price for a domestic stock by its code, returning price, change, percentage, and volume.
order_stock
Place a domestic stock buy or sell order with symbol, quantity, price, and order type.
inquery_balance
Retrieve the current balance and position information for the trading account.
inquery_order_list
Fetch daily order history between a start and end date.
inquery_order_detail
Get detailed information for a specific order by number and date.
inquery_stock_ask
Fetch quote/level-1 order book data for a domestic stock.
order_overseas_stock
Place a buy or sell order for overseas stocks with market and symbol details.
inquery_overseas_stock_price
Query the current price for overseas stocks by symbol and market.