@hyperfixi/mcp-server 2.0.0 → 2.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 +148 -223
- package/dist/esm-LUPOYJFX.js +6055 -0
- package/dist/index.js +4008 -62
- package/package.json +60 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @hyperfixi/mcp-server
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) server for hyperscript development
|
|
3
|
+
MCP (Model Context Protocol) server for hyperscript and multilingual DSL development. Provides **80 tools**, 5 resources, and 3 prompts across 11 categories: validation, compilation, analysis, patterns, LSP bridge, language profiles, code generation, route extraction, 8 domain DSLs, IR conversion, and MCP sampling.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -27,7 +27,7 @@ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_
|
|
|
27
27
|
"mcpServers": {
|
|
28
28
|
"lokascript": {
|
|
29
29
|
"command": "node",
|
|
30
|
-
"args": ["/path/to/
|
|
30
|
+
"args": ["/path/to/hyperfixi/packages/mcp-server/dist/index.js"]
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -45,234 +45,159 @@ Or if installed globally:
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
## Available Tools (
|
|
49
|
-
|
|
50
|
-
### Validation Tools
|
|
51
|
-
|
|
52
|
-
| Tool | Description
|
|
53
|
-
| ---------------------- |
|
|
54
|
-
| `validate_hyperscript` |
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
|
95
|
-
|
|
|
48
|
+
## Available Tools (80)
|
|
49
|
+
|
|
50
|
+
### Validation & Semantic Tools (8)
|
|
51
|
+
|
|
52
|
+
| Tool | Description |
|
|
53
|
+
| ---------------------- | ---------------------------------------------------------------- |
|
|
54
|
+
| `validate_hyperscript` | Check hyperscript for syntax errors and role warnings |
|
|
55
|
+
| `validate_schema` | Validate internal command schema definitions (not user code) |
|
|
56
|
+
| `suggest_command` | Suggest the best command for a task (multilingual) |
|
|
57
|
+
| `get_bundle_config` | Get recommended bundle configuration based on usage |
|
|
58
|
+
| `parse_multilingual` | Parse hyperscript in any of 24 languages with confidence scoring |
|
|
59
|
+
| `translate_to_english` | Normalize non-English hyperscript to English + explicit syntax |
|
|
60
|
+
| `explain_in_language` | Explain code with grammar rules, roles, and translations |
|
|
61
|
+
| `get_code_fixes` | Get auto-fixes for specific error codes |
|
|
62
|
+
|
|
63
|
+
### Compilation & Code Generation (6)
|
|
64
|
+
|
|
65
|
+
| Tool | Description |
|
|
66
|
+
| ---------------------- | --------------------------------------------------------------------------- |
|
|
67
|
+
| `compile_hyperscript` | Compile to optimized JavaScript (natural language, explicit, or JSON input) |
|
|
68
|
+
| `validate_and_compile` | Parse to semantic IR with diagnostics (no JS output) |
|
|
69
|
+
| `translate_code` | High-fidelity translation with SVO/SOV/VSO grammar transformation |
|
|
70
|
+
| `generate_tests` | Generate Playwright behavior tests from hyperscript |
|
|
71
|
+
| `generate_component` | Generate React, Vue, or Svelte component from hyperscript |
|
|
72
|
+
| `diff_behaviors` | Compare two inputs for semantic equivalence |
|
|
73
|
+
|
|
74
|
+
### Analysis (4)
|
|
75
|
+
|
|
76
|
+
| Tool | Description |
|
|
77
|
+
| -------------------- | ------------------------------------------------------------- |
|
|
78
|
+
| `analyze_complexity` | Calculate cyclomatic, cognitive, and Halstead metrics |
|
|
79
|
+
| `analyze_metrics` | Detect code smells, quality issues, and patterns |
|
|
80
|
+
| `explain_code` | Plain English explanation for beginner/intermediate/expert |
|
|
81
|
+
| `recognize_intent` | Classify code purpose (dom-manipulation, form-handling, etc.) |
|
|
82
|
+
|
|
83
|
+
### Pattern Lookup (4)
|
|
84
|
+
|
|
85
|
+
| Tool | Description |
|
|
86
|
+
| ----------------------- | -------------------------------------------------------------- |
|
|
87
|
+
| `get_examples` | Get working code examples matching a task description |
|
|
88
|
+
| `search_patterns` | Search pattern database by keyword or category |
|
|
89
|
+
| `translate_hyperscript` | Translate keywords between 24 languages (pattern substitution) |
|
|
90
|
+
| `get_pattern_stats` | Get statistics about patterns and languages |
|
|
91
|
+
|
|
92
|
+
### LSP Bridge (4)
|
|
93
|
+
|
|
94
|
+
| Tool | Description |
|
|
95
|
+
| ---------------------- | ------------------------------------------------------- |
|
|
96
|
+
| `get_diagnostics` | LSP-compatible diagnostics with line/column positions |
|
|
97
|
+
| `get_completions` | Context-aware code completions (multilingual) |
|
|
98
|
+
| `get_hover_info` | Hover documentation for hyperscript elements |
|
|
99
|
+
| `get_document_symbols` | Document outline (event handlers, behaviors, functions) |
|
|
100
|
+
|
|
101
|
+
### Language Documentation (4)
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
| -------------------------- | ------------------------------------------------------- |
|
|
105
|
+
| `get_command_docs` | Documentation for a specific hyperscript command |
|
|
106
|
+
| `get_expression_docs` | Documentation for expression types |
|
|
107
|
+
| `search_language_elements` | Search commands, expressions, keywords, features, roles |
|
|
108
|
+
| `suggest_best_practices` | Analyze code and suggest improvements |
|
|
109
|
+
|
|
110
|
+
### Language Profiles (5)
|
|
111
|
+
|
|
112
|
+
| Tool | Description |
|
|
113
|
+
| --------------------------- | ------------------------------------------------- |
|
|
114
|
+
| `list_supported_languages` | List all 24 languages with metadata |
|
|
115
|
+
| `get_language_profile` | Full profile (keywords, markers, config) |
|
|
116
|
+
| `get_keyword_translations` | Translations of a keyword across languages |
|
|
117
|
+
| `get_role_markers` | Role markers (destination, source, patient, etc.) |
|
|
118
|
+
| `compare_language_profiles` | Find translation gaps between languages |
|
|
119
|
+
|
|
120
|
+
### IR Conversion (2)
|
|
121
|
+
|
|
122
|
+
| Tool | Description |
|
|
123
|
+
| ------------------- | ---------------------------------------------------- |
|
|
124
|
+
| `convert_format` | Convert between explicit bracket syntax and LLM JSON |
|
|
125
|
+
| `validate_explicit` | Validate bracket syntax without compilation (fast) |
|
|
126
|
+
|
|
127
|
+
### Route Extraction (2)
|
|
128
|
+
|
|
129
|
+
| Tool | Description |
|
|
130
|
+
| ------------------------ | ---------------------------------------------------------- |
|
|
131
|
+
| `extract_routes` | Scan HTML for route declarations (hyperscript, htmx, fixi) |
|
|
132
|
+
| `generate_server_routes` | Generate Express/Hono/Django/FastAPI/OpenAPI scaffolding |
|
|
133
|
+
|
|
134
|
+
### Cross-Domain Dispatch (4)
|
|
135
|
+
|
|
136
|
+
| Tool | Description |
|
|
137
|
+
| ------------------- | ------------------------------------------ |
|
|
138
|
+
| `detect_domain` | Auto-detect which domain handles an input |
|
|
139
|
+
| `compile_auto` | Auto-detect domain and compile in one shot |
|
|
140
|
+
| `parse_composite` | Parse multi-line input across domains |
|
|
141
|
+
| `compile_composite` | Compile multi-line input across domains |
|
|
142
|
+
|
|
143
|
+
### MCP Sampling (5)
|
|
144
|
+
|
|
145
|
+
| Tool | Description |
|
|
146
|
+
| ------------------- | ------------------------------------------------------ |
|
|
147
|
+
| `ask_claude` | Ask Claude a question via MCP sampling |
|
|
148
|
+
| `summarize_content` | Summarize text content |
|
|
149
|
+
| `analyze_content` | Analyze sentiment, entities, themes, tone, or keywords |
|
|
150
|
+
| `translate_content` | Translate text between natural languages |
|
|
151
|
+
| `execute_llm` | Execute LLM command in natural language (8 languages) |
|
|
152
|
+
|
|
153
|
+
### Domain DSL Tools (32)
|
|
154
|
+
|
|
155
|
+
8 domains, each with `parse_`, `compile_`, `validate_`, `translate_` tools:
|
|
156
|
+
|
|
157
|
+
| Domain | Languages | compile Output |
|
|
158
|
+
| -------------- | ------------------------------ | --------------------------------- |
|
|
159
|
+
| `sql` | en, es, ja, ar, ko, zh, tr, fr | SQL query string |
|
|
160
|
+
| `bdd` | en, es, ja, ar | Playwright test (Given/When/Then) |
|
|
161
|
+
| `jsx` | en, es, ja, ar, ko, zh, tr, fr | JSX/React markup |
|
|
162
|
+
| `todo` | en, es, ja, ar, ko, zh, tr, fr | Structured operation object |
|
|
163
|
+
| `behaviorspec` | en, es, ja, ar, ko, zh, tr, fr | Playwright interaction test |
|
|
164
|
+
| `llm` | en, es, ja, ar, ko, zh, tr, fr | LLMPromptSpec JSON |
|
|
165
|
+
| `flow` | en, es, ja, ar, ko, zh, tr, fr | Reactive data flow JS |
|
|
166
|
+
| `voice` | en, es, ja, ar, ko, zh, tr, fr | DOM interaction command |
|
|
96
167
|
|
|
97
168
|
## Available Resources (5)
|
|
98
169
|
|
|
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` |
|
|
106
|
-
|
|
107
|
-
##
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
```
|
|
170
|
+
| URI | Description |
|
|
171
|
+
| -------------------------------- | ---------------------------- |
|
|
172
|
+
| `hyperscript://docs/commands` | Command reference (markdown) |
|
|
173
|
+
| `hyperscript://docs/expressions` | Expression syntax guide |
|
|
174
|
+
| `hyperscript://docs/events` | Event handling reference |
|
|
175
|
+
| `hyperscript://examples/common` | Common patterns |
|
|
176
|
+
| `hyperscript://languages` | Supported languages (JSON) |
|
|
177
|
+
|
|
178
|
+
## Supported Languages (24)
|
|
179
|
+
|
|
180
|
+
| Language | Code | Word Order | Example |
|
|
181
|
+
| -------------- | ---- | ---------- | --------------------- |
|
|
182
|
+
| English | `en` | SVO | `toggle .active` |
|
|
183
|
+
| Japanese | `ja` | SOV | `.active を 切り替え` |
|
|
184
|
+
| Korean | `ko` | SOV | `.active 를 토글` |
|
|
185
|
+
| Spanish | `es` | SVO | `alternar .active` |
|
|
186
|
+
| Arabic | `ar` | VSO | `تبديل .active` |
|
|
187
|
+
| Chinese | `zh` | SVO | `切换 .active` |
|
|
188
|
+
| Turkish | `tr` | SOV | `.active değiştir` |
|
|
189
|
+
| French | `fr` | SVO | `basculer .active` |
|
|
190
|
+
| German | `de` | SVO | `umschalten .active` |
|
|
191
|
+
| Portuguese | `pt` | SVO | `alternar .active` |
|
|
192
|
+
| And 14 more... | | | |
|
|
261
193
|
|
|
262
194
|
## Development
|
|
263
195
|
|
|
264
196
|
```bash
|
|
265
|
-
|
|
266
|
-
npm
|
|
267
|
-
|
|
268
|
-
#
|
|
269
|
-
npm test
|
|
270
|
-
|
|
271
|
-
# Type check
|
|
272
|
-
npm run typecheck
|
|
273
|
-
|
|
274
|
-
# Build
|
|
275
|
-
npm run build
|
|
197
|
+
npm run dev # Development mode
|
|
198
|
+
npm test # Run tests (375 tests)
|
|
199
|
+
npm run typecheck # TypeScript validation
|
|
200
|
+
npm run build # Build
|
|
276
201
|
```
|
|
277
202
|
|
|
278
203
|
## License
|