sktime-mcp

v0.1.3
sktime-mcp Checked 4 days ago Published 12 days ago

MCP (Model Context Protocol) layer for sktime - Registry-Driven for LLMs

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

query_registry

Discover sktime estimators, metrics, or capability tags. Common tags you can filter estimators by: 'capability:pred_int' (bool) - prediction intervals, 'capability:multivariate' (bool) - multivariate support, 'capability:missing_values' (bool) - NaN handling, 'requires-fh-in-fit' (bool) - needs forecast horizon at fit time. Set task='tag' (or 'tags') to query the full list of capability tags.

ParameterTypeDescription
limitintegerMaximum results (default: 50). Ignored if task='tag'.
offsetintegerSkip this many results for pagination (default: 0). Ignored if task='tag'.
querystringSearch by name or description (substring, case-insensitive). Can be combined with task and tags filters.
tagsobjectFilter by capability tags, e.g. {'capability:pred_int': true}. Ignored if task='tag'.
taskstringFilter by scitype: forecaster, classifier, regressor, transformer, clusterer, detector, splitter, metric, param_est, aligner, network. Set to 'tag' or 'tags' to retrieve capability tags.

describe_component

Describe a registered sktime component (estimator, splitter, metric or transformer) by name or a loaded qualified alias. Client input is never evaluated or used to import modules.

ParameterTypeDescription
name *stringName of the component class (e.g., 'ARIMA', 'SlidingWindowSplitter', 'MeanAbsolutePercentageError')

instantiate

Create an estimator or pipeline instance using a sktime craft specification. The spec is a string that evaluates to an estimator, e.g., 'ARIMA(order=(1, 1, 1))' or 'Detrender() * ARIMA()'.

ParameterTypeDescription
spec *stringCraft specification string.

list_handles

List all active estimator handles in memory

release_handle

Release an estimator handle and free it from memory

ParameterTypeDescription
handle *stringHandle ID to release

fit

Fit an estimator on data. Provide explicit X_handle and/or y_handle (or datasets) depending on the estimator's scitype; each handle/dataset pair (y_handle vs y_dataset, X_handle vs X_dataset) is mutually exclusive. A data handle loaded with exog_columns carries X alongside its target: fit(y_handle=h) uses that X automatically (reported under 'exogenous').

ParameterTypeDescription
estimator_handle *stringHandle from instantiate
X_datasetstringOptional: Demo dataset name for X data; it must ship exogenous data (a target-only dataset such as 'airline' is refused). Mutually exclusive with X_handle.
X_handlestringOptional: data handle whose exogenous columns (exog_columns) are used as X. Errors if the handle has no exogenous columns. Do not pass the same handle as y_handle. Mutually exclusive with X_dataset.
fhinteger | arrayOptional: Forecast horizon (e.g. 12 or [1,2,3]) to pass to fit
run_asyncbooleanIf True, runs the fit asynchronously in the background and returns a job_id.
y_datasetstringOptional: Demo dataset name for y data. Mutually exclusive with y_handle.
y_handlestringOptional: data handle whose target series is y. Mutually exclusive with y_dataset. If it carries exogenous columns and X_handle/X_dataset are omitted, they are used as X.

predict

Generate predictions from a fitted estimator. Supports different modes like predict, predict_interval, predict_quantiles. The full result is also registered as a data handle, returned as `prediction_handle`: pass it to plot_series (with the train/test handles), save_data, or call_method on a metric (y_pred_data_handle) to score it against a test split. A forecaster fitted with exogenous data needs FUTURE X covering the horizon: pass X_handle (e.g. the test half from split_data) or X_dataset.

ParameterTypeDescription
estimator_handle *stringHandle of a fitted estimator
X_datasetstringOptional: Demo dataset name for X data; it must ship exogenous data (a target-only dataset such as 'airline' is refused). Mutually exclusive with X_handle.
X_handlestringOptional: data handle whose exogenous columns are the future X for the horizon (required if the forecaster was fitted with X). Errors if the handle has none. Mutually exclusive with X_dataset.
alphanumber | arrayAlpha values for quantiles (float or list of floats)
coveragenumber | arrayCoverage level for intervals (float or list of floats)
horizonintegerForecast horizon (default: 12). Capped by the server's SKTIME_MCP_MAX_HORIZON (default 10000); larger requests are rejected.
modestringPrediction mode
run_asyncbooleanIf true, runs prediction as a background job and returns a job_id.
y_datasetstringOptional: Demo dataset name for y data. Mutually exclusive with y_handle.
y_handlestringOptional: data handle whose target series is y: the series a detector annotates or a transformer transforms (as in fit). Forecasters ignore it. Mutually exclusive with y_dataset.

update

Update a fitted estimator with new data. If y_handle carries exogenous columns and X_handle/X_dataset are omitted, they are used as X automatically.

