Quant Companion MCP

Quant Companion MCP

Provides real-time options analytics, pricing with Greeks, Monte Carlo simulations, volatility analysis, strategy backtesting, and risk metrics using actual market data from Yahoo Finance and Polygon.io.

Category
访问服务器

README

Quant Companion MCP

A Model Context Protocol (MCP) server that gives AI assistants real-time options analytics and trading strategy capabilities.

Why Use This

  • No more Googling for option prices — just ask "what's AAPL 200 call worth?"
  • Instant Greeks — delta, gamma, theta, vega calculated in real-time
  • Backtesting in plain English — "backtest momentum strategy on SPY last 5 years"
  • Volatility analysis — compare implied vs historical, spot overpriced options
  • Monte Carlo simulations — "what's the probability NVDA hits $150 by March?"
  • No coding required — just talk to Claude like you would a quant analyst

The AI can't hallucinate numbers. Every price, every Greek, every simulation comes from actual market data and deterministic math.


Example Prompts

Options Analysis

"What's the implied volatility on TSLA options right now vs its 30-day historical vol?"

"Price a 6-month AAPL 200 call with current market conditions"

"Show me the volatility smile for SPY options expiring next month"

"Is there any unusual options activity on NVDA today?"

Probability & Simulations

"What's the probability NVDA ends above $140 in 3 months?"

"Run a Monte Carlo simulation on AAPL for the next 6 months"

"Compare price forecasts using GBM vs local vol vs SABR models for META"

Strategy & Backtesting

"Backtest a 20/50 moving average crossover strategy on SPY from 2020 to now"

"Run the momentum_plus strategy on QQQ and show me the trades"

"Compare momentum_plus_multi against buy-and-hold SPY over 10 years"

"What would my returns be if I ran a dual momentum strategy on these ETFs?"

Risk Analysis

"Calculate Sharpe ratio, max drawdown, and VaR for this portfolio"

"How much would I have lost in the 2022 bear market with this strategy?"

"What's the worst-case scenario for holding TSLA calls through earnings?"

Quick Lookups

"What's AAPL trading at right now?"

"Get me SPY price history for the last 2 years"

"Show me all available option expirations for GOOGL"

Quick Start (5 minutes)

Prerequisites

  • Node.js 18+ installed
  • Claude Desktop app

Step 1: Clone and Build

git clone https://github.com/yourusername/quant-companion-mcp.git
cd quant-companion-mcp
npm install
npm run build

Step 2: Find Your Claude Config File

Windows:

%APPDATA%\Claude\claude_desktop_config.json

Usually: C:\Users\YourName\AppData\Roaming\Claude\claude_desktop_config.json

macOS:

~/Library/Application Support/Claude/claude_desktop_config.json

Linux:

~/.config/Claude/claude_desktop_config.json

If the file doesn't exist, create it.

Step 3: Add the MCP Server

Open the config file and add this (replace the path with your actual path):

{
  "mcpServers": {
    "quant-companion": {
      "command": "node",
      "args": ["C:/full/path/to/quant-companion-mcp/packages/mcp-tools/dist/index.js"],
      "env": {
        "POLYGON_API_KEY": ""
      }
    }
  }
}

Important: Use the full absolute path. On Windows use forward slashes or escaped backslashes.

Step 4: Restart Claude Desktop

Completely quit Claude Desktop (not just close the window) and reopen it.

Step 5: Verify It Works

Open a new chat and ask:

What's AAPL trading at right now?

If you see a real price, you're good. If Claude says it can't access market data, check your path in the config.


Optional: Better Data with Polygon.io

Yahoo Finance works fine for most use cases but rate limits on options chains. For heavier usage:

  1. Get a free API key at https://polygon.io
  2. Add it to your config:
{
  "mcpServers": {
    "quant-companion": {
      "command": "node",
      "args": ["C:/path/to/packages/mcp-tools/dist/index.js"],
      "env": {
        "POLYGON_API_KEY": "your_key_here"
      }
    }
  }
}

The system automatically falls back to Yahoo if Polygon rate limits.


What You Can Do

Market Data

  • get_current_price: Real-time stock/ETF price
  • get_historical_prices: OHLCV data for any date range
  • get_options_chain: Full options chain with strikes & expirations

Options Pricing

  • price_option_black_scholes: European option pricing with all Greeks
  • price_option_monte_carlo: MC pricing with confidence intervals
  • compute_implied_vol: Back out IV from observed price

Volatility Analysis

  • compute_historical_vol: Realized volatility from price history
  • get_vol_smile: IV curve across strikes (single expiration)
  • get_vol_surface: Full IV surface (strike × maturity)
  • summarize_vol_regime: HV vs IV comparison with interpretation

Simulations & Forecasting

  • simulate_price: GBM price simulation with probability analysis
  • simulate_price_with_local_vol: Skew-adjusted simulation using vol surface
  • compare_models_forecast_distribution: Compare GBM, Local Vol, SABR, Heston
  • backtest_forecast_accuracy: Historical accuracy of forecast models

Risk & Strategy

  • compute_risk_metrics: Sharpe, Sortino, max drawdown, VaR
  • run_backtest: Strategy backtesting (MA crossover, momentum, mean reversion, dual momentum)
  • detect_unusual_activity: Options flow analysis (volume spikes, sweeps)

Architecture

Claude / AI Assistant
        |
        | MCP Protocol (stdio)
        v
    mcp-tools
        - 18 MCP tool definitions
        - Market data providers (Yahoo Finance, Polygon.io)
        - Input validation (Zod schemas)
        |
        | Function calls
        v
    quant-core
        - Black-Scholes pricing & Greeks
        - Monte Carlo simulations
        - Implied volatility solver (Newton-Raphson)
        - Vol smile & surface computation
        - Risk metrics (Sharpe, Sortino, VaR, max drawdown)
        - Strategy backtesting framework
        - SABR & Heston stochastic vol models
        
        Pure functions. No side effects. No network calls.

Project Structure

packages/
  quant-core/           # Pure TypeScript math library
    blackScholes.ts     # BS pricing & Greeks
    monteCarlo.ts       # MC simulations
    impliedVol.ts       # Newton-Raphson IV solver
    volatility.ts       # Historical vol calculations
    volSmile.ts         # Smile curve computation
    volSurface.ts       # Surface interpolation
    risk.ts             # Sharpe, Sortino, VaR, drawdown
    backtest.ts         # Simple backtesting (MCP tools)
    sabr.ts             # SABR model calibration
    heston.ts           # Heston stochastic vol
    strategy/           # Advanced strategy framework

  mcp-tools/            # MCP server
    index.ts            # Server entry point (stdio transport)
    marketData.ts       # Yahoo/Polygon data providers
    tools/              # 18 MCP tool definitions

Development

# Run tests
npm test

# Build all packages
npm run build

# Dev mode (auto-rebuild)
npm run dev

Troubleshooting

Claude says it can't access the tools

  • Make sure the path in config is absolute and correct
  • Check that you ran npm run build
  • Fully restart Claude Desktop (quit, not just close)

Getting rate limited

  • Add a Polygon API key for better limits
  • Space out rapid-fire options chain requests

Numbers look wrong

  • Check if market is open (prices may be stale after hours)
  • Options data can be delayed up to 15 min on free tier

Heston/SABR is slow

  • First calibration takes 2-3 seconds, subsequent calls are faster
  • This is expected for stochastic vol models

Known Issues

  • Yahoo Finance rate limits aggressively on options chain calls, polygon fallback helps
  • Heston calibration can be slow on first run (~2-3 sec)
  • Vol surface interpolation gets weird at far OTM strikes

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选