Volatility MCP
Allows loading market data from Polygon, including listing universes and assets and using the data for volatility analysis.
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.
π Volatility MCP
An MCP (Model Context Protocol) server for iterative volatility analytics: ARCH β GARCH β GJR-GARCH β EGARCH, with pre-flight statistical gates, input optimization, VaR / Expected Shortfall, Basel backtesting, and a stateful feedback loop that guides an LLM agent through every stage of the analysis.
Volatility Analytics Lab Β· Finance Β· Risk Β· Analytics
What This Is
A feedback-driven volatility analytics engine wrapped as an MCP server. An LLM agent (Claude, GPT, etc.) calls tools one at a time; each tool returns results plus recommendations for the next step. The agent iterates until diagnostics pass, backtests pass, and reports are generated.
data.load β preflight.run β optimize.* β models.fit β diagnostics.run
β compare.run β risk.var β backtest.rolling β backtest.coverage
β report.excel β feedback.explain_decisionThree Pillars
Pillar | What it does | Folder |
π‘οΈ Pre-flight gates | 12 statistical checks run BEFORE any model fit. If Engle ARCH-LM fails, GARCH is blocked. |
|
π― Input optimization |
|
|
π Feedback loop | Session state + workflow DAG + advisor. Every tool returns |
|
Related MCP server: risk-analytics-mcp-server
Quick Start
# Clone
git clone https://github.com/volatility-analytics-lab/volatility-mcp.git
cd volatility-mcp
# Install
python -m pip install -e ".[dev]"
# Run tests
make test
# Start the MCP server (stdio transport)
make run
# Or SSE transport for remote access
make run-sseConnect from Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"volatility": {
"command": "python",
"args": ["-m", "mcp_server.server"],
"cwd": "/path/to/volatility-mcp"
}
}
}Then ask Claude: "Analyze Reliance Industries volatility using the volatility MCP server."
Tool Surface
Category | Tools |
Session |
|
Data |
|
Pre-flight |
|
Optimize |
|
Models |
|
Diagnostics |
|
Compare |
|
Risk |
|
Scenario |
|
Backtest |
|
Report |
|
Feedback |
|
See docs/MCP_PROTOCOL.md for the full surface.
Architecture
Presentation: Streamlit Β· Claude Desktop Β· REST clients Β· Jupyter
β HTTP / stdio / SSE
Protocol: FastMCP server (tools Β· resources Β· prompts)
β
Engine: core/ (preflight Β· diagnostics Β· models Β· optimize
Β· risk Β· backtest Β· feedback Β· reporting)
β
Storage: session_store/ (SQLite + parquet)
Data: yfinance Β· CSV Β· Alpha Vantage Β· Polygon Β· KiteSee docs/ARCHITECTURE.md for the full layered design.
Folder Structure
volatility-mcp/
βββ mcp_server/ # MCP protocol layer
β βββ server.py # Entry point: registers tools, resources, prompts
β βββ tools/ # Tools callable by the LLM agent
β β βββ session.py # open_session / close_session / get_state
β β βββ data.py # load_market / load_csv / list_universes
β β βββ preflight.py # run_preflight / get_gate_status
β β βββ diagnostics.py # run_diagnostics (LB, ARCH-LM, JB, Q-Q stats)
β β βββ optimize.py # optimize_order / optimize_distribution / optimize_window
β β βββ models.py # fit_model / forecast / list_models
β β βββ compare.py # compare_models (AIC/BIC/QLIKE/RMSE)
β β βββ risk.py # compute_var / compute_es / basel_es
β β βββ scenario.py # apply_shock / stressed_var
β β βββ backtest.py # rolling_backtest / kupiec / christoffersen
β β βββ report.py # build_excel / build_pdf / build_markdown
β β βββ feedback.py # get_next_action / explain_decision
β βββ resources/ # Static context (read by LLM, not executed)
β β βββ model_catalog.md
β β βββ test_catalog.md
β β βββ workflows/ # 01_discovery β 05_validation
β βββ prompts/ # Prompt templates for guided workflows
β βββ schemas/ # JSON schemas for tool I/O contracts
β
βββ core/ # Framework-agnostic engine (no MCP code here)
β βββ data/ # Providers: yfinance, CSV, Alpha Vantage, Polygon, Kite
β βββ preflight/ # 12-check gate layer
β β βββ checks/ # 01_sample_size.py β¦ 12_frequency_adequacy.py
β βββ diagnostics/ # Post-fit: LB, ARCH-LM, JB, sign-bias, Nyblom
β βββ models/
β β βββ univariate/ # ARCH, GARCH, GJR-GARCH, EGARCH, FIGARCH, EWMA
β β βββ multivariate/ # DCC, BEKK, O-GARCH
β β βββ stochastic/ # Heston, SV-Jumps
β β βββ ml/ # LSTM, Transformer, TFT
β βββ optimize/ # order_selector, distribution_selector, window_selectorβ¦
β βββ risk/ # VaR (parametric, historical, FHS, MC), ES, Basel, portfolio
β βββ backtest/ # Kupiec, Christoffersen, DQ, Traffic Light, Diebold-Mariano
β βββ feedback/ # Session, state machine, workflow DAG, advisor, decision log
β βββ reporting/ # Excel, PDF, Markdown, Plotly charts
β
βββ session_store/ # SQLite / DuckDB persistent session backend
βββ tests/ # Mirrors core/ structure; synthetic GARCH fixtures
βββ examples/
β βββ 01_basic_flow.py # preflight β fit β forecast β VaR
β βββ 02_feedback_loop_demo.py # Full iterate-until-stable flow
β βββ 03_optimization_walkthrough.py
β βββ notebooks/mcp_client_demo.ipynb
βββ docker/
β βββ Dockerfile
β βββ docker-compose.yml
β βββ entrypoint.sh
βββ docs/
βββ ARCHITECTURE.md
βββ FEEDBACK_LOOP.md
βββ PREFLIGHT_CHECKS.md
βββ INPUT_OPTIMIZATION.md
βββ MODEL_CATALOG.md
βββ TEST_CATALOG.md
βββ MCP_PROTOCOL.md
βββ DECISION_RULES.mdDocumentation
Doc | What it covers |
Layered architecture, data flow, scaling options | |
How the iterative workflow works | |
Every gate explained | |
How each input is tuned | |
When to use which model | |
Every statistical test | |
Tool/resource/prompt surface | |
Decision tree for model selection |
Credits & Intellectual Debt
This project is built on the shoulders of the following thinkers and their work.
Nassim Nicholas Taleb β The Black Swan (2007), Dynamic Hedging (1997), Antifragile (2012). The pre-flight normality gate, stressed VaR scenarios, and the philosophy of iterating toward robustness over point estimates all trace back here.
Robert F. Engle β ARCH paper (Econometrica, 1982). The Engle ARCH-LM test is the single most critical pre-flight gate: if it fails, GARCH is blocked.
Tim Bollerslev β GARCH(p,q) paper (Journal of Econometrics, 1986). The industry workhorse at the center of the model catalog.
Nelson (1991), Glosten-Jagannathan-Runkle (1993) β EGARCH and GJR-GARCH respectively. The leverage asymmetry gate recommends these when sign-bias fires.
Philippe Jorion β Value at Risk (3rd ed., 2006). The parametric, historical, and FHS VaR implementations follow his treatment directly.
Kupiec (1995), Christoffersen (1998), Engle & Manganelli (2004) β the POF, conditional coverage, and Dynamic Quantile backtests that form the coverage scorecard.
Patton (2011) β established QLIKE as the robust loss function for
volatility forecast comparison. Default objective in optimize_window.
Diebold & Mariano (1995) β the DM test used in backtest_diebold_mariano
to compare competing model forecasts.
Basel Committee on Banking Supervision β Basel III framework: source of the 97.5% ES requirement, 10-day horizon, traffic light zones, and capital multiplier rules.
Kevin Sheppard β the arch Python
package that powers all GARCH-family estimation in this project.
License
MIT β see LICENSE.
Educational use only. Market data may be delayed. Not investment advice.
This server cannot be deployed
Maintenance
Related MCP Connectors
Stock & options risk analytics for AI agents: pre-trade risk scan, IV, gamma walls, Monte Carlo.
Guardrails for trading agents. Built-in risk management, 100+ tools for strategy R&D, 12+ venues.
Connect AI agents to financial institution origination, analytics, and compliance workflows.
Build, backtest, and deploy quantitative trading strategies from your AI agent.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to perform Black-Litterman portfolio optimization with investor views, backtesting, and asset analysis, generating dashboards for visualization.57 PyPIMIT
- AlicenseAqualityDmaintenanceProvides AI agents with quantitative risk tools such as VaR, expected shortfall, GARCH volatility, backtesting, stress testing, tail risk analysis, and credit scoring using synthetic or user-supplied data.71MIT
- AlicenseAqualityBmaintenanceEnables time series analysis following Box-Jenkins-Treadway methodology, supporting guided or autonomous modes for model identification, estimation, and diagnosis via an LLM.35GPL 2.0
- FlicenseAqualityDmaintenanceEnables AI agents to forecast asset price paths using Monte Carlo simulation with EGARCH volatility and skewed-t shocks, providing risk metrics and percentiles.21-