Labsco
S-FM logo

FAIM Time-Series forecasting

โ˜… 8

from S-FM

Zero-shot Time-Series forecasting with foundation time-series models

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

FAIM MCP Server

npm version License: MIT

A Model Context Protocol (MCP) server that integrates the FAIM time series forecasting SDK with any MCP-compatible AI assistant, enabling AI-powered forecasting capabilities.

NPM Package: @faim-group/mcp

Overview

This MCP server currently exposes two foundation time-series models from the FAIM API for zero-shot forecasting:

  • Chronos2
  • TiRex

Key Features

โœ… Two MCP Tools:

  • list_models: Returns available forecasting models and capabilities
  • forecast: Performs point and probabilistic time series forecasting

โœ… Flexible Input Formats:

  • 1D arrays: Single univariate time series
  • 3D arrays: batch/sequence/feature format

โœ… Probabilistic Forecasting:

  • Point forecasts (single value predictions)
  • Quantile forecasts (confidence intervals)
  • Sample forecasts (distribution samples)
  • Custom quantile levels for risk assessment

Examples

n8n Workflow - Demand Forecasting

An example n8n workflow for demand forecasting is available in examples/n8n/demand_forecasting.json. This workflow demonstrates how to integrate the FAIM MCP server with n8n for automated demand forecasting tasks.

To use this example:

  1. Open n8n
  2. Import the workflow from n8n_examples/demand_forecasting.json
  3. Configure your FAIM API key in the MCP connection settings
  4. Execute the workflow with your time series data

MCP Compatibility

This server implements the Model Context Protocol (MCP), an open protocol for connecting AI assistants to external tools and data sources. It works with any LLM and application that implements an MCP client.

Using with Any LLM or System

This server implements the standard MCP protocol and works with any application that implements an MCP client:

  • Direct MCP client implementation
  • AI framework adapters that support MCP
  • IDE extensions that expose MCP tools to any LLM
  • Custom middleware that translates between MCP and your LLM's tool calling format

Project Structure

faim-mcp/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts              # MCP server entry point
โ”‚   โ”œโ”€โ”€ types.ts              # TypeScript interfaces
โ”‚   โ”œโ”€โ”€ tools/
โ”‚   โ”‚   โ”œโ”€โ”€ list-models.ts    # List models tool
โ”‚   โ”‚   โ””โ”€โ”€ forecast.ts       # Forecasting tool
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ client.ts         # FAIM client singleton
โ”‚       โ”œโ”€โ”€ validation.ts     # Input validation
โ”‚       โ””โ”€โ”€ errors.ts         # Error transformation
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ tools/
โ”‚   โ”‚   โ”œโ”€โ”€ list-models.test.ts
โ”‚   โ”‚   โ””โ”€โ”€ forecast.test.ts
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ validation.test.ts
โ”‚       โ””โ”€โ”€ errors.test.ts
โ”œโ”€โ”€ dist/                     # Built output
โ”‚   โ”œโ”€โ”€ index.js             # ESM bundle
โ”‚   โ”œโ”€โ”€ index.cjs            # CommonJS bundle
โ”‚   โ”œโ”€โ”€ index.d.ts           # Type declarations
โ”‚   โ””โ”€โ”€ *.map                # Source maps
โ””โ”€โ”€ package.json, tsconfig.json, tsup.config.ts, vitest.config.ts

Testing

The project includes comprehensive tests for:

  • Input Validation: Valid/invalid inputs, edge cases, boundary values
  • Error Handling: SDK errors, JavaScript errors, error classification
  • Tool Functionality: Response structure, model availability
  • Type Safety: TypeScript compilation, type guards

Run tests:

npm test                 # Run all tests
npm run test:coverage   # Run with coverage report
npm run test:ui         # Run with UI dashboard

Debugging

Enable verbose logging:

NODE_ENV=development node dist/index.js

Output goes to stderr (not interfering with stdout JSON-RPC).