Prophet MCP Server
An MCP server powered by Meta's Prophet that enables LLMs to perform time-series forecasting, trend analysis, and predictive modeling on historical data. It provides LLM-friendly statistical summaries, automated business-rule validation, and ready-to-render Chart.js visualizations.
README
Prophet MCP Server
An open-source Model Context Protocol (MCP) server engineered for Time-Series Forecasting.
Powered by Meta's Prophet, this server enables LLMs to generate accurate forecasts, trend analyses, and confidence intervals from historical data โ turning raw numbers into actionable insights within AI workflows.
Note: This project is a specialized fork of the sendgrid-mcp server, re-engineered to provide robust forecasting capabilities via the MCP protocol.
๐ Key Capabilities
1. Predictive Modeling
Leverages Meta's Prophet to predict future trends based on historical data. Handles seasonality, outliers, and trend changes automatically.
2. LLM-Friendly Output
Returns data in a format optimized for Large Language Models:
- Plain-English Summaries: Instant context on trends (e.g., "Trending UPWARD by +51.7%").
- Statistical Breakdowns: Historical vs. Forecasted means, min/max, standard deviations.
- Chart.js Config: Ready-to-render visualization config for web deployment.
3. Bounds Validation
Optional upper/lower limits to flag out-of-bounds forecasts โ turning predictions into decision-support with business-rule enforcement.
4. Interactive Visualization
Includes Chart.js configuration in every response with:
- Red dots for actual historical data
- Dashed blue line for forecast predictions
- Shaded confidence interval band
- Red/orange dashed limit lines (when bounds are set)
๐ How It Works
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. LLM sends your historical data (dates + values) โ
โ 2. Prophet model learns the pattern โ
โ 3. Server generates forecast for N future periods โ
โ 4. Response includes: โ
โ โโโ Human-readable summary with trend analysis โ
โ โโโ Forecast data table (with optional bounds status) โ
โ โโโ Chart.js config for instant visualization โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Real-World Example
Let's say you tracked daily website conversions over 10 days and want to forecast the next 5 days โ with a safety limit of max 22 conversions (your team can't handle more).
Input
{
"ds": ["2025-01-01", "2025-01-02", "2025-01-03", "2025-01-04", "2025-01-05",
"2025-01-06", "2025-01-07", "2025-01-08", "2025-01-09", "2025-01-10"],
"y": [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
"periods": 5,
"upper_limit": 22
}
Output
### Prophet Forecast Data ###
Summary of forecast metrics:
- Historical Period: 2025-01-01 to 2025-01-10
- Historical Data Points: 10
- Historical Mean: 14.50
- Forecast Periods: 5
- Trend Direction: UPWARD (+51.7% vs historical mean)
Bounds Validation:
- Upper Limit: 22
- โ ๏ธ 2 date(s) OUT OF BOUNDS:
2025-01-14: yhat=23.00 > upper_limit=22
2025-01-15: yhat=24.00 > upper_limit=22
Key Takeaway: The model predicts the values will trend upward over the next
5 periods, with predicted values ranging from 20.00 to 24.00.
Date | yhat | yhat_lower | yhat_upper | Status
----------------------------------------------------
2025-01-01 | 10.00 | 10.00 | 10.00 | โ
OK
...
2025-01-14 | 23.00 | 23.00 | 23.00 | โ ๏ธ EXCEEDS UPPER
2025-01-15 | 24.00 | 24.00 | 24.00 | โ ๏ธ EXCEEDS UPPER
chartjs = { ... }
No data-science expertise required. The output tells you the trend direction, flags risky dates, and provides visualization config โ all in plain text.
๐ ๏ธ Tool: forecast_time_series
Description
Ingests time-series data and returns a future forecast with a detailed text summary, bounds validation, and Chart.js visualization config.
Input Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ds |
array[string] |
โ Yes | โ | List of dates in ISO format (YYYY-MM-DD) |
y |
array[number] |
โ Yes | โ | List of numeric values aligned with ds |
periods |
integer |
No | 10 |
Number of future periods to forecast |
lower_limit |
number |
No | โ | Flag forecast values below this threshold |
upper_limit |
number |
No | โ | Flag forecast values above this threshold |
Output Columns
| Column | Meaning |
|---|---|
ds |
Date for the observed or predicted value |
yhat |
Predicted value (model's best estimate) |
yhat_lower |
Lower bound of confidence interval (worst-case) |
yhat_upper |
Upper bound of confidence interval (best-case) |
status |
โ OK, โ ๏ธ EXCEEDS UPPER, or โ ๏ธ BELOW LOWER (only when limits are set) |
Understanding the Two Types of Bounds
yhat_lower / yhat_upper |
lower_limit / upper_limit |
|
|---|---|---|
| Set by | Prophet model (automatic) | You (manual) |
| Purpose | Statistical confidence range | Business rule enforcement |
| Answers | "How sure is the model?" | "Is the forecast safe for my business?" |
| Example | "Revenue will be 800โ1200" | "Our warehouse can't handle > 1000 orders" |
๐ Project Structure
Prophet_mcp/
โโโ app.py # Flask server โ MCP endpoint, auth, JSON-RPC routing
โโโ mcp_helper.py # Core engine โ Prophet forecasting, summary, Chart.js config
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โโโ .gitignore # Git exclusions
โโโ examples/ # Local testing utilities (not required for deployment)
โโโ plot_forecast.py # Script to call API and generate a local HTML chart
โโโ forecast_chart.html # Auto-generated preview (gitignored)
๐ฆ Installation & Setup
Prerequisites
- Anaconda or Miniconda (recommended for Prophet dependencies)
- Python 3.11+
1. Environment Setup
# Create environment
conda create -n prophet-mcp python=3.11
conda activate prophet-mcp
# Install dependencies
pip install -r requirements.txt
Windows Users: Prophet requires
CmdStan. If you encounter issues, refer to the Prophet Installation Guide or install via conda:conda install -c conda-forge prophet.
2. Configuration
The server uses Bearer Token authentication. Set the MCP_TOKEN environment variable, or it defaults to the value in app.py:
# Set your token (recommended for production)
export MCP_TOKEN="your-secure-token-here"
๐โโ๏ธ Running the Server
python app.py
- Server URL:
http://localhost:3000 - MCP Endpoint:
POST http://localhost:3000/mcp
Authentication
All requests must include the header:
Authorization: Bearer <your-token>
Example API Call (cURL)
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Authorization: `MCP_TOKEN` \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "forecast_time_series",
"arguments": {
"ds": ["2025-01-01","2025-01-02","2025-01-03","2025-01-04","2025-01-05",
"2025-01-06","2025-01-07","2025-01-08","2025-01-09","2025-01-10"],
"y": [10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
"periods": 5,
"upper_limit": 22
}
},
"id": 1
}'
๐งช Testing & Visualization
Local Testing Script
python examples/plot_forecast.py
This script will:
- Call your MCP server's API
- Extract the Chart.js config from the response
- Generate
forecast_chart.htmlwith an interactive chart - Open it in your default browser
The generated chart features a dark glassmorphism theme with:
- ๐ด Red dots โ Historical actuals
- ๐ต Dashed blue line โ Forecast predictions
- ๐ฆ Shaded blue band โ Confidence interval
- ๐ด Red dashed line โ Upper limit (if set)
- ๐ Orange dashed line โ Lower limit (if set)
โ๏ธ Cloud Deployment
For deploying to Google Cloud (or any cloud provider), you only need:
app.py
mcp_helper.py
requirements.txt
The examples/ folder is for local testing only and is not required in production.
๐ Security
- Bearer Token authentication on all endpoints
- Token configurable via
MCP_TOKENenvironment variable - JSON-RPC error handling with proper error codes
- Input validation on all tool parameters
๐ Dependencies
| Package | Purpose |
|---|---|
flask |
Web server framework |
pandas |
Data manipulation |
prophet |
Time-series forecasting engine |
requests |
HTTP client (examples only) |
๐ License
MIT License
๐ฅ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Author: Pradeep Chandra Kalahasthi
Original Base: sendgrid-mcp
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.