@shoplflow/mcp 0.1.0
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 +92 -0
- package/dist/index.js +10183 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @shoplflow/mcp
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server that exposes the shoplflow design system to AI coding agents
|
|
4
|
+
(Claude Code, Cursor, …) so they generate UI against **real** tokens, components, and icons instead
|
|
5
|
+
of hallucinating them.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
Metadata is **generated at build time** from the same sources that produce the shipped library, then
|
|
10
|
+
served by a thin stdio server. This makes drift structurally impossible — the MCP can never describe a
|
|
11
|
+
token or component that differs from what actually ships.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
tokens.json ─┐
|
|
15
|
+
*-assets barrel ─┤ scripts/generate-metadata.cjs ─► src/data/*.generated.json ─► MCP server (stdio)
|
|
16
|
+
*.types.ts ─┘ (build step) (bundled into the bin)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Roadmap
|
|
20
|
+
|
|
21
|
+
| Phase | Surface | Source | Status |
|
|
22
|
+
|-------|---------|--------|--------|
|
|
23
|
+
| 1 | Design tokens (`list_tokens`, `get_token`, `shoplflow://tokens`) | `tokens.json` | ✅ done |
|
|
24
|
+
| 2 | Icon search (`search_icon`) | `*-assets` barrels | ✅ done |
|
|
25
|
+
| 3 | Component API (`search_component`, `get_component_api`) | `*.types.ts` | ✅ done |
|
|
26
|
+
| 4 | Usage examples (`get_usage_example`) | `*.stories.tsx` | ✅ done |
|
|
27
|
+
| 5 | Setup & environment (`get_setup_guide`, `check_environment`, server `instructions`) | provider + `setup.curated.json` | ✅ done |
|
|
28
|
+
|
|
29
|
+
## Develop
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm --filter @shoplflow/mcp generate:metadata # regenerate metadata from sources
|
|
33
|
+
pnpm --filter @shoplflow/mcp build:package # generate + bundle to dist/
|
|
34
|
+
pnpm --filter @shoplflow/mcp start # run the built server over stdio
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Connect (consuming app)
|
|
38
|
+
|
|
39
|
+
Add to the client's MCP config (Claude Code shown):
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"mcpServers": {
|
|
44
|
+
"shoplflow": {
|
|
45
|
+
"command": "npx",
|
|
46
|
+
"args": ["-y", "@shoplflow/mcp"]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Tools
|
|
53
|
+
|
|
54
|
+
**Tokens (Phase 1)**
|
|
55
|
+
- **`list_tokens`** — discover token names/values; filter by `domain` (`shared` | `shopl` | `hada`), `type`, or a `query` substring.
|
|
56
|
+
- **`get_token`** — full record for one token by exact `name` (+ optional `domain`).
|
|
57
|
+
- Resource **`shoplflow://tokens`** — the entire catalog as JSON.
|
|
58
|
+
|
|
59
|
+
Typography tokens (e.g. `body1_700`) are applied via the `typography` prop / CSS class, not a CSS variable —
|
|
60
|
+
the served records carry `className` for those and `cssVar` for the rest.
|
|
61
|
+
|
|
62
|
+
**Icons (Phase 2)**
|
|
63
|
+
- **`search_icon`** — find icons by name or meaning; filter by `domain` (`shopl` | `hada`) and `limit`.
|
|
64
|
+
Returns the raw name (`IcAdd`) and public alias (`AddIcon`), both importable from the brand asset
|
|
65
|
+
package and usable as `<Icon iconSource={AddIcon} />`. Icon sets differ per brand.
|
|
66
|
+
|
|
67
|
+
**Components (Phase 3)**
|
|
68
|
+
- **`search_component`** — discover `@shoplflow/base` components by name, module, prop, or variant value;
|
|
69
|
+
filter by `group` (module) and `limit`. Compound components are listed per part (e.g. `ModalContainer`, `ModalHeader`).
|
|
70
|
+
- **`get_component_api`** — full API for one component by exact name: props (with JSDoc + optionality),
|
|
71
|
+
exact variant values (`sizeVar`/`styleVar`/…), polymorphism (`as` + default element), and native-HTML-attr passthrough.
|
|
72
|
+
- Resource **`shoplflow://components`** — compact index of every component.
|
|
73
|
+
|
|
74
|
+
Component metadata is extracted from `*.types.ts` via ts-morph (build-time only), mirroring how the library
|
|
75
|
+
composes props from the documented mixins in `utils/type/ComponentProps.ts`.
|
|
76
|
+
|
|
77
|
+
**Usage examples (Phase 4)**
|
|
78
|
+
- **`get_usage_example`** — real, copy-pasteable examples for a component, extracted from its stories
|
|
79
|
+
(`args` + `render` JSX, with `play`/test code stripped). Accepts a module name (`Button`, `Modal`) or a
|
|
80
|
+
component name from `get_component_api` (`ModalContainer` resolves to the `Modal` stories).
|
|
81
|
+
|
|
82
|
+
**Setup & environment (Phase 5)**
|
|
83
|
+
- Server **`instructions`** — an always-on preflight (surfaced at connect) so the agent never skips the
|
|
84
|
+
mandatory `ShoplflowProvider` + global-CSS setup, or the client-only / Next.js constraint.
|
|
85
|
+
- **`get_setup_guide`** — required style import, the Provider wrapper + `domain` prop, peer deps, and a
|
|
86
|
+
ready-to-paste snippet (synthesized from the real provider/exports, so it can't reference a wrong import).
|
|
87
|
+
- **`check_environment`** — per-framework support (Vite/CRA supported; Next.js Pages constrained; Next.js
|
|
88
|
+
App Router needs a `'use client'` boundary + Emotion registry), with workarounds.
|
|
89
|
+
|
|
90
|
+
Auto facts (provider props, CSS exports, peer deps) come from `@shoplflow/base`; the curated guidance
|
|
91
|
+
(setup steps, framework constraints, the `instructions` text) lives in **`setup.curated.json`** — the one
|
|
92
|
+
file the team edits. Keep the `Next.js` entries in sync with the library's actual support stance.
|