@hyperfixi/mcp-server 2.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 +280 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6095 -0
- package/package.json +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# @hyperfixi/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for hyperscript development assistance. Provides 22 tools and 5 resources for code analysis, pattern lookup, validation, semantic parsing, language documentation, and LSP-compatible features with full multilingual support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### From Source
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd packages/mcp-server
|
|
11
|
+
npm install
|
|
12
|
+
npm run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Using npx
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx @hyperfixi/mcp-server
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Claude Desktop Configuration
|
|
22
|
+
|
|
23
|
+
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"lokascript": {
|
|
29
|
+
"command": "node",
|
|
30
|
+
"args": ["/path/to/lokascript/packages/mcp-server/dist/index.js"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or if installed globally:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"lokascript": {
|
|
42
|
+
"command": "hyperfixi-mcp"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Available Tools (22)
|
|
49
|
+
|
|
50
|
+
### Validation Tools
|
|
51
|
+
|
|
52
|
+
| Tool | Description |
|
|
53
|
+
| ---------------------- | -------------------------------------------------------------------- |
|
|
54
|
+
| `validate_hyperscript` | Validate syntax with semantic analysis, detect errors and warnings |
|
|
55
|
+
| `suggest_command` | Suggest the best command for a task |
|
|
56
|
+
| `get_bundle_config` | Get recommended Vite plugin configuration |
|
|
57
|
+
| `parse_multilingual` | Parse hyperscript in any supported language with confidence scoring |
|
|
58
|
+
| `translate_to_english` | Translate hyperscript from any language to English |
|
|
59
|
+
| `explain_in_language` | Comprehensive code explanation with grammar, roles, and translations |
|
|
60
|
+
|
|
61
|
+
### Pattern Tools
|
|
62
|
+
|
|
63
|
+
| Tool | Description |
|
|
64
|
+
| ----------------------- | -------------------------------- |
|
|
65
|
+
| `get_examples` | Get few-shot examples for a task |
|
|
66
|
+
| `search_patterns` | Search pattern database |
|
|
67
|
+
| `translate_hyperscript` | Translate between 13 languages |
|
|
68
|
+
| `get_pattern_stats` | Get database statistics |
|
|
69
|
+
|
|
70
|
+
### Analysis Tools
|
|
71
|
+
|
|
72
|
+
| Tool | Description |
|
|
73
|
+
| -------------------- | ------------------------------------------------- |
|
|
74
|
+
| `analyze_complexity` | Calculate cyclomatic, cognitive, Halstead metrics |
|
|
75
|
+
| `analyze_metrics` | Comprehensive code analysis |
|
|
76
|
+
| `explain_code` | Natural language code explanation |
|
|
77
|
+
| `recognize_intent` | Classify code purpose |
|
|
78
|
+
|
|
79
|
+
### LSP Bridge Tools
|
|
80
|
+
|
|
81
|
+
| Tool | Description |
|
|
82
|
+
| ---------------------- | ---------------------------------------- |
|
|
83
|
+
| `get_diagnostics` | LSP-compatible error/warning diagnostics |
|
|
84
|
+
| `get_completions` | Context-aware code completions |
|
|
85
|
+
| `get_hover_info` | Hover documentation |
|
|
86
|
+
| `get_document_symbols` | Document outline symbols |
|
|
87
|
+
|
|
88
|
+
### Language Documentation Tools
|
|
89
|
+
|
|
90
|
+
| Tool | Description |
|
|
91
|
+
| -------------------------- | --------------------------------------------------------------------- |
|
|
92
|
+
| `get_command_docs` | Get documentation for a specific hyperscript command |
|
|
93
|
+
| `get_expression_docs` | Get documentation for expression types |
|
|
94
|
+
| `search_language_elements` | Search across all language elements (commands, expressions, keywords) |
|
|
95
|
+
| `suggest_best_practices` | Analyze code and suggest improvements |
|
|
96
|
+
|
|
97
|
+
## Available Resources (5)
|
|
98
|
+
|
|
99
|
+
| URI | Description |
|
|
100
|
+
| -------------------------------- | ----------------------------- |
|
|
101
|
+
| `hyperscript://docs/commands` | Command reference (markdown) |
|
|
102
|
+
| `hyperscript://docs/expressions` | Expression syntax guide |
|
|
103
|
+
| `hyperscript://docs/events` | Event handling reference |
|
|
104
|
+
| `hyperscript://examples/common` | Common patterns |
|
|
105
|
+
| `hyperscript://languages` | 13 supported languages (JSON) |
|
|
106
|
+
|
|
107
|
+
## Example Usage
|
|
108
|
+
|
|
109
|
+
### Validate Code
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
User: Validate this hyperscript: on click put 'hello into #output
|
|
113
|
+
|
|
114
|
+
Claude: [uses validate_hyperscript]
|
|
115
|
+
The code has an error: Unbalanced single quotes
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Suggest Commands
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
User: What hyperscript command should I use to show a modal?
|
|
122
|
+
|
|
123
|
+
Claude: [uses suggest_command]
|
|
124
|
+
Use the `show` command: show #modal with *opacity
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Get Examples
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
User: Show me examples of toggle patterns
|
|
131
|
+
|
|
132
|
+
Claude: [uses get_examples]
|
|
133
|
+
Here are examples:
|
|
134
|
+
- on click toggle .active
|
|
135
|
+
- on click toggle .open on #menu
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Translate
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
User: Translate "on click toggle .active" to Japanese
|
|
142
|
+
|
|
143
|
+
Claude: [uses translate_hyperscript]
|
|
144
|
+
Japanese: クリック で .active を トグル
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Parse Multilingual Code (Phase 5)
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
User: Parse this Korean hyperscript: .active 를 토글
|
|
151
|
+
|
|
152
|
+
Claude: [uses parse_multilingual with language: 'ko']
|
|
153
|
+
{
|
|
154
|
+
"success": true,
|
|
155
|
+
"confidence": 0.95,
|
|
156
|
+
"command": {
|
|
157
|
+
"name": "toggle",
|
|
158
|
+
"roles": { "patient": ".active" }
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Translate to English (Phase 5)
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
User: What does this Japanese code mean? #button の .active を 切り替え
|
|
167
|
+
|
|
168
|
+
Claude: [uses translate_to_english with sourceLanguage: 'ja']
|
|
169
|
+
English: toggle .active on #button
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Explain Code in Detail (Phase 6)
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
User: Explain this Korean code in detail: .active 를 토글
|
|
176
|
+
|
|
177
|
+
Claude: [uses explain_in_language with sourceLanguage: 'ko']
|
|
178
|
+
{
|
|
179
|
+
"command": {
|
|
180
|
+
"name": "toggle",
|
|
181
|
+
"description": "Toggle a class or attribute on/off",
|
|
182
|
+
"category": "dom-class"
|
|
183
|
+
},
|
|
184
|
+
"roles": {
|
|
185
|
+
"patient": {
|
|
186
|
+
"value": ".active",
|
|
187
|
+
"description": "The class or attribute to toggle",
|
|
188
|
+
"required": true
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"grammar": {
|
|
192
|
+
"wordOrder": "SOV",
|
|
193
|
+
"direction": "ltr"
|
|
194
|
+
},
|
|
195
|
+
"keywords": {
|
|
196
|
+
"toggle": { "primary": "토글", "alternatives": ["전환"] }
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Supported Languages
|
|
202
|
+
|
|
203
|
+
The MCP server supports hyperscript in 21+ languages:
|
|
204
|
+
|
|
205
|
+
| Language | Code | Example |
|
|
206
|
+
| ----------- | ---- | --------------------- |
|
|
207
|
+
| English | `en` | `toggle .active` |
|
|
208
|
+
| Japanese | `ja` | `.active を 切り替え` |
|
|
209
|
+
| Korean | `ko` | `.active 를 토글` |
|
|
210
|
+
| Spanish | `es` | `alternar .active` |
|
|
211
|
+
| Arabic | `ar` | `تبديل .active` |
|
|
212
|
+
| Chinese | `zh` | `切换 .active` |
|
|
213
|
+
| Portuguese | `pt` | `alternar .active` |
|
|
214
|
+
| French | `fr` | `basculer .active` |
|
|
215
|
+
| German | `de` | `umschalten .active` |
|
|
216
|
+
| Turkish | `tr` | `.active değiştir` |
|
|
217
|
+
| And more... | | |
|
|
218
|
+
|
|
219
|
+
## Tool Dependencies & Fallback Behavior
|
|
220
|
+
|
|
221
|
+
Each tool has different package requirements. All tools work without optional packages by using built-in fallbacks:
|
|
222
|
+
|
|
223
|
+
| Tool | Required Package | Fallback Behavior |
|
|
224
|
+
| -------------------------- | --------------------------------- | ----------------------------------- |
|
|
225
|
+
| `validate_hyperscript` | - | Full functionality (built-in) |
|
|
226
|
+
| `suggest_command` | - | Full functionality (built-in) |
|
|
227
|
+
| `get_bundle_config` | - | Full functionality (built-in) |
|
|
228
|
+
| `parse_multilingual` | `@lokascript/semantic` | Returns error (no fallback) |
|
|
229
|
+
| `translate_to_english` | `@lokascript/semantic` | Returns error (no fallback) |
|
|
230
|
+
| `explain_in_language` | `@lokascript/semantic` | Returns error (no fallback) |
|
|
231
|
+
| `analyze_complexity` | `@lokascript/ast-toolkit` | Simple regex-based metrics |
|
|
232
|
+
| `analyze_metrics` | `@lokascript/ast-toolkit` | Simple regex-based metrics |
|
|
233
|
+
| `explain_code` | `@lokascript/ast-toolkit` | Pattern-based explanation |
|
|
234
|
+
| `recognize_intent` | `@lokascript/ast-toolkit` | Pattern-based intent detection |
|
|
235
|
+
| `get_examples` | `@hyperfixi/patterns-reference` | Built-in example patterns |
|
|
236
|
+
| `search_patterns` | `@hyperfixi/patterns-reference` | Built-in pattern search |
|
|
237
|
+
| `translate_hyperscript` | `@lokascript/semantic` | Returns error (no fallback) |
|
|
238
|
+
| `get_pattern_stats` | `@hyperfixi/patterns-reference` | Basic statistics |
|
|
239
|
+
| `get_diagnostics` | `@lokascript/semantic` (optional) | Regex-based diagnostics |
|
|
240
|
+
| `get_completions` | `@lokascript/semantic` (optional) | English-only completions |
|
|
241
|
+
| `get_hover_info` | - | Built-in documentation |
|
|
242
|
+
| `get_document_symbols` | - | Regex-based extraction |
|
|
243
|
+
| `get_command_docs` | `@hyperfixi/patterns-reference` | Built-in command docs |
|
|
244
|
+
| `get_expression_docs` | `@hyperfixi/patterns-reference` | Returns error (needs migration) |
|
|
245
|
+
| `search_language_elements` | `@hyperfixi/patterns-reference` | Built-in search |
|
|
246
|
+
| `suggest_best_practices` | - | Full functionality (built-in rules) |
|
|
247
|
+
|
|
248
|
+
### Installation Options
|
|
249
|
+
|
|
250
|
+
**Minimal (validation only):**
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
npm install @hyperfixi/mcp-server
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Recommended (full features):**
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
npm install @hyperfixi/mcp-server @lokascript/semantic @lokascript/ast-toolkit @hyperfixi/patterns-reference
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Development
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Run in development mode
|
|
266
|
+
npm run dev
|
|
267
|
+
|
|
268
|
+
# Run tests
|
|
269
|
+
npm test
|
|
270
|
+
|
|
271
|
+
# Type check
|
|
272
|
+
npm run typecheck
|
|
273
|
+
|
|
274
|
+
# Build
|
|
275
|
+
npm run build
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|