MCP.so
Sign In
Q

Qlib Mcp

@lsj210001

About Qlib Mcp

Microsoft Qlib MCP Server - 让 AI Agent 直接调用 Qlib 做量化研究。支持数据查询、因子分析、策略回测。

Config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "qlib-mcp": {
      "command": "python",
      "args": [
        "-m",
        "qlib.run.get_data",
        "qlib_data",
        "\\"
      ]
    }
  }
}

Tools

No tools detected

We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.

Overview

What is Qlib Mcp?

Qlib Mcp is an MCP server for the Microsoft Qlib quantitative research platform. It enables AI agents to perform data queries, factor analysis, and strategy backtesting by directly invoking Qlib functionalities.

How to use Qlib Mcp?

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.

Key features of Qlib Mcp

  • 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

Use cases of Qlib Mcp

  • Initializing the Qlib data environment for subsequent analysis
  • Listing CSI300 constituent stocks as of a specific date
  • Retrieving closing prices and volume for a specific stock over 60 days
  • Performing 20‑day momentum factor IC (information coefficient) analysis
  • Running a TopK momentum strategy backtest on CSI300 from 2020 to 2023

FAQ from Qlib Mcp

Which tool must be called first?

You must call qlib_init first to initialize the Qlib data environment before using any other tool.

What runtime dependencies are required?

Python 3.10+ (3.12 recommended), pyqlib, mcp, and Qlib 0.9+ with MCP 1.26+.

How do I get help on Qlib expression syntax?

Call qlib_expression_help with a topic parameter such as "operators" to retrieve the full operator list and Alpha158 documentation.

What markets and index pools are supported?

Two regions: A‑share (cn) with pools all, csi300, csi500, csi100, sz50; US (us) with sp500 and nasdaq100.

Where does the data live?

Data is downloaded to a local directory, by default ~/.qlib/qlib_data/cn_data for A‑share daily lines (about 500 MB).

Frequently asked questions

Which tool must be called first?

You must call qlib_init first to initialize the Qlib data environment before using any other tool.

What runtime dependencies are required?

Python 3.10+ (3.12 recommended), pyqlib, mcp, and Qlib 0.9+ with MCP 1.26+.

How do I get help on Qlib expression syntax?

Call qlib_expression_help with a topic parameter such as "operators" to retrieve the full operator list and Alpha158 documentation.

What markets and index pools are supported?

Two regions: A‑share (cn) with pools all, csi300, csi500, csi100, sz50; US (us) with sp500 and nasdaq100.

Where does the data live?

Data is downloaded to a local directory, by default ~/.qlib/qlib_data/cn_data for A‑share daily lines (about 500 MB).

Comments

More Other MCP servers