spotlight-mcp
v0.1.6MCP server for the Spotlight Design System
An MCP (Model Context Protocol) server that exposes the Spotlight Design System (@castandcrew/platform-ui) to AI tools like Claude. It allows Claude to look up component props, design tokens, usage guidelines, MUI migration paths, and design rules — without hallucinating APIs that don't exist. When connected to Claude Code (or any MCP-compatible client), spotlight-mcp gives Claude access to 12 tools. ask_spotlight is the front door — one call routes across components, guidance, tokens, classes, and migration, so the client doesn't have to orchestrate several lookups.
Summary extracted from the README.
spotlight-mcp
An MCP (Model Context Protocol) server that exposes the Spotlight Design System (@castandcrew/platform-ui) to AI tools like Claude. It allows Claude to look up component props, design tokens, usage guidelines, MUI migration paths, and design rules — without hallucinating APIs that don't exist.
What it does
When connected to Claude Code (or any MCP-compatible client), spotlight-mcp gives Claude access to 12 tools. ask_spotlight is the front door — one call routes across components, guidance, tokens, classes, and migration, so the client doesn't have to orchestrate several lookups. The rest are precise follow-ups.
| Tool | What Claude can ask |
|---|---|
ask_spotlight |
"How should I label and place buttons?" — one-call answer context |
get_component |
"What props does AutocompleteInput have?" |
search_components |
"What components exist for date input?" |
get_token |
"What is the value of --space-md?" |
search_tokens |
"What tokens exist for spacing?" |
search_utility_classes |
"What's the CSS class for body text?" |
get_migration_guide |
"How do I migrate from MUI Button?" |
get_pattern |
"When should I use Modal vs Drawer?" |
validate_usage |
"Is this JSX correct per Spotlight rules?" |
list_deprecated |
"What components should I avoid?" |
All data comes from a static data/index.json file — no network calls, no AI inside the
server. The index has two sources, both merged by the indexer:
- Derived — components, props, tokens, utility classes, and rules parsed automatically
from the
@castandcrew/platform-uisource repo. - Hand-authored — selection/decision guidance, code recipes, migration guides, icon and
layout references, and motion docs in
content/. This is the canonical home for Spotlight design knowledge being migrated off thespotlight-knowledgeClaude Code plugin (which the MCP is intended to replace).
Getting it running
Use
@castandcrew/spotlight-mcp0.1.4or later. Earlier npm versions (0.1.0–0.1.3) ship an empty index (0 components, 0 tokens, 0 utility classes), sosearch_components,get_component,search_tokens,get_tokenandsearch_utility_classesreturn nothing. Do not use them.0.1.4is the first release with a populateddata/index.json: 169 entries (165 unique component names), 329 tokens, 218 utility classes, 111 patterns and 71 rules. See Via npm to connect it without cloning anything.You can also run it from source. A fresh clone is fine:
data/index.jsonis committed with real data, sopnpm install && pnpm buildis enough to get a working server. Regenerate it only when the upstream library changes — see Updating the index.If the index is ever empty, the server says so. It does not answer
[]as if the design system were empty: each tool returns an explicit error naming the index path, the counts it found and the command to fix it, and a status banner is written to stderr at startup. See When the index is empty.Prerequisites (source): Node 18+ and
pnpm.
git clone https://github.com/cast-and-crew/spotlight-mcp.git
cd spotlight-mcp
pnpm install # installs deps and builds dist/ via the prepare script
pnpm build # re-compile src/ → dist/ if needed
Connect it to Claude Code (recommended)
Register the built server at user scope (available in every project):
claude mcp add spotlight --scope user -- node "$(pwd)/dist/index.js"
Start a new Claude Code session — the 12 tools appear. They're all read-only lookups, so
auto-approve them to avoid per-call prompts: run /permissions and add mcp__spotlight, or
choose "don't ask again" on the first prompt.
Then just ask — e.g. "Using spotlight, when should I use a Modal vs a Drawer?" or "what
color token for a critical background?". ask_spotlight is the one-call front door; the
other tools are precise follow-ups.
Verify it's working:
./scripts/smoke.sh # boots the server, lists tools, runs a few real calls
pnpm test # full suite (index integrity, tool calls, content merge)
Connect it to Claude Desktop
Claude Desktop doesn't use the claude mcp add CLI — it reads local MCP servers from its own
config file. Point it at the built server:
Via the UI: Settings → Developer → Local MCP servers → Edit config.
Or edit the file directly (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"spotlight": {
"command": "node",
"args": ["/absolute/path/to/spotlight-mcp/dist/index.js"]
}
}
}
Restart Claude Desktop. Settings → Developer → Local MCP servers should show spotlight as
running.
Verify it's working:
ps aux | grep spotlight-mcp # confirms the process is alive
tail -f ~/Library/Logs/Claude/mcp-server-spotlight.log # confirms the handshake succeeded
Look for "Server started and connected successfully" with no error after it.
Scope: this config covers Claude Desktop's Chat. The Code Tab is Claude Code and reads Claude Code's own config (
~/.claude.json) — register the server there withclaude mcp add(section above) or install thespotlight-coworkplugin, which bundles it.mcp-server-spotlight.logrecords Chat's server process. (Claude Desktop merged Cowork into Chat — Cowork capabilities live in the same conversation now, there is no separate Cowork option; thespotlight-coworkplugin keeps its name.) (An earlier draft of this README claimed the Code Tab could not reach the server; that was a misconfigured path in~/.claude.json, not a limitation — verified in SPT-1526 v2, 2026-09-08.)
Other clients
- MCP Inspector (GUI to poke at tools):
npx @modelcontextprotocol/inspector node dist/index.js - HTTP (Claude.ai, custom integrations):
pnpm start:http(orPORT=8080 pnpm start:http)POST /mcp— Streamable HTTP (recommended) ·GET /sse+POST /messages— SSE legacy ·GET /health- The HTTP server has no authentication and accepts requests from any origin (CORS is open so browser clients can connect). Run it only on a trusted network; the network boundary is the protection.
Via npm
0.1.4 or later is required. npx -y @castandcrew/spotlight-mcp downloads and starts the
server; it ships the full index, so no clone or build is needed. Pin a version range so a
future release cannot change your setup unannounced, for example
@castandcrew/spotlight-mcp@0.1.4 (exact) or @castandcrew/spotlight-mcp@~0.1.4 (patch
updates only).
Versions 0.1.0–0.1.3 (including the 0.1.3 pipeline smoke test) have an empty index and
predate the empty-index guard described below. Do not use them.
The plugins in claude-plugins (spotlight-cowork, spotlight-remediation,
spotlight-advisor, spotlight-patterns, repo-spec and spotlight-design) start the server
through npx -y @castandcrew/spotlight-mcp in their .mcp.json.
Claude Code:
claude mcp add spotlight -- npx -y @castandcrew/spotlight-mcp
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"spotlight": {
"command": "npx",
"args": ["-y", "@castandcrew/spotlight-mcp"]
}
}
}
Same config works on any machine — no absolute path, no local checkout required.
Development
After pnpm install (see Getting it running):
pnpm dev:stdio # run from source in stdio mode (tsx, no build step)
pnpm dev:http # run from source in HTTP mode
pnpm build # compile src/ → dist/
pnpm start # run the built server (stdio)
pnpm test # run the vitest suite
Testing
Three layers, fastest first. Build first with pnpm build.
# 1. stdio smoke test — boots the server, lists tools, runs a few real calls
pnpm build && ./scripts/smoke.sh
# 2. automated suite (21 checks: index integrity, end-to-end tool calls, manual-merge)
pnpm test
# 3. MCP Inspector — a GUI to invoke any tool with arbitrary arguments
npx @modelcontextprotocol/inspector node dist/index.js
Live in Claude Code (the real test). Register the built server, then ask design questions and watch Claude call the tools:
claude mcp add spotlight -- node "$(pwd)/dist/index.js"
Then ask things like "should I use a Modal or a Drawer for a confirmation?", "what props
does Button take?", "how do I migrate a MUI Select?". To compare against the old
spotlight-knowledge plugin fairly, disable that plugin first — otherwise you can't tell
which source answered.
See docs/TESTING.md for details.
Updating the index
The data/index.json file is the source of truth for all MCP tools. The indexer parses the
@castandcrew/platform-ui source repo and merges the hand-authored content/
folder into a single index.
Run the indexer
# Pass the repo root — the Nx monorepo layout is auto-detected
pnpm index /path/to/common-ui-component-library
The indexer auto-detects the monorepo: it reads component/token source from
packages/platform-ui/src (falling back to src/ for older checkouts) and docs from the
repo-root docs/. It reads:
| Source | What it extracts |
|---|---|
packages/platform-ui/src/{category}/{Component}/types.ts |
Props, types, JSDoc, defaults (MUI re-exports annotated propsSource: "mui") |
…/{Component}/index.tsx (or index.ts) |
Component description, deprecation status |
…/{Component}/*.stories.tsx |
Story names and Storybook URLs |
…/{Component}/*.module.css |
Which design tokens each component uses |
…/Foundations/token-directory/outputs/token-dictionary.json |
Design tokens |
…/Foundations/token-directory/outputs/class-dictionary.json |
CSS utility classes |
docs/{category}/{Component}.md |
whenToUse, whenNotToUse, examples, MUI migration notes |
docs/SPOTLIGHT_RULES.md, docs/rules/ |
Rules (forbidden/allowed components, conventions) |
guides/*.md |
Long-form usage patterns |
content/** (this repo) |
Hand-authored patterns, component overrides, and rules |
After running the indexer, commit the refreshed data/index.json and restart the MCP server.
The indexer refuses to write an index that is missing derived data. If components, tokens,
utilityClasses, patterns or rules would come out empty, it prints what it resolved and why
each collection is empty, and leaves the existing data/index.json untouched. Override with
--allow-empty if you really need the file written — but do not commit the result.
This matters because patterns and rules are mostly merged from this repo's own content/,
so they stay populated even when the source path is wrong. An index generated against a bad path
looks plausible (patterns: 95, rules: 63) while being useless. That is how the empty 0.1.3
index shipped.
When the index is empty
The server never answers [] as if the design system had no such component. Two failure classes:
- Unusable — the index file is missing, unreadable, not JSON, or not shaped like an index.
loadIndex()throws, so every tool returns an error. - Degraded — the index parses but some collections are empty. Only the tools that need the
missing data error; the rest keep working. With the 0.1.3 index, for example,
get_pattern,get_recipeandidentify_patternstill answer correctly from the 103 patterns it did have.
Either way a status banner goes to stderr at startup (visible in
~/Library/Logs/Claude/mcp-server-spotlight.log for Claude Desktop), GET /health reports
per-collection counts in HTTP mode, and each failing tool returns a JSON error naming the resolved
index path, the counts found, the generated date and the command to fix it. The server does not
exit — a dead server tells the model nothing.
Tools guard only on what they read: validate_usage, for instance, requires both rules and
components, because its deprecated-component check reads deprecated, which the indexer derives
from components. With 0 components it would otherwise report valid: true for any snippet.
Current index coverage (generated: 2026-09-01)
| Metric | Count |
|---|---|
| Components | 84 (11 categories) |
| Components with props | 52 (all parsed locally — no MUI re-exports in the current index) |
Components with usage.whenToUse |
39 (whenNotToUse 42, examples 19) |
| Components with stories | 70 |
| Patterns | 111 (selection 41, recipe 26, guide 11, reference 9, migration 8, rules 5, layout 5, icon 4, overview 2) |
| Design tokens | 329 (light theme) |
| Utility classes | 218 |
| Rules | 71 |
| MUI migration entries | 24 |
| Deprecated entries | 0 (nothing is deprecated upstream today) |
Historical coverage gaps (pre-monorepo) are tracked in platform-ui-gaps.md.
Architecture
spotlight-mcp/
├── src/
│ ├── index.ts # Entry point — parses --http / --stdio flag
│ ├── server.ts # Creates McpServer and registers all tools
│ ├── types.ts # TypeScript types for index.json schema
│ ├── data/
│ │ └── loader.ts # Reads and caches data/index.json at runtime
│ ├── tools/ # One file per MCP tool
│ │ ├── ask_spotlight.ts # single-call front door (routes across all data)
│ │ ├── get_component.ts
│ │ ├── search_components.ts
│ │ ├── get_token.ts
│ │ ├── search_tokens.ts
│ │ ├── search_utility_classes.ts
│ │ ├── get_migration_guide.ts
│ │ ├── get_pattern.ts
│ │ ├── validate_usage.ts
│ │ └── list_deprecated.ts
│ └── transports/
│ ├── stdio.ts # stdio transport (Claude Code, CLI tools)
│ └── http.ts # Streamable HTTP + SSE legacy
├── content/ # Hand-authored knowledge merged into the index
│ ├── patterns/ # selection & decision guides, motion
│ ├── recipes/ # reusable UI code recipes
│ ├── reference/ # critical-rules, token usage, conventions
│ ├── icons/ layout/ migration/ overview/
│ ├── components/ # per-component usage overrides
│ └── rules/ # extra rules (frontmatter)
├── scripts/
│ ├── indexer.ts # Generates data/index.json (derived + content/)
│ └── smoke.sh # stdio smoke test
├── test/ # vitest: index-integrity, tools, manual-merge
├── docs/
│ ├── TESTING.md # How to test (interactive + automated)
│ └── RELEASING.md # Branching, versioning, release runbook
├── data/
│ └── index.json # Generated index — this is what the server reads
└── platform-ui-gaps.md # Historical (pre-monorepo) coverage gaps
How it connects to Claude
The MCP server does not call any AI. Claude calls it:
User question
↓
Claude (Anthropic) — reads tool descriptions, decides which to call
↓
spotlight-mcp server — looks up data/index.json
↓
Returns structured JSON to Claude
↓
Claude answers the user using real Spotlight data
The tool descriptions (the text in each server.tool(name, description, ...) call) are the only "bridge" between natural language and the server. Well-written descriptions = Claude uses the right tool at the right time.
Publishing
Releases are tagged on main and staged on npm by the Release GitHub workflow; a maintainer
approves the staged version in npm. Do not run npm publish / pnpm publish from a laptop: it
skips the checks that stop an empty index from shipping (that is how 0.1.3 went out).
Branching, versioning rules, the step-by-step release runbook and rollback are in
docs/RELEASING.md.
Clients that run npx -y @castandcrew/spotlight-mcp (without a pinned version) get the latest
release on the next start; pin a range (see Via npm) to avoid that.
Environment variables
| Variable | Default | Description |
|---|---|---|
PORT |
3000 |
HTTP server port (only in --http mode) |
SPOTLIGHT_INDEX_PATH |
data/index.json (bundled) |
Path to a custom index file |