shelfsignal-mcp
# ShelfSignal v1.3.0
Open-source competitive product intelligence, US effective landed price tracking, and deterministic COGS Margin Defense engine for US DTC e-commerce brands, agencies, and AI agent workflows.
MIT License · Python 3.10+ · Self-Hosted · Zero Monthly SaaS Fees · [Acceptable Use Policy](ACCEPTABLE_USE.md) · [Changelog](CHANGELOG.md) · [Contributing](CONTRIBUTING.md)
## Why ShelfSignal Exists
Monday, 9:04 AM. A competitor drops their hero SKU by $5. Generic monitors blast an urgent alert—pushing your team to blindly match it, even though the rival is already out of stock, charges $6.99 shipping on orders under $50, and matching $5 off permanently would push your net margin below 18%.
ShelfSignal turns public product pages into **verified change events**, **true US checkout landed prices**, and **deterministic COGS margin-defense actions**—accessible via Web Console, CLI, FastAPI, and a native **9-tool MCP Server** for Claude Code and Cursor.
## Demo Showcase & Local WebGL Recording

Record a fresh 1280×720 live Three.js WebGL MP4 + README GIF directly from `site/index.html` (auto-performs 360° archive orbit, fleet spotlight switching, and **Dispatch Burst Sweep**) on your machine with Playwright + FFmpeg:
**Windows PowerShell** (single-line):
```powershell
$env:PYTHONPATH="."; python scripts/record_demo.py
```
**macOS / Linux**:
```bash
PYTHONPATH=. python scripts/record_demo.py
```
Outputs `docs/media/shelfsignal-demo.mp4` and `docs/media/shelfsignal-demo.gif`.
## Core Capabilities
- **US Effective Landed Price Engine**: Parses real checkout economics beyond sticker price—`Free shipping over $50`, `$6.99 flat shipping`, `$10 off $75+`, `BOGO 50% off`, and `Subscribe & Save 15%` (with multi-currency support for `USD`, `CAD`, `AUD`, `GBP`, `EUR`, `MYR`, `SGD`, `IDR`, `THB`, `VND`, `CNY`).
- **Deterministic COGS Margin Defense**: Computes exact net profit, margin floor price, and max safe voucher ceiling (`HOLD_PRICE_COMPETITOR_OOS`, `HOLD_AND_MONITOR`, `MATCH_WITH_VOUCHER`, `PROTECT_MARGIN_DO_NOT_MATCH`).
- **Spec-Aware O(N) SKU Matching**: Inverted blocking index shrinks 600-SKU matching from 179,700 pairs to 3,003 pairs (-98.33%, ~50x faster) while blocking size/pack mismatches (`16 fl oz` vs `32 fl oz`, `1-pack` vs `2-pack`).
- **Compliant HTTP-First + Optional Browser Fallback**: AsyncIO engine with RFC 9309 single-flight `robots.txt` caching, SSRF/auth-path blocking, adaptive 429/403 circuit breakers, and explicit `--browser` (or UI **Browser Mode (JS)**) Playwright rendering for Cloudflare-fronted Shopify Plus stores.
- **Editorial Web Console (`EN / 华语`)**: `Ctrl+K` command palette, drag-and-drop CSV/TXT URL import, 3-step Quick Start bar, 1-click quick filter chips, drag-to-reorder saved filter views, 14-day SVG price trend + COGS drawer, and Visual Adapter Studio.
- **Native 9-Tool MCP Server (`shelfsignal-mcp`)**: JSON-RPC 2.0 stdio integration for Claude Code and Cursor.
## Verified Benchmarks
| Benchmark | Baseline | ShelfSignal v1.3.0 | Improvement |
| :--- | :--- | :--- | :--- |
| Static HTML Parsing (`bs4_lxml`) | — | 232.5/s (Win11) – 486.7/s (Linux) | 10–30x faster with optional `selectolax` |
| 40-URL Async Collection | 1.29s–1.47s sync | 0.16s–0.29s async | **5.05x–8.23x speedup** |
| 100-URL / 10-Domain Scale Test | Sequential | 0.363s (275 req/s, p95 108.9ms) | Exact 10 single-flight `robots.txt` fetches |
| 600-SKU Cross-Site Matching | 179,700 pairs (~29–52s) | 3,003 pairs (0.55s–1.04s) | **98.33% fewer pairs (~50x faster)** |
## 10-Second Quickstart
**Windows PowerShell** (single-line):
```powershell
pip install -r requirements.txt; $env:PYTHONPATH="."; python -m shelfsignal demo --serve
```
**macOS / Linux**:
```bash
pip install -r requirements.txt && PYTHONPATH=. python -m shelfsignal demo --serve
```
Open `http://127.0.0.1:8000` to explore the seeded 14-day US DTC workspace, landed price matrix, margin defense simulator, and Visual Adapter Studio.
## Common CLI Commands
```bash
# Fetch a public product page (add --browser for JS / Shopify Plus pages after `pip install playwright && playwright install chromium`)
python -m shelfsignal fetch "https://fellowproducts.com/products/stagg-ekg-electric-pour-over-kettle" --browser
# Compute US effective landed price
python -m shelfsignal landed-price 32.99 --currency USD --promo "$5 off" --shipping "Free shipping over $50"
# Run deterministic COGS Margin Defense
python -m shelfsignal margin --own-price 49.99 --cogs 18.00 --fee-pct 3.0 --fulfillment 4.50 --min-margin 20 --comp-price 44.99
# Run release self-check (tests + static site + dashboard integrity)
PYTHONPATH=. python scripts/verify_release.py
```
## Connect to Claude Code / Cursor (9-Tool MCP Server)
```json
{
"mcpServers": {
"shelfsignal": {
"command": "python",
"args": ["-m", "shelfsignal", "mcp"]
}
}
}
```
## Isolated Static Website (`site/`)
The `site/` directory contains a physically isolated, GitHub Pages-ready US-First marketing & documentation site (11 HTML pages, 4 field guides, 3 competitor comparisons, 2 zero-login interactive calculators, `robots.txt` with `Content-Signal`, `llms.txt`, `llms-full.txt`, `sitemap.xml`, and `EN / 华语` toggle).
```bash
# Preview static site locally
python -m http.server -d site 8080
# Update placeholder domain across site/ before publishing
python scripts/set_site_domain.py --base-url "https://waterdolphinkiller.github.io/shelfsignal"
```
## Compliance Boundary
ShelfSignal only processes publicly accessible product and catalog URLs. It enforces RFC 9309 `robots.txt`, blocks private/localhost SSRF targets and `/login` / `/account` / `/checkout` paths, and hard-stops on HTTP `401` / `403` / `429` / `451` or CAPTCHA challenges without bypass modules. See [ACCEPTABLE_USE.md](ACCEPTABLE_USE.md).
TDQS
Scored across 9 tools
Each tool targets a distinct operation in the competitive product-monitoring workflow: fetch/parse, snapshot diff, spec-aware matching, natural-language query, summary, adapter listing, landed-price computation, catalog discovery, and margin defense. The potentially closest pairs (diff_products vs. discover_catalog, query_changes vs. workspace_summary) are clearly separated by their descriptions.
All tools share the shelfsignal_ prefix and snake_case formatting, and most use a verb_noun pattern such as fetch_product, query_changes, and discover_catalog. A few are noun phrases (workspace_summary, landed_price, margin_defense), which is a minor deviation rather than a confusing inconsistency.
Nine tools is well-scoped for a competitive product-intelligence server, with each tool covering a meaningful part of the workflow. There is no obvious filler or excessive fragmentation.
The surface covers the core lifecycle well: product ingestion, comparison, cross-site matching, workspace querying, summaries, catalog discovery, landed pricing, and margin analysis. Minor gaps exist around explicit workspace/adapter management or alerting, but core workflows are covered.