Electronic/mechanical BOM sourcing and supply risk MCP server
  • TypeScript 96.6%
  • CSS 2.8%
  • Dockerfile 0.3%
  • Shell 0.2%
  • HTML 0.1%
Find a file
Erwan Lee Pesle 637c79441c
Some checks are pending
CI / verify (push) Waiting to run
Docker / qualify (push) Waiting to run
Docker / docker (push) Blocked by required conditions
Docker / smoke (push) Blocked by required conditions
refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31
2026-12-05 22:40:48 +08:00
.github/workflows feat: initial @casys/mcp-sourcing v0.1.0 Level-2 Compose MCP server 2026-12-05 21:36:41 +08:00
scripts refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
src refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
tests refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
.dockerignore refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
.gitignore refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
deno.json refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
deno.lock refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
docker-entrypoint.sh feat: initial @casys/mcp-sourcing v0.1.0 Level-2 Compose MCP server 2026-12-05 21:36:41 +08:00
Dockerfile refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
LICENSE feat: initial @casys/mcp-sourcing v0.1.0 Level-2 Compose MCP server 2026-12-05 21:36:41 +08:00
mod.ts refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
README.md refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00
server.ts refactor: align @vidimus/mcp-sourcing to @mcpview/create + components/layout + server 0.31 2026-12-05 22:40:48 +08:00

@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, explicit UNLINKED flagging 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_*, and EXPORT_CONTROLLED flags, 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.
  • 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-seller supSearchMpn/supSearch)
  • Three synchronized Compose Board MCP App widgets (src/ui/widgets/ -> src/ui/dist/):
    • Responsive @mcpview/components/layout treatments (wide, panel, mobile) + ?layout= override + ui/notifications/size-changed auto-sizing.
    • Bilingual en/fr i18n driven by hostContext.locale and Intl.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).

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 legacy MCP_CORS_ORIGINS fallback) 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 with retrievedAt (ISO-8601) and distributor.
  • demo-fixture — returned only when the caller explicitly passes allowDemoCatalog: true and no live credentials are configured. Demo prices are never returned silently.
  • unavailable — returned when live distributor credentials are absent and allowDemoCatalog is not true, with actionable recovery guidance pointing to https://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.