PluginBench
MCP Server
Maintained
MIT

QuantContext MCP Server

io.github.zomma-dev/quantcontext

Deterministic stock screening, backtesting, and factor analysis for AI trading agents using real market data.

What is the QuantContext MCP server?

QuantContext is an MCP server that converts plain-English strategy descriptions into executable quantitative research. It provides three core tools—stock screening, backtesting, and factor analysis—that compose into a full research workflow, with all results computed from real market data and fully reproducible.

QuantContext enables AI agents to screen stocks by fundamentals, momentum, quality, or technical signals; backtest strategies over historical data with rebalance loops; and decompose returns into Fama-French factors to identify alpha. No API keys or configuration required; data is cached locally for fast subsequent queries.

How to install QuantContext

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "quantcontext": {
      "command": "uvx",
      "args": [
        "quantcontext-mcp"
      ]
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • screen_stocks — Filter S&P 500, Nasdaq 100, or Russell 2000 by fundamentals, momentum, quality, technical signals, or multi-factor blends. Returns ranked candidates.
  • backtest_strategy — Test a strategy over history with a rebalance-loop engine. Returns CAGR, Sharpe ratio, max drawdown, equity curve, and trade log.
  • factor_analysis — Decompose strategy returns into Fama-French factors (market, size, value, momentum). Returns alpha with t-statistic, factor loadings, and R-squared.

Use cases

  • Screen S&P 500 for value stocks by PE ratio and ROE, then backtest performance over 3 years
  • Identify top momentum stocks in Nasdaq 100 and test a monthly rebalance strategy with drawdown limits
  • Analyze whether a multi-factor strategy's returns come from real alpha or just factor exposure
  • Test technical signals (RSI, moving average crossovers) on Russell 2000 with historical data
  • Rank stocks by a blend of value, momentum, and quality factors and evaluate risk-adjusted returns

QuantContext MCP server FAQ

What is QuantContext?

QuantContext is an MCP server that turns plain-English strategy descriptions into executable quant research: screen stocks, backtest strategies, and run factor analysis. All numbers are computed from real market data, not generated by an LLM.

Is QuantContext free?

Yes. QuantContext is open-source (MIT license) and requires no API keys or paid subscriptions. Data comes from public sources (Yahoo Finance, Kenneth French Data Library, Wikipedia).

How do I install it in Claude Desktop?

Run `pip install quantcontext-mcp`, then add the server to `~/Library/Application Support/Claude/claude_desktop_config.json` with command `quantcontext`. No configuration needed.

What data does it use?

Daily OHLCV prices and fundamentals from Yahoo Finance, Fama-French factors from Kenneth French Data Library, and universe lists from Wikipedia. All data is cached locally for fast queries.

Can I use it outside of an AI agent?

Yes. The tools are importable directly in Python via `from quantcontext.server import screen_stocks, backtest_strategy, factor_analysis` for use in existing scripts.

How fast is it?

First call downloads and caches data (10-30 seconds). Subsequent screening runs under 1 second, backtesting takes 3-8 seconds using the local cache.

README (reference)

Source of truth, from the repository.

QuantContext

QuantContext is an MCP server that turns plain-English strategy descriptions into executable quant research: screen stocks by any criteria, backtest over historical data, and run factor analysis to see where the returns come from. Every number is computed from real market data, not generated by an LLM. Results are fully reproducible.

Works with Claude, Codex, OpenCode, or any other MCP-compatible coding agent.

Install

pip install quantcontext-mcp

Claude Code:

claude mcp add quantcontext -- quantcontext

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "quantcontext": {
      "command": "quantcontext"
    }
  }
}

No API keys. No configuration.

Tools

Three tools that compose into a full research workflow:

screen_stocks -> backtest_strategy -> factor_analysis
ToolWhat it does
screen_stocksFilter S&P 500, Nasdaq 100, or Russell 2000 by fundamentals, momentum, quality, technical signals, or a multi-factor blend. Returns ranked candidates.
backtest_strategyTest a strategy over history with a rebalance-loop engine. Returns CAGR, Sharpe, max drawdown, equity curve, and trade log.
factor_analysisDecompose strategy returns into Fama-French factors (market, size, value, momentum). Returns alpha with t-statistic, factor loadings, and R-squared.

