# QuantContext

Turns a plain-English strategy into quant research on real market data: screen stocks, backtest the idea, break the returns into factors. Handy when you want numbers you can reproduce.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 9
- Author: zomma-dev
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/zomma-dev/quantcontext-mcp-server
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/mcp/quantcontext

## What it does

The server hands your agent three tools that chain together. `screen_stocks` filters a universe by fundamentals, momentum, quality or technical signals and returns ranked names. `backtest_strategy` runs a strategy through history with a rebalance loop and reports CAGR, Sharpe, max drawdown, an equity curve and a trade log. `factor_analysis` splits the returns into Fama-French factors and gives you alpha with a t-statistic.

Every figure comes from market data rather than from the model, so the same request yields the same answer twice. No API keys are involved: prices and fundamentals come from Yahoo Finance, factors from the Kenneth French Data Library, universe lists from Wikipedia. The first call downloads and caches everything; later screens finish in under a second and backtests in a few seconds. To avoid the cold start, run `quantcontext-warmup --url https://quantcontext.ai/api/data` once after install.

The tools are importable straight from Python — `from quantcontext.server import screen_stocks, backtest_strategy, factor_analysis`. All of them are async and return JSON strings, which means an existing script can pick up backtesting without going through an agent. Strategies are built from the same screen types the screening tool uses.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add quantcontext -- uvx quantcontext-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from quantcontext-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add quantcontext -- uvx quantcontext-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from quantcontext-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "quantcontext": {
            "command": "uvx",
            "args": [
                "quantcontext-mcp"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from quantcontext-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "quantcontext": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "quantcontext-mcp"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from quantcontext-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add quantcontext uvx quantcontext-mcp
```
uvx runs the command named after the package; if the README names another one, use uvx --from quantcontext-mcp <command>

## When to use it
- filter stocks by PE, ROE and debt load
- run a strategy over history with monthly rebalancing
- tell real alpha from plain factor exposure
- compare momentum strategies across universes
- add backtesting to an existing Python script

## Example prompts
- Screen the S&P 500 for value names: PE under 15, ROE above 12%
- Backtest a momentum strategy on the Nasdaq 100, monthly rebalance, last 2 years
- Run factor analysis on that strategy — is the return alpha or just factor exposure?

## Similar
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89408
- [CCXT](https://affpapa.org/en/nevibecode/mcp/ccxt.md) — MCP server · ★ 44583
- [Finance Toolkit](https://affpapa.org/en/nevibecode/mcp/finance-toolkit.md) — MCP server · ★ 5458
- [EdgarTools](https://affpapa.org/en/nevibecode/mcp/edgartools.md) — MCP server · ★ 2814
- [LetsFG — Flights & Hotels](https://affpapa.org/en/nevibecode/mcp/letsfg-flights-hotels.md) — MCP server · ★ 2188
- [AutoTS](https://affpapa.org/en/nevibecode/mcp/autots.md) — MCP server · ★ 1434

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
