autots.mcp package

Subpackages

Submodules

autots.mcp.cache module

State management & global caches for the AutoTS MCP server.

autots.mcp.cache.cache_object(obj: Any, cache_type: str, metadata: dict | None = None) str

Cache an object and return a unique ID.

autots.mcp.cache.clear_cache(obj_id: str | None = None, cache_type: str | None = None)

Clear cache - specific ID, specific type, or all if both None.

autots.mcp.cache.get_cached_object(obj_id: str, cache_type: str) Dict[str, Any]

Retrieve a cached object by ID and type.

autots.mcp.cache.list_all_cached_objects() dict

List all cached objects across all cache types.

autots.mcp.data_utils module

DataFrame loading and CSV formatting utilities for the AutoTS MCP server.

autots.mcp.data_utils.build_csv_metadata(filepath: str, df: DataFrame, is_long: bool = False) dict

Build metadata dict for a CSV export with loading instructions.

autots.mcp.data_utils.dataframe_to_output(df: DataFrame, output_format: str = 'json_wide', save_path: str | None = None) dict | str

Convert DataFrame to requested output format.

Parameters:
  • df – DataFrame with DatetimeIndex.

  • output_format – “json_wide”, “json_long”, “csv_wide”, or “csv_long”.

  • save_path – Optional path to save CSV (returns path).

Returns:

Dictionary (JSON) or string (CSV path).

autots.mcp.data_utils.load_to_dataframe(data: dict | str | None = None, data_format: str = 'wide', data_id: str | None = None) DataFrame

Load data to pandas DataFrame from multiple sources.

Parameters:
  • data – JSON dict, CSV file path, or URL. If None, must provide data_id.

  • data_format – “wide” or “long” (for JSON dict input).

  • data_id – Optional cached data ID to load from cache.

Returns:

DataFrame with DatetimeIndex.

autots.mcp.data_utils.save_temp_csv(df: DataFrame, is_long: bool = False) str

Save DataFrame to a temporary CSV file and return the path.

autots.mcp.data_utils.serialize_timestamps(obj)

Recursively convert pandas Timestamp objects to strings for JSON serialization.

autots.mcp.prompts module

MCP Prompt & Resource definitions for the AutoTS MCP server.

async autots.mcp.prompts.get_prompt(name: str, arguments: dict | None = None)
autots.mcp.prompts.get_resources(mcp_file_path: str) list
async autots.mcp.prompts.read_resource(uri: str) str

autots.mcp.schemas module

MCP Tool definitions for the AutoTS MCP server.

Combines tool schemas from:
  • schemas_data.py — cache management + data loading/conversion tools

  • schemas_forecast.py — forecasting and prediction manipulation tools

  • schemas_features.py — event risk and feature detection tools

autots.mcp.schemas_data module

MCP Tool schemas for cache management and data loading/conversion tools.

autots.mcp.schemas_features module

MCP Tool schemas for event risk forecasting and feature detection tools.

autots.mcp.schemas_forecast module

MCP Tool schemas for forecasting, prediction, event risk, and feature detection tools.

autots.mcp.server module

MCP Server for AutoTS Time Series Forecasting

Main entry point and request routing. Delegates to:
  • autots.mcp.schemas — Tool definitions

  • autots.mcp.prompts — Prompt & Resource definitions

  • autots.mcp.handlers — Tool execution logic

  • autots.mcp.cache — State management

Re-exports of sub-module symbols are provided at the bottom of this file for backwards compatibility (tests and other code that imports from autots.mcp.server).

autots.mcp.server.serve()

Start the MCP server.

Module contents

Model Context Protocol (MCP) Server for AutoTS

This package provides an MCP server interface for AutoTS forecasting capabilities, enabling LLM integration for time series forecasting tasks.

autots.mcp.serve()

Start the MCP server.