Skip to main content

Overview

The Statistical Factor Models Server fits statistical factor models from numeric panel matrices. It covers Stock-Watson EM, complete-panel Bai-Ng style extraction, and Banbura-Modugno dynamic factor extraction.

Connection

Add this server to your MCP client configuration.
{
  "mcpServers": {
    "statistical-factor-models": {
      "url": "https://backend-production-c775c.up.railway.app/mcp/statistical-factor-models"
    }
  }
}
Restart the client after changing MCP configuration. The server tools appear automatically after the connection is established.

Transport

PropertyValue
ProtocolMCP over Streamable HTTP
MCP URLhttps://backend-production-c775c.up.railway.app/mcp/statistical-factor-models
Health URLhttps://backend-production-c775c.up.railway.app/health
MCP path/mcp/statistical-factor-models
Request envelope{"request": {...}}
AuthOptional bearer token when enabled for the endpoint

Best-Fit Workflows

  • Fit a balanced panel with no missing values.
  • Fit a missing-value panel with Stock-Watson EM.
  • Fit a missing-value panel with a dynamic/state-space factor model.
  • Use explicit mixed-frequency mappings for Stock-Watson runs.
  • complete-panel-factor-extractor-fit
  • swfactor-extractor-create -> swfactor-extractor-fit
  • bmfactor-extractor-fit

Tools

ToolDescriptionReturns
swfactor-extractor-fitFit the Stock-Watson EM factor model on a 2D panel X with shape (N, T), where rows are series and columns are time points. Missing observations may be passed as null/NaN. Every row of X must already be stationary / I(0); if the underlying series are I(1), transform them first, for example with first differences or log differences. Preferred agent path: first create a handle with swfactor-extractor-create, pass exactly one of n_factors or n_factors_max in init_kwargs, and always pass explicit flow_series and flow_series_diff there, even when both are empty dicts. Then call swfactor-extractor-fit with that handle. Do not pass n_factors_max directly to swfactor-extractor-fit, and do not rely on direct/singleton SW calls to fill flow_series or flow_series_diff for you. For mixed-frequency setup, ordinary MAR rows and end-of-period stock-style rows should not go into flow_series or flow_series_diff; use flow_series[i]=M for Type C / Type D rows that decompose into M higher-frequency I(0) pieces, and use flow_series_diff[i]=M only for Type E rows built as stationary transforms of averaged I(1) levels. Classify rows by the stationary series actually passed into X, not by the raw source column. Example: if X rows are adjusted log-returns for [SPY_adj_close, QQQ_adj_close, IWM_adj_close, ...] and only SPY and QQQ are quarter-end rows on a monthly grid, use flow_series={0:3,1:3} and flow_series_diff={}. When the subtask is only to prepare SW mixed-frequency mappings, return only those two arguments.Any
complete-panel-factor-extractor-fitFit the complete-panel Bai-Ng style factor model on a balanced 2D numeric panel X with shape (N, T). Missing values are not allowed. Every row of X must already be stationary / I(0); if the underlying series are I(1), transform them first, for example with first differences or log differences. Fast happy path: call this tool directly with {"request":{"X":[[1.0,2.0,3.0],[1.5,2.5,3.5]]}}. If you need custom rank settings, first create a handle with complete-panel-factor-extractor-create and pass exactly one of n_factors or n_factors_max in init_kwargs.Any
bmfactor-extractor-fitFit the Banbura-Modugno dynamic factor model on a 2D panel X with shape (N, T), where rows are series and columns are time points. Missing observations may be passed as null/NaN. Every row of X must already be stationary / I(0); if the underlying series are I(1), transform them first, for example with first differences or log differences. Use this when you want a dynamic/state-space model rather than the simpler SW extractor. Fast happy path: call this tool directly with {"request":{"X":[[1.0,null,3.0],[2.0,2.5,3.5]]}}. If you need custom rank settings, first create a handle with bmfactor-extractor-create and pass exactly one of n_factors or n_factors_max in init_kwargs.Any

Examples

Fit a balanced panel directly

{
  "request": {
    "X": [
      [
        1.0,
        2.0,
        3.0,
        4.0
      ],
      [
        1.5,
        2.5,
        3.5,
        4.5
      ],
      [
        2.0,
        3.0,
        4.0,
        5.0
      ]
    ]
  }
}

Create a Stock-Watson extractor

{
  "request": {
    "init_kwargs": {
      "n_factors_max": 2,
      "flow_series": {},
      "flow_series_diff": {}
    }
  }
}

Fit the created Stock-Watson extractor

{
  "request": {
    "handle": "<handle-from-create>",
    "X": [
      [
        1.0,
        null,
        3.0,
        4.0
      ],
      [
        2.0,
        2.5,
        null,
        4.5
      ],
      [
        0.5,
        1.0,
        1.5,
        2.0
      ]
    ]
  }
}

Notes

  • Primary fitting tools expect X as a JSON array of arrays with shape (N, T): rows are series, columns are time points.
  • Input rows should already be stationary / I(0).
  • Use null for missing observations in the Stock-Watson and dynamic factor tools.
  • For Stock-Watson mixed-frequency work, create a handle with explicit flow_series and flow_series_diff first.

Client setup

Configure this endpoint in Cursor, Claude Desktop, or a generic MCP client.

Shared tools

Use health, result, artifact, environment, and table helper tools.

Other Servers

Dataloader

Market-data retrieval, TA-Lib indicators, and dataframe exports.

Fama-French Replicate

Official and replicated Fama-French factors plus loadings and alpha estimation.

Jump Models

JumpModel and SparseJumpModel regime fitting, online prediction, and backtesting.

Wavelet Mean Reversion

Wavelet-based mean reversion analysis for financial time series.

Parallax ExtremeHurst

ExtremeHurst signal generation from OHLCV data.

EP Ratio Screener

Fundamental stock screening based on earnings yield and balance-sheet quality.

Volatility Scaling Lab

Volatility targeting, EWMA volatility, Monte Carlo bands, and risk diagnostics.