Microsoft Qlib MCP Server - AI agent interface for quantitative research. Provides A-stock/US stock historical data queries, factor calculation, strategy backtesting and performance evaluation.
The Qlib MCP server has moderate definition quality with significant gaps. All 5 tools are explicitly registered with @mcp.tool() decorators and have descriptions, but descriptions are often too long (exceed 1024 char baseline) and include example values that LLMs may reuse literally. Parameter schemas are present and mostly well-typed, but lack proper JSON Schema structure validation. Tool names follow verb_noun convention adequately. Error handling exists but is minimal, most tools return plain text errors without recovery guidance or error classification. The server is in Chinese, which is valid but reduces usability for English-speaking LLM agents. No tool annotations (readOnlyHint, destructiveHint, idempotentHint) are present despite the MCP spec supporting them. Output schemas are documented in code comments but not formalized in the registration.
基于动量或自定义信号的 TopK 持仓策略回测。
下载 Qlib 示例数据集到本地(约 500MB~2GB)。
查询股票历史价格/因子数据。
初始化 Qlib 数据环境。必须在使用其他工具前调用。
获取指定市场/指数的成分股列表。
Descriptions are in Chinese, reducing clarity for English-speaking LLM agents. Tool selection and parameter interpretation depend on readable descriptions. [Source: pattern:tool-description]
Descriptions include example values (e.g., 'all', 'csi300', 'Ref($close,1)', 'SH600000') that LLMs frequently reuse literally rather than adapting to context. Should use enum constraints instead. [Source: pattern:constrained-input]
Many parameters lack type constraints and enums. 'market', 'region', 'interval', 'freq', 'hold_thresh' should declare valid values explicitly. Free-form strings invite hallucinated invalid values. [Source: pattern:constrained-input]
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | F | 46 | 2026-07-28+ | v2 |
| 2026-03-09 | F | 0 | - | v1 |
Output schemas are not formalized in tool registration. Responses are plain text summaries (qlib_list_instruments, qlib_download_data) or partially-parsed dictionaries (qlib_get_data). LLMs cannot plan downstream calls without knowing return structure. [Source: pattern:response-shaper]
Error handling is minimal and lacks recovery guidance. Most tools return 'try calling X' hints as plain text, not classified as retryable, user-fixable, or fatal. No structured error format. [Source: pattern:recovery-guide]
qlib_get_data source code is truncated/corrupted mid-function. The docstring reads '象找到数据:{symbols}({star', cutting off after line ~300. Cannot fully assess schema or error handling for this critical tool. [Source: review:incomplete-code]
No tool annotations (readOnlyHint, destructiveHint, idempotentHint) present. qlib_download_data and qlib_backtest_topk have side effects or may fail non-deterministically, but agents cannot infer this from schema. [Source: pattern:tool]
qlib_list_instruments returns a text summary with up to 20 items, not paginated structured results. No way to fetch all instruments or subsequent pages. Violates pagination pattern. [Source: pattern:paginated-result]
qlib_get_data's 'symbols' param accepts both stock codes ('SH600000,SZ000001') and market names ('csi300'), but this is not clearly documented or constrained. Ambiguous parameter design forces LLM to guess format. [Source: pattern:constrained-input]
qlib_init requires 'data_path' parameter but provides no way to discover available data paths or check existing installations. Forces agent to know filesystem structure. Should offer a discovery tool. [Source: pattern:tool-chain]