Guide · Amazon Forecast · Dataset Groups & Pipeline Overview
Amazon Forecast for MCP Servers — Time-Series Forecasting Pipeline, Dataset Groups, and SDK Setup
Amazon Forecast is AWS's fully managed time-series forecasting service. It trains machine learning models on your historical data and returns probabilistic forecasts — not just a point estimate, but a full distribution across p10, p50, and p90 quantiles. For MCP server teams, Forecast enables tools that predict request volume, anticipate endpoint downtime windows, project resource demand, and surface leading indicators before incidents occur. This overview covers the two-package SDK split, the five-stage pipeline (dataset group → datasets → predictor → forecast → query), and the domain types that determine which additional signals Forecast adds automatically.
TL;DR
Amazon Forecast uses two npm packages: @aws-sdk/client-forecast for the management plane (create resources, train models, generate forecasts) and @aws-sdk/client-forecastquery for the query plane (read forecast values at runtime). The pipeline is linear: create a dataset group → create one or more datasets and import data → create an AutoPredictor → create a forecast → query the forecast. Training takes 20–90 minutes; query calls complete in under 100 ms. Schema attribute names are lowercase (item_id, timestamp, target_value) — a common gotcha if you're used to Personalize's uppercase schema fields.
Why MCP servers benefit from time-series forecasting
Most MCP monitoring tools are reactive — they alert when something has already gone wrong. Amazon Forecast adds a predictive layer: by training on historical endpoint health, request rates, and error patterns, your MCP server tools can answer questions like:
- Load forecasting: "How many requests will this MCP endpoint receive in the next 4 hours?" — size resources ahead of demand instead of autoscaling after the spike.
- Downtime prediction: Historical patterns in connection timeouts, schema drift events, and error spikes often precede outages. A p90 forecast band that widens dramatically is an early warning signal.
- Maintenance windows: "When is traffic lowest over the next 7 days?" — schedule disruptive maintenance in the valleys the model identifies.
- Capacity planning: Project 30-day request volume trends to inform whether a team tier upgrade is warranted before the monthly billing cycle.
- Alerting calibration: Replace static thresholds with forecast-aware thresholds — alert when actual values cross the p90 upper band rather than a fixed number.
Forecast runs entirely within your AWS account. All training data stays in your S3 bucket; IAM boundaries control access; VPC endpoints eliminate public network exposure for inference calls.
Two SDK packages, two planes
Install both before starting:
npm install @aws-sdk/client-forecast @aws-sdk/client-forecastquery
The management client handles resource lifecycle — creating datasets, training predictors, generating forecast objects:
import { ForecastClient } from "@aws-sdk/client-forecast";
const forecast = new ForecastClient({ region: "us-east-1" });
The query client reads forecast values at runtime — it has its own endpoint and its own IAM action namespace:
import { ForecastQueryClient } from "@aws-sdk/client-forecastquery";
const forecastQuery = new ForecastQueryClient({ region: "us-east-1" });
The management endpoint is forecast.us-east-1.amazonaws.com; the query endpoint is forecastquery.us-east-1.amazonaws.com. Separate IAM roles are appropriate: a provisioning role with forecast:Create* permissions for setup, and an inference role with only forecast:QueryForecast for the MCP server's runtime calls.
The five-stage pipeline
Every Forecast workflow follows the same sequence. Each stage produces an ARN that the next stage references:
- Dataset group — the top-level container. Selects the domain and ties all datasets, predictors, and forecasts together.
- Datasets + import jobs — one to three datasets (target time series, related time series, item metadata). Import jobs pull CSV data from S3.
- AutoPredictor (predictor) — the ML model training run. AutoML selects and ensembles the best algorithms. Backtesting metrics (RMSE, WAPE) are available after training completes.
- Forecast — an artifact that materializes prediction values for all items. Specifying
ForecastTypes: ["0.1","0.5","0.9"]at creation requests p10/p50/p90 quantile bands. - Query — runtime calls via
QueryForecastCommandthat return the forecast values for a specificitem_id.
Forecasts are static artifacts — they represent the prediction as of when they were generated. For rolling forecasts, schedule a nightly CreateForecastCommand and swap the ARN your query calls use once the new forecast reaches ACTIVE status.
Creating a dataset group
The dataset group specifies the domain, which determines available built-in signals and schema conventions. For MCP server metrics, CUSTOM or WEB_TRAFFIC are the most appropriate choices:
import { CreateDatasetGroupCommand } from "@aws-sdk/client-forecast";
const { DatasetGroupArn } = await forecast.send(new CreateDatasetGroupCommand({
DatasetGroupName: "mcp-endpoint-traffic",
Domain: "CUSTOM",
// Other domains: "RETAIL" | "INVENTORY_PLANNING" | "EC2_CAPACITY"
// "WORK_FORCE" | "WEB_TRAFFIC" | "METRICS"
Tags: [{ Key: "project", Value: "alivemcp" }],
}));
console.log("Dataset group ARN:", DatasetGroupArn);
// arn:aws:forecast:us-east-1:123456789012:dataset-group/mcp-endpoint-traffic
Dataset groups are immutable after creation — you cannot change the domain. If you need to switch domains, create a new dataset group and re-import all data.
Domain selection reference
| Domain | Best for | Built-in signals added |
|---|---|---|
CUSTOM | Server metrics, error rates, arbitrary numeric KPIs | None — full control over schema |
WEB_TRAFFIC | Request-per-minute endpoint traffic, page views | Holiday calendar (US by default) |
METRICS | Financial KPIs, business metrics at high frequency | None — supports sub-hour frequencies |
RETAIL | E-commerce demand forecasting | Holiday calendar + promotions |
EC2_CAPACITY | AWS compute capacity planning | AWS-internal utilization features |
INVENTORY_PLANNING | Supply chain inventory levels | None — specialized schema fields |
WORK_FORCE | Staffing demand | Holiday calendar |
For monitoring MCP endpoints on AliveMCP, CUSTOM gives full flexibility: you define the schema, choose which endpoints become item_id values, and decide whether to add weather or calendar signals at the predictor stage without being constrained by a domain's fixed schema.
Dataset types
Within a dataset group, you can register up to three dataset types. Only the target time series is required:
- TARGET_TIME_SERIES (required) — the values you want to forecast. Must include
item_id(string),timestamp(timestamp), andtarget_value(float). For MCP monitoring:item_id= endpoint slug,target_value= request count or latency p95. - RELATED_TIME_SERIES (optional) — additional time series that co-vary with the target. Must cover the same items and time range, plus the forecast horizon. Example: error rate percentage as a co-variate alongside request count as the target.
- ITEM_METADATA (optional) — static (non-time-varying) attributes per item. Example: endpoint category (REST/SSE/stdio), cloud provider, region. These become covariates in the model without requiring time-series alignment.
More detail on creating datasets and running import jobs is in the dataset import guide.
Pricing snapshot
| Activity | Price | Notes |
|---|---|---|
| Dataset import | $0.088 / GB | Based on raw CSV size in S3 |
| Predictor training | $0.24 / hour | AutoML trains multiple algorithms in parallel — billed per hour of compute |
| Forecast generation | $1.00 / 1K time steps | Steps = items × horizon length |
| Forecast query | $0.01 / 1K queries | QueryForecastCommand calls |
| Free tier | First 10K time steps / month | Applies to both generation and query |
For a dataset with 500 MCP endpoints and a 7-day hourly horizon (168 hours), forecast generation costs: 500 items × 168 steps = 84,000 time steps = $0.084. If you regenerate the forecast daily, monthly cost = $0.084 × 30 = $2.52 for generation, plus $0.01 per 1K queries.
Polling for resource readiness
All Forecast resources are created asynchronously. The pattern across all stages is identical — poll Describe*Command until Status === "ACTIVE":
import { DescribeDatasetGroupCommand } from "@aws-sdk/client-forecast";
async function waitForActive(arn, describeCmd, getStatus) {
while (true) {
const result = await forecast.send(describeCmd(arn));
const status = getStatus(result);
if (status === "ACTIVE") return result;
if (status.endsWith("FAILED")) throw new Error(`Resource failed: ${JSON.stringify(result)}`);
await new Promise(r => setTimeout(r, 30_000)); // 30s poll interval
}
}
// Example: wait for dataset group
await waitForActive(
DatasetGroupArn,
(arn) => new DescribeDatasetGroupCommand({ DatasetGroupArn: arn }),
(r) => r.Status
);
Use the same helper for DescribeDatasetImportJobCommand, DescribeAutoPredictorCommand, and DescribeForecastCommand. Polling at 30-second intervals is safe for all stages — predictor training takes 20–90 minutes, so aggressive polling wastes API quota without accelerating completion.
Key gotchas at a glance
- Lowercase schema attributes: Amazon Forecast uses
item_id,timestamp,target_value— all lowercase. This differs from services like DynamoDB or Personalize that use uppercase conventions. Uppercase names fail schema validation with a cryptic error. - Two separate npm packages:
@aws-sdk/client-forecastfor management,@aws-sdk/client-forecastqueryfor queries. Trying to callQueryForecastCommandfrom theForecastClientproduces a "command not found" error at import time. - ForecastTypes are quantile strings, not integers:
["0.1","0.5","0.9"], not[10, 50, 90]or["p10","p50","p90"]. The string format is the decimal probability; the response keys arep10,p50,p90. - TimestampFormat must exactly match your CSV: If your CSV has
2026-01-15 14:00:00, the format string is"yyyy-MM-dd HH:mm:ss". A mismatch causes the import job to succeed with zero rows imported — no error is thrown. - Deletion order: Forecast → Predictor → Dataset Import Job → Dataset → Dataset Group. You cannot delete a parent resource while child resources exist.
Continue in this series
- Dataset import and schema design — CreateDatasetCommand, Avro-free schema definition, S3 CSV format, timestamp gotchas, missing value fills
- Predictor training and AutoML — CreateAutoMLPredictorCommand, ForecastHorizon, weather and calendar signals, GetAccuracyMetricsCommand
- Generating and querying forecasts — CreateForecastCommand, QueryForecastCommand, percentile bands, batch export
Related monitoring guides: CloudWatch metrics for MCP servers · SageMaker endpoints with MCP servers · Prometheus for MCP server observability