Qlib Mcp
About
Microsoft Qlib MCP Server - 让 AI Agent 直接调用 Qlib 做量化研究。支持数据查询、因子分析、策略回测。
Details
- Author
- lsj210001
- Downloads
- 250
- Categories
- Other
Jump to
- Initialize the Qlib data environment (required first step)
- Download A‑share or US stock dataset commands
- Query index constituent stocks (CSI300, CSI500, etc.)
- Retrieve historical price and factor data with Qlib expressions
- Run TopK momentum strategy backtests with annualized return and Sharpe ratio
- Perform IC analysis and quantile return for factor validation
- Get expression syntax help for operators and Alpha158
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Qlib McpCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install Python 3.10+, then install pyqlib and mcp. Download Qlib A‑share daily data (approx. 500 MB). Register the server with an MCP client (Claude Desktop, mcporter, Cursor) by adding a JSON configuration that points to the server.py script. After calling the qlib_init tool first, you can invoke tools for data, factors, and backtesting.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"qlib mcp": {
"qlib-mcp": {
"command": "python",
"args": [
"-m",
"qlib.run.get_data",
"qlib_data",
"\\"
]
}
}
}
}
McpServers
{
"qlib-mcp": {
"command": "python",
"args": [
"-m",
"qlib.run.get_data",
"qlib_data",
"\\"
]
}
}
qlib-mcp
> 全网首个 Microsoft Qlib 量化研究平台的 MCP Server — 让 AI Agent 直接调用 Qlib 做数据查询、因子分析和策略回测。
---
功能概览
| 工具 | 说明 |
|------|------|
| qlib_init | 初始化 Qlib 数据环境(必须首先调用) |
| qlib_download_data | 获取 A 股/美股数据集下载命令 |
| qlib_list_instruments | 查询 CSI300/CSI500 等指数成分股列表 |
| qlib_get_data | 查询历史价格与因子数据(支持 Qlib 表达式) |
| qlib_backtest_topk | TopK 动量策略回测,返回年化收益/夏普/最大回撤 |
| qlib_factor_analysis | IC 分析 + 分位数收益,快速验证因子有效性 |
| qlib_expression_help | 表达式语法帮助(算子列��� / Alpha158 说明) |
---
安装
前置依赖
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



