@uni-design-system/uni-mcp 4.2.0 → 4.4.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 +97 -44
- package/dist/{chunk-VQE52XFX.js → chunk-252ZWTTU.js} +835 -229
- package/dist/chunk-252ZWTTU.js.map +1 -0
- package/dist/http.js +1 -1
- package/dist/server.js +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-VQE52XFX.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,18 +6,68 @@ authoritative, version-pinned interface to the **Uni Design System** — the rig
|
|
|
6
6
|
component, the right props, the right tokens, and the sanctioned patterns instead
|
|
7
7
|
of hallucinated APIs.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
from the monorepo's own sources at build time, then read at runtime:
|
|
9
|
+
## Getting started
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
| `@uni-design-system/uni-core` themes/tokens | `token-adapter` | tokens (style + behavioral) & theme templates |
|
|
16
|
-
| `packages/angular/storybook-static/index.json` + story sources | `storybook-adapter` | copy-pasteable examples |
|
|
11
|
+
You need a project that already uses Uni (e.g. `@uni-design-system/uni-angular`)
|
|
12
|
+
and an MCP-capable assistant. The server runs locally over stdio via `npx` — no
|
|
13
|
+
install, no build step, no API key.
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
### Claude Code
|
|
16
|
+
|
|
17
|
+
From your project root:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
claude mcp add --scope project uni -- npx -y @uni-design-system/uni-mcp@latest
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`--scope project` writes the config to a `.mcp.json` you can commit, so the
|
|
24
|
+
whole team gets the server. Equivalent `.mcp.json`:
|
|
25
|
+
|
|
26
|
+
```jsonc
|
|
27
|
+
{
|
|
28
|
+
"mcpServers": {
|
|
29
|
+
"uni": {
|
|
30
|
+
"command": "npx",
|
|
31
|
+
"args": ["-y", "@uni-design-system/uni-mcp@latest"]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Cursor / Claude Desktop / Continue
|
|
38
|
+
|
|
39
|
+
All share the same config shape as the `.mcp.json` above — put it in
|
|
40
|
+
`.cursor/mcp.json` (Cursor), `claude_desktop_config.json` (Claude Desktop), or
|
|
41
|
+
your client's MCP settings.
|
|
42
|
+
|
|
43
|
+
### Pin it to your installed Uni version
|
|
44
|
+
|
|
45
|
+
All Uni packages release under one coordinated version number. The server
|
|
46
|
+
answers from an index stamped with the release it was built from, so for
|
|
47
|
+
answers that exactly match the APIs you have installed, replace `@latest` with
|
|
48
|
+
the version of `@uni-design-system/uni-angular` in your `package.json`:
|
|
49
|
+
|
|
50
|
+
```jsonc
|
|
51
|
+
"args": ["-y", "@uni-design-system/uni-mcp@4.3.0"]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`@latest` is fine when you track current Uni releases.
|
|
55
|
+
|
|
56
|
+
### Verify and try it
|
|
57
|
+
|
|
58
|
+
In Claude Code, `/mcp` should list **uni** as connected. Then ask things like:
|
|
59
|
+
|
|
60
|
+
- *"What Uni components are available for collecting user input?"*
|
|
61
|
+
- *"Show me the props and a working example for `uni-button`."*
|
|
62
|
+
- *"Which Uni theme tokens should style a card's background and border?"*
|
|
63
|
+
- *"When should I use a drawer vs a dialog? Any accessibility requirements?"*
|
|
64
|
+
- *"Generate a Uni theme from our brand color `#0052FF` and wire it up."*
|
|
65
|
+
|
|
66
|
+
That last one uses the `generate-uni-theme` tool: it returns a complete
|
|
67
|
+
WCAG-AA light + dark `uni-theme.ts` file (plus the `UNI_THEMES` provider
|
|
68
|
+
snippet and a contrast report). The generated file is plain, editable data and
|
|
69
|
+
becomes your app's styling source of truth — restyle later by editing its
|
|
70
|
+
tokens, never by hardcoding hex values in components.
|
|
21
71
|
|
|
22
72
|
## Tools
|
|
23
73
|
|
|
@@ -31,48 +81,33 @@ so the same tool call returns the right usage per framework with no schema chang
|
|
|
31
81
|
| `get-guidelines` | when-to-use, do/don't, accessibility |
|
|
32
82
|
| `list-themes` | theme templates |
|
|
33
83
|
| `get-theme-template` | **style overrides** (→ Emotion CSS) and **component options** (→ props), kept distinct |
|
|
84
|
+
| `generate-uni-theme` | complete WCAG-AA light+dark `uni-theme.ts` from brand hex color(s), with vibe/scheme/shape options, provider registration snippet, and contrast report |
|
|
34
85
|
| `search` | keyword search across components, tokens, themes, guidelines |
|
|
35
86
|
|
|
36
87
|
Resources: `uni://meta`, `uni://components/{id}`, `uni://tokens/{id}`,
|
|
37
88
|
`uni://themes/{id}`, `uni://guidelines/{id}`.
|
|
38
89
|
|
|
39
|
-
##
|
|
90
|
+
## Remote endpoint (Streamable HTTP, hosted on Render)
|
|
40
91
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
pnpm --filter @uni-design-system/uni-mcp dev # stdio server, hot reload
|
|
44
|
-
pnpm --filter @uni-design-system/uni-mcp inspect # open the MCP Inspector
|
|
45
|
-
pnpm --filter @uni-design-system/uni-mcp serve:http # local HTTP server
|
|
46
|
-
```
|
|
92
|
+
The same server core runs behind HTTP for a shared, always-current team
|
|
93
|
+
endpoint — useful when you'd rather not run node processes per client.
|
|
47
94
|
|
|
48
|
-
`
|
|
49
|
-
`
|
|
50
|
-
without it the index still builds, just with no examples.
|
|
51
|
-
|
|
52
|
-
## Use it — local (stdio)
|
|
95
|
+
- `GET /health` → status + index counts (used by Render's health check)
|
|
96
|
+
- `POST /mcp` → JSON-RPC (Streamable HTTP, stateless)
|
|
53
97
|
|
|
54
|
-
|
|
98
|
+
Client config:
|
|
55
99
|
|
|
56
100
|
```jsonc
|
|
57
101
|
{
|
|
58
102
|
"mcpServers": {
|
|
59
103
|
"uni": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
104
|
+
"url": "https://uni-mcp.onrender.com/mcp",
|
|
105
|
+
"headers": { "Authorization": "Bearer <UNI_MCP_TOKEN>" }
|
|
62
106
|
}
|
|
63
107
|
}
|
|
64
108
|
}
|
|
65
109
|
```
|
|
66
110
|
|
|
67
|
-
Or run the built bin directly: `node packages/mcp/dist/stdio.js`.
|
|
68
|
-
|
|
69
|
-
## Use it — remote (Streamable HTTP, hosted on Render)
|
|
70
|
-
|
|
71
|
-
The same server core runs behind HTTP for a shared, always-current team endpoint.
|
|
72
|
-
|
|
73
|
-
- `GET /health` → status + index counts (used by Render's health check)
|
|
74
|
-
- `POST /mcp` → JSON-RPC (Streamable HTTP, stateless)
|
|
75
|
-
|
|
76
111
|
Environment:
|
|
77
112
|
|
|
78
113
|
| Var | Purpose | Default |
|
|
@@ -82,19 +117,37 @@ Environment:
|
|
|
82
117
|
| `UNI_MCP_TOKEN` | if set, require `Authorization: Bearer <token>` | _(none)_ |
|
|
83
118
|
| `UNI_ALLOWED_HOSTS` | comma list enabling DNS-rebinding protection | _(none)_ |
|
|
84
119
|
|
|
85
|
-
Deploy with the repo-root [`render.yaml`](../../render.yaml) blueprint.
|
|
120
|
+
Deploy with the repo-root [`render.yaml`](../../render.yaml) blueprint.
|
|
86
121
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
122
|
+
## How it's built
|
|
123
|
+
|
|
124
|
+
The server answers from a **built index** (`src/data/uni-index.json`) that is
|
|
125
|
+
normalized from the monorepo's own sources at build time, then read at runtime:
|
|
126
|
+
|
|
127
|
+
| Source | Adapter | Feeds |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `packages/angular` component sources (signals API) | `angular-adapter` | per-framework component API |
|
|
130
|
+
| `@uni-design-system/uni-core` themes/tokens | `token-adapter` | tokens (style + behavioral) & theme templates |
|
|
131
|
+
| component `.mdx` docs pages (`## Overview` / `## Do` / `## Don't` / `## Accessibility`) | `mdx-adapter` | authored guidelines |
|
|
132
|
+
| `packages/angular/storybook-static/index.json` + story sources | `storybook-adapter` | copy-pasteable examples |
|
|
133
|
+
|
|
134
|
+
The model is **framework-aware by construction**: each component carries a
|
|
135
|
+
`bindings` map (`angular` today; `react` fills in as `uni-react` reaches parity)
|
|
136
|
+
so the same tool call returns the right usage per framework with no schema change.
|
|
137
|
+
|
|
138
|
+
## Develop
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pnpm --filter @uni-design-system/uni-mcp build-index # regenerate the index from sources
|
|
142
|
+
pnpm --filter @uni-design-system/uni-mcp dev # stdio server, hot reload
|
|
143
|
+
pnpm --filter @uni-design-system/uni-mcp inspect # open the MCP Inspector
|
|
144
|
+
pnpm --filter @uni-design-system/uni-mcp serve:http # local HTTP server
|
|
96
145
|
```
|
|
97
146
|
|
|
147
|
+
`build` runs `build-index` then bundles with `tsup`. Examples require
|
|
148
|
+
`packages/angular/storybook-static/index.json` to exist (`pnpm build-storybook`);
|
|
149
|
+
without it the index still builds, just with no examples.
|
|
150
|
+
|
|
98
151
|
## How answers stay current
|
|
99
152
|
|
|
100
153
|
The index is stamped with the Uni release it was built from (from
|