MCP Hub
Back to servers

QuantRisk

Portfolio risk analytics — VaR, Monte Carlo, optimization, options Greeks, stress testing.

Registry
Updated
May 9, 2026

Quick Install

npx -y @quantrisk/mcp-server

QuantRisk MCP

Portfolio risk analytics as MCP tools — VaR, Monte Carlo, optimization, options Greeks, and stress testing — for AI assistants.

Project home: quantrisk.dev

npm version License: MIT MCP Compatible


What it does

There are thousands of MCP servers; very few do quantitative finance. QuantRisk lets your AI assistant answer questions like "what's my portfolio's VaR at 95%?" with a real number instead of a definition. It exposes ten institutional-grade analytics tools over MCP — they run server-side on Cloudflare Workers and return structured JSON the model can reason about.

Install

npm install -g @quantrisk/mcp-server

Get a key at quantrisk.dev/upgrade (free tier available, no card required), then add to your client config.

Claude Desktop

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

{
  "mcpServers": {
    "quantrisk": {
      "command": "quantrisk-mcp",
      "env": { "QUANTRISK_API_KEY": "qr_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
    }
  }
}

Cursor

.cursor/mcp.json (project) or ~/.cursor/mcp.json (global):

{
  "mcpServers": {
    "quantrisk": {
      "command": "quantrisk-mcp",
      "env": { "QUANTRISK_API_KEY": "qr_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
    }
  }
}

Direct HTTP (Streamable)

If your client speaks Streamable HTTP, point it at the hosted endpoint:

{
  "mcpServers": {
    "quantrisk": {
      "transport": "http",
      "url": "https://quantrisk-mcp.quantrisk.workers.dev/mcp",
      "headers": { "Authorization": "Bearer qr_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
    }
  }
}

Tools

ToolPurposeTier
analyze_riskVaR (historical / parametric / Cornish-Fisher), CVaR, volatility, beta, max drawdownFree
monte_carlo_simulationDistribution of future returns across simulated pathsFree
stress_testP&L under GFC 2008, COVID 2020, dot-com bust, etc.Free
correlation_matrixPairwise correlations + eigenvalue decompositionFree
performance_attributionSharpe, Sortino, Treynor, Calmar, Information ratioFree
sector_exposureGICS sector + market-cap concentration (HHI)Free
price_historyHistorical OHLCV for one or more tickersFree
optimize_portfolioMean-variance optimization (max Sharpe / min variance / target return)Pro
compare_portfoliosHead-to-head risk/return comparison of 2–5 allocationsPro
calculate_greeksDelta, gamma, theta, vega, rho for options portfoliosPro

Pricing

FreePro ($29/mo)
Positions per call20500
Monte Carlo paths1,000100,000
Price history1 ticker × 1 yr20 tickers × 5 yr
Calls / day1005,000
Tools710

Subscribe at quantrisk.dev/upgrade — cancel any time.

Architecture

Two pieces ship from this repo:

  1. bin/quantrisk-mcp.js — a stdio ⇄ Streamable-HTTP bridge installed via npm install -g. It reads JSON-RPC from stdin, forwards each message to the hosted server with the user's API key, and writes responses back. This is what Claude Desktop / Cursor talk to.

  2. src/ — the Cloudflare Worker that handles the actual MCP protocol, runs the analytics engine, and gates by tier. State lives in a Durable Object (UserState) per API key. Stripe handles billing; webhooks promote/demote tiers.

The math is in src/engine/ — pure TypeScript, no external dependencies, fully unit-tested.

Self-hosting

You can run your own instance on Cloudflare Workers:

git clone https://github.com/QuantRisk/mcp-server.git
cd mcp-server
npm install
cp .env.example .env   # fill in STRIPE_SECRET_KEY + STRIPE_WEBHOOK_SECRET
npx wrangler kv namespace create PRICE_CACHE
# put the returned id into wrangler.toml
echo "<sk_...>"   | npx wrangler secret put STRIPE_SECRET_KEY
echo "<whsec_...>" | npx wrangler secret put STRIPE_WEBHOOK_SECRET
npx wrangler deploy

You'll need:

  • A Cloudflare account (free tier works for low traffic)
  • A Stripe account if you want paid-tier gating; you can rip out the tier middleware for a no-auth fork

Development

npm install
npm test            # full vitest suite
npm run test:watch  # watch mode
npm run dev         # `wrangler dev` — local Worker on :8787
npm run typecheck   # tsc --noEmit
npm run build       # compile src/ → dist/ (used by npm publish)

The engine layer (src/engine/) is the highest-leverage place to contribute — it's pure math, has near-100% test coverage, and every formula carries a comment with the source paper.

Before opening a PR:

  • Engine functions need tests in test/engine/
  • New external dependencies need a one-line justification in the PR description
  • Tool input/output shapes are frozen — schema changes require a version bump

License

MIT — see LICENSE. The hosted service at quantrisk.dev is a separate commercial offering; this license covers the source code, not access to the API.

Reviews

No reviews yet

Sign in to write a review