
McPortfolio: A Model Context Protocol server providing 9 specialized tools for LLM-driven portfolio optimization using natural language, covering mean-variance to machine learning approaches.
概览
This project allows users to work with advanced portfolio optimization using natural language, without writing code. It provides covering everything from classic mean-variance optimization to modern machine learning approaches like Hierarchical Risk Parity. Portfolio optimizers are algorithms and mathematical tools designed to help investors allocate their capital among different assets in a way that balances risk and return. The most common approaches include: - Finds the portfolio with the lowest risk for a given expected return, or the highest return for a given risk, based on historical means and covariances. - Seeks the portfolio with the best risk-adjusted return, maximizing the Sharpe ratio. - Focuses on constructing the portfolio with the lowest possible volatility. - The set of optimal portfolios that offer the highest expected return for a defined level of risk. - Combines market equilibrium with investor views to produce more stable and realistic portfolios.
README
以下为原文 README 节选,完整内容请查看原文。
// Modified by Edward Brandler, based on original files from PyPortfolioOpt and USolver
McPortfolio - LLM-Driven Portfolio Optimization
This project allows users to work with advanced portfolio optimization using natural language, without writing code. It provides 9 specialized MCP tools covering everything from classic mean-variance optimization to modern machine learning approaches like Hierarchical Risk Parity.
Overview of Portfolio Optimizers:
Portfolio optimizers are algorithms and mathematical tools designed to help investors allocate their capital among different assets in a way that balances risk and return. The most common approaches include:
- Mean-Variance Optimization (Markowitz): Finds the portfolio with the lowest risk for a given expected return, or the highest return for a given risk, based on historical means and covariances.
- Maximum Sharpe Ratio: Seeks the portfolio with the best risk-adjusted return, maximizing the Sharpe ratio.
- Minimum Volatility: Focuses on constructing the portfolio with the lowest possible volatility.
- Efficient Frontier: The set of optimal portfolios that offer the highest expected return for a defined level of risk.
- Black-Litterman Model: Combines market equilibrium with investor views to produce more stable and realistic portfolios.
- Hierarchical Risk Parity (HRP): Uses clustering algorithms to build diversified portfolios that are robust to estimation errors.
- Mean-CVaR and Mean-Semivariance: Alternative risk measures that focus on downside risk or tail risk, rather than standard deviation.
These optimizers allow users to tailor their portfolios to their specific risk tolerance, investment goals, and market views.
It gives a universal solver interface for Model-Constraint-Problem (MCP). It makes the PyPortfolioOpt library’s features available to Large Language Models (LLMs) through an MCP Server. The main goal is to let .
This project builds on the open-source USolver project, which gives a Model Context Protocol server with tools for different optimization problems. Through USolver, this project works with this powerful solver:
cvxpy- Used for convex optimization problems in portfolio theory, like maximizing Sharpe ratio or minimizing volatility with linear and quadratic constraints.
Important Points for LLM-Driven Optimization
The LLM’s ability to pick the right solver, parameters, and variables for an optimization problem is a judgment call. It is affected by the non-deterministic nature of LLMs.
Users should check both the LLM’s assumptions and the output.
How to Check:
安装
docker run -d -p 8001:8001 --name mcportfolio mcportfolio:latest