quant-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@quant-mcpWhat's the Sharpe ratio and VaR for my current portfolio?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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: HeadlessTracker
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
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
Backtest strategies and analyze portfolios on any ticker: CAGR, drawdown, Sharpe, from real data.
Live market data, financial analysis, and portfolio research tools across 10,000+ tickers.
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.-
- AlicenseAqualityCmaintenanceLocal-first crypto portfolio aggregation across exchanges (Bybit, Binance), EVM and Solana wallets, and Polymarket. Read-only credentials, runs as a local MCP server. Data aggregation only, not financial advice.1569 npm5MIT
- AlicenseNot gradedqualityCmaintenanceEnables market-data analysis and quantitative research over a local Parquet lake with tools for bars, indicators, scans, backtests, and safe SQL queries.MIT
- AlicenseNot gradedqualityCmaintenanceProvides tools to scrape and access Pakistan Stock Exchange (PSX) market data, including market data, intraday, historical, sector, gainers/losers, OHLCV, and volume analysis. Supports both local stdio and remote HTTP deployments with API key authentication.MIT