🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@quantrisk/mcp-server

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quantrisk/mcp-server

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.

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
75
-17.58%
Maintainers
1
Weekly downloads
 
Created
Source

@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

ToolDescriptionTier
analyze_riskVaR, CVaR, volatility, beta, max drawdown for a portfolioFree
monte_carlo_simulationDistribution of future returns across simulated pathsFree
stress_testP&L impact under GFC 2008, COVID crash, dot-com, and moreFree
correlation_matrixPairwise asset correlations + eigenvalue decompositionFree
performance_attributionSharpe, Sortino, Treynor, Calmar, Information ratioFree
sector_exposureGICS sector, market cap, and HHI concentration breakdownFree
price_historyHistorical OHLCV data for one or more tickersFree
optimize_portfolioMean-variance optimization: max Sharpe, min variance, target returnPaid
compare_portfoliosHead-to-head risk/return comparison of 2-5 portfolio allocationsPaid
calculate_greeksDelta, gamma, theta, vega, rho for options portfoliosPaid

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

LimitValue
Positions per call20
Monte Carlo paths1,000
Price history1 ticker, 1 year
Correlation matrix10 assets
API calls100/day, 10/minute
Tools7 of 10 (no optimize, compare, or Greeks)

Pro — $29/month

LimitValue
Positions per call500
Monte Carlo paths100,000
Price history20 tickers, 5 years
Correlation matrix50 assets
API calls5,000/day, 60/minute
Custom stress scenariosIncluded
Full factor attributionIncluded
ToolsAll 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.

Keywords

mcp

FAQs

Package last updated on 09 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts