実際の市場データを使用して、AIエージェントによる決定論的な銘柄スクリーニング、ヒストリカル・バックテスト、およびFama-Frenchファクター分析を可能にします。
別名 zomma-dev/quantcontext-mcp-server, quantcontext-mcp-server, quantcontext-mcp
- スター
- 10
- ツール
- 3
- ダウンロード数(30日間)
- 268
- 最新バージョン
- 0.1.2
- 最終コミット
- 2026年10月21日
- ライセンス
- MIT
QuantContext MCPとは
QuantContextはMCPサーバーです。 実際の市場データを使用して、AIエージェントによる決定論的な銘柄スクリーニング、ヒストリカル・バックテスト、およびFama-Frenchファクター分析を可能にします。. 3個のツールを提供しており、screen_stocks, backtest_strategy, factor_analysisなどがあります。
プロジェクトのREADMEから生成された概要
QuantContext MCP server について
QuantContextは、Claude、Codex、またはOpenCodeを使用する開発者が、自然言語を通じて計量的なリサーチや銘柄スクリーニングを行えるようにします。これにより、ユーザーは生成された数値ではなく、実際の市場データを用いて、英語による戦略の説明をそのまま実行可能なリサーチワークフローへと変換できます。このサーバーは、APIキーや複雑な設定を必要とせずローカルで動作し、Yahoo FinanceやKenneth French Data Libraryなどのソースからデータを取得します。
ユーザーは3つの主要なツールにアクセスして、完全なリサーチパイプラインを構築できます。screen_stocksツールは、ファンダメンタルズ、モメンタム、またはテクニカル指標を使用して、S&P 500やNasdaq 100などのユニバースをフィルタリングします。backtest_strategyツールは、これらの選択を過去の期間にわたって評価し、CAGR、シャープレシオ、最大ドローダウンなどの指標を算出します。最後に、factor_analysisツールは、リターンをFama-Frenchファクターに分解し、戦略が真のアルファを生み出しているのか、単に市場エクスポージャーを反映しているだけなのかを判断します。この構成は、コーディングエージェント環境内で、再現可能かつ決定論的な結果を直接必要とするトレーダーやリサーチャーに最適です。
できること
- 1特定の指標による銘柄のフィルタリング株価収益率(PER)が低く、自己資本利益率(ROE)が高いS&P 500構成銘柄をエージェントに探させます。
- 2トレーディング戦略の履歴検証Nasdaq 100におけるモメンタム戦略が、月次リバランスを行った場合に過去2年間でどのようなパフォーマンスを示したかをテストします。
- 3リターンの要因分析戦略のパフォーマンスが、純粋なアルファによるものか、あるいは特定のFama-Frenchファクターへのエクスポージャーによるものかを判断します。
プロジェクトの README から作成されています。すべてのユースケースは、その引用と照らし合わせて確認されています。
QuantContext MCPのインストール方法
フォーマット検証日 2026年11月10日Cursor に追加Gooseに追加Claude CodeにQuantContext MCPをインストール
$ claude mcp add quantcontext-mcp-server -- uvx quantcontext-mcpCursorにQuantContext MCPをインストール
~/.cursor/mcp.json
{
"mcpServers": {
"quantcontext-mcp-server": {
"command": "uvx",
"args": [
"quantcontext-mcp"
]
}
}
}VS CodeにQuantContext MCPをインストール
.vscode/mcp.json
{
"servers": {
"quantcontext-mcp-server": {
"type": "stdio",
"command": "uvx",
"args": [
"quantcontext-mcp"
]
}
}
}VS Code CLIにQuantContext MCPをインストール
$ code --add-mcp '{"name":"quantcontext-mcp-server","type":"stdio","command":"uvx","args":["quantcontext-mcp"]}'Claude DesktopにQuantContext MCPをインストール
claude_desktop_config.json
{
"mcpServers": {
"quantcontext-mcp-server": {
"command": "uvx",
"args": [
"quantcontext-mcp"
]
}
}
}CodexにQuantContext MCPをインストール
$ codex mcp add quantcontext-mcp-server -- uvx quantcontext-mcpCodex config.tomlにQuantContext MCPをインストール
~/.codex/config.toml
[mcp_servers.quantcontext-mcp-server] command = "uvx" args = ["quantcontext-mcp"]
Gemini CLIにQuantContext MCPをインストール
$ gemini mcp add -s user quantcontext-mcp-server uvx -- quantcontext-mcpGemini settings.jsonにQuantContext MCPをインストール
~/.gemini/settings.json
{
"mcpServers": {
"quantcontext-mcp-server": {
"command": "uvx",
"args": [
"quantcontext-mcp"
]
}
}
}QuantContext MCPツール 3
READMEから検出screen_stocksbacktest_strategyfactor_analysis
| screen_stocks | — | |
| backtest_strategy | — | |
| factor_analysis | — |
自動チェック
実行日 2026年11月13日完全なレポート →自動チェックに合格しました。これはセキュリティ監査ではありません。コードを読み、サーバーに必要最小限のアクセス権を与えてください。 チェックの仕組み
- ソースリポジトリがリンクされており、アクセス可能合格
- オープンソースライセンス (OSI)合格
- 過去1年以内にコミットまたはリリースあり合格
- パッケージ名が有名なパッケージに酷似していない合格
- リモートエンドポイントがHTTPSを使用未チェック
- 破壊的なツールがラベル付けされている合格
- モデルへの隠れた指示がない合格
- パッケージおよびその依存関係に重大な勧告なし合格
README
GitHubで見る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
| Tool | What it does |
|---|---|
screen_stocks |
Filter S&P 500, Nasdaq 100, or Russell 2000 by fundamentals, momentum, quality, technical signals, or a multi-factor blend. Returns ranked candidates. |
backtest_strategy |
Test a strategy over history with a rebalance-loop engine. Returns CAGR, Sharpe, 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. |
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
| Screen | Description | Key parameters |
|---|---|---|
fundamental_screen |
Filter by PE, ROE, leverage, revenue growth | pe_lt, roe_gt, debt_equity_lt, revenue_growth_gt |
quality_screen |
Profitability and balance sheet health | roe_gt, debt_equity_lt, profit_margin_gt |
momentum_screen |
Rank by N-day price momentum | lookback_days, top_pct |
value_screen |
Cheapest stocks by valuation | pe_lt, top_n |
factor_model |
Multi-factor composite score | weights (value/momentum/quality/volatility), top_n |
technical_signal |
RSI and SMA crossover signals | rsi_period, sma_short, sma_long |
mean_reversion |
Stocks below z-score threshold | lookback_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.
| Data | Source | Cache |
|---|---|---|
| Daily OHLCV prices | Yahoo 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
License
MIT
QuantContext MCPのよくある質問
QuantContext MCPをClaude Codeに追加するには
ターミナルでclaude mcp add quantcontext-mcp-server -- uvx quantcontext-mcpを実行します。すべてのプロジェクトで利用するには--scope userを追加します。
QuantContext MCPをCursorに追加するには
~/.cursor/mcp.jsonを開き、上記のインストールセクションに示すCursor設定を使ってmcpServersの下にサーバーを追加します。
QuantContext MCPが提供するツールは
3個のツールを提供しており、screen_stocks, backtest_strategy, factor_analysisなどがあります。
このMCP serverにはAPIキーが必要ですか?
いいえ、このサーバーの動作にAPIキーや設定は必要ありません。
これらのツールを独自のPythonスクリプトで使用できますか?
はい、AIエージェントを介さなくても、既存のPythonスクリプトから直接インポートして使用できます。
データの取得にはどのくらいの時間がかかりますか?
最初のツール呼び出し時にデータのダウンロードとキャッシュが行われるため、10〜30秒ほどかかりますが、2回目以降の呼び出しはローカルキャッシュを使用するため、より高速に結果が得られます。