MCP server connecting Google TimesFM 2.5 to Shopify Admin GraphQL for forecasting, demand planning, and anomaly detection.
Project description
shopify-forecast-mcp
⚠️ v0.1.0 Alpha — Early release. API surface may change before v0.2. Feedback welcome: open an issue.
Merchant-native MCP server that connects Google's TimesFM 2.5 time-series foundation model to your Shopify store — so your AI assistant can answer "what does next month look like?" with a real forecast grounded in your order history.
No dashboards, no exports, no per-store training. Works with Claude Desktop, Claude Code, Cursor, and any MCP-compatible AI client.
Why
Shopify has four official MCP servers, all buyer-facing or developer-facing. None serve merchant operations: forecasting, demand planning, promo analysis, anomaly detection.
Existing third-party tools either use weak models (moving averages, Prophet) or lock insights inside closed SaaS dashboards. This one:
- Runs TimesFM 2.5 (Google's 200M-param foundation model) — state of the art on the GIFT-Eval retail benchmark
- Pulls directly from Shopify Admin GraphQL with bulk operations, refund-aware normalization, multi-currency, and cost-based rate limiting
- Returns markdown tables with confidence bands that render natively in your MCP client
- Ships as a single
uvxcommand — zero manual Python setup - Is MIT licensed, free forever
Quick start
Three steps to a working forecast in under 5 minutes:
1. Install uv (once)
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
irm https://astral.sh/uv/install.ps1 | iex
2. Get a Shopify Admin API access token
Follow docs/SETUP.md to create a custom app, enable the required scopes (read_orders, read_all_orders, read_products, read_inventory), and generate an access token.
3. Add to Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows) and add:
{
"mcpServers": {
"shopify-forecast": {
"command": "uvx",
"args": ["shopify-forecast-mcp"],
"env": {
"SHOPIFY_FORECAST_SHOP": "mystore.myshopify.com",
"SHOPIFY_FORECAST_ACCESS_TOKEN": "shpat_xxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
}
Restart Claude Desktop, then ask: "What does next month look like?"
First run downloads TimesFM 2.5 weights (~400MB, one-time). Subsequent forecasts are <10 seconds.
Prefer the terminal first? You can verify your setup before wiring Claude Desktop by running
uvx shopify-forecast-mcpdirectly — it launches the MCP server on stdio and will exit cleanly on Ctrl-C when no client is attached. Or exercise the CLI:uvx --from shopify-forecast-mcp shopify-forecast revenue --horizon 7.
Alpha pre-release: if installing v0.1.0-rc1, use
"args": ["--prerelease=allow", "shopify-forecast-mcp@0.1.0rc1"]instead.
See also: docs/SETUP.md for Claude Code + generic MCP client setup, Docker install, and multi-store configuration.
Examples
Drop these into your AI client after setup:
Revenue forecasting — "What does next month look like?" Returns a daily-granularity revenue forecast for the next 30 days with an 80% confidence band (q10–q90).
Demand + reorder alerts — "Which SKUs need to be reordered in the next 2 weeks?" Returns top-N SKUs with projected demand vs current inventory, flagging stockout risk.
Promo analysis — "How did Black Friday perform vs last year?" Returns revenue lift, order lift, AOV change, discount depth, and post-promo hangover estimate for both windows side by side.
Scenario planning — "Compare 3 promo scenarios for December: 10% off, 20% off + free shipping, and BOGO." Returns 3 differentiated forecasts in one markdown response with per-scenario revenue, units, and margin implications.
Tools
Seven MCP tools, full reference in docs/TOOLS.md:
| Tool | Purpose |
|---|---|
forecast_revenue |
Store-level revenue forecast with confidence bands |
forecast_demand |
Product/collection/SKU demand + reorder alerts |
analyze_promotion |
Past promo vs baseline — lift, AOV, hangover |
detect_anomalies |
Flag days outside forecast quantile bands |
compare_periods |
Year-over-year / month-over-month comparison |
compare_scenarios |
What-if forecasting across 2-4 scenarios |
get_seasonality |
Explain learned seasonal patterns |
Architecture
Two-layer design: a pure-Python core library (Shopify client, time-series shaping, TimesFM forecaster, analytics, covariates) wrapped by a thin MCP server and a matching CLI. Core is importable and testable without the MCP runtime.
Dual-backend Shopify access: DirectBackend (httpx + access token, used in Docker and when SHOPIFY_FORECAST_ACCESS_TOKEN is set) or CliBackend (shopify store execute — browser OAuth, no token required, host-only).
Full diagrams + design decisions in docs/ARCHITECTURE.md.
Configuration
Minimum required env vars:
| Variable | Purpose |
|---|---|
SHOPIFY_FORECAST_SHOP |
Your store domain (e.g. mystore.myshopify.com) |
SHOPIFY_FORECAST_ACCESS_TOKEN |
Admin API access token (from custom app) |
See docs/SETUP.md for the full env var table, multi-store config, Docker env passing, and optional tuning knobs.
CLI
A standalone shopify-forecast CLI wraps the same core library without the MCP runtime — useful for scripting, cron, and CI:
uvx --from shopify-forecast-mcp shopify-forecast revenue --horizon 30
uvx --from shopify-forecast-mcp shopify-forecast demand --group-by product --top-n 10
uvx --from shopify-forecast-mcp shopify-forecast promo --start 2025-11-24 --end 2025-11-30
uvx --from shopify-forecast-mcp shopify-forecast compare --period-a 2024-11:2024-12 --period-b 2025-11:2025-12
Add --json to any verb for machine-readable output. See docs/SETUP.md#cli-usage for the full CLI reference.
Docker
Run the MCP server (or any CLI verb) without installing Python:
docker run --rm -i \
-e SHOPIFY_FORECAST_SHOP=mystore.myshopify.com \
-e SHOPIFY_FORECAST_ACCESS_TOKEN=shpat_xxx \
ghcr.io/mcostigliola321/shopify-forecast-mcp:latest
Two image variants:
:latest— lazy model download on first call (smaller image, ~1.5GB):bundled— TimesFM weights baked in (larger image, ~2.5GB, offline-capable)
Browser-based OAuth does NOT work in containers; Docker mode requires the access-token env var. See docs/SETUP.md#docker.
Roadmap
v0.1.0 is the first public alpha, covering the full MVP (7 MCP tools + 4 CLI verbs + dual-backend). Future: see .planning/ROADMAP.md.
Contributing
Feedback and bug reports welcome at GitHub Issues. For code contributions, see docs/ARCHITECTURE.md for the two-layer design and open a draft PR early.
License
MIT. TimesFM 2.5 weights are Apache 2.0 (compatible).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shopify_forecast_mcp-0.1.0.tar.gz.
File metadata
- Download URL: shopify_forecast_mcp-0.1.0.tar.gz
- Upload date:
- Size: 499.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b2db710c9e9d9f72f00e3c15c517ae6e2a59cd056ba3e4d53359edd0ddec36f
|
|
| MD5 |
70ff7626069b9733d87851e25e9ad8ad
|
|
| BLAKE2b-256 |
a0a0bdbecfbb167963c6864b3b0d596cfaa6390e475e02b0d804f8cdb1bc00ae
|
File details
Details for the file shopify_forecast_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shopify_forecast_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 61.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a489ab27f02b2dee781a2cf673418d6c8eba84b6af21301296e31d2183adac3e
|
|
| MD5 |
d3193efc057bbe7d0aa0e251e6fbbd76
|
|
| BLAKE2b-256 |
dee419b4fc34aa301ad6fe2e6aceebca3a3903522a4b6b7db87304ed7e3ac309
|