KOSPI/KOSDAQ Stock Data MCP server

Integrates with pykrx to provide real-time access to KOSPI and KOSDAQ stock market data, offering tools for retrieving ticker symbols, OHLCV data, market capitalization, fundamental metrics, and trading volumes.
Back to servers
Provider
Sangrok Mun
Release date
Feb 14, 2025
Language
Python
Package
Stats
12.0K downloads
28 stars

Here's the OHLCV (Open, High, Low, Close, Volume) data for Samsung Electronics for the past month.


3. Get market capitalization data:

Human: What's the market cap of Naver for the last week? Assistant: I'll retrieve Naver's (035420) market cap data for the last week.

Using tool 'get_stock_market_cap'... Date Market Cap 2024-02-14 49,321,050,000,000 2024-02-13 48,987,320,000,000 ...


## Acknowledgements

This package is built on:
- [fastmcp](https://github.com/Quansight/fastmcp) for MCP server functionality
- [FinanceDataReader](https://github.com/financedata-org/FinanceDataReader) for financial data retrieval

## License

This project is licensed under the MIT License.

AI: This MCP server provides KOSPI/KOSDAQ stock data through a straightforward interface, allowing you to retrieve various stock information including ticker symbols, price data, market capitalization, and fundamental metrics.

## Installation

### Prerequisites

This package requires [uv](https://github.com/astral-sh/uv) for installation and execution.

### Option 1: Installing via Smithery

To install automatically via Smithery:

```bash
npx -y @smithery/cli install @dragon1086/kospi-kosdaq-stock-server --client claude

Option 2: Manual Installation

# Create and activate a virtual environment
uv venv .venv
source .venv/bin/activate  # On Unix/macOS
# .venv\Scripts\activate   # On Windows

# Install the package
uv pip install kospi-kosdaq-stock-server

Configuration for Claude Desktop

After installation, configure the MCP server in your Claude Desktop configuration file:

  1. Locate the configuration file:

    • On macOS: /Users/username/Library/Application Support/Claude/claude_desktop_config.json
    • On Windows: %APPDATA%/Claude/claude_desktop_config.json
  2. Add the server configuration:

{
    "mcpServers": {
        "kospi-kosdaq": {
            "command": "uvx",
            "args": ["kospi_kosdaq_stock_server"]
        }
    }
}
  1. Restart Claude for the changes to take effect.

Available Tools

Ticker Information

  • load_all_tickers: Loads all ticker symbols and names for KOSPI and KOSDAQ
    • No arguments required

Stock Data Retrieval

  • get_stock_ohlcv: Retrieves OHLCV (Open/High/Low/Close/Volume) data

    • fromdate (string, required): Start date (YYYYMMDD)
    • todate (string, required): End date (YYYYMMDD)
    • ticker (string, required): Stock ticker symbol
    • adjusted (boolean, optional): Use adjusted prices (defaults to True)
  • get_stock_market_cap: Retrieves market capitalization data

    • fromdate (string, required): Start date (YYYYMMDD)
    • todate (string, required): End date (YYYYMMDD)
    • ticker (string, required): Stock ticker symbol
  • get_stock_fundamental: Retrieves PER/PBR/Dividend Yield data

    • fromdate (string, required): Start date (YYYYMMDD)
    • todate (string, required): End date (YYYYMMDD)
    • ticker (string, required): Stock ticker symbol
  • get_stock_trading_volume: Retrieves trading volume by investor type

    • fromdate (string, required): Start date (YYYYMMDD)
    • todate (string, required): End date (YYYYMMDD)
    • ticker (string, required): Stock ticker symbol

Usage Examples

Loading Tickers

Human: Please load all available stock tickers.
Assistant: I'll help you load all KOSPI and KOSDAQ stock tickers.

> Using tool 'load_all_tickers'...
Successfully loaded 2,873 stock tickers.

Retrieving OHLCV Data

Human: Show me Samsung Electronics' stock data for the last month.
Assistant: I'll retrieve Samsung Electronics' (005930) OHLCV data for the last month.

> Using tool 'get_stock_ohlcv'...
Date        Open    High    Low     Close   Volume
2024-02-14  73,800  74,000  73,400  73,700  7,823,124
2024-02-13  73,600  74,200  73,200  73,800  8,943,217
...

Getting Market Capitalization

Human: What's the market cap of Naver for the last week?
Assistant: I'll retrieve Naver's (035420) market cap data for the last week.

> Using tool 'get_stock_market_cap'...
Date        Market Cap
2024-02-14  49,321,050,000,000
2024-02-13  48,987,320,000,000
...

For retrieving fundamental data or trading volume information, use similar patterns with the appropriate tool and parameters.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later