@golemui/gui-mcp 0.14.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 +104 -0
- package/index.d.ts +1 -0
- package/index.js +2165 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# @golemui/gui-mcp
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) server that gives AI coding
|
|
4
|
+
assistants (Claude Code, Cursor, Windsurf, …) deterministic schema validation and form
|
|
5
|
+
generation for [GolemUI](https://golemui.com) form definitions.
|
|
6
|
+
|
|
7
|
+
GolemUI forms are portable JSON schemas — small enough that an LLM can emit them cleanly,
|
|
8
|
+
strict enough that one wrong property name breaks the runtime. This server closes the gap:
|
|
9
|
+
your AI calls it to **validate** what it wrote and to **generate** forms from existing
|
|
10
|
+
JSON Schemas or OpenAPI operations, with the bundled GolemUI schemas as the source of truth.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
The server is a standalone Node CLI distributed on npm. Add it to your IDE's MCP config —
|
|
15
|
+
no project install required.
|
|
16
|
+
|
|
17
|
+
### Claude Code
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
claude mcp add golemui -- npx -y @golemui/gui-mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or paste this into `~/.claude/settings.json` (or your project's `.mcp.json`):
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"golemui": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["-y", "@golemui/gui-mcp"]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Cursor / Windsurf / other MCP-capable IDEs
|
|
37
|
+
|
|
38
|
+
Same config — point an `mcpServers.golemui` entry at `npx -y @golemui/gui-mcp`.
|
|
39
|
+
|
|
40
|
+
### Verify
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx -y @golemui/gui-mcp < /dev/null
|
|
44
|
+
# → @golemui/gui-mcp v0.0.1 ready on stdio
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Tools
|
|
48
|
+
|
|
49
|
+
### `validate_form_definition`
|
|
50
|
+
|
|
51
|
+
Validates a GolemUI form definition against the bundled JSON Schemas. Returns
|
|
52
|
+
`{ valid: true }` on success, or a structured list of errors with JSON Pointer paths
|
|
53
|
+
and concrete fix suggestions ("`format: 'mail'` is not valid — did you mean `'email'`?").
|
|
54
|
+
Also lints reactive expressions (`include.when`, `disabled.when`, …) for common mistakes
|
|
55
|
+
like missing `$form.` prefixes, single `=` in equality checks, and unbalanced brackets.
|
|
56
|
+
|
|
57
|
+
**Input:** `{ formDefinition: { form: [...], states?: {...} } }`
|
|
58
|
+
|
|
59
|
+
### `generate_from_json_schema`
|
|
60
|
+
|
|
61
|
+
Maps a JSON Schema (the form-data shape, e.g. a Zod-derived schema) into a GolemUI
|
|
62
|
+
form definition. Handles strings (with `format` → specialized widgets), numbers,
|
|
63
|
+
booleans, enums, nested objects, and arrays of objects. The result is validated before
|
|
64
|
+
being returned, so you get a guaranteed-correct form or an explicit list of what could
|
|
65
|
+
not be mapped.
|
|
66
|
+
|
|
67
|
+
**Input:** `{ jsonSchema, submitAction?, submitLabel?, layout? }`
|
|
68
|
+
|
|
69
|
+
### `generate_from_openapi`
|
|
70
|
+
|
|
71
|
+
Resolves an OpenAPI 3.x operation (e.g. `"POST /users"` or an `operationId`), dereferences
|
|
72
|
+
its request body schema, and emits a validated GolemUI form. Falls back to operation
|
|
73
|
+
parameters when no JSON request body is present.
|
|
74
|
+
|
|
75
|
+
**Input:** `{ document | documentUrl, operation, submitAction?, submitLabel? }`
|
|
76
|
+
|
|
77
|
+
### `get_widget_spec`
|
|
78
|
+
|
|
79
|
+
Returns the JSON Schema, kind, a minimal working example, and authoring notes for a
|
|
80
|
+
single GolemUI widget. Cheaper than dumping the whole API into the model's context.
|
|
81
|
+
|
|
82
|
+
**Input:** `{ widgetType }` (one of the widget `type` constants — `textinput`,
|
|
83
|
+
`dropdown`, `repeater`, `flex`, etc.)
|
|
84
|
+
|
|
85
|
+
## How it stays accurate
|
|
86
|
+
|
|
87
|
+
The server ships a frozen snapshot of the GolemUI JSON Schemas inside its npm package,
|
|
88
|
+
version-locked to a specific GolemUI release. A CI check in this monorepo
|
|
89
|
+
(`npm run check:mcp-schemas`) fails if the snapshot drifts from the source schemas in
|
|
90
|
+
`@golemui/gui-shared`, so a published `@golemui/gui-mcp@X.Y.Z` always validates
|
|
91
|
+
against the exact same schema definitions as `@golemui/gui-*@X.Y.Z`.
|
|
92
|
+
|
|
93
|
+
No LLM calls happen inside this server — every tool is deterministic. The MCP is the
|
|
94
|
+
*grounding layer* the host IDE's model calls into.
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# from the repo root
|
|
100
|
+
npx nx run gui-mcp:build # build to dist/libs/gui/mcp
|
|
101
|
+
npx nx run gui-mcp:vite:test # run the test suite
|
|
102
|
+
npm run sync:mcp-schemas # refresh bundled schemas from libs/gui/shared
|
|
103
|
+
npm run check:mcp-schemas # CI mode — exits non-zero if out of sync
|
|
104
|
+
```
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|