autots.mcp package¶
Submodules¶
autots.mcp.server module¶
MCP Server for AutoTS Time Series Forecasting
This server exposes AutoTS forecasting and analysis functions as MCP tools for integration with LLM environments like VS Code.
- autots.mcp.server.build_csv_metadata(filepath: str, df: DataFrame, is_long: bool = False) dict¶
Build metadata for CSV export with loading instructions.
- Parameters:
filepath – Path to CSV file
df – DataFrame that was saved
is_long – Whether CSV is in long format
- Returns:
Metadata dictionary with loading instructions
- autots.mcp.server.cache_object(obj: Any, cache_type: str, metadata: dict | None = None) str¶
Cache an object and return a unique ID.
- Parameters:
obj – Object to cache
cache_type – Type of cache (‘prediction’, ‘autots’, ‘event_risk’, ‘feature_detector’, ‘data’)
metadata – Optional metadata
- Returns:
Unique object ID
- autots.mcp.server.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.server.dataframe_to_output(df: DataFrame, output_format: str = 'json_wide', save_path: str | None = None) dict | str¶
Convert DataFrame to requested output format (token-efficient).
- Parameters:
df – DataFrame with DatetimeIndex
output_format – “json_wide”, “json_long”, “csv_wide”, “csv_long”
save_path – Optional path to save CSV (returns path)
- Returns:
Dictionary (JSON) or string (CSV path)
- autots.mcp.server.get_cached_object(obj_id: str, cache_type: str) Dict[str, Any]¶
Retrieve a cached object by ID and type.
- autots.mcp.server.list_all_cached_objects() dict¶
List all cached objects across all cache types.
- autots.mcp.server.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 input)
data_id – Optional cached data ID to load from cache
- Returns:
DataFrame with DatetimeIndex
- autots.mcp.server.save_temp_csv(df: DataFrame, is_long: bool = False) str¶
Save DataFrame to temporary CSV file.
- Parameters:
df – DataFrame to save
is_long – Convert to long format before saving
- Returns:
Full path to saved CSV
- autots.mcp.server.serialize_timestamps(obj)¶
Recursively convert pandas Timestamp objects to strings for JSON serialization.
- Parameters:
obj – Object that may contain Timestamp objects
- Returns:
Object with Timestamps converted to strings
- 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.