@castandcrew/spotlight-mcp 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -16
- package/data/index.json +56002 -1197
- package/dist/data/health.d.ts +33 -0
- package/dist/data/health.js +111 -0
- package/dist/data/health.js.map +1 -0
- package/dist/data/loader.d.ts +19 -0
- package/dist/data/loader.js +61 -4
- package/dist/data/loader.js.map +1 -1
- package/dist/lib/regex-safety.d.ts +14 -0
- package/dist/lib/regex-safety.js +34 -0
- package/dist/lib/regex-safety.js.map +1 -0
- package/dist/server.js +25 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/_fuzzy.d.ts +49 -0
- package/dist/tools/_fuzzy.js +103 -0
- package/dist/tools/_fuzzy.js.map +1 -0
- package/dist/tools/_guard.d.ts +31 -0
- package/dist/tools/_guard.js +62 -0
- package/dist/tools/_guard.js.map +1 -0
- package/dist/tools/_synonyms.d.ts +1 -0
- package/dist/tools/_synonyms.js +28 -0
- package/dist/tools/_synonyms.js.map +1 -0
- package/dist/tools/ask_spotlight.js +67 -5
- package/dist/tools/ask_spotlight.js.map +1 -1
- package/dist/tools/get_component.js +14 -5
- package/dist/tools/get_component.js.map +1 -1
- package/dist/tools/get_migration_guide.js +4 -2
- package/dist/tools/get_migration_guide.js.map +1 -1
- package/dist/tools/get_pattern.js +22 -7
- package/dist/tools/get_pattern.js.map +1 -1
- package/dist/tools/get_recipe.js +4 -2
- package/dist/tools/get_recipe.js.map +1 -1
- package/dist/tools/get_token.js +5 -3
- package/dist/tools/get_token.js.map +1 -1
- package/dist/tools/identify_pattern.js +7 -5
- package/dist/tools/identify_pattern.js.map +1 -1
- package/dist/tools/list_deprecated.js +4 -2
- package/dist/tools/list_deprecated.js.map +1 -1
- package/dist/tools/search_components.js +9 -3
- package/dist/tools/search_components.js.map +1 -1
- package/dist/tools/search_tokens.js +8 -3
- package/dist/tools/search_tokens.js.map +1 -1
- package/dist/tools/search_utility_classes.js +4 -2
- package/dist/tools/search_utility_classes.js.map +1 -1
- package/dist/tools/validate_usage.js +25 -5
- package/dist/tools/validate_usage.js.map +1 -1
- package/dist/transports/http.js +21 -1
- package/dist/transports/http.js.map +1 -1
- package/dist/types.d.ts +8 -2
- package/dist/version.d.ts +1 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ An MCP (Model Context Protocol) server that exposes the **Spotlight Design Syste
|
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
9
|
-
When connected to Claude Code (or any MCP-compatible client), `spotlight-mcp` gives Claude access to
|
|
9
|
+
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.
|
|
10
10
|
|
|
11
11
|
| Tool | What Claude can ask |
|
|
12
12
|
|------|---------------------|
|
|
@@ -35,8 +35,29 @@ server. The index has two sources, both merged by the [indexer](#updating-the-in
|
|
|
35
35
|
|
|
36
36
|
## Getting it running
|
|
37
37
|
|
|
38
|
-
> **
|
|
39
|
-
>
|
|
38
|
+
> **Run it from source. The npm package is not usable yet.**
|
|
39
|
+
>
|
|
40
|
+
> `@castandcrew/spotlight-mcp` does exist on npm (`npm view @castandcrew/spotlight-mcp version`
|
|
41
|
+
> → `0.1.3`), but that publication is a **smoke test of the release pipeline, not a release**.
|
|
42
|
+
> The tool is still in preliminary testing and nothing else has been published.
|
|
43
|
+
>
|
|
44
|
+
> Concretely, the published tarball ships a `data/index.json` containing **0 components,
|
|
45
|
+
> 0 tokens and 0 utility classes** (only 103 patterns and 71 rules), so `search_components`,
|
|
46
|
+
> `search_tokens`, `get_component`, `get_token` and `search_utility_classes` return nothing.
|
|
47
|
+
> Verified 2026-09-08 by running `npx -y @castandcrew/spotlight-mcp` in an empty directory:
|
|
48
|
+
> the server starts and lists all 12 tools, but has no component or token data behind them.
|
|
49
|
+
>
|
|
50
|
+
> **A fresh clone of this repo is fine.** `data/index.json` is committed with real data
|
|
51
|
+
> (84 components, 329 tokens, 218 utility classes, 111 patterns, 71 rules; `generated:
|
|
52
|
+
> 2026-09-01`), so `pnpm install && pnpm build` is enough to get a working server. Regenerate
|
|
53
|
+
> it only when the upstream library changes — see [Updating the index](#updating-the-index).
|
|
54
|
+
>
|
|
55
|
+
> **If the index is ever empty, the server now says so.** It no longer answers `[]` as if the
|
|
56
|
+
> design system were empty: each tool returns an explicit error naming the index path, the
|
|
57
|
+
> counts it found and the command to fix it, and a status banner is written to stderr at
|
|
58
|
+
> startup. See [When the index is empty](#when-the-index-is-empty).
|
|
59
|
+
>
|
|
60
|
+
> **Prerequisites (source):** Node 18+ and `pnpm`.
|
|
40
61
|
|
|
41
62
|
```bash
|
|
42
63
|
git clone https://github.com/cast-and-crew/spotlight-mcp.git
|
|
@@ -53,7 +74,7 @@ Register the built server at **user scope** (available in every project):
|
|
|
53
74
|
claude mcp add spotlight --scope user -- node "$(pwd)/dist/index.js"
|
|
54
75
|
```
|
|
55
76
|
|
|
56
|
-
Start a new Claude Code session — the **
|
|
77
|
+
Start a new Claude Code session — the **12 tools** appear. They're all read-only lookups, so
|
|
57
78
|
auto-approve them to avoid per-call prompts: run `/permissions` and add `mcp__spotlight`, or
|
|
58
79
|
choose **"don't ask again"** on the first prompt.
|
|
59
80
|
|
|
@@ -68,20 +89,90 @@ other tools are precise follow-ups.
|
|
|
68
89
|
pnpm test # full suite (index integrity, tool calls, content merge)
|
|
69
90
|
```
|
|
70
91
|
|
|
92
|
+
### Connect it to Claude Desktop
|
|
93
|
+
|
|
94
|
+
Claude Desktop doesn't use the `claude mcp add` CLI — it reads local MCP servers from its own
|
|
95
|
+
config file. Point it at the built server:
|
|
96
|
+
|
|
97
|
+
**Via the UI:** Settings → Developer → Local MCP servers → **Edit config**.
|
|
98
|
+
|
|
99
|
+
**Or edit the file directly** (macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"spotlight": {
|
|
105
|
+
"command": "node",
|
|
106
|
+
"args": ["/absolute/path/to/spotlight-mcp/dist/index.js"]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Restart Claude Desktop. Settings → Developer → Local MCP servers should show `spotlight` as
|
|
113
|
+
**running**.
|
|
114
|
+
|
|
115
|
+
**Verify it's working:**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
ps aux | grep spotlight-mcp # confirms the process is alive
|
|
119
|
+
tail -f ~/Library/Logs/Claude/mcp-server-spotlight.log # confirms the handshake succeeded
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Look for `"Server started and connected successfully"` with no error after it.
|
|
123
|
+
|
|
124
|
+
> **Scope:** this config covers Claude Desktop's **Chat** and **Cowork**. The **Code Tab** is
|
|
125
|
+
> Claude Code and reads Claude Code's own config (`~/.claude.json`) — register the server there
|
|
126
|
+
> with `claude mcp add` (section above) or install the `spotlight-cowork` plugin, which bundles it.
|
|
127
|
+
> `mcp-server-spotlight.log` only records Chat's server process; Cowork calls show up as
|
|
128
|
+
> permission requests in `~/Library/Logs/Claude/main.log` and in the session transcript.
|
|
129
|
+
> (An earlier draft of this README claimed the Code Tab could not reach the server; that was a
|
|
130
|
+
> misconfigured path in `~/.claude.json`, not a limitation — verified in SPT-1526 v2, 2026-09-08.)
|
|
131
|
+
|
|
71
132
|
### Other clients
|
|
72
133
|
|
|
73
134
|
- **MCP Inspector** (GUI to poke at tools): `npx @modelcontextprotocol/inspector node dist/index.js`
|
|
74
135
|
- **HTTP** (Claude.ai, custom integrations): `pnpm start:http` (or `PORT=8080 pnpm start:http`)
|
|
75
136
|
- `POST /mcp` — Streamable HTTP (recommended) · `GET /sse` + `POST /messages` — SSE legacy · `GET /health`
|
|
76
137
|
|
|
77
|
-
###
|
|
138
|
+
### Via npm — ⚠️ not usable yet
|
|
139
|
+
|
|
140
|
+
**Do not point a client at the npm package expecting it to work.** `npx -y @castandcrew/spotlight-mcp`
|
|
141
|
+
resolves and starts (0.1.3 is on npm), but it serves an index with **0 components and 0 tokens** —
|
|
142
|
+
that publication was a pipeline smoke test while the tool is still in preliminary testing.
|
|
143
|
+
|
|
144
|
+
This matters beyond this repo: **six** plugins declare `npx -y @castandcrew/spotlight-mcp` in
|
|
145
|
+
their `.mcp.json` — `spotlight-cowork`, `spotlight-remediation`, `spotlight-advisor`,
|
|
146
|
+
`spotlight-patterns`, `repo-spec` and `spotlight-design` — and around a dozen guides in
|
|
147
|
+
`claude-plugins` tell users to run `claude mcp add … npx -y @castandcrew/spotlight-mcp`
|
|
148
|
+
(`spotlight-remediation/skills/project-setup` runs it automatically). Until a real release ships,
|
|
149
|
+
use the from-source setup above.
|
|
150
|
+
|
|
151
|
+
Note that 0.1.3 predates the guard described below, so it still answers `[]` silently rather than
|
|
152
|
+
erroring — the guard only protects setups running a build from this repo.
|
|
153
|
+
|
|
154
|
+
The commands below are kept for when the package is genuinely released.
|
|
155
|
+
|
|
156
|
+
**Claude Code:**
|
|
78
157
|
|
|
79
158
|
```bash
|
|
80
159
|
claude mcp add spotlight -- npx -y @castandcrew/spotlight-mcp
|
|
81
160
|
```
|
|
82
161
|
|
|
83
|
-
|
|
84
|
-
|
|
162
|
+
**Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"spotlight": {
|
|
168
|
+
"command": "npx",
|
|
169
|
+
"args": ["-y", "@castandcrew/spotlight-mcp"]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Same config works on any machine — no absolute path, no local checkout required.
|
|
85
176
|
|
|
86
177
|
---
|
|
87
178
|
|
|
@@ -162,20 +253,50 @@ repo-root `docs/`. It reads:
|
|
|
162
253
|
|
|
163
254
|
After running the indexer, commit the refreshed `data/index.json` and restart the MCP server.
|
|
164
255
|
|
|
165
|
-
|
|
256
|
+
**The indexer refuses to write an index that is missing derived data.** If `components`, `tokens`,
|
|
257
|
+
`utilityClasses`, `patterns` or `rules` would come out empty, it prints what it resolved and why
|
|
258
|
+
each collection is empty, and leaves the existing `data/index.json` untouched. Override with
|
|
259
|
+
`--allow-empty` if you really need the file written — but do not commit the result.
|
|
260
|
+
|
|
261
|
+
This matters because `patterns` and `rules` are mostly merged from this repo's own `content/`,
|
|
262
|
+
so they stay populated even when the source path is wrong. An index generated against a bad path
|
|
263
|
+
looks plausible (`patterns: 95, rules: 63`) while being useless. That is how the empty 0.1.3
|
|
264
|
+
index shipped.
|
|
265
|
+
|
|
266
|
+
### When the index is empty
|
|
267
|
+
|
|
268
|
+
The server never answers `[]` as if the design system had no such component. Two failure classes:
|
|
269
|
+
|
|
270
|
+
- **Unusable** — the index file is missing, unreadable, not JSON, or not shaped like an index.
|
|
271
|
+
`loadIndex()` throws, so every tool returns an error.
|
|
272
|
+
- **Degraded** — the index parses but some collections are empty. Only the tools that need the
|
|
273
|
+
missing data error; the rest keep working. With the 0.1.3 index, for example, `get_pattern`,
|
|
274
|
+
`get_recipe` and `identify_pattern` still answer correctly from the 103 patterns it did have.
|
|
275
|
+
|
|
276
|
+
Either way a status banner goes to **stderr** at startup (visible in
|
|
277
|
+
`~/Library/Logs/Claude/mcp-server-spotlight.log` for Claude Desktop), `GET /health` reports
|
|
278
|
+
per-collection counts in HTTP mode, and each failing tool returns a JSON error naming the resolved
|
|
279
|
+
index path, the counts found, the `generated` date and the command to fix it. The server does not
|
|
280
|
+
exit — a dead server tells the model nothing.
|
|
281
|
+
|
|
282
|
+
Tools guard only on what they read: `validate_usage`, for instance, requires both `rules` **and**
|
|
283
|
+
`components`, because its deprecated-component check reads `deprecated`, which the indexer derives
|
|
284
|
+
from `components`. With 0 components it would otherwise report `valid: true` for any snippet.
|
|
285
|
+
|
|
286
|
+
### Current index coverage (`generated: 2026-09-01`)
|
|
166
287
|
|
|
167
288
|
| Metric | Count |
|
|
168
289
|
|--------|-------|
|
|
169
|
-
| Components |
|
|
170
|
-
| Components with props |
|
|
171
|
-
| Components with `whenToUse` |
|
|
172
|
-
| Components with stories |
|
|
173
|
-
| Patterns |
|
|
290
|
+
| Components | 84 (11 categories) |
|
|
291
|
+
| Components with props | 52 (all parsed locally — no MUI re-exports in the current index) |
|
|
292
|
+
| Components with `usage.whenToUse` | 39 (`whenNotToUse` 42, `examples` 19) |
|
|
293
|
+
| Components with stories | 70 |
|
|
294
|
+
| Patterns | 111 (selection 41, recipe 26, guide 11, reference 9, migration 8, rules 5, layout 5, icon 4, overview 2) |
|
|
174
295
|
| Design tokens | 329 (light theme) |
|
|
175
296
|
| Utility classes | 218 |
|
|
176
|
-
| Rules |
|
|
177
|
-
| MUI migration entries |
|
|
178
|
-
| Deprecated entries |
|
|
297
|
+
| Rules | 71 |
|
|
298
|
+
| MUI migration entries | 24 |
|
|
299
|
+
| Deprecated entries | 0 (nothing is deprecated upstream today) |
|
|
179
300
|
|
|
180
301
|
Historical coverage gaps (pre-monorepo) are tracked in [`platform-ui-gaps.md`](./platform-ui-gaps.md).
|
|
181
302
|
|