quant-mcp
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.
quant-mcp
A standalone Model Context Protocol server for quantitative portfolio analysis. It exposes financial calculation tools over stdio, so it can be launched by any MCP-compatible host or inspected locally with the MCP Inspector.
The calculations use historical OHLCV data from the bundled data/ directory. The server performs the calculations; the coordinating LLM does not estimate the results.
Requirements
Python 3.11+
Node.js and
npxonly if using the MCP Inspector
Related MCP server: TapeDeck
Setup
From this directory:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txtThe CSV files in data/ are part of the server and should remain in the repository. Each ticker file must use this schema:
date,open,high,low,close,volumeWhen extracting this directory into its own repository, include data/*.csv. If you commit from the current parent quantdesk repository first, its root .gitignore may require git add -f data/*.csv; that parent rule does not apply once this directory becomes the repository root.
Run
The default transport is stdio:
python server.pyThe process waits for MCP messages on stdin. For interactive inspection, use another terminal:
npx @modelcontextprotocol/inspector python server.pyDo not print ordinary logging to stdout while the server is running over stdio because stdout is the MCP protocol channel.
Configure an MCP host
A local stdio host should launch the server with:
{
"command": "/absolute/path/to/quant-mcp/.venv/bin/python",
"args": ["/absolute/path/to/quant-mcp/server.py"]
}The server has no API key or network dependency. A host is responsible for keeping the process alive and communicating with it over stdin/stdout.
Tools
All tool arguments and results are JSON-compatible.
Tool | Arguments | Purpose |
| none | Lists tickers with bundled price data. |
|
| Returns weights, annualized return, volatility, and Sharpe ratio. |
|
| Returns portfolio and per-ticker annualized volatility. |
|
| Returns the annualized Sharpe ratio. |
|
| Calculates historical or parametric one-day Value at Risk. |
|
| Returns return correlations and the most correlated pairs. |
|
| Compares historical metrics before and after a hypothetical rebalance. |
A position has this shape:
{"ticker": "AAPL", "quantity": 10}risk_free_rate is an annual decimal rate, such as 0.02 for 2%. window_days limits calculations to the most recent trading days. VaR supports historical and parametric methods.
Project layout
quant-mcp/
├── server.py # FastMCP tool definitions and stdio entry point
├── metrics.py # Pure quantitative calculations
├── data/*.csv # Historical OHLCV data used at runtime
├── requirements.txt
└── .gitignoreDevelopment
Run the server tests when a test suite is present:
python -m pytest -vThe metrics.py functions are independent of MCP and can also be tested directly. Keep protocol integration in server.py and calculation logic in metrics.py.
Data note
The current bundled data may be synthetic sample data. Review and replace it with appropriately licensed historical data before using the server for production analysis. The server is an analytical tool, not investment advice.
This server cannot be deployed
Maintenance
Related MCP Connectors
Backtest and analyze any portfolio, incl. nested multi-strategy ones: returns, risk, factors, guides
Stocks, crypto, FX, and portfolio math in one tool — no per-source API juggling.
Portfolio-aware finance tools: drift, risk, earnings, benchmarks, news, tax harvesting
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceProvides comprehensive stock analysis tools for real-time market data, technical indicators, and portfolio evaluations using Finnhub and Alpha Vantage. It supports both stdio and Render-compatible HTTP transport modes for flexible integration across environments.-
- AlicenseNot gradedqualityDmaintenanceEnables market-data analysis and quantitative research over a local Parquet lake with tools for bars, indicators, scans, backtests, and safe SQL queries.MIT
- AlicenseAqualityCmaintenanceEnables querying stock quotes and computing portfolio risk/return metrics such as Sharpe ratio, drawdown, volatility, and correlations, as well as historical summaries and asset comparisons.4MIT
- FlicenseNot gradedqualityCmaintenanceEnables deterministic financial research by retrieving price history, calculating risk metrics such as Sharpe ratio and drawdown, and generating cited, provenance-aware reports.-