ParameterTypeDescription
estimator_handle *stringHandle of a fitted estimator
X_datasetstringOptional: Demo dataset for X data; it must ship exogenous data. Mutually exclusive with X_handle.
X_handlestringOptional: data handle whose exogenous columns are used as X. Errors if the handle has none. Mutually exclusive with X_dataset.
y_datasetstringOptional: Demo dataset for y data. Mutually exclusive with y_handle.
y_handlestringOptional: data handle whose target series is the new y. Mutually exclusive with y_dataset.

get_fitted_params

Get fitted parameters from an estimator

ParameterTypeDescription
estimator_handle *stringHandle of a fitted estimator

call_method

Dynamically call any native method on an instantiated sktime component (e.g. 'split', 'get_alignment', '__call__'). Use this tool to interact with non-standard scitypes like Splitters, Metrics, or Aligners that do not support the generic 'fit' or 'predict' endpoints. Pass 'kwargs' as a dictionary of arguments.

ParameterTypeDescription
handle_id *stringMemory handle ID of the instantiated component
method_name *stringName of the method to call (e.g. 'split')
kwargsobjectDictionary of keyword arguments to pass to the method. Pass '_dataset' or '_data_handle' as suffixes in keys to inject memory data (e.g., {'y_dataset': 'airline'}).

evaluate

Cross-validate a forecaster with expanding-window CV. Each fold scores fh steps (default 1), with cutoffs advanced by step_length. Without initial_window, exactly cv_folds folds end at the final observation. Horizon caps and fold geometry are checked before jobs or arrays are created. Dataset and data handle inputs are supported for y and X. Exogenous columns attached to the y handle are used automatically when X is omitted; passing the same handle as y and X is refused.