Sample Prompts

Stock screening:

Screen S&P 500 for value stocks: PE under 15, ROE above 12%
Find the top 20% momentum stocks in the Nasdaq 100 over the last 200 days
Rank S&P 500 stocks by a blend of value, momentum, and quality, equal weight each factor
Find S&P 500 stocks with RSI under 40 and price above the 200-day moving average

Backtesting:

Backtest a top-20% momentum strategy on Nasdaq 100, monthly rebalance, last 2 years
How would a value screen (PE under 15, ROE above 12%) have performed on S&P 500 over the last 3 years?
Test a momentum strategy with a 15% stop loss and 20% max portfolio drawdown circuit breaker

Full research workflow:

Screen S&P 500 for cheap, high-quality stocks. Backtest monthly over 3 years,
then run factor analysis. Is the return real alpha or just factor exposure?

Screen Types

ScreenDescriptionKey parameters
fundamental_screenFilter by PE, ROE, leverage, revenue growthpe_lt, roe_gt, debt_equity_lt, revenue_growth_gt
quality_screenProfitability and balance sheet healthroe_gt, debt_equity_lt, profit_margin_gt
momentum_screenRank by N-day price momentumlookback_days, top_pct
value_screenCheapest stocks by valuationpe_lt, top_n
factor_modelMulti-factor composite scoreweights (value/momentum/quality/volatility), top_n
technical_signalRSI and SMA crossover signalsrsi_period, sma_short, sma_long
mean_reversionStocks below z-score thresholdlookback_days, z_threshold

Use from Python

The tools are also importable directly — no agent required. Useful if you have an existing script and want to plug in backtesting or factor analysis.

from quantcontext.server import screen_stocks, backtest_strategy, factor_analysis
import asyncio, json

# Screen
result = json.loads(asyncio.run(screen_stocks(
    universe="sp500",
    screen_type="fundamental_screen",
    config={"pe_lt": 15, "roe_gt": 12},
)))

# Backtest
bt = json.loads(asyncio.run(backtest_strategy(
    stages=[{"order": 1, "type": "screen", "skill": "fundamental_screen", "config": {"pe_lt": 15, "roe_gt": 12}}],
    universe="sp500",
    rebalance="monthly",
    start_date="2022-01-01",
)))
print(bt["metrics"])

# Factor analysis — pipe the equity curve straight in
fa = json.loads(asyncio.run(factor_analysis(
    equity_curve=bt["full_equity_curve"]
)))
print(fa["alpha_annualized"], fa["alpha_tstat"])

Strategies are expressed using the built-in screen types from the table above. All functions are async and return JSON strings.

Data

All public data, no API keys required.

DataSourceCache
Daily OHLCV pricesYahoo Finance (yfinance)~/.cache/quantcontext/prices.parquet
Fundamentals (PE, ROE, margins, etc.)Yahoo Finance~/.cache/quantcontext/financials/, 24h TTL
Fama-French factors (Mkt-RF, SMB, HML, Mom)Kenneth French Data Library~/.cache/quantcontext/ff_factors.parquet
Universe lists (S&P 500, Nasdaq 100)Wikipedia~/.cache/quantcontext/sp500_tickers.json

The first tool call downloads and caches data (10-30 seconds). All subsequent calls use the local cache: screening under 1s, backtesting 3-8s.

To skip the cold start, run once after install:

quantcontext-warmup --url https://quantcontext.ai/api/data

Links

  • Docs — full reference, examples, methodology
  • PyPI

License

MIT

<!-- mcp-name: io.github.zomma-dev/quantcontext -->

Related MCP servers

Zoom Docs server for creating and retrieving Zoom documents and notes in Markdown.

3
MIT
View repository →

Zoom Meetings server for meeting search, recordings, transcripts, summaries, and meeting assets.

3
MIT
View repository →

Zoom Revenue Accelerator server for sales insights, conversations, and deal intelligence.

3
MIT
View repository →

Zoom Tasks server for creating, updating, assigning, and synchronizing task workflows.

3
MIT
View repository →

Zoom Chat server for channels, messages, contacts, files, and chat collaboration.

3
MIT
View repository →

Zoom Whiteboard server for creating boards and diagrams and locating existing boards.

3
MIT
View repository →