@golemui/gui-mcp 1.0.0-rc.2 → 1.0.0-rc.4
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/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/README.md +64 -23
- package/cli.js +42 -35
- package/dx/check-dx-code.d.ts +25 -0
- package/dx/dx-lint.d.ts +27 -0
- package/dx/dx-specs.d.ts +70 -0
- package/dx/get-dx-spec.d.ts +27 -0
- package/dx/instructions.d.ts +7 -0
- package/dx/list-dx-factories.d.ts +19 -0
- package/dx/tools.d.ts +3 -0
- package/dx/type-graph.d.ts +10 -0
- package/dx/typecheck.d.ts +41 -0
- package/{get-concept-B7s_l8Qs.js → get-concept-DMoitPWv.js} +621 -20
- package/{tools → json}/generate-from-json-schema.d.ts +3 -3
- package/{tools → json}/generate-from-openapi.d.ts +3 -3
- package/{tools → json}/get-widget-spec.d.ts +3 -3
- package/json/instructions.d.ts +6 -0
- package/json/tools.d.ts +3 -0
- package/{tools → json}/validate-form-definition.d.ts +5 -5
- package/lib.d.ts +17 -7
- package/lib.js +20 -10
- package/package.json +12 -7
- package/{lint → shared/lint}/reactive-expressions.d.ts +8 -0
- package/shared/tool.d.ts +49 -0
- package/shared/tools.d.ts +7 -0
- /package/{utils → json}/errors.d.ts +0 -0
- /package/{mapping → json/mapping}/json-schema-to-gui.d.ts +0 -0
- /package/{mapping → json/mapping}/validator.d.ts +0 -0
- /package/{schemas → json/schemas}/ajv.d.ts +0 -0
- /package/{schemas → json/schemas}/index.d.ts +0 -0
- /package/{schemas → json/schemas}/shallow-validators.d.ts +0 -0
- /package/{lint → json}/string-interpolation.d.ts +0 -0
- /package/{tools → shared}/get-concept.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonSchemaLike } from '
|
|
1
|
+
import { JsonSchemaLike } from './mapping/json-schema-to-gui';
|
|
2
2
|
import { validateFormDefinition } from './validate-form-definition';
|
|
3
3
|
export type GenerateFromJsonSchemaInput = {
|
|
4
4
|
jsonSchema: JsonSchemaLike;
|
|
@@ -18,8 +18,8 @@ export type GenerateFromJsonSchemaResult = {
|
|
|
18
18
|
validation: ReturnType<typeof validateFormDefinition>;
|
|
19
19
|
};
|
|
20
20
|
export declare function generateFromJsonSchema(input: GenerateFromJsonSchemaInput): GenerateFromJsonSchemaResult;
|
|
21
|
-
export declare const
|
|
22
|
-
readonly name: "
|
|
21
|
+
export declare const JSON_GENERATE_FROM_SCHEMA_TOOL: {
|
|
22
|
+
readonly name: "json_generate_from_schema";
|
|
23
23
|
readonly description: string;
|
|
24
24
|
readonly inputSchema: {
|
|
25
25
|
readonly type: "object";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonSchemaLike } from '
|
|
1
|
+
import { JsonSchemaLike } from './mapping/json-schema-to-gui';
|
|
2
2
|
import { validateFormDefinition } from './validate-form-definition';
|
|
3
3
|
type OpenAPIDoc = {
|
|
4
4
|
openapi?: string;
|
|
@@ -47,8 +47,8 @@ export type GenerateFromOpenapiResult = {
|
|
|
47
47
|
validation: ReturnType<typeof validateFormDefinition>;
|
|
48
48
|
};
|
|
49
49
|
export declare function generateFromOpenapi(input: GenerateFromOpenapiInput): Promise<GenerateFromOpenapiResult>;
|
|
50
|
-
export declare const
|
|
51
|
-
readonly name: "
|
|
50
|
+
export declare const JSON_GENERATE_FROM_OPENAPI_TOOL: {
|
|
51
|
+
readonly name: "json_generate_from_openapi";
|
|
52
52
|
readonly description: string;
|
|
53
53
|
readonly inputSchema: {
|
|
54
54
|
readonly type: "object";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WidgetSchema } from '
|
|
1
|
+
import { WidgetSchema } from './schemas/index';
|
|
2
2
|
export type GetWidgetSpecInput = {
|
|
3
3
|
widgetType: string;
|
|
4
4
|
};
|
|
@@ -12,8 +12,8 @@ export type GetWidgetSpecResult = {
|
|
|
12
12
|
export declare function getWidgetSpec(input: GetWidgetSpecInput): GetWidgetSpecResult;
|
|
13
13
|
export declare function listWidgetTypes(): string[];
|
|
14
14
|
export declare function getValidatorsSchema(): WidgetSchema;
|
|
15
|
-
export declare const
|
|
16
|
-
readonly name: "
|
|
15
|
+
export declare const JSON_GET_WIDGET_SPEC_TOOL: {
|
|
16
|
+
readonly name: "json_get_widget_spec";
|
|
17
17
|
readonly description: string;
|
|
18
18
|
readonly inputSchema: {
|
|
19
19
|
readonly type: "object";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON form-definition half of the server's connect-time guidance (the MCP
|
|
3
|
+
* `initialize.instructions` field). Composed with the DX half in `cli.ts`. Owned here so
|
|
4
|
+
* the JSON path's routing advice evolves independently of the `gui.*` path's.
|
|
5
|
+
*/
|
|
6
|
+
export declare const JSON_INSTRUCTIONS: string;
|
package/json/tools.d.ts
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FormattedError } from '
|
|
2
|
-
import { ExpressionFinding } from '../lint/reactive-expressions';
|
|
3
|
-
import { InterpolationFinding } from '
|
|
1
|
+
import { FormattedError } from './errors';
|
|
2
|
+
import { ExpressionFinding } from '../shared/lint/reactive-expressions';
|
|
3
|
+
import { InterpolationFinding } from './string-interpolation';
|
|
4
4
|
export type ValidateInput = {
|
|
5
5
|
formDefinition: unknown;
|
|
6
6
|
};
|
|
@@ -12,8 +12,8 @@ export type ValidateResult = {
|
|
|
12
12
|
interpolationWarnings: InterpolationFinding[];
|
|
13
13
|
};
|
|
14
14
|
export declare function validateFormDefinition(input: ValidateInput): ValidateResult;
|
|
15
|
-
export declare const
|
|
16
|
-
readonly name: "
|
|
15
|
+
export declare const JSON_VALIDATE_FORM_DEFINITION_TOOL: {
|
|
16
|
+
readonly name: "json_validate_form_definition";
|
|
17
17
|
readonly description: string;
|
|
18
18
|
readonly inputSchema: {
|
|
19
19
|
readonly type: "object";
|
package/lib.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
export { validateFormDefinition,
|
|
2
|
-
export type { ValidateInput, ValidateResult } from './
|
|
3
|
-
export { generateFromJsonSchema,
|
|
4
|
-
export type { GenerateFromJsonSchemaInput, GenerateFromJsonSchemaResult, } from './
|
|
5
|
-
export { generateFromOpenapi,
|
|
6
|
-
export { getWidgetSpec,
|
|
7
|
-
export {
|
|
1
|
+
export { validateFormDefinition, JSON_VALIDATE_FORM_DEFINITION_TOOL, } from './json/validate-form-definition';
|
|
2
|
+
export type { ValidateInput, ValidateResult } from './json/validate-form-definition';
|
|
3
|
+
export { generateFromJsonSchema, JSON_GENERATE_FROM_SCHEMA_TOOL, } from './json/generate-from-json-schema';
|
|
4
|
+
export type { GenerateFromJsonSchemaInput, GenerateFromJsonSchemaResult, } from './json/generate-from-json-schema';
|
|
5
|
+
export { generateFromOpenapi, JSON_GENERATE_FROM_OPENAPI_TOOL } from './json/generate-from-openapi';
|
|
6
|
+
export { getWidgetSpec, JSON_GET_WIDGET_SPEC_TOOL } from './json/get-widget-spec';
|
|
7
|
+
export { checkDxCode, DX_CHECK_CODE_TOOL } from './dx/check-dx-code';
|
|
8
|
+
export type { CheckDxCodeInput, CheckDxCodeResult } from './dx/check-dx-code';
|
|
9
|
+
export { getDxSpec, DX_GET_SPEC_TOOL } from './dx/get-dx-spec';
|
|
10
|
+
export type { GetDxSpecInput, GetDxSpecResult } from './dx/get-dx-spec';
|
|
11
|
+
export { listDxFactoriesCatalog, DX_LIST_FACTORIES_TOOL } from './dx/list-dx-factories';
|
|
12
|
+
export type { ListDxFactoriesResult } from './dx/list-dx-factories';
|
|
13
|
+
export { typeCheckDx } from './dx/typecheck';
|
|
14
|
+
export type { DxDiagnostic, DxCheckResult } from './dx/typecheck';
|
|
15
|
+
export { DX_SPECS, listDxFactories, dxCatalog } from './dx/dx-specs';
|
|
16
|
+
export type { DxSpec, DxNamespace, DxCatalog, DxCatalogEntry } from './dx/dx-specs';
|
|
17
|
+
export { getConcept, GET_CONCEPT_TOOL } from './shared/get-concept';
|
package/lib.js
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D, a, b, c, G, J, d, e, f, g, h, i, j, k, l, m, n, o, t, v } from "./get-concept-DMoitPWv.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
a as
|
|
5
|
-
b as
|
|
6
|
-
c as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
d as
|
|
10
|
-
e as
|
|
11
|
-
f as
|
|
3
|
+
D as DX_CHECK_CODE_TOOL,
|
|
4
|
+
a as DX_GET_SPEC_TOOL,
|
|
5
|
+
b as DX_LIST_FACTORIES_TOOL,
|
|
6
|
+
c as DX_SPECS,
|
|
7
|
+
G as GET_CONCEPT_TOOL,
|
|
8
|
+
J as JSON_GENERATE_FROM_OPENAPI_TOOL,
|
|
9
|
+
d as JSON_GENERATE_FROM_SCHEMA_TOOL,
|
|
10
|
+
e as JSON_GET_WIDGET_SPEC_TOOL,
|
|
11
|
+
f as JSON_VALIDATE_FORM_DEFINITION_TOOL,
|
|
12
|
+
g as checkDxCode,
|
|
13
|
+
h as dxCatalog,
|
|
14
|
+
i as generateFromJsonSchema,
|
|
15
|
+
j as generateFromOpenapi,
|
|
16
|
+
k as getConcept,
|
|
17
|
+
l as getDxSpec,
|
|
18
|
+
m as getWidgetSpec,
|
|
19
|
+
n as listDxFactories,
|
|
20
|
+
o as listDxFactoriesCatalog,
|
|
21
|
+
t as typeCheckDx,
|
|
12
22
|
v as validateFormDefinition
|
|
13
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemui/gui-mcp",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.4",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"description": "Model Context Protocol server for GolemUI — gives AI coding assistants deterministic schema validation and form generation for GolemUI form definitions.",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "./lib.js",
|
|
@@ -18,11 +19,9 @@
|
|
|
18
19
|
"files": [
|
|
19
20
|
"*.js",
|
|
20
21
|
"*.d.ts",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"utils",
|
|
25
|
-
"lint",
|
|
22
|
+
"json",
|
|
23
|
+
"dx",
|
|
24
|
+
"shared",
|
|
26
25
|
"*.md"
|
|
27
26
|
],
|
|
28
27
|
"keywords": [
|
|
@@ -36,7 +35,13 @@
|
|
|
36
35
|
"dependencies": {
|
|
37
36
|
"ajv": "^8.17.1",
|
|
38
37
|
"ajv-formats": "^3.0.1",
|
|
39
|
-
"
|
|
38
|
+
"typescript": "^5.9.2",
|
|
39
|
+
"@golemui/gui-schemas": "1.0.0-rc.4",
|
|
40
|
+
"@golemui/gui-shared": "1.0.0-rc.4",
|
|
41
|
+
"@golemui/gui-validators": "1.0.0-rc.4",
|
|
42
|
+
"@golemui/core": "1.0.0-rc.4",
|
|
43
|
+
"zod": "^4.0.0",
|
|
44
|
+
"@standard-schema/spec": "^1.0.0"
|
|
40
45
|
},
|
|
41
46
|
"peerDependencies": {
|
|
42
47
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
@@ -16,3 +16,11 @@ export type ExpressionFinding = {
|
|
|
16
16
|
* We deliberately don't try to fully parse: too easy to get false positives, too little gain.
|
|
17
17
|
*/
|
|
18
18
|
export declare function lintReactiveExpressions(formDefinition: unknown): ExpressionFinding[];
|
|
19
|
+
/**
|
|
20
|
+
* Lint a single reactive expression string in isolation, against the same rules
|
|
21
|
+
* `lintReactiveExpressions` applies while walking a JSON form definition. This is
|
|
22
|
+
* the shared engine the DX path (`dx_check_code`) reuses: the JSON walker has the
|
|
23
|
+
* object tree, the DX linter has the AST — both funnel each `when` expression
|
|
24
|
+
* through here so the two surfaces can never drift.
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkReactiveExpression(expression: string, path?: string): ExpressionFinding[];
|
package/shared/tool.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MCP tool wiring shared by both authoring paths.
|
|
3
|
+
*
|
|
4
|
+
* Each path (`json/`, `dx/`) and the shared surface export a `ToolEntry[]` that pairs an
|
|
5
|
+
* MCP tool descriptor with its handler. The server concatenates those arrays for both the
|
|
6
|
+
* `tools/list` response and name-based dispatch, so adding a tool is a one-line change in
|
|
7
|
+
* the owning module — there is no central switch to keep in sync.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The shape of the exported `*_TOOL` descriptor objects. Kept intentionally loose
|
|
11
|
+
* (`inputSchema: unknown`, readonly fields) so the `as const` descriptors assign without
|
|
12
|
+
* readonly friction; the MCP client is what validates `arguments` against the real
|
|
13
|
+
* `inputSchema` before a call ever reaches us.
|
|
14
|
+
*/
|
|
15
|
+
export type ToolDescriptor = {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
readonly inputSchema: unknown;
|
|
19
|
+
};
|
|
20
|
+
/** One registered MCP tool: its descriptor (advertised to the client) and its handler. */
|
|
21
|
+
export interface ToolEntry {
|
|
22
|
+
tool: ToolDescriptor;
|
|
23
|
+
run: (args: Record<string, unknown> | undefined) => unknown | Promise<unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Pair a tool descriptor with its handler. `args` arrives already shape-validated by the
|
|
27
|
+
* MCP client against `tool.inputSchema`, so this is the single trusted boundary where raw
|
|
28
|
+
* arguments are cast to the handler's input type — instead of an `as any` repeated at
|
|
29
|
+
* every dispatch arm.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const jsonTools = [defineTool(JSON_VALIDATE_FORM_DEFINITION_TOOL, validateFormDefinition)];
|
|
33
|
+
*/
|
|
34
|
+
export declare function defineTool<Input, Output>(tool: ToolDescriptor, handler: (input: Input) => Output): ToolEntry;
|
|
35
|
+
/** Wrap a successful tool result in the MCP text-content envelope. */
|
|
36
|
+
export declare function ok(payload: unknown): {
|
|
37
|
+
content: {
|
|
38
|
+
type: "text";
|
|
39
|
+
text: string;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
/** Wrap an error message in the MCP error envelope. */
|
|
43
|
+
export declare function err(message: string): {
|
|
44
|
+
isError: boolean;
|
|
45
|
+
content: {
|
|
46
|
+
type: "text";
|
|
47
|
+
text: string;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ToolEntry } from './tool';
|
|
2
|
+
/**
|
|
3
|
+
* Cross-cutting reference tools that serve both authoring paths. `get_concept` explains
|
|
4
|
+
* behavior that spans widgets (conditional rendering, per-state props, the reactive
|
|
5
|
+
* scope), which a JSON author and a `gui.*` DX author both reach for.
|
|
6
|
+
*/
|
|
7
|
+
export declare const sharedTools: ToolEntry[];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|