@monoharada/wcf-mcp 0.1.1 → 0.2.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 +401 -15
- package/bin.mjs +19 -2
- package/core.mjs +1897 -157
- package/data/custom-elements.json +18 -0
- package/data/design-tokens.json +1708 -2
- package/data/guidelines-index.json +589 -3
- package/data/llms-full.txt +5291 -0
- package/examples/plugins/custom-validation-plugin.mjs +70 -0
- package/package.json +4 -2
- package/server.mjs +183 -5
- package/validator.mjs +633 -5
- package/wcf-mcp.config.example.json +24 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @monoharada/wcf-mcp
|
|
2
2
|
|
|
3
3
|
web-components-factory デザインシステム用の MCP (Model Context Protocol) サーバー。
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ web-components-factory デザインシステム用の MCP (Model Context Protoco
|
|
|
9
9
|
### npx で起動(クローン不要)
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx @
|
|
12
|
+
npx @monoharada/wcf-mcp
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
### Claude Desktop で使う
|
|
@@ -21,7 +21,7 @@ npx @anthropic/wcf-mcp
|
|
|
21
21
|
"mcpServers": {
|
|
22
22
|
"wcf": {
|
|
23
23
|
"command": "npx",
|
|
24
|
-
"args": ["@
|
|
24
|
+
"args": ["@monoharada/wcf-mcp"]
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -30,23 +30,69 @@ npx @anthropic/wcf-mcp
|
|
|
30
30
|
### Claude Code で使う
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
claude mcp add wcf -- npx @
|
|
33
|
+
claude mcp add wcf -- npx @monoharada/wcf-mcp
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
### Cursor で使う
|
|
37
|
+
|
|
38
|
+
`.cursor/mcp.json` に追加:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"mcpServers": {
|
|
43
|
+
"wcf": {
|
|
44
|
+
"command": "npx",
|
|
45
|
+
"args": ["@monoharada/wcf-mcp"]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### VS Code (GitHub Copilot) で使う
|
|
52
|
+
|
|
53
|
+
`.vscode/mcp.json` に追加:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"mcpServers": {
|
|
58
|
+
"wcf": {
|
|
59
|
+
"command": "npx",
|
|
60
|
+
"args": ["@monoharada/wcf-mcp"]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Windsurf で使う
|
|
67
|
+
|
|
68
|
+
`.windsurf/mcp_config.json` に追加:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"wcf": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["@monoharada/wcf-mcp"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 提供機能(14 tools + 1 prompt + 4 resources)
|
|
37
82
|
|
|
38
83
|
### ガードレール
|
|
39
84
|
|
|
40
85
|
| ツール | 説明 |
|
|
41
86
|
|--------|------|
|
|
42
|
-
| `get_design_system_overview` |
|
|
87
|
+
| `get_design_system_overview` | 最初に呼ぶ前提情報(カテゴリ別コンポーネント数、利用可能パターン、推奨ワークフロー、IDE設定テンプレート)を返す |
|
|
43
88
|
|
|
44
89
|
### コンポーネント検索・API
|
|
45
90
|
|
|
46
91
|
| ツール | 説明 |
|
|
47
92
|
|--------|------|
|
|
48
|
-
| `list_components` |
|
|
49
|
-
| `
|
|
93
|
+
| `list_components` | カテゴリ/クエリ/limit/offset でコンポーネントを段階的に取得(デフォルト20件。全件取得は `limit: 200`) |
|
|
94
|
+
| `search_icons` | アイコン名をキーワード検索し、usage example を返す |
|
|
95
|
+
| `get_component_api` | tagName or className で属性・スロット・イベント・CSS Parts・CSS Custom Properties を取得(`relatedComponents` を含む) |
|
|
50
96
|
| `generate_usage_snippet` | コンポーネントの最小限 HTML スニペットを生成 |
|
|
51
97
|
| `get_install_recipe` | componentId・依存関係・define関数・インストールコマンドを取得 |
|
|
52
98
|
|
|
@@ -54,7 +100,7 @@ claude mcp add wcf -- npx @anthropic/wcf-mcp
|
|
|
54
100
|
|
|
55
101
|
| ツール | 説明 |
|
|
56
102
|
|--------|------|
|
|
57
|
-
| `validate_markup` | HTML
|
|
103
|
+
| `validate_markup` | HTML スニペットを検証し、未知要素・不正enum値・不正スロット名・必須属性欠落(error)、未知属性・トークン誤用・`aria-live`/`role="alert"` 誤用・親子関係違反・空インタラクティブ要素(warning)を検出し、`suggestion` を返す |
|
|
58
104
|
|
|
59
105
|
### UI パターン
|
|
60
106
|
|
|
@@ -68,23 +114,240 @@ claude mcp add wcf -- npx @anthropic/wcf-mcp
|
|
|
68
114
|
|
|
69
115
|
| ツール | 説明 |
|
|
70
116
|
|--------|------|
|
|
71
|
-
| `get_design_tokens` | デザイントークンを type/category/query
|
|
117
|
+
| `get_design_tokens` | デザイントークンを type/category/query/theme で検索(`theme=light` のみ。`dark/all` はエラー) |
|
|
118
|
+
| `get_design_token_detail` | 単一トークンの詳細(references/referencedBy/relatedTokens/usageExamples)を取得 |
|
|
119
|
+
| `get_accessibility_docs` | component/topic/wcagLevel で A11y チェックリストとガイドライン要点を検索(`topic=all` では両ソースを混在返却) |
|
|
72
120
|
| `search_guidelines` | ガイドライン(topic/query)をスコア付きで検索 |
|
|
73
121
|
|
|
122
|
+
#### `get_design_tokens` の使用例
|
|
123
|
+
|
|
124
|
+
**リクエスト:**
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"name": "get_design_tokens",
|
|
128
|
+
"arguments": {
|
|
129
|
+
"type": "color",
|
|
130
|
+
"category": "semantic",
|
|
131
|
+
"theme": "light"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**レスポンス(抜粋):**
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"summary": {
|
|
140
|
+
"totalCount": 42,
|
|
141
|
+
"types": { "color": 42 }
|
|
142
|
+
},
|
|
143
|
+
"tokens": [
|
|
144
|
+
{
|
|
145
|
+
"name": "--color-primary",
|
|
146
|
+
"type": "color",
|
|
147
|
+
"category": "semantic",
|
|
148
|
+
"value": "#0017C1",
|
|
149
|
+
"cssVariable": "var(--color-primary)"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"themes": {
|
|
153
|
+
"requested": "light",
|
|
154
|
+
"resolved": "light",
|
|
155
|
+
"available": ["light"]
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### `get_design_token_detail` の使用例
|
|
161
|
+
|
|
162
|
+
**リクエスト:**
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"name": "get_design_token_detail",
|
|
166
|
+
"arguments": {
|
|
167
|
+
"name": "--color-primary",
|
|
168
|
+
"theme": "light"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**レスポンス(抜粋):**
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"token": {
|
|
177
|
+
"name": "--color-primary",
|
|
178
|
+
"type": "color",
|
|
179
|
+
"category": "semantic",
|
|
180
|
+
"value": "#0017C1",
|
|
181
|
+
"cssVariable": "var(--color-primary)",
|
|
182
|
+
"group": "color"
|
|
183
|
+
},
|
|
184
|
+
"references": [
|
|
185
|
+
{ "name": "--primitive-blue-700", "type": "color", "category": "primitive" }
|
|
186
|
+
],
|
|
187
|
+
"referencedBy": [
|
|
188
|
+
{ "name": "--button-primary-bg", "type": "color", "category": "semantic" }
|
|
189
|
+
],
|
|
190
|
+
"relatedTokens": ["--button-primary-bg"],
|
|
191
|
+
"usageExamples": [
|
|
192
|
+
".example { color: var(--color-primary); }",
|
|
193
|
+
".example { background-color: var(--color-primary); }"
|
|
194
|
+
],
|
|
195
|
+
"theme": {
|
|
196
|
+
"requested": "light",
|
|
197
|
+
"resolved": "light",
|
|
198
|
+
"available": ["light"]
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
> **注意**: `theme` は `"light"` のみサポート。`"dark"` や `"all"` を指定すると `INVALID_THEME` エラーが返ります。
|
|
204
|
+
|
|
205
|
+
### Prompt
|
|
206
|
+
|
|
207
|
+
| 名前 | 説明 |
|
|
208
|
+
|------|------|
|
|
209
|
+
| `figma_to_wcf` | Figma URL を入力に、`overview → tokens → component api → snippet → validate` の実行順を返す |
|
|
210
|
+
|
|
211
|
+
### Resources (`wcf://`)
|
|
212
|
+
|
|
213
|
+
| URI | 説明 |
|
|
214
|
+
|-----|------|
|
|
215
|
+
| `wcf://components` | コンポーネントカタログのスナップショット |
|
|
216
|
+
| `wcf://tokens` | トークン summary(type/category/themes/sample) |
|
|
217
|
+
| `wcf://guidelines/{topic}` | topic 別ガイドライン要約(`accessibility`,`css`,`patterns`,`all`) |
|
|
218
|
+
| `wcf://llms-full` | `llms-full.txt` の全文 |
|
|
219
|
+
|
|
220
|
+
### Figma MCP との併用
|
|
221
|
+
|
|
222
|
+
Figma Dev Mode MCP Server (`@anthropic/figma-dev-mode-mcp-server`) と wcf-mcp を並行で利用すると、Figma デザインから WCF コンポーネントへの変換ワークフローが実現できます。
|
|
223
|
+
|
|
224
|
+
**推奨ワークフロー:**
|
|
225
|
+
|
|
226
|
+
1. **Figma MCP** → `get_design_context` でデザインの構造・カラー・スペーシングを取得
|
|
227
|
+
2. **wcf-mcp** → `get_design_system_overview` で利用可能なコンポーネントを確認
|
|
228
|
+
3. **wcf-mcp** → `get_design_tokens` で Figma カラー値に対応するトークンを検索
|
|
229
|
+
4. **wcf-mcp** → `get_component_api` でコンポーネント仕様を取得
|
|
230
|
+
5. **wcf-mcp** → `generate_usage_snippet` でコード生成
|
|
231
|
+
6. **wcf-mcp** → `validate_markup` で生成コードを検証
|
|
232
|
+
|
|
233
|
+
**Claude Desktop 設定例:**
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"mcpServers": {
|
|
238
|
+
"wcf": {
|
|
239
|
+
"command": "npx",
|
|
240
|
+
"args": ["@monoharada/wcf-mcp"]
|
|
241
|
+
},
|
|
242
|
+
"figma": {
|
|
243
|
+
"command": "npx",
|
|
244
|
+
"args": ["@anthropic/figma-dev-mode-mcp-server"]
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
> `figma_to_wcf` プロンプトは wcf-mcp に組み込まれており、Figma URL を入力として上記ワークフローの実行順序をガイドします。
|
|
251
|
+
|
|
74
252
|
## transport
|
|
75
253
|
|
|
76
254
|
標準は stdio です。HTTP transport も利用できます(localhost のみ)。
|
|
77
255
|
|
|
78
256
|
```bash
|
|
79
|
-
npx @
|
|
257
|
+
npx @monoharada/wcf-mcp --transport=http --port=3100
|
|
80
258
|
```
|
|
81
259
|
|
|
82
260
|
- bind: `127.0.0.1`
|
|
83
261
|
- endpoint: `http://127.0.0.1:3100/mcp`
|
|
84
262
|
|
|
263
|
+
## 設定ファイル
|
|
264
|
+
|
|
265
|
+
`wcf-mcp.config.json` を使うと、データソース差し替えとカスタムツール追加ができます。
|
|
266
|
+
|
|
267
|
+
- デフォルト探索パス: カレントディレクトリの `wcf-mcp.config.json`
|
|
268
|
+
- 明示指定: `npx @monoharada/wcf-mcp --config=./wcf-mcp.config.json`
|
|
269
|
+
- 互換性: 設定ファイルが無ければ従来どおり標準データで起動
|
|
270
|
+
|
|
271
|
+
`dataSources` の相対パス基準:
|
|
272
|
+
|
|
273
|
+
- ルート `dataSources`: config ファイルのディレクトリ基準
|
|
274
|
+
- `plugins[].staticTools` を持つ static plugin の `dataSources`: config ファイルのディレクトリ基準
|
|
275
|
+
- `plugins[].module` が export する plugin の `dataSources`: plugin module ファイルのディレクトリ基準
|
|
276
|
+
|
|
277
|
+
### config 例
|
|
278
|
+
|
|
279
|
+
```json
|
|
280
|
+
{
|
|
281
|
+
"dataSources": {
|
|
282
|
+
"guidelines-index.json": "./guidelines-index.local.json"
|
|
283
|
+
},
|
|
284
|
+
"plugins": [
|
|
285
|
+
{
|
|
286
|
+
"module": "./plugins/custom-validation-plugin.mjs"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"name": "static-tools-plugin",
|
|
290
|
+
"version": "0.1.0",
|
|
291
|
+
"staticTools": [
|
|
292
|
+
{
|
|
293
|
+
"name": "plugin_healthcheck",
|
|
294
|
+
"payload": { "ok": true }
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
※ `./plugins/custom-validation-plugin.mjs` は利用側プロジェクトに配置してください。
|
|
303
|
+
このリポジトリには参照用として `packages/mcp-server/examples/plugins/custom-validation-plugin.mjs` を同梱しています。
|
|
304
|
+
|
|
305
|
+
### plugin 契約(v1)
|
|
306
|
+
|
|
307
|
+
詳細仕様: [docs/plugin-contract-v1.md](../../docs/plugin-contract-v1.md)
|
|
308
|
+
|
|
309
|
+
- `plugins[].name` / `plugins[].version` は必須
|
|
310
|
+
- tool 名は組み込みツール名と重複不可(例: `list_components` など)
|
|
311
|
+
- `dataSources` で差し替え可能な key は次のみ
|
|
312
|
+
- `custom-elements.json`
|
|
313
|
+
- `install-registry.json`
|
|
314
|
+
- `pattern-registry.json`
|
|
315
|
+
- `design-tokens.json`
|
|
316
|
+
- `guidelines-index.json`
|
|
317
|
+
|
|
318
|
+
## structuredContent rollback
|
|
319
|
+
|
|
320
|
+
`get_component_api` / `get_design_tokens` / `get_design_token_detail` / `get_accessibility_docs` / `search_guidelines` は通常 `structuredContent` を返します。
|
|
321
|
+
|
|
322
|
+
- 100KB 制限を超える場合は自動的に `structuredContent` を省略し、`content` のみ返します
|
|
323
|
+
- 緊急切り戻し時は環境変数 `WCF_MCP_DISABLE_STRUCTURED_CONTENT=1` を設定してください
|
|
324
|
+
|
|
325
|
+
例:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
WCF_MCP_DISABLE_STRUCTURED_CONTENT=1 npx @monoharada/wcf-mcp
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Claude Desktop 設定例:
|
|
332
|
+
|
|
333
|
+
```json
|
|
334
|
+
{
|
|
335
|
+
"mcpServers": {
|
|
336
|
+
"wcf": {
|
|
337
|
+
"command": "npx",
|
|
338
|
+
"args": ["@monoharada/wcf-mcp"],
|
|
339
|
+
"env": {
|
|
340
|
+
"WCF_MCP_DISABLE_STRUCTURED_CONTENT": "1"
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
85
347
|
## prefix パラメータ
|
|
86
348
|
|
|
87
349
|
全ツールで `prefix` パラメータをサポート。デフォルトは `dads`(例: `dads-button`)。
|
|
350
|
+
`prefix` は最大64文字まで使用され、超過分は切り詰められます(例: 200文字指定 -> 先頭64文字を採用)。
|
|
88
351
|
|
|
89
352
|
カスタム prefix を指定すると、出力のタグ名が自動変換されます:
|
|
90
353
|
|
|
@@ -92,8 +355,48 @@ npx @anthropic/wcf-mcp --transport=http --port=3100
|
|
|
92
355
|
prefix: "myui" → dads-button → myui-button
|
|
93
356
|
```
|
|
94
357
|
|
|
358
|
+
## v0.2.0 マイグレーション
|
|
359
|
+
|
|
360
|
+
### `list_components` のデフォルトページネーション変更
|
|
361
|
+
|
|
362
|
+
v0.2.0 から `list_components` のデフォルト返却件数が **全件 → 20件** に変更されました。
|
|
363
|
+
|
|
364
|
+
- `limit` を省略すると 20件が返り、`_notice` フィールドで変更を通知します
|
|
365
|
+
- 全件取得が必要な場合: `limit: 200` を指定してください
|
|
366
|
+
- `hasMore: true` の場合、`offset` で次のページを取得できます
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
// 全件取得
|
|
370
|
+
{ "name": "list_components", "arguments": { "limit": 200 } }
|
|
371
|
+
// ページネーション
|
|
372
|
+
{ "name": "list_components", "arguments": { "limit": 20, "offset": 20 } }
|
|
373
|
+
```
|
|
374
|
+
|
|
95
375
|
## ツール使用例
|
|
96
376
|
|
|
377
|
+
### コンポーネント一覧を取得
|
|
378
|
+
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"name": "list_components",
|
|
382
|
+
"arguments": { "category": "Form", "limit": 20 }
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
レスポンス(抜粋):
|
|
387
|
+
```json
|
|
388
|
+
{
|
|
389
|
+
"items": [
|
|
390
|
+
{ "tagName": "dads-input-text", "className": "DadsInputText", "category": "Form" },
|
|
391
|
+
{ "tagName": "dads-textarea", "className": "DadsTextarea", "category": "Form" }
|
|
392
|
+
],
|
|
393
|
+
"total": 8,
|
|
394
|
+
"limit": 20,
|
|
395
|
+
"offset": 0,
|
|
396
|
+
"hasMore": false
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
97
400
|
### コンポーネント API を取得
|
|
98
401
|
|
|
99
402
|
```json
|
|
@@ -103,15 +406,14 @@ prefix: "myui" → dads-button → myui-button
|
|
|
103
406
|
}
|
|
104
407
|
```
|
|
105
408
|
|
|
106
|
-
|
|
409
|
+
レスポンス(抜粋):
|
|
107
410
|
```json
|
|
108
411
|
{
|
|
109
412
|
"tagName": "dads-button",
|
|
110
413
|
"className": "DadsButton",
|
|
111
414
|
"attributes": [
|
|
112
415
|
{ "name": "variant", "type": "'solid' | 'outlined' | 'text'" },
|
|
113
|
-
{ "name": "size", "type": "'x-small' | 'small' | 'medium' | 'large'" }
|
|
114
|
-
...
|
|
416
|
+
{ "name": "size", "type": "'x-small' | 'small' | 'medium' | 'large'" }
|
|
115
417
|
],
|
|
116
418
|
"slots": [...],
|
|
117
419
|
"cssParts": [...],
|
|
@@ -120,6 +422,43 @@ prefix: "myui" → dads-button → myui-button
|
|
|
120
422
|
}
|
|
121
423
|
```
|
|
122
424
|
|
|
425
|
+
### 使い方スニペットを生成
|
|
426
|
+
|
|
427
|
+
```json
|
|
428
|
+
{
|
|
429
|
+
"name": "generate_usage_snippet",
|
|
430
|
+
"arguments": { "component": "dads-button" }
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
レスポンス(テキスト形式 — HTML スニペットをそのまま返します):
|
|
435
|
+
```html
|
|
436
|
+
<dads-button variant="solid">Label</dads-button>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### インストール手順を取得
|
|
440
|
+
|
|
441
|
+
```json
|
|
442
|
+
{
|
|
443
|
+
"name": "get_install_recipe",
|
|
444
|
+
"arguments": { "component": "dads-combobox" }
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
レスポンス(抜粋):
|
|
449
|
+
```json
|
|
450
|
+
{
|
|
451
|
+
"componentId": "combobox",
|
|
452
|
+
"tagNames": ["dads-combobox"],
|
|
453
|
+
"deps": ["avatar", "chip-tag", "icon"],
|
|
454
|
+
"transitiveDeps": ["avatar", "chip-tag", "icon"],
|
|
455
|
+
"define": "defineCombobox",
|
|
456
|
+
"installHint": "wcf add combobox"
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
> `transitiveDeps` は BFS で解決された全推移的依存(自身を除く)の配列です。
|
|
461
|
+
|
|
123
462
|
### HTML バリデーション
|
|
124
463
|
|
|
125
464
|
```json
|
|
@@ -139,13 +478,60 @@ prefix: "myui" → dads-button → myui-button
|
|
|
139
478
|
"severity": "warning",
|
|
140
479
|
"code": "unknownAttribute",
|
|
141
480
|
"message": "Unknown attribute on <dads-button>: foo",
|
|
142
|
-
"tagName": "dads-button",
|
|
143
481
|
"attrName": "foo"
|
|
144
482
|
}
|
|
145
483
|
]
|
|
146
484
|
}
|
|
147
485
|
```
|
|
148
486
|
|
|
487
|
+
### ガイドライン検索
|
|
488
|
+
|
|
489
|
+
```json
|
|
490
|
+
{
|
|
491
|
+
"name": "search_guidelines",
|
|
492
|
+
"arguments": { "query": "keyboard", "topic": "accessibility" }
|
|
493
|
+
}
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
レスポンス(抜粋):
|
|
497
|
+
```json
|
|
498
|
+
{
|
|
499
|
+
"query": "keyboard",
|
|
500
|
+
"topic": "accessibility",
|
|
501
|
+
"totalHits": 3,
|
|
502
|
+
"results": [
|
|
503
|
+
{
|
|
504
|
+
"score": 5,
|
|
505
|
+
"title": "Keyboard Navigation",
|
|
506
|
+
"topic": "accessibility",
|
|
507
|
+
"heading": "Keyboard Navigation",
|
|
508
|
+
"snippet": "All interactive elements must be operable via keyboard..."
|
|
509
|
+
}
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
## スニペット vs レシピ
|
|
515
|
+
|
|
516
|
+
| 用途 | ツール | 返すもの |
|
|
517
|
+
|------|--------|----------|
|
|
518
|
+
| 最小限 HTML を素早く確認 | `generate_usage_snippet` | 単一コンポーネントの HTML 断片 |
|
|
519
|
+
| 画面パターン全体を構築 | `get_pattern_recipe` | 必要コンポーネント群 + 依存解決 + 完全 HTML |
|
|
520
|
+
|
|
521
|
+
**使い分け**: 1 コンポーネントだけ使う場合は `generate_usage_snippet`。複数コンポーネントを組み合わせた UI パターン(フォーム、カード一覧など)には `get_pattern_recipe` を使用。
|
|
522
|
+
|
|
523
|
+
## noscript ガイダンス
|
|
524
|
+
|
|
525
|
+
WCF コンポーネントは JavaScript が必須です。`<noscript>` タグを使い、JavaScript 無効環境に対してフォールバックを提供してください。
|
|
526
|
+
|
|
527
|
+
```html
|
|
528
|
+
<noscript>
|
|
529
|
+
<p>このページは JavaScript を有効にする必要があります。</p>
|
|
530
|
+
</noscript>
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
`get_design_system_overview` の `setupInfo.noscriptGuidance` にも同様の案内が含まれています。
|
|
534
|
+
|
|
149
535
|
## 開発者向け
|
|
150
536
|
|
|
151
537
|
### リポジトリからの起動
|
package/bin.mjs
CHANGED
|
@@ -16,12 +16,14 @@ const USAGE = [
|
|
|
16
16
|
' wcf-mcp',
|
|
17
17
|
' wcf-mcp --transport=stdio',
|
|
18
18
|
' wcf-mcp --transport=http [--port=3100]',
|
|
19
|
+
' wcf-mcp --config=./wcf-mcp.config.json',
|
|
19
20
|
' wcf-mcp --help',
|
|
20
21
|
].join('\n');
|
|
21
22
|
|
|
22
23
|
function parseArgs(argv) {
|
|
23
24
|
let transport = 'stdio';
|
|
24
25
|
let port = 3100;
|
|
26
|
+
let configPath;
|
|
25
27
|
|
|
26
28
|
for (let index = 0; index < argv.length; index += 1) {
|
|
27
29
|
const arg = argv[index];
|
|
@@ -54,11 +56,26 @@ function parseArgs(argv) {
|
|
|
54
56
|
continue;
|
|
55
57
|
}
|
|
56
58
|
|
|
59
|
+
if (arg === '--config') {
|
|
60
|
+
const value = argv[index + 1];
|
|
61
|
+
if (!value || value.startsWith('--')) {
|
|
62
|
+
throw new Error('--config requires a file path');
|
|
63
|
+
}
|
|
64
|
+
configPath = value;
|
|
65
|
+
index += 1;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
|
|
57
69
|
if (arg.startsWith('--port=')) {
|
|
58
70
|
port = Number(arg.slice('--port='.length));
|
|
59
71
|
continue;
|
|
60
72
|
}
|
|
61
73
|
|
|
74
|
+
if (arg.startsWith('--config=')) {
|
|
75
|
+
configPath = arg.slice('--config='.length);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
62
79
|
throw new Error(`Unknown argument: ${arg}`);
|
|
63
80
|
}
|
|
64
81
|
|
|
@@ -70,7 +87,7 @@ function parseArgs(argv) {
|
|
|
70
87
|
throw new Error(`Invalid port: ${String(port)} (expected: integer 1-65535)`);
|
|
71
88
|
}
|
|
72
89
|
|
|
73
|
-
return { help: false, transport, port };
|
|
90
|
+
return { help: false, transport, port, configPath };
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
async function main() {
|
|
@@ -89,7 +106,7 @@ async function main() {
|
|
|
89
106
|
return;
|
|
90
107
|
}
|
|
91
108
|
|
|
92
|
-
const { server } = await createServer();
|
|
109
|
+
const { server } = await createServer({ configPath: parsed.configPath });
|
|
93
110
|
|
|
94
111
|
if (parsed.transport === 'http') {
|
|
95
112
|
const { StreamableHTTPServerTransport } = await import(
|