TuShare (Chinese Financial Data)

by hanxuanliang

3 stars
419 downloads
Not rated
GitHub

About

Integrates with TuShare financial API to provide structured access to Chinese market data including stock listings, concept themes, money flow statistics, and minute-level price data.

Details

Author
hanxuanliang
Repository
hanxuanliang/tsrs-mcp-server
GitHub stars
3
Downloads
419
License
MIT License
Categories
Productivity, Developer Tools, Design, Workplace, AI, Infrastructure, Communication, Other

- 提供多个 MCP 工具:连板晋级、热榜、涨跌停、概念题材等。
- 支持同花顺资金流向与板块资金流向数据。
- 支持 A 股分钟级交易数据。
- 基于 Rust 构建,性能高效。
- 支持 Stdio 和 HTTP 两种运行模式。

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 TuShare (Chinese Financial Data)
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    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

复制 .env.example.env 并设置 TuShare token,然后通过 cargo build --release 构建或直接下载对应平台的 release 产物。支持 Stdio 模式(默认执行 ./tsrs-mcp-server stdio)和 Streamable HTTP 模式(端点 http://127.0.0.1:8999)。

limit_step

获取每天连板个数晋级的股票. 参数: trade_date, start_date, end_date, nums. 返回数据: 股票代码、名称、交易日期、连板次数.

ths_hot

获取同花顺App热榜数据. 参数: trade_date. 返回数据: 股票信息、排名、热度、概念等.

kpl_list

获取涨跌停板数据. 参数: tag, start_date, end_date. 返回数据: 涨跌停详细信息、成交数据等.

kpl_concept

获取开盘啦概念题材列表. 参数: trade_date. 返回数据: 题材代码、名称、涨停数量等.

kpl_concept_cons

获取开盘啦概念题材的成分股. 参数: trade_date, ts_code. 返回数据: 题材成分股详细信息.

limit_cpt_list

获取每天涨停股票最多的概念板块. 参数: trade_date, start_date, end_date. 返回数据: 板块代码、名称、连板数据等.

moneyflow_ths

获取同花顺个股资金流向数据. 参数: ts_code, trade_date, start_date, end_date. 返回数据: 资金流向详细数据.

moneyflow_cnt_ths

获取同花顺概念板块每日资金流向. 参数: trade_date, start_date, end_date. 返回数据: 板块资金流向数据.

stk_mins

获取A股分钟数据. 参数: ts_code, freq, start_date, end_date. 返回数据: 分钟级别的交易数据.

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "tushare (chinese financial data)": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

tsrs-mcp-server

这是一个基于 Model Context Protocol (MCP) 的TuShare数据服务器,提供了一系列股票市场数据查询接口。

项目简介

本项目是一个Rust实现的MCP服务器,封装了TuShare的API接口,提供了多个股票市场数据查询工具。项目使用了以下主要技术:

- Rust
- Model Context Protocol (MCP)
- Poem MCP Server
- TuShare API
- 过程宏 (Procedural Macros)

功能特性

项目提供了以下MCP工具:

| 工具名称 | 功能描述 | 主要参数 | 返回数据 |
|---------|---------|---------|---------|
| limit_step | 获取每天连板个数晋级的股票 | trade_date, start_date, end_date, nums | 股票代码、名称、交易日期、连板次数 |
| ths_hot | 获取同花顺App热榜数据 | trade_date | 股票信息、排名、热度、概念等 |
| kpl_list | 获取涨跌停板数据 | tag, start_date, end_date | 涨跌停详细信息、成交数据等 |
| kpl_concept | 获取开盘啦概念题材列表 | trade_date | 题材代码、名称、涨停数量等 |
| kpl_concept_cons | 获取开盘啦概念题材的成分股 | trade_date, ts_code | 题材成分股详细信息 |
| limit_cpt_list | 获取每天涨停股票最多的概念板块 | trade_date, start_date, end_date | 板块代码、名称、连板数据等 |
| moneyflow_ths | 获取同花顺个股资金流向数据 | ts_code, trade_date, start_date, end_date | 资金流向详细数据 |
| moneyflow_cnt_ths | 获取同花顺概念板块每日资金流向 | trade_date, start_date, end_date | 板块资金流向数据 |
| stk_mins | 获取A股分钟数据 | ts_code, freq, start_date, end_date | 分钟级别的交易数据 |

项目结构

项目包含以下主要组件:

- ts-derive: 提供用于TuShare API的过程宏实现
- ts-model: 包含数据模型
- src: 主程序实现

环境配置

在运行之前,需要设置TuShare的API token:

- 复制 .env.example.env
- 在 .env 文件中设置你的TuShare token:

TUSHARE_TOKEN=your_token_here

构建

前提条件:安装 Rust 和 Cargo。

cargo build --release

./target/release/tsrs-mcp-server

运行

你可以在release中找到对应平台下的编译产物, 例如 tsrs-mcp-server-<tag>-aarch64-apple-darwin.tar.gz

服务器支持两种运行模式:

1. Stdio模式(默认):直接下载release产物。执行: ./tsrs-mcp-server stdio
2. Stream模式:提供Streamable HTTP模式。endpoint: http://127.0.0.1:8999

运行方式如下图配置(仅展示在chatwise的配置):

chatwise-config

鸣谢

感谢以下项目和库, 尤其是 poem-mcpserver 对MCP编写的极强便捷性支持, 没有它, 本项目没有如此简便的实现方式。
同时感谢 TuShare API 提供的数据接口。
最后要感谢 rust, 没有 procedural macros, 本项目的模版实现将变得异常机械化。

- TuShare API
- poem-mcpserver

License

本项目采用 MIT 许可证。详见 LICENSE 文件。2a:["$","div",null,{"className":"my-8 pb-8 h-full max-w-5xl mx-auto","children":["$","div",null,{"className":"grid grid-cols-1 md:grid-cols-3 gap-6","children":["$","$L31",null,{"mcp":{"id":"mcp_o0t0O4ETaURU","name":"TuShare (Chinese Financial Data)","description":"Integrates with TuShare financial API to provide structured access to Chinese market data including stock listings, concept themes, money flow statistics, and minute-level price data.","logo":"https://avatars.githubusercontent.com/hanxuanliang","banner_url":null,"stars":3,"downloads":0,"categories":["productivity","dev","design","workplace","ai","deployment","version-control","infrastructure","collaboration"],"isRecommended":false,"created_at":"2025-04-17T01:24:46.958647+00:00","updated_at":"2025-04-17T01:49:56.023347+00:00","author":"hanxuanliang","average_rating":0,"total_ratings":0,"github_url":"https://github.com/hanxuanliang/tsrs-mcp-server","commit":"main","official":false,"bundler_compatible":false,"mcp_language":1,"slug":"hanxuanliang-tushare-chinese-financial-data","website":null,"is_sse":false,"summary":"A Rust-based MCP server for Tu

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.