Sponsored by Deepsite.site

Tushare MCP Server

Created By
buuzzy7 months ago
Content

Tushare MCP Server

基于 Model Context Protocol (MCP) 的智能股票数据助手

License: MIT Python Version

🚀 核心功能

1. 股票基础信息查询

  • 支持通过股票代码(如:000001.SZ)精确查询
  • 支持通过股票名称(如:平安银行)模糊查询
  • 返回信息包含:
    • 股票代码和名称
    • 所属行业和地区
    • 上市日期
    • 市场类型
    • 交易状态

2. 智能股票搜索

  • 支持模糊关键词搜索
  • 同时匹配股票代码和名称
  • 支持行业关键词搜索(如:"新能源"、"科技")
  • 返回匹配度最高的股票列表

3. 财务报表分析

  • 支持查询上市公司利润表数据
  • 灵活的时间范围查询(年报、季报、半年报)
  • 多种报表类型支持(合并报表、母公司报表等)
  • 主要指标一目了然:
    • 每股收益
    • 营业收入和成本
    • 期间费用
    • 利润指标
  • 支持历史数据对比分析

4. 安全的Token管理

  • 交互式Token配置流程
  • 本地安全存储(加密保存)
  • Token有效性自动验证
  • 定期Token状态检查

🎯 使用场景

  1. 投资研究

    "帮我查找所有新能源相关的股票"
    "查询比亚迪的基本信息"
    "获取平安银行2023年的利润表"
    
  2. 财务分析

    "查看腾讯控股最新一期合并报表"
    "对比阿里巴巴近三年的利润变化"
    "分析小米集团的季度利润趋势"
    
  3. 行业分析

    "列出所有医药行业的股票"
    "查找深圳地区的科技公司"
    
  4. 报表查询

    "查询平安银行2023年第一季度的利润表"
    "获取比亚迪的母公司报表"
    "查看茅台近5年的年度利润表"
    

🛠️ 技术特点

  • 基于MCP协议,支持与Claude等AI助手自然对话
  • 实时连接Tushare Pro数据源
  • 智能错误处理和提示
  • 支持并发请求处理
  • 数据缓存优化

📦 安装说明

环境要求

  • Python 3.8+
  • Tushare Pro账号和API Token

快速开始

  1. 安装包
git clone https://github.com/zhewenzhang/tushare_MCP.git
cd tushare_MCP
pip install -r requirements.txt
  1. 启动服务
python server.py
  1. 在Claude中安装
mcp install server.py

🔑 首次配置

  1. 获取Token

  2. 配置Token

    对Claude说:请帮我配置Tushare token
    
  3. 验证配置

    对Claude说:请检查token状态
    

📚 API参考

工具函数

  1. 股票查询
get_stock_basic_info(ts_code="", name="")
# 示例:get_stock_basic_info(ts_code="000001.SZ")
  1. 股票搜索
search_stocks(keyword="")
# 示例:search_stocks(keyword="新能源")
  1. 利润表查询
get_income_statement(ts_code="", start_date="", end_date="", report_type="1")
# 示例:get_income_statement(ts_code="000001.SZ", start_date="20230101", end_date="20231231")
  1. Token管理
setup_tushare_token(token="")
check_token_status()

🔒 数据安全

  • Token存储:用户主目录下的.tushare_mcp/.env
  • 环境变量:使用python-dotenv安全管理
  • 数据传输:HTTPS加密

🤝 贡献指南

欢迎提交Issue和Pull Request!

📄 开源协议

MIT License - 详见 LICENSE 文件

本地环境说明

Python 环境是由操作系统或外部工具(比如 Homebrew)管理的。为了保护系统级的 Python 安装,直接使用 pip3 install 来安装包到全局环境通常是不被允许的。需要通过激活虚拟环境(前提是创建虚拟环境)来完成

python3 -m venv venv source venv/bin/activate

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
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.
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.
Tavily Mcp
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Serper MCP ServerA Serper MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Playwright McpPlaywright MCP server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
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.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
CursorThe AI Code Editor
WindsurfThe new purpose-built IDE to harness magic
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"
DeepChatYour AI Partner on Desktop
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.