JSPM

@quantrisk/mcp-server

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 211
  • Score
    100M100P100Q78496F
  • License MIT

Portfolio risk analytics engine exposed as MCP tools — VaR, Monte Carlo, Markowitz optimization, options Greeks, and stress testing — for quant traders talking to AI assistants.

Package Exports

  • @quantrisk/mcp-server
  • @quantrisk/mcp-server/package.json
  • @quantrisk/mcp-server/server

Readme

@quantrisk/mcp-server

Portfolio risk analytics engine for AI assistants — VaR, Monte Carlo, optimization, stress testing, and more.

npm version License: MIT MCP Compatible CI


Why QuantRisk?

There are over 10,000 MCP servers indexed across every major registry. Zero of them compute portfolio risk. You can ask your AI assistant to check GitHub issues, query a database, or send a Slack message — but if you ask "what's my portfolio's VaR at 95% confidence?" you get a polite explanation of what VaR is, not an answer.

QuantRisk closes that gap. It exposes institutional-grade risk analytics — Value at Risk, Monte Carlo simulation, Markowitz optimization, options Greeks, stress testing against historical crises — as first-class MCP tools. You describe your portfolio in plain English. Your AI assistant calls the right tool, runs the math server-side on Cloudflare's global edge, and returns a structured result it can reason about and explain.

No Python environment. No Bloomberg terminal. No context-switching. Just quant-grade analytics inside the conversation you're already having.


Quick Install

npm install -g @quantrisk/mcp-server

Get a free API key at quantrisk.dev.

Claude Desktop

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

{
  "mcpServers": {
    "quantrisk": {
      "command": "quantrisk-mcp",
      "env": {
        "QUANTRISK_API_KEY": "your-api-key-here"
      }
    }
  }
}

Cursor

Add to your Cursor MCP config (.cursor/mcp.json in your project root or ~/.cursor/mcp.json globally):

{
  "mcpServers": {
    "quantrisk": {
      "command": "quantrisk-mcp",
      "env": {
        "QUANTRISK_API_KEY": "your-api-key-here"
      }
    }
  }
}

Remote (Streamable HTTP)

If you prefer the hosted endpoint directly:

{
  "mcpServers": {
    "quantrisk": {
      "transport": "http",
      "url": "https://mcp.quantrisk.dev/sse",
      "headers": {
        "Authorization": "Bearer your-api-key-here"
      }
    }
  }
}

Tool Reference

Tool Description Tier
analyze_risk VaR, CVaR, volatility, beta, max drawdown for a portfolio Free
monte_carlo_simulation Distribution of future returns across simulated paths Free
stress_test P&L impact under GFC 2008, COVID crash, dot-com, and more Free
correlation_matrix Pairwise asset correlations + eigenvalue decomposition Free
performance_attribution Sharpe, Sortino, Treynor, Calmar, Information ratio Free
sector_exposure GICS sector, market cap, and HHI concentration breakdown Free
price_history Historical OHLCV data for one or more tickers Free
optimize_portfolio Mean-variance optimization: max Sharpe, min variance, target return Paid
compare_portfolios Head-to-head risk/return comparison of 2-5 portfolio allocations Paid
calculate_greeks Delta, gamma, theta, vega, rho for options portfolios Paid

Full input/output schemas for every tool are documented at quantrisk.dev/docs.


Example Conversations

Everything below is real natural language. The AI constructs the tool call from your words; you never touch JSON.


Value at Risk

"I have 200 shares of AAPL, 150 shares of MSFT, and 100 shares of NVDA. What's my portfolio's VaR at 95% confidence over a 1-day horizon?"

Your portfolio has an estimated 1-day 95% VaR of $4,820 (2.3% of portfolio value).
Expected shortfall in the worst 5% of days is $7,340. Annual volatility is 28.4%.
Portfolio beta vs SPY is 1.12.

Monte Carlo Simulation

"Run a Monte Carlo simulation on that portfolio with 10,000 paths over the next month."

Over 10,000 simulated 21-day paths:
  Median outcome: $214,500 (+2.6%)
  5th percentile: $183,200 (-12.2%)
  95th percentile: $248,100 (+18.9%)
  Probability of any loss: 31.4%
  Worst simulated outcome: $151,800

Stress Testing

"Stress test my portfolio against 2008 and COVID. How bad would it have gotten?"

2008 Financial Crisis: -$41,200 (-19.7%)
  Worst position: NVDA (-28.4%), Best: MSFT (-14.1%)

COVID Crash (Feb-Mar 2020): -$33,800 (-16.2%)
  Worst position: AAPL (-21.3%), Best: MSFT (-12.8%)

Both scenarios would have been painful. Tech-heavy portfolios had limited shelter
in either event. Consider adding uncorrelated assets or tail-risk hedges.

Portfolio Optimization

"Optimize my portfolio for maximum Sharpe ratio. Keep any single position under 40%."

Optimal weights for maximum Sharpe (1.87):
  AAPL: 38.2%
  MSFT: 39.8%
  NVDA: 22.0%

Expected annual return: 24.3%
Expected annual volatility: 19.1%
Compared to your current allocation, this improves Sharpe by 0.31.

Pricing

Free Tier — No credit card required

Limit Value
Positions per call 20
Monte Carlo paths 1,000
Price history 1 ticker, 1 year
Correlation matrix 10 assets
API calls 100/day, 10/minute
Tools 7 of 10 (no optimize, compare, or Greeks)

Pro — $29/month

Limit Value
Positions per call 500
Monte Carlo paths 100,000
Price history 20 tickers, 5 years
Correlation matrix 50 assets
API calls 5,000/day, 60/minute
Custom stress scenarios Included
Full factor attribution Included
Tools All 10

Upgrade at quantrisk.dev/upgrade — takes 30 seconds, cancel any time.


Self-Hosting

The server is open source under MIT. You can deploy your own instance on Cloudflare Workers in under 5 minutes.

git clone https://github.com/quantrisk/mcp-server.git
cd mcp-server
npm install
cp .env.example .env
# Fill in ALPHA_VANTAGE_KEY and STRIPE_SECRET_KEY in .env
npx wrangler deploy

You'll need:

  • A Cloudflare account (free tier works)
  • An Alpha Vantage API key (free at alphavantage.co)
  • A Stripe account for billing (optional — remove the tier middleware if you want no-auth self-hosted)

The hosted service at mcp.quantrisk.dev is the recommended path for most users. Self-hosting is for teams with data-residency requirements or those who want to modify the analytics engine.


Contributing

Contributions are welcome — especially to the engine layer (src/engine/), which is pure TypeScript math with no external dependencies.

git clone https://github.com/quantrisk/mcp-server.git
cd mcp-server
npm install
npm test          # run the full test suite
npm run test:watch # watch mode for development

Before opening a PR:

  • All engine functions must have corresponding tests in test/engine/
  • No new external dependencies without discussion
  • Math implementations should cite the formula/paper in a comment
  • Tool input/output shapes are frozen — changes to schemas require a version bump

See CONTRIBUTING.md for the full guide.


License

MIT — see LICENSE.

The hosted service at quantrisk.dev is a separate commercial product. The MIT license covers this repository's code; it does not grant access to the hosted API.


Built with @modelcontextprotocol/sdk, deployed on Cloudflare Workers.