- TypeScript 96.6%
- CSS 2.8%
- Dockerfile 0.3%
- Shell 0.2%
- HTML 0.1%
| .github/workflows | ||
| scripts | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| deno.json | ||
| deno.lock | ||
| docker-entrypoint.sh | ||
| Dockerfile | ||
| LICENSE | ||
| mod.ts | ||
| README.md | ||
| server.ts | ||
@vidimus/mcp-sourcing
Stateless Level-2 @mcpview/compose MCP server for hardware Buy-branch sourcing & BOM
intelligence, aligned with @mcpview/server@^0.31.0, @mcpview/components@^0.17.0/layout, and
the canonical @mcpview/create (--preset=engineering) widget architecture.
- Zero-key deterministic engines (usable immediately with zero distributor API keys):
- Multi-tier BOM cost rollup (
bom_rollup): attrition, MOQ/SPQ rounding, excess cost, price breaks, NRE amortization, static FX table (USD/EUR/GBP/JPY/CNY), Make/Buy split, top-5 Pareto cost drivers, explicitUNLINKEDflagging for unpriced parts. - Supply-chain risk & multi-level BOM critical path (
supply_risk): topological DAG longest-path lead time with safe cycle detection,NO_SUPPLIER,SINGLE_SOURCE,STOCK_SHORTAGE,LONG_LEAD,LIFECYCLE_*, andEXPORT_CONTROLLEDflags, transparent 0–100 risk score, and prioritized mitigation checklist. - Make-vs-Buy break-even engine (
make_vs_buy): unit/total cost curves, piecewise analytical break-even crossover across Buy MOQ & price breaks, capacity-constrained lead time, and lead-time delta.
- Multi-tier BOM cost rollup (
- Live distributor API adapters (with parallel fan-out, per-distributor timeout, partial-failure
resilience, and per-request BYO-Key isolation):
- DigiKey Product Information v4 (OAuth2
client_credentials+ SHA-256-keyed bounded token cache) - Mouser Search API v1 (partnumber & keyword search, price/lead-time parser)
- Nexar / Octopart GraphQL API (OAuth2
supply.domain+ multi-sellersupSearchMpn/supSearch)
- DigiKey Product Information v4 (OAuth2
- Three synchronized Compose Board MCP App widgets (
src/ui/widgets/->src/ui/dist/):- Responsive
@mcpview/components/layouttreatments (wide,panel,mobile) +?layout=override +ui/notifications/size-changedauto-sizing. - Bilingual
en/fri18n driven byhostContext.localeandIntl.NumberFormat+ light/dark host theming. - Engineering + semantic compose ports (
part.selected/part.focus,requirement.selected/requirement.focus,artifact.selected/artifact.focus,semantic.selection.changed/semantic.selection.apply).
- Responsive
Quickstart
# Stateless HTTP server on http://127.0.0.1:3025/mcp (health: /health)
deno task serve
# Native stdio transport (for local MCP hosts)
deno task serve:stdio
# Build widgets & run CI quality gate (fmt, check, lint, test, bundle freshness)
deno task build:ui
deno task ci:check
# Full release gate (ci:check + native stdio smoke)
deno task release:check
HTTP Host & Origin Guard (@mcpview/server@^0.31.0)
HTTP requests pass through @mcpview/server's Host and Origin guard before every route:
- Set
MCP_ALLOWED_ORIGINS(comma-separated, e.g.https://app.vidimus.run,http://localhost:*, with legacyMCP_CORS_ORIGINSfallback) to authorize browser origins. Wildcard"*"is rejected. - Set
MCP_ALLOWED_HOSTS(comma-separated, e.g.mcp-sourcing-xyz.a.run.app) when exposing the server on a non-loopback address (--hostname=0.0.0.0/ Cloud Run). Wildcard"*"is rejected. - Omitting both env vars preserves safe loopback-only defaults locally.
Level-2 Snippets & Widgets
All 7 capabilities are exposed both as direct sourcing_* MCP tools and as replayable Level-2
@mcpview/compose snippets via list_snippets / run_snippet:
| Snippet | Direct MCP Tool | Primary Widget URI | API Keys Required? |
|---|---|---|---|
bom_rollup |
sourcing_bom_rollup |
ui://mcp-sourcing/bom-rollup |
No |
supply_risk |
sourcing_supply_risk |
ui://mcp-sourcing/supply-risk |
No |
make_vs_buy |
sourcing_make_vs_buy |
ui://mcp-sourcing/bom-rollup |
No |
part_search |
sourcing_part_search |
ui://mcp-sourcing/part-compare |
Live keys (or allowDemoCatalog: true) |
part_quote |
sourcing_part_quote |
ui://mcp-sourcing/part-compare |
Live keys (or allowDemoCatalog: true) |
bom_price_live |
sourcing_bom_price_live |
ui://mcp-sourcing/bom-rollup, ui://mcp-sourcing/supply-risk |
Live keys (or allowDemoCatalog: true) |
provider_status |
sourcing_provider_status |
ui://mcp-sourcing/part-compare |
No (masked status only) |
Distributor Configuration & BYO-Key Headers
Server-wide environment variables:
| Distributor | Environment Variables |
|---|---|
| DigiKey v4 | DIGIKEY_CLIENT_ID, DIGIKEY_CLIENT_SECRET, optional DIGIKEY_SANDBOX=true |
| Mouser v1 | MOUSER_API_KEY |
| Nexar / Octopart | NEXAR_CLIENT_ID, NEXAR_CLIENT_SECRET |
Multi-tenant per-request BYO-Key headers are strictly opt-in via
VIDIMUS_ALLOW_REQUEST_CREDENTIALS=true and isolated per HTTP request via AsyncLocalStorage
(never shared across concurrent requests, never mixed with server secrets, and never logged):
| Distributor | Per-Request HTTP Headers |
|---|---|
| DigiKey v4 | X-Vidimus-Digikey-Client-Id, X-Vidimus-Digikey-Client-Secret, optional X-Vidimus-Digikey-Sandbox |
| Mouser v1 | X-Vidimus-Mouser-Api-Key |
| Nexar / Octopart | X-Vidimus-Nexar-Client-Id, X-Vidimus-Nexar-Client-Secret |
Literal Provenance Guarantees
Every tool and snippet response carries an explicit literal provenance field (mirrored in
_meta["io.casys/provenance"]):
deterministic-analysis— pure deterministic math on caller-supplied lines (bom_rollup,supply_risk,make_vs_buy,provider_status).distributor-quote— live HTTP responses from DigiKey, Mouser, or Nexar/Octopart, stamped withretrievedAt(ISO-8601) anddistributor.demo-fixture— returned only when the caller explicitly passesallowDemoCatalog: trueand no live credentials are configured. Demo prices are never returned silently.unavailable— returned when live distributor credentials are absent andallowDemoCatalogis not true, with actionablerecoveryguidance pointing tohttps://app.vidimus.run/connectors, env vars, and BYO-Key headers.
Docker & Cloud Run
# Build local image
docker build -t mcp-sourcing:local .
# Run stateless HTTP server on port 3025
docker run --rm -p 127.0.0.1:3025:3025 \
-e VIDIMUS_ALLOW_REQUEST_CREDENTIALS=true \
mcp-sourcing:local http
# Verify /health
curl -fsS http://127.0.0.1:3025/health
# Run stdio mode
docker run --rm -i mcp-sourcing:local stdio
On Google Cloud Run, the container runs as non-root deno, honors $PORT automatically (defaulting
to 3025), binds 0.0.0.0, and accepts Cloud Run hostnames configured via MCP_ALLOWED_HOSTS.
License
MIT — see LICENSE.