Quant Framework MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Quant Framework MCP Server Analyze US GDP data from FRED using a linear regression model"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Quant Framework
An open, pluggable framework for composable quantitative workflows. Start with FRED. Expand to anything.
Inspired by Karpathy's autoresearch — the same three-layer contract (immutable evaluator, agent sandbox, human direction), applied to quantitative finance as an extensible framework.
This is a framework — not a product. FRED is the hello-world connector. Everything else is an extension of the same pattern.
Prerequisites
Python 3.12.10+
uv — Python package manager
FRED API Key — Get one free from FRED
Related MCP server: godel-mcp
Installation
# Clone the repository
git clone <repo-url>
cd quant_framework
# Install all dependencies
uv syncConfiguration
Environment Variables
Create a .env file in the project root (or export directly):
# .env
FRED_API_KEY=your_api_key_herePersona Config
Edit configs/persona.yaml to control which functions and connectors your MCP server exposes:
name: "Quant Research Agent"
description: "MCP server exposing quantitative research functions"
host: "127.0.0.1"
port: 8000
functions:
- run_linear
- run_random_forest
- run_svr
- run_xgboost
- run_bayesian_ridge
- run_hmm
connectors:
- fredGuardrails Config
Edit configs/guardrails.yaml to define validation rules for function outputs:
defaults:
max_records: 10000
rules:
run_linear:
max_records: 5000
required_fields: [model, r_squared, coefficients]
roles:
analyst:
redacted_fields: [model]Usage
CLI — Start the MCP Server
# Show available commands
uv run quant --help
# Start the MCP server with SSE transport
uv run quant serve --persona configs/persona.yaml
# Use stdio transport instead
uv run quant serve --persona configs/persona.yaml --transport stdioThis will:
Register all modelling functions from the
FunctionRegistryInitialise connectors (auto-connects using
$FRED_API_KEY)Start the MCP server on
127.0.0.1:8000
Connect from Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"quant-framework": {
"url": "http://localhost:8000/sse"
}
}
}Run the Example Script
uv run python examples/basic_usage.pyThis demonstrates:
Querying GDP data from FRED
Running linear regression via the
FunctionRegistryValidating the result through the
GuardrailEngine
Project Structure
quant_framework/
├── pyproject.toml # Dependencies & CLI entry point
├── configs/
│ ├── persona.yaml # MCP server persona config
│ └── guardrails.yaml # Validation rules
├── examples/
│ └── basic_usage.py # End-to-end demo script
├── experiments/ # Autonomous research loop files
│ ├── evaluate.py # Evaluation harness (scalar metric)
│ ├── prepare_snapshot.py # Data snapshot caching script
│ └── strategy.py # Editable strategy sandbox
├── program.md # Human-directed research agenda
└── quant_framework/ # Package root
├── cli.py # CLI (quant serve)
├── core/
│ ├── function.py # @register_function, FunctionRegistry, FunctionResult
│ └── guardrail.py # GuardrailEngine, GuardrailViolation
├── connectors/
│ ├── connectors.py # BaseConnector, ConnectorRegistry
│ └── fred.py # FREDConnector (with 24h file cache)
├── functions/
│ └── modelling.py # Registered modelling functions
└── mcp/
└── generator.py # MCPServerGeneratorCore Components
Connectors
Connector | Registry Name | Description |
|
| Federal Reserve Economic Data with 24h file-based cache |
from quant_framework.connectors import FREDConnector
fred = FREDConnector()
fred.connect({"api_key": "your_key"})
df = fred.query("GDP", observation_start="2020-01-01")Modelling Functions
All functions are registered with @register_function and return a FunctionResult:
Function | Registry Name | Model Type | Key Outputs |
|
| LinearRegression | coefficients, intercept, r² |
|
| RandomForestRegressor | feature_importances, r² |
|
| SVR | r² |
|
| XGBRegressor | feature_importances, r² |
|
| BayesianRidge | posterior_std, alpha_, lambda_ |
|
| GaussianHMM | hidden_states, transition_matrix, AIC, BIC |
from quant_framework.functions.modelling import run_linear_regression
result = run_linear_regression(df, target="GDP", features=["UNRATE", "FEDFUNDS"])
print(result.output["r_squared"]) # 0.12
print(result.trace_id) # unique trace IDGuardrail Engine
from quant_framework.core import GuardrailEngine
engine = GuardrailEngine("configs/guardrails.yaml")
engine.validate("run_linear", result.output) # passes
engine.validate("run_linear", result.output, role="analyst") # applies role-specific rulesHot-reload: edits to the YAML take effect immediately (checks file mtime)
Per-role overrides: stricter rules for specific roles
Function Registry
from quant_framework.core import FunctionRegistry
# List all registered functions
FunctionRegistry.list() # ['run_linear', 'run_random_forest', ...]
FunctionRegistry.list_by_category("modelling") # filter by category
# Call by name
result = FunctionRegistry.call("run_linear", df=df, target="GDP")The Autonomous Research Loop
The framework includes a fully autonomous research loop designed to test hypotheses and incrementally improve a quantitative strategy.
It builds on the three-layer contract outlined in program.md:
Fixed Evaluation Harness (
experiments/evaluate.py): Scores the strategy on a fixed historical dataset.Strategy Sandbox (
experiments/strategy.py): The single file where the agent tests features, model choices, and signal logic.Human Direction (
program.md): Defines the agent's constraints and the high-level research agenda.
Running the Loop
Provide the program.md file to any autonomous coding agent (like Claude or the built-in system) and instruct it to begin. The agent will read program.md, modify experiments/strategy.py, run evaluate.py, and use a keep/discard ratchet to only commit changes that improve the composite score.
Extending the Framework
Add a Connector
from quant_framework.connectors.connectors import BaseConnector, ConnectorRegistry
@ConnectorRegistry.register("bloomberg")
class BloombergConnector(BaseConnector):
def connect(self, config): ...
def query(self, request, **kwargs): ...
def get_schema(self): ...
def health_check(self): ...Add a Function
from quant_framework.core import register_function, FunctionResult
@register_function(name="my_indicator", category="technical")
def my_indicator(df, window=14):
result = ... # your logic
return FunctionResult(output={"value": result}, metrics={"window": window})The function is automatically available in the FunctionRegistry and can be exposed as an MCP tool by adding its name to your persona YAML.
Design Principles
Connector-first. Every data source is a
BaseConnector. Learn one interface, connect anything.Functions as atoms. Decorated Python functions that auto-register and auto-expose via MCP.
Progressive complexity. Start with FRED. Add what you need, when you need it.
Three-layer contract. Immutable evaluator (guardrails), agent sandbox (function store), human direction (persona configs).
Contributors
Arjun Singh
License
MIT
Available Tools
6 toolsrun_bayesian_ridgeB
Fit a Bayesian Ridge Regression.
Returns standard regression outputs plus Bayesian-specific posterior standard deviations and estimated precision parameters (alpha, lambda).
Inputs: kwargs (required). Returns: result
run_hmmA
Fit a Gaussian Hidden Markov Model.
Unlike the regression functions, HMMs are unsupervised — there is no
target column. The function discovers *n_states* hidden regimes in the
data and returns the decoded state sequence, transition matrix, and
per-state Gaussian parameters.Inputs: kwargs (required). Returns: result
run_linearC
Fit a Linear Regression and return results with coefficients and residuals.
Inputs: kwargs (required). Returns: result
run_random_forestC
Fit a Random Forest Regressor and return results with feature importances.
Inputs: kwargs (required). Returns: result
run_svrC
Fit a Support Vector Regressor and return results.
Inputs: kwargs (required). Returns: result
run_xgboostB
Fit an XGBoost Regressor and return results with feature importances.
Inputs: kwargs (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Every tool has a clearly distinct purpose with no ambiguity - each implements a different machine learning algorithm (Bayesian Ridge, HMM, Linear Regression, Random Forest, SVR, XGBoost). The descriptions clearly differentiate between supervised regression methods and the unsupervised HMM approach.
Perfect naming consistency with all tools following the exact same 'run_algorithm' pattern. The naming convention is completely uniform across all six tools, making them easily predictable and readable.
Six tools is well-scoped for a quant framework server focused on statistical modeling algorithms. Each tool earns its place by covering different modeling approaches (linear, tree-based, Bayesian, HMM, SVM, gradient boosting) without redundancy.
The toolset covers a comprehensive range of regression and time series modeling algorithms appropriate for quantitative analysis. Minor gaps might include clustering algorithms or additional preprocessing tools, but the core modeling surface is well-covered for a quant framework.
Maintenance
Related MCP Connectors
Research-only MCP server: your AI as a quant research desk. 90 tools, no trades, no brokers.
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
Production MCP server for US equity and options intelligence: real-time IV radar, Monte Carlo simulation, options pressure, strategy backtesting, AI prediction, pre-trade risk analysis, and automated stock research reports.
Unified financial infrastructure connecting AI agents directly to trade live/demo brokerage accounts, Web3 non-custodial wallets, real-time market data across equities, ETFs, crypto, forex, options, DeFi swaps, and prediction markets, institutional research feeds, and algorithmic strategy backtesters.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables quant research, strategy generation, backtesting, and paper trading from natural language prompts, integrating with AI agents via an MCP server.24-
- AlicenseAqualityDmaintenanceAn MCP server that exposes Godel Terminal-style financial research as tools for AI clients, including security descriptions, quotes, financials, historical prices, analyst ratings, most-active, search, news, and live quotes. It provides a pluggable data provider interface so you can inject your own data source.92MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to run a full quant research workflow over MCP: pulling data, authoring and backtesting strategies, running statistical validation and risk checks, and recording findings for future sessions.1MIT
- AlicenseNot gradedqualityBmaintenanceA quantitative research MCP server that lets AI agents submit plugin-based tasks for factor analysis, model training, and backtesting. Agents can inspect task status, logs, artifacts, and lineage through a shared research runtime.75 PyPI5Apache 2.0