ParameterTypeDescription
estimator_handle *stringHandle from instantiate
y *stringTarget time series: data_handle id or demo dataset name (e.g. 'airline').
XstringOptional: exogenous time series: a data_handle id (its exogenous columns are used; errors if it has none) or a demo dataset name that ships exogenous data (a target-only dataset such as 'airline' is r…
cv_foldsintegerNumber of cross-validation folds (default: 3). The series must have at least max(fh) + (cv_folds - 1) * step_length + 1 observations. Ignored if initial_window is set.
fhinteger | arrayForecast horizon scored in each fold, relative to the fold cutoff. Integer n: steps 1..n (e.g. 12 = a 12-step-ahead evaluation). List of ints: exactly those steps (e.g. [1, 6, 12]). Default 1. Maximum…
initial_windowintegerOptional: initial training window size for expanding-window CV. When set, folds run from this window to the end of the series (cv_folds is ignored); must be <= len(y) - max(fh).
metricstringOptional: performance metric name (e.g. 'MeanAbsolutePercentageError').
run_asyncbooleanIf true, runs evaluation as a background job and returns a job_id.
step_lengthintegerNumber of time steps the fold cutoff advances between folds (default 1). Larger values mean fewer refits.

list_available_data

List all data available for use — system demo datasets and active user-loaded data handles — in a single unified response. Use is_demo=true for demos only, is_demo=false for handles only, or omit is_demo to get both.

ParameterTypeDescription
is_demobooleanOptional filter: true = only system demos, false = only active data handles, omit = both.

load_data_source

Load data from various sources into a data handle for forecasting. Can run synchronously (blocking) or asynchronously in the background. Supported source types: 'pandas' - from a dict or inline data (keys: data, time_column, target_column). 'file' - from CSV, Excel (.xlsx), or Parquet (keys: path, time_column, target_column). 'sql' - from a SQL database (keys: connection_string, query, time_column, target_column). 'url' - from a web URL pointing to CSV/Excel/Parquet (keys: url, time_column, target_column). GUIDELINES: 1. NEVER assume a column is a time index unless the user says so. 2. ALWAYS…

ParameterTypeDescription
config *objectData source configuration. Must include 'type' (pandas, sql, file, url).
run_asyncbooleanIf True, loads data in the background (non-blocking) and returns a job_id. If False (default), blocks and returns the data_handle directly.

release_data_handle

Release a data handle and free memory

ParameterTypeDescription
data_handle *stringData handle to release

inspect_data

Inspect a loaded data handle and return rich metadata for understanding the series before modelling. Returns mtype, scitype, shape, column names, dtypes, index level names, inferred frequency, cutoff (last training timestamp), total missing-value count, a 5-row head preview, and per-column summary statistics. Works on handles from load_data_source, split_data, or transform_data. Does not modify the data.

ParameterTypeDescription
data_handle *stringData handle ID to inspect (from load_data_source, split_data, or transform_data).

split_data

Split a time series data handle into temporal train and test sets, registering both halves as new data handles. Provide exactly one of test_size (fraction in (0, 1)) or fh (forecast horizon). fh may be an integer (hold out that many final steps) or a list of relative horizon indices (hold out max(fh) final steps). Returns train_handle, test_handle, cutoff timestamp, train_size, and n_test.

ParameterTypeDescription
data_handle *stringData handle ID to split (from load_data_source or transform_data).
fhinteger | arrayForecast horizon for the test window. Integer: hold out that many final time steps. List of ints: hold out max(fh) final steps (e.g. fh=[1,5,10] reserves 10 steps). Mutually exclusive with test_size.
test_sizenumberFraction of observations to hold out for the test set, exclusive range (0.0, 1.0), rounded up to a whole observation. Must leave at least one training observation. Mutually exclusive with fh.

transform_data

Transform a loaded data handle and return a new handle. action='format' (default): auto-fix common time series issues — infer/set frequency, remove duplicate timestamps, fill index gaps, and forward/backward-fill missing values; returns changes_applied. action='convert': convert y to a different sktime mtype via convert_to() (requires to_mtype, e.g. 'pd.DataFrame', 'pd.Series', 'np.ndarray'). Replaces the legacy format_time_series tool.

ParameterTypeDescription
data_handle *stringData handle ID to transform.
actionstringTransformation to apply: 'format' (default) or 'convert'.
auto_infer_freqboolean(format only) Infer and set DatetimeIndex frequency (default: true).
fill_missingboolean(format only) Forward/backward fill missing values (default: true).
remove_duplicatesboolean(format only) Drop duplicate timestamps, keeping first (default: true).
to_mtypestring(convert only, required) Target sktime mtype string, e.g. 'pd.DataFrame', 'pd.Series', 'np.ndarray'.

save_data

Persist the target series (y) and any exogenous features (X) behind a data handle to a local file. Combines y and X into one table. Creates parent directories as needed. Supported formats: csv (default, writes index as first column), parquet, json (records orient, ISO dates).

ParameterTypeDescription
data_handle *stringData handle ID to export (from load_data_source, split_data, or transform_data).
path *stringDestination file path. Format is controlled by the format argument, not the file extension.
formatstringOutput format: csv (default), parquet, or json.
overwritebooleanReplace the file if it already exists. Default false — an existing file is not clobbered unless this is true.

plot_series

Plot one or more time series natively, e.g. the train and test handles from split_data together with the prediction_handle returned by predict. Saves the plot to `path` when given. Otherwise PNG and WebP plots are returned as an MCP image content block, and SVG as a base64 string.

ParameterTypeDescription
data_handles *arrayList of data handle IDs to plot (e.g., train, test, forecasts).
dpiintegerResolution in dots per inch (default: 150).
figsizearrayFigure size as [width, height] in inches (default: [12, 6]).
image_formatstringImage output format: 'png' (default), 'svg', or 'webp'.
labelsarrayOptional list of labels corresponding to each data handle.
markersstring | arrayMarker style(s) for data points (e.g., 'o', ['.', 'x']).
pathstringOptional local file path to save the plot (e.g., '/tmp/plot.png'). If omitted, the plot is returned inline.
titlestringOptional title for the plot.
x_labelstringCustom x-axis label.
y_labelstringCustom y-axis label.

export_code

Export an estimator or pipeline as executable Python code

ParameterTypeDescription
handle *stringHandle ID of the estimator/pipeline to export
datasetstringOptional dataset name for the fit example (e.g. 'airline', 'sunspots'). Defaults to 'airline' if omitted.
include_fit_examplebooleanWhether to include a fit/predict example (default: false)
var_namestringVariable name to use in generated code (default: 'model')

save_model

Save an estimator/pipeline handle using sktime MLflow integration

ParameterTypeDescription
estimator_handle *stringHandle ID of the estimator to save
path *stringLocal directory or URI where the model will be saved
mlflow_paramsobjectOptional extra parameters for sktime.utils.mlflow_sktime.save_model

load_model

Load a saved sktime model from a local path and register it for use

ParameterTypeDescription
path *stringPath to the saved model directory

check_job_status

Check the status and progress of a background job

ParameterTypeDescription
job_id *stringJob ID to check

list_jobs

List all background jobs with optional status filter

ParameterTypeDescription
limitintegerMaximum number of jobs to return per page (default: 20)
offsetintegerNumber of jobs to skip for pagination (default: 0)
statusstringFilter by status: pending, running, completed, failed, cancelled

cancel_job

Cancel a running or pending background job. Set delete=true to also remove the job record entirely (useful for cleaning up completed/failed jobs).

ParameterTypeDescription
job_id *stringJob ID to cancel
deletebooleanAlso remove the job record after cancelling (default: false)

run_command

Run an arbitrary CLI/bash command on the HOST machine, in the server's working directory, as the user that launched the server (not a container or sandbox). Use it to install packages into the server's environment (e.g. the server's python -m pip install mlflow) or inspect the filesystem. Output is capped; a 'truncated' flag indicates when it was shortened.

ParameterTypeDescription
command *stringThe shell command to run (executed via /bin/sh -c).