@morya-ui/mcp 0.1.1
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 +21 -0
- package/README.md +135 -0
- package/bin/morya-ui-mcp.js +2 -0
- package/data/catalog.json +22947 -0
- package/data/example-coverage.json +2986 -0
- package/dist/__tests__/resources.test.d.ts +1 -0
- package/dist/__tests__/resources.test.js +10 -0
- package/dist/__tests__/tools.test.d.ts +1 -0
- package/dist/__tests__/tools.test.js +109 -0
- package/dist/catalog.d.ts +97 -0
- package/dist/catalog.js +75 -0
- package/dist/decisions.d.ts +19 -0
- package/dist/decisions.js +155 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +106 -0
- package/dist/patterns.d.ts +80 -0
- package/dist/patterns.js +383 -0
- package/dist/resources.d.ts +5 -0
- package/dist/resources.js +205 -0
- package/dist/tools.d.ts +157 -0
- package/dist/tools.js +975 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +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.
|
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
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 starter scaffold |
|
|
70
|
+
| `get_design_rules` | Design-token and composition rules |
|
|
71
|
+
| `recommend_component` | List, read, or recommend component selection guides |
|
|
72
|
+
|
|
73
|
+
`mode`: `zh` (default) or `en`.
|
|
74
|
+
|
|
75
|
+
Component lookup accepts common aliases such as `DataTable`, `数据表格`, `Pager`, and `确认弹窗`.
|
|
76
|
+
|
|
77
|
+
### Recommended workflow
|
|
78
|
+
|
|
79
|
+
**Look up a component:**
|
|
80
|
+
|
|
81
|
+
1. `search` or `get_component`
|
|
82
|
+
2. `get_example` for unfamiliar APIs
|
|
83
|
+
3. `validate_usage` on generated snippets
|
|
84
|
+
|
|
85
|
+
**Plan a page:**
|
|
86
|
+
|
|
87
|
+
1. `recommend_page` with business intent, page type, and features
|
|
88
|
+
2. `get_pattern` for the returned `matchedPattern`
|
|
89
|
+
3. `get_component` / `get_example` for core components
|
|
90
|
+
4. `get_design_rules` before custom layout or CSS
|
|
91
|
+
5. `recommend_component` when choosing between similar components
|
|
92
|
+
|
|
93
|
+
For a starter Vue file, pass `includeScaffold: true` to `recommend_page`:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"intent": "Oil well management list",
|
|
98
|
+
"pageType": "list",
|
|
99
|
+
"features": ["filters", "create", "pagination"],
|
|
100
|
+
"mode": "en",
|
|
101
|
+
"includeScaffold": true
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`recommend_component` modes:
|
|
106
|
+
|
|
107
|
+
- omit `query` and `decision` → list decision guides
|
|
108
|
+
- `decision` only → read one guide (e.g. `overlay-choice`)
|
|
109
|
+
- `query` → recommend a component for a UI question
|
|
110
|
+
|
|
111
|
+
## Develop
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pnpm install
|
|
115
|
+
pnpm mcp:generate
|
|
116
|
+
pnpm mcp:build
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Catalog sources: `src/components/*/docs` and `playground/src/docs/guide/*.md`.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
pnpm mcp:generate
|
|
123
|
+
pnpm mcp:check-catalog
|
|
124
|
+
pnpm mcp:validate-catalog
|
|
125
|
+
pnpm mcp:audit-examples
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Release
|
|
129
|
+
|
|
130
|
+
From the repo root (version syncs from `morya-ui`):
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pnpm release:mcp -- --dry-run
|
|
134
|
+
pnpm release:mcp
|
|
135
|
+
```
|