inquery-overseas-stock-price
Retrieve overseas stock prices using KIS REST API MCP Server, enabling users to query real-time data by specifying a stock symbol and market.
Instructions
Get overseas stock price from Korea Investment & Securities
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market | Yes | ||
| symbol | Yes |
Implementation Reference
- server.py:727-765 (handler)The primary handler function decorated with @mcp.tool decorator, which registers the tool and defines its schema via parameters and description. It fetches the current overseas stock price using the KIS API.@mcp.tool( name="inquery-overseas-stock-price", description="Get overseas stock price from Korea Investment & Securities", ) async def inquery_overseas_stock_price(symbol: str, market: str): """ Get overseas stock price Args: symbol: Stock symbol (e.g. "AAPL") market: Market code ("NASD" for NASDAQ, "NYSE" for NYSE, etc.) Returns: Dictionary containing stock price information """ async with httpx.AsyncClient() as client: token = await get_access_token(client) response = await client.get( f"{TrIdManager.get_domain('buy')}{OVERSEAS_STOCK_PRICE_PATH}", headers={ "content-type": CONTENT_TYPE, "authorization": f"{AUTH_TYPE} {token}", "appkey": os.environ["KIS_APP_KEY"], "appsecret": os.environ["KIS_APP_SECRET"], "tr_id": "HHDFS00000300" }, params={ "AUTH": "", "EXCD": market, "SYMB": symbol } ) if response.status_code != 200: raise Exception(f"Failed to get overseas stock price: {response.text}") return response.json()
- server.py:727-730 (registration)The @mcp.tool decorator registers the 'inquery-overseas-stock-price' tool with MCP server.@mcp.tool( name="inquery-overseas-stock-price", description="Get overseas stock price from Korea Investment & Securities", )
- server.py:46-46 (helper)API endpoint path constant used by the tool.OVERSEAS_STOCK_PRICE_PATH = "/uapi/overseas-price/v1/quotations/price"
- server.py:752-752 (helper)Hardcoded TR_ID for overseas stock price inquiry."tr_id": "HHDFS00000300"