mcp-quant-engine
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
量化引擎 MCP 服务器 (mcp-quant-engine)
基于 Model Context Protocol (MCP) 的量化金融计算服务器,使用 FastMCP 框架,为 AI 客户端(如 Claude)提供专业的金融数学计算工具。
功能概览
本服务器提供 24 个 MCP 工具,覆盖量化金融四大核心领域:
模块 | 工具数量 | 功能 |
pricing.py | 6 | 期权定价(BS模型、隐含波动率、蒙特卡洛、Greeks、二叉树) |
portfolio.py | 5 | 组合优化(均值方差、有效前沿、Black-Litterman、HRP、绩效指标) |
risk.py | 5 | 风险度量(历史VaR、参数法VaR、MC VaR、CVaR、最大回撤) |
fixed_income.py | 4 | 固定收益(债券定价、久期、凸性、Nelson-Siegel曲线) |
utils.py | 4 | 工具函数(收益解析、矩阵解析、格式化、输入验证) |
Related MCP server: Bloomberg MCP
安装
# 克隆项目
git clone https://github.com/yourusername/mcp-quant-engine.git
cd mcp-quant-engine
# 安装依赖
pip install -r requirements.txt使用
直接运行
python server.py配置 MCP 客户端
在 Claude Desktop 配置文件中添加:
{
"mcpServers": {
"quant-engine": {
"command": "python",
"args": ["path/to/mcp-quant-engine/server.py"]
}
}
}工具列表
期权定价工具 (pricing.py)
工具 | 描述 | 参数 |
| BS看涨期权定价 | S, K, T, r, sigma |
| BS看跌期权定价 | S, K, T, r, sigma |
| 隐含波动率(牛顿迭代法) | price, S, K, T, r, option_type |
| 蒙特卡洛期权定价 | S, K, T, r, sigma, n_sims, option_type |
| 全部Greeks计算 | S, K, T, r, sigma, option_type |
| 二叉树定价(美式期权) | S, K, T, r, sigma, steps, option_type |
组合优化工具 (portfolio.py)
工具 | 描述 | 参数 |
| 均值方差优化 | returns_str, cov_matrix_str, target_return |
| 有效前沿计算 | returns_str, cov_matrix_str, n_points |
| Black-Litterman模型 | P_str, Q_str, cov_matrix_str, market_weights_str, tau |
| 层次风险平价 | returns_str |
| 组合绩效指标 | weights_str, returns_str, cov_matrix_str, rf |
风险度量工具 (risk.py)
工具 | 描述 | 参数 |
| 历史模拟法VaR | returns_str, confidence |
| 参数法VaR | mean, std, confidence |
| 蒙特卡洛VaR | returns_str, confidence, n_sims |
| 条件VaR (CVaR/ES) | returns_str, confidence |
| 最大回撤 | prices_str |
固定收益工具 (fixed_income.py)
工具 | 描述 | 参数 |
| 债券定价 | face, coupon_rate, ytm, maturity, freq |
| 久期计算 | face, coupon_rate, ytm, maturity, freq |
| 凸性计算 | face, coupon_rate, ytm, maturity, freq |
| NS收益率曲线拟合 | beta0, beta1, beta2, tau, maturities_str |
工具函数 (utils.py)
工具 | 描述 | 参数 |
| 解析收益序列 | input_str |
| 解析矩阵 | input_str |
| 格式化数值 | value, precision |
| 输入验证 | args_str |
输入格式说明
收益序列:逗号分隔的数值字符串,如
"0.01,0.02,-0.01"矩阵:分号分隔行、逗号分隔列,如
"0.04,0.01;0.01,0.09"权重向量:逗号分隔的数值,如
"0.3,0.4,0.3"
技术栈
MCP SDK:
mcp.server.fastmcp.FastMCP数值计算: NumPy, SciPy
数据处理: Pandas
优化求解: scipy.optimize.minimize (SLSQP)
层次聚类: scipy.cluster.hierarchy
统计分布: scipy.stats.norm
理论参考
Black, F. & Scholes, M. (1973). The Pricing of Options and Corporate Liabilities.
Cox, J., Ross, S. & Rubinstein, M. (1979). Option Pricing: A Simplified Approach.
Markowitz, H. (1952). Portfolio Selection.
Black, F. & Litterman, R. (1991). Global Portfolio Optimization.
Lopez de Prado, M. (2016). Building Diversified Portfolios that Outperform Out-of-Sample.
Nelson, C. & Siegel, A. (1987). Parsimonious Modeling of Yield Curves.
Jorion, P. (2007). Value at Risk: The New Benchmark for Managing Financial Risk.
Rockafellar, R. & Uryasev, S. (2002). Conditional Value-at-Risk.
项目结构
mcp-quant-engine/
├── server.py # MCP Server 入口
├── mcp_quant_engine/
│ ├── __init__.py # FastMCP 实例创建
│ ├── pricing.py # 期权定价工具(6个)
│ ├── portfolio.py # 组合优化工具(5个)
│ ├── risk.py # 风险度量工具(5个)
│ ├── fixed_income.py # 固定收益工具(4个)
│ └── utils.py # 数学工具函数(4个)
├── README.md
├── SKILL.md
└── requirements.txt测试
运行单元测试:
pip install pytest flake8
pytest tests/ -v --tb=short代码质量检查:
flake8 . --count --max-line-length=120 --statistics许可证
MIT License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Research-only MCP server: your AI as a quant research desk. 90 tools, no trades, no brokers.
Production MCP server for US equity and options intelligence: real-time IV radar, Monte Carlo simulation, options pressure, strategy backtesting, AI prediction, pre-trade risk analysis, and automated stock research reports.
MCP server for Financial Modeling Prep API with 250+ financial data tools
Official Intrinio MCP server. US stock prices, options and fundamentals for AI agents.
Related MCP Servers
AlicenseAqualityDmaintenanceAn MCP server that lets AI assistants analyze portfolios, stress-test scenarios, generate synthetic market paths, and scan SEC filings — in under 2 minutes.833MIT- AlicenseNot gradedqualityCmaintenanceAn MCP server that bridges AI assistants with Bloomberg Terminal data. It exposes 18 tools for reference, historical, technical analysis, screening, and calendar data through natural language.MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for quantitative portfolio optimization and analysis, providing tools for market data ingestion, covariance estimation, portfolio construction (mean-variance, Black-Litterman, HRP, CVaR, regularized), risk attribution, and statistical analysis to AI assistants.MIT
- AlicenseNot gradedqualityBmaintenanceEnables users to compute European option prices and sensitivity metrics, run Monte Carlo GBM simulations, calculate historical/parametric VaR/CVaR, evaluate bond duration and convexity, and interpolate Nelson-Siegel yield curves through MCP.7MIT