linker-wind-mcp
v0.1.0
Published
MCP server for Wind financial data (wsd/wsi/wsq/wss/wset/edb)
Readme
linker-wind-mcp
MCP server for Wind 金融数据终端,提供 6 个 Wind API 工具。
功能
| 工具 | Wind API | 格式 | 用途 |
|------|----------|------|------|
| get_wind_daily | w.wsd() | TSV | 日频历史数据(开/高/低/收/量/仓) |
| get_wind_minutes | w.wsi() | TSV | 分钟级K线(1/5/15/30/60分钟) |
| get_wind_realtime | w.wsq() | JSON | 实时行情快照(最新价/买卖盘/成交量) |
| get_wind_cross_section | w.wss() | TSV | 横截面批量数据(多合约同一时点) |
| get_wind_sector | w.wset() | JSON | 板块成分列表(交易所合约/指数) |
| get_wind_edb | w.edb() | TSV | 宏观/产业经济指标时间序列 |
安装
npm install
npm run build配置
Claude Desktop
编辑 claude_desktop_config.json:
{
"mcpServers": {
"linker-wind": {
"command": "npx",
"args": ["-y", "linker-wind-mcp"],
"env": {
"WIND_API_BASE": "http://api_ai.linker.net/wind-api"
}
}
}
}本地调试:将 WIND_API_BASE 改为 http://192.168.10.200:10010
Cursor
编辑项目根目录 .cursor/mcp.json:
{
"mcpServers": {
"linker-wind": {
"command": "npx",
"args": ["-y", "linker-wind-mcp"],
"env": {
"WIND_API_BASE": "http://192.168.10.200:10010"
}
}
}
}Claude Code
在项目根目录创建 .mcp.json:
{
"mcpServers": {
"linker-wind": {
"type": "stdio",
"command": "npx",
"args": ["-y", "linker-wind-mcp"],
"env": {
"WIND_API_BASE": "http://192.168.10.200:10010"
}
}
}
}或使用命令行:
claude mcp add linker-wind --env WIND_API_BASE=http://192.168.10.200:10010 -- npx -y linker-wind-mcp使用示例
1. 日频行情(wsd)
单合约多字段:
用户: PG2609.DCE 最近5天的开高低收量仓
AI调用: get_wind_daily({
codes: ["PG2609.DCE"],
fields: ["open","high","low","close","volume","oi"],
start_date: "2026-07-14",
end_date: "2026-07-18"
})多合约单字段:
用户: 对比 PG2609、PG2611、PG2701 三个合约的收盘价
AI调用: get_wind_daily({
codes: ["PG2609.DCE","PG2611.DCE","PG2701.DCE"],
fields: ["close"],
start_date: "2026-07-14",
end_date: "2026-07-18"
})2. 分钟行情(wsi)
用户: PG2609 今天上午9点到10点的5分钟K线
AI调用: get_wind_minutes({
codes: ["PG2609.DCE"],
fields: ["open","high","low","close","volume"],
start_time: "2026-07-17 09:00:00",
end_time: "2026-07-17 10:00:00",
options: "BarSize=5"
})3. 实时行情(wsq)
用户: PG2609、M2509、PP2509 现在的价格和成交量
AI调用: get_wind_realtime({
codes: ["PG2609.DCE","M2509.DCE","PP2509.DCE"]
})返回 JSON,默认字段:rt_last(最新价)、rt_bid1(买一)、rt_ask1(卖一)、rt_vol(成交量)
4. 横截面数据(wss)
用户: 今天所有 PG 合约的收盘价和持仓量
AI调用: get_wind_cross_section({
codes: ["PG2609.DCE","PG2611.DCE","PG2701.DCE"],
fields: ["close","oi"],
options: "tradeDate=2026-07-17"
})5. 板块成分(wset)
用户: PG(液化石油气)有哪些期货合约
AI调用: get_wind_sector({
set_name: "futurecc",
options: "wind_code=PG.DCE;date=2026-07-17"
})
futurecc用品种代码(如PG.DCE、CU.SHF)而非交易所名。查指数成分用sectorconstituent+windcode=000300.SH。
6. 经济指标(edb)
用户: 查询 M0067855 指标最近一周的数据
AI调用: get_wind_edb({
codes: ["M0067855"],
start_date: "2026-07-14",
end_date: "2026-07-18"
})测试
方法一:直接测试 API 逻辑
node test_tool.mjs方法二:curl 测后端
curl -X POST http://192.168.10.200:10010/execute \
-H "Content-Type: application/json" \
-d '{"code":"w.wsd(\"PG2609.DCE\", \"close\", \"2026-07-14\", \"2026-07-18\")","timeout":30}'方法三:MCP stdio 协议测试
参考 testing.md 中的 JSON-RPC 测试脚本。
实测结果
| 测试项 | 结果 | |-------|------| | wsd 单合约多字段 | ✅ 6字段4天数据 | | wsd 多合约单字段 | ✅ 3合约4天收盘价(M2509/PP2509全null - 非交易日) | | wsi 5分钟K线 | ✅ 12条5分钟数据 | | wsq 实时行情 | ✅ 3合约实时报价(bid/ask为0 - 非交易时段) | | wss 横截面 | ✅ 3合约收盘价+持仓量 | | MCP stdio 端到端 | ✅ readOnlyHint标注生效,TSV/JSON格式正确 |
已知限制
| 限制 | 说明 | |------|------| | 多合约+多字段 | Wind 不支持同时多合约多字段(error_code=-40522018),单次只能"单合约多字段"或"多合约单字段" | | 精度 | 数值保留2位小数(遵循规范),汇率等高精度数据会从 6.7779 截为 6.78 | | 非交易时段 | wsq 实时行情在非交易时段返回上一交易日收盘数据,bid/ask 为 0 | | 到期合约 | 已到期合约查询返回全 null,TSV 会跳过整行(null行不输出) | | 无鉴权 | Wind API 当前无认证机制,依赖网络隔离保障安全 |
数据格式
TSV(时间序列)
# wsd | PG2609.DCE | close,volume | 2026-07-14~2026-07-18
date CLOSE VOLUME
2026-07-14 5031 10825
2026-07-15 5060 6325
2026-07-16 5061 7945
2026-07-17 5102 8136- 首行
#元信息供 LLM 引用 - 列名行仅一次
- 数值 2 位小数
- null 行跳过
JSON(快照/变结构)
[
{"contract":"PG2609.DCE","rt_last":5558,"rt_bid1":5556,"rt_ask1":5559,"rt_vol":15329}
]用于 wsq 实时快照和 wset 板块成分(字段不固定)。
开发
npm run build # 编译
npm run watch # 监听模式License
MIT
