Integrations
Enables secure storage and loading of Tushare API tokens through environment variables, allowing users to configure their credentials without hardcoding them.
Serves as the framework for exposing the MCP server's functionality via HTTP APIs, providing standardized endpoints for integration with other applications.
Provides version control for the MCP server codebase, with specific instructions for cloning the repository as part of the installation process.
Tushare_MCP
基于 Model Context Protocol (MCP) 的智能股票数据助手
该项目基于 Tushare 的金融数据接口进行开发,支持的能力包括:
1、工具调用,比方说股票的行情数据、更深度的财务数据以及指数数据等。
2、提供安全的 Tushare Token 配置与状态检查机制。
3、通过 FastAPI 封装,提供标准化的 HTTP API 接口,方便与其他应用集成。
✨ 已支持能力
- 全面的股票数据查询:
- 提供股票基本信息、实时行情(日线、指标)、历史股价变动查询。
- 支持通过股票代码或名称进行智能搜索。
- 深度财务数据分析:
- 获取上市公司详细财务报表,包括利润表、资产负债表、现金流量表。
- 查询关键财务指标数据。
- 指数与市场数据覆盖:
- 支持主流指数的基本信息查询、成分股获取及全球指数行情。
- 股东及公司基本面信息:
- 查询股东户数、十大股东信息、每日股本市值以及股权质押明细。
❌ 未支持能力
- 资金、板块、概念数据和成分股
- 公告、研报等资讯类数据
- 技术面、历史、实时分钟数据
由于这部分数据在 Tushare 需要单独开通权限或收费,故暂未添加
🚀 快速开始
环境要求
- Python 3.8+
- Tushare 账号和 API Token (获取地址: Tushare Pro Token 申请页面,请自行注册)
安装步骤
- 克隆仓库:Copy
- 创建并激活虚拟环境 (推荐):Copy
- 安装依赖:Copy
配置 Tushare Token
本项目需要 Tushare API Token 才能正常工作。你有以下几种方式配置 Token:
- 通过
.env
文件 (推荐,安全):- 在项目根目录下创建一个名为
.env
的文件 (此文件已被.gitignore
忽略,不会提交到版本库)。 - 在
.env
文件中添加以下内容,并将<你的TUSHARE_TOKEN>
替换为你的真实 Token:Copy
- 在项目根目录下创建一个名为
- 通过环境变量:
在运行
server.py
之前,设置名为TUSHARE_TOKEN
的环境变量。Copy
启动服务
在 AI IDE 软件中(如 Cursor 或 Trae) 的 MCP 服务中添加对应的 Servers
📄 开源协议
MIT License - 详见 LICENSE 文件
本地环境说明
Python 环境是由操作系统或外部工具(比如 Homebrew)管理的。为了保护系统级的 Python 安装,直接使用 pip3 install 来安装包到全局环境通常是不被允许的。需要通过激活虚拟环境(前提是创建虚拟环境)来完成
This server cannot be installed
A Model Context Protocol server that provides intelligent stock data assistance through Tushare's financial data API, enabling users to query comprehensive stock information, financial data, and market indices through natural language.
Related MCP Servers
- -securityAlicense-qualityA server based on Model Context Protocol that enables AI assistants to query and search for stock information using the Tushare API.Last updated -PythonMIT License
- -securityFlicense-qualityA Model Context Protocol server that interfaces with Alpaca trading API, allowing users to manage portfolios, place trades, and access market data through natural language interactions.Last updated -Python
- AsecurityAlicenseAqualityA Model Context Protocol server that enables interaction with Yahoo Finance to retrieve stock pricing, company information, and historical financial data through natural language queries.Last updated -93PythonMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server providing tools for querying A-share stock market data, including historical prices, financial reports, market indices, and macroeconomic indicators.Last updated -2883PythonMIT License