TushareBLOCK
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
基于 MCP (Model Context Protocol) 的 Tushare 金融数据服务器,提供 52 个专业金融数据分析工具。
🎯 项目特性
- ✅ 52个专业工具 - 涵盖股票、期货、外汇、财务等10大类
- ✅ 双模式支持 - stdio 模式和 HTTP SSE 模式
- ✅ 智能缓存 - 自动缓存管理,提升查询效率
- ✅ 权限管理 - 支持不同 Tushare 权限级别
- ✅ 开箱即用 - 自动工具发现和注册
📦 快速开始
1. 安装依赖
pip install -r requirements.txt
2. 配置 Tushare Token
在项目根目录创建 .env 文件:
TUSHARE_TOKEN=your_token_here
获取 Token: https://tushare.pro/user/token
3. 选择运行模式
方式 A: stdio 模式(推荐用于 Claude Desktop)
配置文件: %APPDATA%\Claude\claude_desktop_config.json (Windows) 或 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
{
"mcpServers": {
"tushare": {
"command": "python",
"args": ["D:/AI/tushare_MCP/server.py"]
}
}
}启动: 重启 Claude Desktop 即可自动启动
方式 B: Streamable HTTP 模式(推荐用于调试和远程访问)
启动服务器:
# Windows start_http_server.bat # Linux/macOS chmod +x start_http_server.sh ./start_http_server.sh
配置文件: 同上 Claude Desktop 配置文件
{
"mcpServers": {
"tushare-http": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}🛠️ 模式对比
📊 工具分类
Tushare MCP 工具完整列表 本文档列出了所有支持的MCP工具,共 52个工具,分为10个类别。
📊 一、Alpha策略分析工具 (6个) 行业Alpha分析 analyzesectoralpha_strategy
功能:分析单个板块相对强度Alpha,计算2日和5日Alpha收益 参数:sectorcode(板块代码,必填)、benchmarkcode(基准指数,默认000300.SH)、enddate(结束日期,YYYYMMDD格式,默认今天) 说明:计算2天和5天的区间收益率,计算超额收益Alpha = 板块收益 - 基准收益,综合得分 = Alpha2 × 60% + Alpha5 × 40% ranksectorsbyalpha
功能:申万一级行业Alpha排名,显示前N名强势板块 参数:benchmarkcode(基准指数,默认000300.SH)、enddate(结束日期,YYYYMMDD格式,默认今天)、topn(显示前N名,默认10) 说明:自动分析所有31个申万一级行业,按综合得分降序排列 rankl2sectorsby
5e8c8793279cOBSERVED · 2026-10-08Exposed tools (66)
66 read · 0 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
analyze_concept_alpha_strategy | read | |
analyze_sector_alpha_strategy | read | |
analyze_sector_health | read | |
collect_stock_data | read | |
collect_stock_sector_mapping | read | |
filter_stocks | read | |
get_block_trade | read | |
get_cache_stats | read | 获取缓存统计信息 |
get_concept_moneyflow_dc | read | |
get_cyq_perf | read | |
get_daily_basic | read | |
get_eastmoney_concept_board | read | |
get_eastmoney_concept_daily | read | |
get_eastmoney_concept_member | read | |
get_etf_daily | read | |
get_fina_indicator | read | |
get_fut_basic | read | |
get_fut_holding | read | |
get_fut_min | read | |
get_fut_wsr | read | |
get_fx_daily | read | |
get_global_index | read | |
get_income_statement | read | |
get_index_daily | read | |
get_index_rt_k | read | |
get_industry_index_codes | read | |
get_limit_cpt_list | read | |
get_limit_list | read | |
get_margin | read | |
get_margin_detail | read | |
get_nh_index | read | |
get_pledge_detail | read | |
get_share_float | read | |
get_stock_auction | read | |
get_stock_basic_info | read | |
get_stock_daily | read | |
get_stock_holder_number | read | |
get_stock_holder_trade | read | |
get_stock_intraday_history | read | |
get_stock_min | read | |
get_stock_moneyflow_dc | read | |
get_stock_repurchase | read | |
get_stock_rt_k | read | |
get_stock_sector_mapping | read | |
get_stock_survey | read | |
get_stock_weekly | read | |
get_stocks_by_sector | read | |
get_sw_industry_daily | read | |
get_sw_industry_members | read | |
get_top_inst | read | |
get_top_list | read | |
inst_track_scan | read | |
macro_scan | read | |
rank_concepts_alpha_velocity | read | |
rank_concepts_by_alpha | read | |
rank_l1_sectors_alpha_full | read | |
rank_l1_sectors_alpha_velocity | read | |
rank_l2_sectors_alpha_velocity | read | |
rank_l2_sectors_by_alpha | read | |
rank_sectors_by_alpha | read | |
scan_announcement_signals | read | |
scan_concepts_volume_anomaly | read | |
scan_l2_volume_anomaly | read | |
scan_realtime_strong_sectors | read | |
search_global_indexes | read | |
search_stocks | read |
Trust audit
BLOCKgrade F · trust 48/100 Do not install this without reading the findings. The audit found something that could harm you or your machine.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | FAIL |
| L2 | Instruction surface (what it tells the agent) | FAIL |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- UNDECLARED (1 observation(s))
- Network
- declared (4 observation(s))
- Shell
- declared (1 observation(s))
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (17)
echo "[错误] 无法终止进程,可能需要 sudo 权限"
echo "请使用 sudo 运行此脚本,或手动终止进程后重试:"
echo " sudo kill -9 $PID"
python : Traceback (most recent call last):
module = importlib.import_module(f'tools.{module_name}')&& rm -rf /var/lib/apt/lists/*
print(f"📍 MCP 端点: http://127.0.0.1:8000/mcp", file=sys.stderr)
print(f"📍 健康检查: http://127.0.0.1:8000/health", file=sys.stderr)
print(f"📍 工具列表: http://127.0.0.1:8000/tools", file=sys.stderr)
echo - MCP 端点: http://127.0.0.1:8000/mcp
system use found in code, not declared in the description
return hashlib.md5(key_str.encode('utf-8')).hexdigest()return hashlib.md5(data_str.encode('utf-8')).hexdigest()print(f"Token set: {token[:5]}...")print(f"✅ 已检测到 Tushare Token: {token[:8]}...{token[-4:]}")"url": "http://127.0.0.1:8000/mcp"
mcp, tushare, python-dotenv, pandas, starlette, uvicorn, httpx
Gates applied: no_behavioural_pass.
5e8c8793279cfull audit observations/trust-audit/mcp-server/zhewenzhang__tushare.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-08 | 5e8c8793279c | BLOCK | F | 48 | first audit |
Questions
What tools does Tushare expose?
66 in total: 66 read-only, 0 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.
Is Tushare safe to connect to an agent?
No — not without reading the findings first. The audit graded it F (48/100) and found 4 critical or high issues in the source. Each one is listed on this page with the file and line it is on.
What credentials does Tushare need?
It reads TUSHARE_TOKEN from the environment. Give it a token scoped to the least it needs — an agent that can be talked into calling a tool can be talked into calling it with your credentials.
How does Tushare run?
It speaks streamable-http, so it runs as a service you connect to over the network.
How current is this page?
The grade is for one exact copy of the source (5e8c8793279c), read on 2026-10-08. The repository is watched and re-audited when it changes.