What This Server Does
#MCP Endpoint: Compare Securities
- Compare up to 6 symbols against a benchmark (default: SPY)
- Returns 81 QuantStats metrics per symbol including CAGR, Sharpe, Sortino, Max Drawdown
- Lightweight JSON response designed for LLM/MCP consumption
- No API key required on the MCP endpoint
API Endpoints (Key Protected)
- Single symbol analysis with full HTML report generation
- Multi-symbol comparison with charts and CSV exports
- Portfolio analysis with weighted allocations
Data Source
- Yahoo Finance via yfinance - stocks, ETFs, metals, crypto
- Flexible date ranges with configurable risk-free rate
MCP Configuration
#Server URL
https://qrep-api.tigzig.com/mcp
SSE transport. Connect any MCP client (Claude Desktop, n8n, Cursor) to this URL.
Available Tool
mcp_compare_securities
Compare securities against a benchmark with 81 QuantStats metrics each.
Parameters
symbols: "AAPL,MSFT,GOOG" (comma-separated, max 6)
benchmark: "SPY" (default)
start_date: "2020-01-01" (YYYY-MM-DD)
end_date: "2025-12-31" (YYYY-MM-DD)
risk_free_rate: 0.045 (decimal, optional)
Example Prompt
"Compare AAPL, MSFT and GOOG against SPY from 2020-01-01 to 2025-12-31"
How It Works
#- Built with FastAPI +
fastapi-mcppackage which exposes FastAPI endpoints as MCP tools - MCP endpoint is a GET at
/mcp/compare- no API key needed - Uses the original ranaroussi/quantstats library for metric computation
- Pulls price data from Yahoo Finance via yfinance
- Rate limited (20/min per IP, 100/min global) with per-IP concurrency controls
- Deployed on Coolify (Hetzner) with Cloudflare WAF and JS Challenge
How to Replicate
#Clone the repo and deploy:
- Clone github.com/amararun/qrep-backend-fastapi
- Install dependencies:
pip install -r requirements.txt - Set environment variables (see
.env.examplein repo) - Run:
uvicorn main:app --host 0.0.0.0 --port 8000 - MCP endpoint available at
http://localhost:8000/mcp
Key Environment Variables
QPULSE_API_KEY=your-key # for /qpulse/* endpoints
BASE_URL=https://your-domain.com
RATE_LIMIT=20/minute