# Demand Forecast Calculator MCP

> The Demand Forecast Calculator runs advanced time-series models to project future product demand. It uses Simple Moving Average, Weighted Moving Average, and Exponential Smoothing methods on historical data. You get a 3-month forecast for your inventory planning, plus Mean Absolute Error (MAE) and Mean Absolute Percentage Error (MAPE) metrics so you know which model fits your sales history best.

## Overview
- **Category:** supply-chain
- **Price:** Free
- **Tags:** demand-planning, sma, wma, exponential-smoothing, forecasting-engine

## Description

Predicting what customers need next is tough; demand doesn't move in straight lines. This MCP gives you a way to run multiple forecasting models on your historical sales data—it’s like having three different quantitative analysts running the numbers simultaneously. You feed it past periods of demand, and it spits out a 3-month projection using methods like Simple Moving Average, Weighted Moving Average, and Exponential Smoothing. Crucially, for every forecast, you get error metrics (MAE and MAPE). This means you don't just get a number; you get confidence in that number. You can compare the output of each model to figure out which one handles your specific data noise or trend best. Connect this MCP through Vinkius to let your agent run deep planning analyses without leaving your preferred workflow.


## Tools

### analyze_exponential_smoothing
Predicts demand using Exponential Smoothing, which gives disproportionate importance to the most recent data points.

### analyze_sma
Calculates a forecast by giving every historical data point an equal weight in the moving average calculation.

### analyze_wma
Determines the forecast using Weighted Moving Average, allowing you to assign specific importance levels to different periods of history.

## Prompt Examples

**Prompt:** 
```
Calculate a 3-month forecast using SMA with a window size of 3 for this demand: [10, 12, 15, 14, 18]
```

**Response:** 
```
The `analyze_sma` tool has processed your data. The forecast for the next three months is [15.67, 15.67, 15.67] with a calculated MAPE of approximately 8.2%.
```

**Prompt:** 
```
Use Exponential Smoothing to predict demand for [100, 110, 120] with alpha=0.5 and beta=0.3.
```

**Response:** 
```
Using `analyze_exponential_smoothing`, the predicted demand for the next three periods is [130, 140, 150].
```

**Prompt:** 
```
Analyze demand using WMA with weights [0.5, 0.3, 0.2] for data: [50, 60, 70]
```

**Response:** 
```
The `analyze_wma` tool calculated the forecast as [76, 76, 76] based on your provided weights and historical sequence.
```

## Capabilities

### Generate Simple Moving Average forecasts
Calculates a demand projection by averaging the sales data over a fixed, equal-weight historical window.

### Calculate Weighted Moving Average projections
Creates a forecast using an average where recent periods contribute more weight than older ones, based on user-defined weights.

### Run Exponential Smoothing analysis
Generates a smooth demand estimate that adapts quickly to the most recent data points while retaining memory of longer trends.

## Use Cases

### Sudden market trend change
A retailer sees a sudden spike in interest for outdoor gear. Instead of relying on last year's average, they ask their agent to run `analyze_exponential_smoothing` against the current sales data. The resulting forecast shows a much steeper upward curve than what SMA would predict, allowing them to immediately adjust raw material orders.

### Seasonality planning
A manufacturing plant needs to plan for predictable seasonal dips and spikes. They run `analyze_sma` on the last five years of sales data to get a robust, stable baseline prediction that smooths out minor daily noise.

### Analyzing promotional impact
A marketing team wants to know if recent heavy promotions are dragging down future demand. They use `analyze_wma`, assigning the highest weight to data from the last two weeks, isolating the immediate effect of the promotion on the forecast.

## Benefits

- Stop guessing which forecast model works. You can run all three—`analyze_sma`, `analyze_wma`, and `analyze_exponential_smoothing`—and compare their error rates (MAE/MAPE) to see which is best for your data.
- Gain confidence in your numbers. Every forecast result comes packaged with Mean Absolute Error and MAPE scores, letting you grade the reliability of the prediction instantly.
- Model flexibility means better planning. If your market changes fast, `analyze_exponential_smoothing` adapts quickly. If stability is key, others provide solid baselines.
- Saves time compared to manual modeling. Instead of opening three different statistical packages and running separate analyses for trend detection, you get it all in one place.
- Directly informs purchasing decisions. By knowing the predicted demand with high accuracy, your team avoids costly over-ordering or lost sales due to shortages.

## How It Works

The bottom line is you get multiple projections with built-in accuracy checks, letting you compare models side by side instead of guessing which one works best.

1. First, you send your historical sales figures and specify which forecasting method you want (e.g., Simple Moving Average).
2. The MCP processes the data using the chosen mathematical model, generating a 3-month forecast for future demand.
3. Finally, it returns not only the predicted numbers but also statistical error metrics like MAE and MAPE to grade the accuracy of that specific projection.

## Frequently Asked Questions

**How do I use analyze_sma with the Demand Forecast Calculator?**
You provide your historical sales data, and the tool calculates a forecast by averaging those values equally. This is useful for stable markets where no single period should influence the prediction more than another.

**What does MAPE mean when I run analyze_exponential_smoothing?**
MAPE stands for Mean Absolute Percentage Error. It's a measure of how far off your forecast is, expressed as a percentage. A lower MAPE means the model's prediction is tighter to reality.

**Can analyze_wma handle different weight sets?**
Yes, you define the weights (e.g., [0.5, 0.3, 0.2]) that represent how much importance you want to give to specific historical periods when calculating the forecast.

**Do I need multiple tools for forecasting?**
Not anymore. This MCP consolidates three core statistical methods—`analyze_sma`, `analyze_wma`, and `analyze_exponential_smoothing`—so you can compare them all in one single workflow.

**How do I connect my agent to run analyze_wma?**
You connect your AI client via Vinkius, which grants access to this MCP. Once connected, you just call the `analyze_wma` tool directly within your prompt, no complex setup is needed.

**Can analyze_exponential_smoothing handle irregularly spaced historical demand points?**
No, this method requires sequential data points. The input must be a continuous series of demands over time; the tool cannot interpolate or account for gaps in your history.

**If I use analyze_sma on a very short data set, will it fail?**
The tool requires enough historical points to calculate an average. For SMA, you must provide at least the minimum window size specified for the calculation to proceed.

**Is there a limit if I send many forecasts using analyze_wma in one session?**
While we recommend batching requests where possible, running too many complex calculations rapidly might hit platform rate limits. If you encounter an error, try spacing out your calls.

**What forecasting methods are supported?**
The server supports Simple Moving Average (`analyze_sma`), Weighted Moving Average (`analyze_wma`), and Exponential Smoothing (`analyze_exponential_smoothing`).

**How is the accuracy of the forecast measured?**
Accuracy is measured using Mean Absolute Error (MAE) and Mean Absolute Percentage Error (MAPE) through a backtesting process on your historical data.

**What inputs are required for the SMA tool?**
The `analyze_sma` tool requires an array of historical demand values and a window size representing the number of periods to include in the average.