FAIM MCP Server
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.
README
FAIM MCP Server
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 capabilitiesforecast: 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
Installation
Prerequisites
- Node.js 20+
- npm 10+
- FAIM API key: Register at https://faim.it.com/ to get your
FAIM_API_KEY
Remote MCP Server — Useful for Workflow Automation Tools like n8n
The MCP server is deployed remotely.
To use the remote MCP server, send requests to the following endpoint:
https://mcp.faim.it.com
Provide your FAIM API key using Bearer authentication.
Local MCP server
Option 1: Install from npm (Recommended)
Configure your client to use it directly with npx:
{
"mcpServers": {
"faim": {
"command": "npx",
"args": ["-y", "@faim-group/mcp"],
"env": {
"FAIM_API_KEY": "your-api-key-here"
}
}
}
}
No installation required - npx will automatically download and run the latest version.
Alternatively, if you prefer to install globally first:
npm install -g @faim-group/mcp
Then in config:
{
"mcpServers": {
"faim": {
"command": "faim-mcp",
"env": {
"FAIM_API_KEY": "your-api-key-here"
}
}
}
}
Option 2: Clone and Build Locally
# Clone the repository
git clone <repository-url>
cd faim-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run type checker
npm run lint
Then use the local path:
{
"mcpServers": {
"faim": {
"command": "node",
"args": ["/path/to/faim-mcp/dist/index.js"],
"env": {
"FAIM_API_KEY": "your-api-key-here"
}
}
}
}
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:
- Open n8n
- Import the workflow from
n8n_examples/demand_forecasting.json - Configure your FAIM API key in the MCP connection settings
- Execute the workflow with your time series data
Configuration
Environment Variables
# Required: Your FAIM API key
export FAIM_API_KEY="your-api-key-here"
# Optional: Set to non-production for verbose logging
export NODE_ENV=development
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
Usage
Starting the Server
# Build and start the server
npm run build
node dist/index.js
The server will:
- Read the API key from environment
- Initialize the FAIM client
- Listen on stdin for JSON-RPC requests
- Send responses to stdout
Tool 1: List Models
Returns available forecasting models and their capabilities.
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "list_models",
"description": "...",
"inputSchema": { ... }
},
{
"name": "forecast",
"description": "...",
"inputSchema": { ... }
}
]
}
}
Tool 2: Forecast
Performs time series forecasting using FAIM models.
Request (Point Forecast):
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "forecast",
"arguments": {
"model": "chronos2",
"x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"horizon": 10,
"output_type": "point"
}
}
}
Request (Quantile Forecast with Confidence Intervals):
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "forecast",
"arguments": {
"model": "chronos2",
"x": [[[100, 50], [102, 51], [105, 52]]],
"horizon": 5,
"output_type": "quantiles",
"quantiles": [0.1, 0.5, 0.9]
}
}
}
Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"success": true,
"data": {
"model_name": "chronos2",
"model_version": "1.0",
"output_type": "point",
"forecast": {
"point": [[[11], [12], [13], ...]]
},
"metadata": {
"token_count": 150,
"duration_ms": 245
},
"shape_info": {
"input_shape": [1, 10, 1],
"output_shape": [1, 10, 1]
}
}
}
}
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).
Building and Deployment
Build for Production
npm run build
Outputs:
dist/index.js- ESM moduledist/index.cjs- CommonJS moduledist/index.d.ts- Type declarations- Source maps for debugging
Deployment Checklist
- [ ] Set
FAIM_API_KEYenvironment variable - [ ] Run
npm run build - [ ] Run
npm testto verify - [ ] Deploy
dist/directory - [ ] Run
node dist/index.jsas the server process
Troubleshooting
"FAIM_API_KEY not set"
export FAIM_API_KEY="your-key-here"
node dist/index.js
"Module not found" errors
npm install
npm run build
Server not responding
- Check that stdout/stderr are properly connected
- Verify JSON-RPC format of requests
- Check logs for error messages
- Ensure FAIM API is accessible
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。