@uni-design-system/uni-mcp 4.0.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 ADDED
@@ -0,0 +1,103 @@
1
+ # @uni-design-system/uni-mcp
2
+
3
+ A [Model Context Protocol](https://modelcontextprotocol.io) server that gives AI
4
+ coding assistants (Claude Code, Claude Desktop, Cursor, Continue, …) an
5
+ authoritative, version-pinned interface to the **Uni Design System** — the right
6
+ component, the right props, the right tokens, and the sanctioned patterns instead
7
+ of hallucinated APIs.
8
+
9
+ It answers from a **built index** (`src/data/uni-index.json`) that is normalized
10
+ from the monorepo's own sources at build time, then read at runtime:
11
+
12
+ | Source | Adapter | Feeds |
13
+ |---|---|---|
14
+ | `packages/angular` component sources (signals API) | `angular-adapter` | per-framework component API |
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 |
17
+
18
+ The model is **framework-aware by construction**: each component carries a
19
+ `bindings` map (`angular` today; `react` fills in as `uni-react` reaches parity)
20
+ so the same tool call returns the right usage per framework with no schema change.
21
+
22
+ ## Tools
23
+
24
+ | Tool | Returns |
25
+ |---|---|
26
+ | `list-components` | inventory (id, name, summary, category, frameworks) |
27
+ | `get-component` | full API card for one component (framework-scoped) |
28
+ | `get-component-examples` | working snippets + Storybook links |
29
+ | `list-tokens` | tokens filtered by type / kind / theme |
30
+ | `get-token` | resolved value, style/behavioral kind, per-theme values |
31
+ | `get-guidelines` | when-to-use, do/don't, accessibility |
32
+ | `list-themes` | theme templates |
33
+ | `get-theme-template` | **style overrides** (→ Emotion CSS) and **component options** (→ props), kept distinct |
34
+ | `search` | keyword search across components, tokens, themes, guidelines |
35
+
36
+ Resources: `uni://meta`, `uni://components/{id}`, `uni://tokens/{id}`,
37
+ `uni://themes/{id}`, `uni://guidelines/{id}`.
38
+
39
+ ## Develop
40
+
41
+ ```bash
42
+ pnpm --filter @uni-design-system/uni-mcp build-index # regenerate the index from sources
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
+ ```
47
+
48
+ `build` runs `build-index` then bundles with `tsup`. Examples require
49
+ `packages/angular/storybook-static/index.json` to exist (`pnpm build-storybook`);
50
+ without it the index still builds, just with no examples.
51
+
52
+ ## Use it — local (stdio)
53
+
54
+ Claude Code / Claude Desktop / Cursor / Continue all share the same config shape:
55
+
56
+ ```jsonc
57
+ {
58
+ "mcpServers": {
59
+ "uni": {
60
+ "command": "npx",
61
+ "args": ["-y", "@uni-design-system/uni-mcp@latest"]
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
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
+ Environment:
77
+
78
+ | Var | Purpose | Default |
79
+ |---|---|---|
80
+ | `PORT` | bind port (Render sets this) | `8080` |
81
+ | `HOST` | bind address | `0.0.0.0` |
82
+ | `UNI_MCP_TOKEN` | if set, require `Authorization: Bearer <token>` | _(none)_ |
83
+ | `UNI_ALLOWED_HOSTS` | comma list enabling DNS-rebinding protection | _(none)_ |
84
+
85
+ Deploy with the repo-root [`render.yaml`](../../render.yaml) blueprint. Client config:
86
+
87
+ ```jsonc
88
+ {
89
+ "mcpServers": {
90
+ "uni": {
91
+ "url": "https://uni-mcp.onrender.com/mcp",
92
+ "headers": { "Authorization": "Bearer <UNI_MCP_TOKEN>" }
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ ## How answers stay current
99
+
100
+ The index is stamped with the Uni release it was built from (from
101
+ `packages/angular`'s version), so an assistant's answers match the version the
102
+ developer installed. Regenerate and commit `src/data/uni-index.json` on each
103
+ release — ideally wired into the Changesets release action (Phase 3).