Home / MCP / TSRS MCP Server

TSRS MCP Server

Provides access to TuShare stock market data via MCP tools and runtimes in stdio mode

rust
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "tsrs_mcp": {
            "command": "./target/release/tsrs-mcp-server",
            "args": [
                "stdio"
            ],
            "env": {
                "TUSHARE_TOKEN": "your_token_here"
            }
        }
    }
}

You run a Rust-based MCP server that exposes TuShare stock market data through a set of MCP tools. It wraps TuShare APIs and lets you query data efficiently via the MCP protocol, enabling easy integration with MCP clients and visualization tools.

How to use

Start the server in stdio mode to run it locally and expose MCP endpoints. Once running, you can connect your MCP client to the local server and call the available tools to fetch stock market data. The server also supports a Streamable HTTP mode for remote access at the endpoint http://127.0.0.1:8999.

Key tools you can use include limit_step, ths_hot, kpl_list, kpl_concept, kpl_concept_cons, limit_cpt_list, moneyflow_ths, moneyflow_cnt_ths, and stk_mins. Each tool returns specific market data such as daily progressions, hot lists, price limits, concept groups, capital flows, and intraday minute data. Ensure you have a valid TuShare API token to access the underlying TuShare data.

How to install

Prerequisites: you need Rust and Cargo installed on your system.

# Install Rust toolchain (if not already installed)
# Follow the official Rust install instructions for your platform.

# Build the MCP server in release mode
cargo build --release

# Run the server in stdio mode (from the repository root, adjust path if needed)
./target/release/tsrs-mcp-server stdio

# Optional: run on a specific platform, when a release artifact is provided
# You may also run the prebuilt release binary if you have it
./tsrs-mcp-server stdio

Additional notes

Environment configuration: you must provide your TuShare API token. Create a copy of the example environment file and set the token value.

# Example environment setup
# Copy the example file
cp .env.example .env

# Edit the token value in .env
# TUSHARE_TOKEN=your_token_here

Troubleshooting

If the server fails to start, verify that you have Rust and Cargo installed, and that you set the TUSHARE_TOKEN in your environment file. Check for port conflicts if you use the HTTP stream mode. Ensure you are running the stdio command from the release-built binary path or the provided executable.

Available tools

limit_step

Get the number of consecutive daily limit-ups for stocks with trade_date, start_date, end_date, and nums; returns stock code, name, trade date, and the number of consecutive limit-ups.

ths_hot

Fetch TongHuaShun app hot list data for a given trade_date, including stock information, ranking, 热度, and related concepts.

kpl_list

Retrieve data on涨跌停板 with details and trading volumes using tag, start_date, end_date.

kpl_concept

Get the open market concept list for a given trade_date including concept code, name, and number of涨停 stocks.

kpl_concept_cons

Get constituents of open market concepts using trade_date and ts_code to return constituent stock details.

limit_cpt_list

Identify the concept sectors with the most涨停 stocks per day, returning sector code, name, and consecutive涨停 data.

moneyflow_ths

Obtain TongHuaShun stock capital flow data for ts_code with trade_date, start_date, and end_date, returning detailed money flow information.

moneyflow_cnt_ths

Fetch daily capital flow data for TongHuaShun concept boards, including板块资金流向 details.

stk_mins

Retrieve A-share minute-level trading data for ts_code with given frequency, start_date, and end_date.