@morya-ui/mcp 0.4.4 → 0.4.5

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Morya UI contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Morya UI contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,154 +1,154 @@
1
- # @morya-ui/mcp
2
-
3
- Optional [Model Context Protocol](https://modelcontextprotocol.io/) (stdio) server for [`morya-ui`](https://www.npmjs.com/package/morya-ui).
4
-
5
- It indexes component docs, guides, examples, and reusable page patterns so **any MCP-capable AI client** can look up the real API before writing code. It does **not** replace installing the UI library:
6
-
7
- ```bash
8
- pnpm add morya-ui
9
- ```
10
-
11
- Public docs: run the docs site (`pnpm dev`) and open **Docs → MCP**.
12
-
13
- ## Run
14
-
15
- ```bash
16
- npx -y @morya-ui/mcp
17
- ```
18
-
19
- Typical client config (field names vary by client):
20
-
21
- ```json
22
- {
23
- "command": "npx",
24
- "args": ["-y", "@morya-ui/mcp"]
25
- }
26
- ```
27
-
28
- Local checkout:
29
-
30
- ```bash
31
- pnpm --filter @morya-ui/mcp build
32
- node packages/ui-mcp/bin/morya-ui-mcp.js
33
- ```
34
-
35
- ## Tools
36
-
37
- MCP also exposes **resources** and **resource templates** for clients that support `resources/list`, `resources/templates/list`, and `resources/read`. Call `version` to see the current resource and template counts.
38
-
39
- Static resources:
40
-
41
- - `m://catalog/index.json`
42
- - `m://design-rules.json`
43
-
44
- Resource templates:
45
-
46
- - `component-docs` → `m://components/{component}/docs/{locale}`
47
- - `component-api` → `m://components/{component}/api.json`
48
- - `guide-docs` → `m://guides/{guide}/docs/{locale}`
49
-
50
- ### Core — component docs
51
-
52
- | Tool | Purpose |
53
- | ---------------- | -------------------------------------------- |
54
- | `list` | List components / guides / examples / categories / patterns |
55
- | `search` | Search docs, examples, patterns, and decisions |
56
- | `get_component` | Component metadata and API |
57
- | `get_example` | One source-backed example |
58
- | `get_guide` | Guide docs |
59
- | `get_setup` | Install / setup bundle |
60
- | `validate_usage` | Soft-check props / events |
61
- | `version` | Package + catalog status |
62
-
63
- ### Advanced — page composition (optional)
64
-
65
- | Tool | Purpose |
66
- | --------------------- | ------------------------------------------------------------- |
67
- | `list_patterns` | List reusable page composition patterns |
68
- | `get_pattern` | Read a pattern's structure, layout, and rules |
69
- | `recommend_page` | Recommend a pattern from page intent; optional `density`, `brief`, starter scaffold |
70
- | `map_reference` | Map a reference brief → snippets, token roles, signature shell |
71
- | `get_design_rules` | Design-token, shells catalog, and composition rules |
72
- | `recommend_component` | List, read, or recommend component selection guides |
73
- | `list_golden_pages` | List golden page samples (list / form / dashboard) |
74
- | `get_golden_page` | Read golden page Vue source |
75
- | `list_page_snippets` | List section snippets for local page edits |
76
- | `get_page_snippet` | Read a section snippet (`filters`, `toolbar`, `form-actions`…) |
77
- | `get_style_direction` | Resolve visual style from user words / cues (or ask) |
78
- | `get_style_shells` | List or read token-only signature shells with pasteable CSS |
79
- | `validate_page` | Contract (`ok`) + craft suggestions; pass `brief` for fidelity checks |
80
-
81
- `mode`: `zh` (default) or `en`.
82
-
83
- Component lookup accepts common aliases such as `DataTable`, `数据表格`, `Pager`, and `确认弹窗`.
84
-
85
- ### Recommended workflow
86
-
87
- **Look up a component:**
88
-
89
- 1. `search` or `get_component`
90
- 2. `get_example` for unfamiliar APIs
91
- 3. `validate_usage` on generated snippets
92
-
93
- **Plan a page:**
94
-
95
- 1. `recommend_page` with business intent, page type, features, optional `density` / `brief`
96
- 2. If the user gave a screenshot/mock description → `map_reference` (or reuse `recommend_page.referenceMapping`)
97
- 3. `get_page_snippet` for each mapped block; optional `get_style_shells` for Account / Express / Flow
98
- 4. `get_golden_page` only when unsure of whole-page block order
99
- 5. `get_design_rules` / `get_component` / `get_example` for APIs
100
- 6. `recommend_component` when choosing between similar components
101
- 7. `validate_usage` + `validate_page({ brief })` — contract must pass (`ok: true`)
102
-
103
- **Edit one section of an existing page:**
104
-
105
- 1. `list_page_snippets` with `query` or `pageType`
106
- 2. `get_page_snippet` for the matched section (`list-filters`, `form-actions`, …)
107
- 3. `get_component` / `get_example` for unfamiliar imports
108
- 4. `validate_usage` + `validate_page` on the merged result
109
-
110
- For a starter Vue file, pass `includeScaffold: true` to `recommend_page`:
111
-
112
- ```json
113
- {
114
- "intent": "Oil well management list",
115
- "pageType": "list",
116
- "features": ["filters", "create", "pagination"],
117
- "mode": "en",
118
- "includeScaffold": true
119
- }
120
- ```
121
-
122
- `recommend_component` modes:
123
-
124
- - omit `query` and `decision` → list decision guides
125
- - `decision` only → read one guide with **when / avoidWhen / recipe (props, slots, events) / antiPatterns** (e.g. `overlay-choice`, `selection-choice`, `feedback-choice`, `confirm-choice`)
126
- - `query` → recommend a guide for a UI question (same recipe payload)
127
-
128
- Offline mirror for the page skill: `design-kit/.../references/decision-recipes.md` (regenerate with `pnpm --filter @morya-ui/mcp generate:recipes`).
129
-
130
- ## Develop
131
-
132
- ```bash
133
- pnpm install
134
- pnpm mcp:generate
135
- pnpm mcp:build
136
- ```
137
-
138
- After editing `src/decisions.ts`, run `pnpm --filter @morya-ui/mcp generate:recipes` (also runs as part of `build`) so the skill offline recipes stay in sync.
139
-
140
- ```bash
141
- pnpm mcp:generate
142
- pnpm mcp:check-catalog
143
- pnpm mcp:validate-catalog
144
- pnpm mcp:audit-examples
145
- ```
146
-
147
- ## Release
148
-
149
- From the repo root (version syncs from `morya-ui`):
150
-
151
- ```bash
152
- pnpm release:mcp -- --dry-run
153
- pnpm release:mcp
154
- ```
1
+ # @morya-ui/mcp
2
+
3
+ Optional [Model Context Protocol](https://modelcontextprotocol.io/) (stdio) server for [`morya-ui`](https://www.npmjs.com/package/morya-ui).
4
+
5
+ It indexes component docs, guides, examples, and reusable page patterns so **any MCP-capable AI client** can look up the real API before writing code. It does **not** replace installing the UI library:
6
+
7
+ ```bash
8
+ pnpm add morya-ui
9
+ ```
10
+
11
+ Public docs: run the docs site (`pnpm dev`) and open **Docs → MCP**.
12
+
13
+ ## Run
14
+
15
+ ```bash
16
+ npx -y @morya-ui/mcp
17
+ ```
18
+
19
+ Typical client config (field names vary by client):
20
+
21
+ ```json
22
+ {
23
+ "command": "npx",
24
+ "args": ["-y", "@morya-ui/mcp"]
25
+ }
26
+ ```
27
+
28
+ Local checkout:
29
+
30
+ ```bash
31
+ pnpm --filter @morya-ui/mcp build
32
+ node packages/ui-mcp/bin/morya-ui-mcp.js
33
+ ```
34
+
35
+ ## Tools
36
+
37
+ MCP also exposes **resources** and **resource templates** for clients that support `resources/list`, `resources/templates/list`, and `resources/read`. Call `version` to see the current resource and template counts.
38
+
39
+ Static resources:
40
+
41
+ - `m://catalog/index.json`
42
+ - `m://design-rules.json`
43
+
44
+ Resource templates:
45
+
46
+ - `component-docs` → `m://components/{component}/docs/{locale}`
47
+ - `component-api` → `m://components/{component}/api.json`
48
+ - `guide-docs` → `m://guides/{guide}/docs/{locale}`
49
+
50
+ ### Core — component docs
51
+
52
+ | Tool | Purpose |
53
+ | ---------------- | -------------------------------------------- |
54
+ | `list` | List components / guides / examples / categories / patterns |
55
+ | `search` | Search docs, examples, patterns, and decisions |
56
+ | `get_component` | Component metadata and API |
57
+ | `get_example` | One source-backed example |
58
+ | `get_guide` | Guide docs |
59
+ | `get_setup` | Install / setup bundle |
60
+ | `validate_usage` | Soft-check props / events |
61
+ | `version` | Package + catalog status |
62
+
63
+ ### Advanced — page composition (optional)
64
+
65
+ | Tool | Purpose |
66
+ | --------------------- | ------------------------------------------------------------- |
67
+ | `list_patterns` | List reusable page composition patterns |
68
+ | `get_pattern` | Read a pattern's structure, layout, and rules |
69
+ | `recommend_page` | Recommend a pattern from page intent; optional `density`, `brief`, starter scaffold |
70
+ | `map_reference` | Map a reference brief → snippets, token roles, signature shell |
71
+ | `get_design_rules` | Design-token, shells catalog, and composition rules |
72
+ | `recommend_component` | List, read, or recommend component selection guides |
73
+ | `list_golden_pages` | List golden page samples (list / form / dashboard) |
74
+ | `get_golden_page` | Read golden page Vue source |
75
+ | `list_page_snippets` | List section snippets for local page edits |
76
+ | `get_page_snippet` | Read a section snippet (`filters`, `toolbar`, `form-actions`…) |
77
+ | `get_style_direction` | Resolve visual style from user words / cues (or ask) |
78
+ | `get_style_shells` | List or read token-only signature shells with pasteable CSS |
79
+ | `validate_page` | Contract (`ok`) + craft suggestions; pass `brief` for fidelity checks |
80
+
81
+ `mode`: `zh` (default) or `en`.
82
+
83
+ Component lookup accepts common aliases such as `DataTable`, `数据表格`, `Pager`, and `确认弹窗`.
84
+
85
+ ### Recommended workflow
86
+
87
+ **Look up a component:**
88
+
89
+ 1. `search` or `get_component`
90
+ 2. `get_example` for unfamiliar APIs
91
+ 3. `validate_usage` on generated snippets
92
+
93
+ **Plan a page:**
94
+
95
+ 1. `recommend_page` with business intent, page type, features, optional `density` / `brief`
96
+ 2. If the user gave a screenshot/mock description → `map_reference` (or reuse `recommend_page.referenceMapping`)
97
+ 3. `get_page_snippet` for each mapped block; optional `get_style_shells` for Account / Express / Flow
98
+ 4. `get_golden_page` only when unsure of whole-page block order
99
+ 5. `get_design_rules` / `get_component` / `get_example` for APIs
100
+ 6. `recommend_component` when choosing between similar components
101
+ 7. `validate_usage` + `validate_page({ brief })` — contract must pass (`ok: true`)
102
+
103
+ **Edit one section of an existing page:**
104
+
105
+ 1. `list_page_snippets` with `query` or `pageType`
106
+ 2. `get_page_snippet` for the matched section (`list-filters`, `form-actions`, …)
107
+ 3. `get_component` / `get_example` for unfamiliar imports
108
+ 4. `validate_usage` + `validate_page` on the merged result
109
+
110
+ For a starter Vue file, pass `includeScaffold: true` to `recommend_page`:
111
+
112
+ ```json
113
+ {
114
+ "intent": "Oil well management list",
115
+ "pageType": "list",
116
+ "features": ["filters", "create", "pagination"],
117
+ "mode": "en",
118
+ "includeScaffold": true
119
+ }
120
+ ```
121
+
122
+ `recommend_component` modes:
123
+
124
+ - omit `query` and `decision` → list decision guides
125
+ - `decision` only → read one guide with **when / avoidWhen / recipe (props, slots, events) / antiPatterns** (e.g. `overlay-choice`, `selection-choice`, `feedback-choice`, `confirm-choice`)
126
+ - `query` → recommend a guide for a UI question (same recipe payload)
127
+
128
+ Offline mirror for the page skill: `design-kit/.../references/decision-recipes.md` (regenerate with `pnpm --filter @morya-ui/mcp generate:recipes`).
129
+
130
+ ## Develop
131
+
132
+ ```bash
133
+ pnpm install
134
+ pnpm mcp:generate
135
+ pnpm mcp:build
136
+ ```
137
+
138
+ After editing `src/decisions.ts`, run `pnpm --filter @morya-ui/mcp generate:recipes` (also runs as part of `build`) so the skill offline recipes stay in sync.
139
+
140
+ ```bash
141
+ pnpm mcp:generate
142
+ pnpm mcp:check-catalog
143
+ pnpm mcp:validate-catalog
144
+ pnpm mcp:audit-examples
145
+ ```
146
+
147
+ ## Release
148
+
149
+ From the repo root (version syncs from `morya-ui`):
150
+
151
+ ```bash
152
+ pnpm release:mcp -- --dry-run
153
+ pnpm release:mcp
154
+ ```
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- import '../dist/index.js'
1
+ #!/usr/bin/env node
2
+ import '../dist/index.js'