- tsrs-mcp-server
Content
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。
服务器支持两种运行模式:
- Stdio模式(默认):直接下载release产物。执行:
./tsrs-mcp-server stdio - Stream模式:提供Streamable HTTP模式。endpoint: http://127.0.0.1:8999
运行方式如下图配置(仅展示在chatwise的配置):

鸣谢
感谢以下项目和库, 尤其是 poem-mcpserver 对MCP编写的极强便捷性支持, 没有它, 本项目没有如此简便的实现方式。
同时感谢 TuShare API 提供的数据接口。
最后要感谢 rust, 没有 procedural macros, 本项目的模版实现将变得异常机械化。
License
本项目采用 MIT 许可证。详见 LICENSE 文件。
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
WindsurfThe new purpose-built IDE to harness magic
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
DeepChatYour AI Partner on Desktop