@monoharada/wcf-mcp 0.1.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,162 @@
1
+ # @anthropic/wcf-mcp
2
+
3
+ web-components-factory デザインシステム用の MCP (Model Context Protocol) サーバー。
4
+
5
+ リポジトリをクローンせずに、AI エージェントからコンポーネントの検索・API取得・バリデーション・パターン生成が行えます。
6
+
7
+ ## クイックスタート
8
+
9
+ ### npx で起動(クローン不要)
10
+
11
+ ```bash
12
+ npx @anthropic/wcf-mcp
13
+ ```
14
+
15
+ ### Claude Desktop で使う
16
+
17
+ `claude_desktop_config.json` に追加:
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "wcf": {
23
+ "command": "npx",
24
+ "args": ["@anthropic/wcf-mcp"]
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ ### Claude Code で使う
31
+
32
+ ```bash
33
+ claude mcp add wcf -- npx @anthropic/wcf-mcp
34
+ ```
35
+
36
+ ## 提供ツール(8個)
37
+
38
+ ### コンポーネント検索・API
39
+
40
+ | ツール | 説明 |
41
+ |--------|------|
42
+ | `list_components` | デザインシステム内の全カスタム要素を一覧表示 |
43
+ | `get_component_api` | tagName or className で属性・スロット・イベント・CSS Parts・CSS Custom Properties を取得 |
44
+ | `generate_usage_snippet` | コンポーネントの最小限 HTML スニペットを生成 |
45
+ | `get_install_recipe` | componentId・依存関係・define関数・インストールコマンドを取得 |
46
+
47
+ ### バリデーション
48
+
49
+ | ツール | 説明 |
50
+ |--------|------|
51
+ | `validate_markup` | HTML スニペットを CEM に照合し、未知の要素(error)・属性(warning)を検出 |
52
+
53
+ ### UI パターン
54
+
55
+ | ツール | 説明 |
56
+ |--------|------|
57
+ | `list_patterns` | 利用可能な UI パターン(レシピ)を一覧表示 |
58
+ | `get_pattern_recipe` | パターンの完全レシピ(必要コンポーネント・依存解決・HTML)を取得 |
59
+ | `generate_pattern_snippet` | パターンの HTML スニペットを生成 |
60
+
61
+ ## prefix パラメータ
62
+
63
+ 全ツールで `prefix` パラメータをサポート。デフォルトは `dads`(例: `dads-button`)。
64
+
65
+ カスタム prefix を指定すると、出力のタグ名が自動変換されます:
66
+
67
+ ```
68
+ prefix: "myui" → dads-button → myui-button
69
+ ```
70
+
71
+ ## ツール使用例
72
+
73
+ ### コンポーネント API を取得
74
+
75
+ ```json
76
+ {
77
+ "name": "get_component_api",
78
+ "arguments": { "tagName": "dads-button" }
79
+ }
80
+ ```
81
+
82
+ レスポンス:
83
+ ```json
84
+ {
85
+ "tagName": "dads-button",
86
+ "className": "DadsButton",
87
+ "attributes": [
88
+ { "name": "variant", "type": "'solid' | 'outlined' | 'text'" },
89
+ { "name": "size", "type": "'x-small' | 'small' | 'medium' | 'large'" },
90
+ ...
91
+ ],
92
+ "slots": [...],
93
+ "cssParts": [...],
94
+ "cssProperties": [...],
95
+ "events": [...]
96
+ }
97
+ ```
98
+
99
+ ### HTML バリデーション
100
+
101
+ ```json
102
+ {
103
+ "name": "validate_markup",
104
+ "arguments": {
105
+ "html": "<dads-button variant=\"solid\" foo=\"bar\">Click</dads-button>"
106
+ }
107
+ }
108
+ ```
109
+
110
+ レスポンス:
111
+ ```json
112
+ {
113
+ "diagnostics": [
114
+ {
115
+ "severity": "warning",
116
+ "code": "unknownAttribute",
117
+ "message": "Unknown attribute on <dads-button>: foo",
118
+ "tagName": "dads-button",
119
+ "attrName": "foo"
120
+ }
121
+ ]
122
+ }
123
+ ```
124
+
125
+ ## 開発者向け
126
+
127
+ ### リポジトリからの起動
128
+
129
+ ```bash
130
+ # ルートの依存関係をインストール済みの場合
131
+ npm run mcp:design-system
132
+
133
+ # スタンドアロン版(packages/mcp-server/ 内で完結)
134
+ npm run mcp:standalone
135
+ ```
136
+
137
+ ### データの更新
138
+
139
+ CEM やレジストリを更新した後:
140
+
141
+ ```bash
142
+ npm run mcp:build # データファイルをパッケージにコピー
143
+ npm run mcp:check # データが最新かチェック(CI用)
144
+ ```
145
+
146
+ ### パッケージ構成
147
+
148
+ ```
149
+ packages/mcp-server/
150
+ ├── bin.mjs # エントリポイント (#!/usr/bin/env node)
151
+ ├── server.mjs # MCP サーバー本体
152
+ ├── validator.mjs # HTML バリデーター
153
+ ├── package.json # npm パッケージ定義
154
+ └── data/ # バンドルデータ (npm run mcp:build で生成)
155
+ ├── custom-elements.json
156
+ ├── install-registry.json
157
+ └── pattern-registry.json
158
+ ```
159
+
160
+ ## 要件
161
+
162
+ - Node.js >= 18
package/bin.mjs ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { startServer } from './server.mjs';
3
+
4
+ startServer().catch((err) => {
5
+ console.error(err);
6
+ process.exit(1);
7
+ });