@ng-forge/dynamic-form-mcp 1.0.0-rc.4 → 1.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/index.d.ts ADDED
@@ -0,0 +1,252 @@
1
+ /**
2
+ * @ng-forge/dynamic-form-mcp
3
+ *
4
+ * MCP server for ng-forge dynamic forms - AI-assisted form schema generation
5
+ * @packageDocumentation
6
+ */
7
+
8
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
+
10
+ export declare interface AddonTypeInfo {
11
+ /** Discriminant matching `addon.type` in form configs. */
12
+ type: string;
13
+ /** Source category — core ships from the library, adapter from a UI-integration package. */
14
+ category: 'core' | 'adapter';
15
+ /** Provider package; `'core'` means @ng-forge/dynamic-forms. */
16
+ package: string;
17
+ /** Adapter that ships this type, or `null` for core types. */
18
+ adapter: UiIntegration | null;
19
+ /** One-line description of what this type renders. */
20
+ description: string;
21
+ /**
22
+ * Whether the type survives `JSON.stringify`/`parse`. JSON-safe types may
23
+ * be referenced from server-driven configs; code-only types are dropped by
24
+ * the lenient validator when the config came from JSON.
25
+ */
26
+ jsonSafe: boolean;
27
+ /** Per-type config props (excludes universal `slot`, `className`, `hidden`, `disabled`). */
28
+ props: Record<string, PropertyInfo>;
29
+ /** Full inline example for documentation. */
30
+ example: string;
31
+ /** Minimal valid config (just required props). */
32
+ minimalExample: string;
33
+ }
34
+
35
+ /** Create and configure the MCP server */
36
+ export declare function createServer(): McpServer;
37
+
38
+ /**
39
+ * Per-field-type addon support metadata. Records which slots and types a
40
+ * field type accepts at runtime — feeds the validator's allowed-list checks.
41
+ */
42
+ export declare interface FieldAddonSupportInfo {
43
+ /** Field type discriminant (matches `FieldDef.type`). */
44
+ fieldType: string;
45
+ /** Adapter shipping the field — null for core fields. */
46
+ adapter: UiIntegration | null;
47
+ /** Slots this field accepts. */
48
+ slots: ('prefix' | 'suffix' | string)[];
49
+ /** Whitelist of allowed types (omitted = any registered type). */
50
+ allowedTypes?: string[];
51
+ }
52
+
53
+ export declare interface FieldTypeInfo {
54
+ type: string;
55
+ category: 'value' | 'container' | 'button' | 'display';
56
+ description: string;
57
+ valueType?: string;
58
+ baseInterface?: string;
59
+ props: Record<string, PropertyInfo>;
60
+ validationSupported: boolean;
61
+ example: string;
62
+ /** Field types that this container can contain (for containers only) */
63
+ canContain?: string[];
64
+ /** Field types that this container CANNOT contain (for containers only) */
65
+ cannotContain?: string[];
66
+ /** Where this field type is allowed to be placed */
67
+ allowedIn?: string[];
68
+ /** Where this field type is NOT allowed to be placed */
69
+ notAllowedIn?: string[];
70
+ /** Whether this field type is part of core library or requires an adapter */
71
+ source: 'core' | 'adapter';
72
+ /** Minimal valid example (just required properties) */
73
+ minimalExample?: string;
74
+ }
75
+
76
+ /**
77
+ * Formatted validation error for easy consumption.
78
+ */
79
+ export declare interface FormattedValidationError {
80
+ /**
81
+ * Path to the invalid field (e.g., 'fields[0].props.type').
82
+ */
83
+ path: string;
84
+ /**
85
+ * Error message.
86
+ */
87
+ message: string;
88
+ /**
89
+ * Expected value or type.
90
+ */
91
+ expected?: string;
92
+ /**
93
+ * Received value.
94
+ */
95
+ received?: string;
96
+ }
97
+
98
+ /** Look up a single addon type by its discriminant. */
99
+ export declare function getAddonType(type: string): AddonTypeInfo | undefined;
100
+
101
+ /** Get every registered addon type. */
102
+ export declare function getAddonTypes(): AddonTypeInfo[];
103
+
104
+ /** Filter addon types by source (`'core'` / `'adapter'`). */
105
+ export declare function getAddonTypesByCategory(category: 'core' | 'adapter'): AddonTypeInfo[];
106
+
107
+ /** Get the per-field-type addon support map. */
108
+ export declare function getFieldAddonSupport(): FieldAddonSupportInfo[];
109
+
110
+ /** Get a specific field type by name */
111
+ export declare function getFieldType(type: string): FieldTypeInfo | undefined;
112
+
113
+ /** Get all available field types */
114
+ export declare function getFieldTypes(): FieldTypeInfo[];
115
+
116
+ /** Get field types by category */
117
+ export declare function getFieldTypesByCategory(category: 'value' | 'container' | 'button' | 'display'): FieldTypeInfo[];
118
+
119
+ /**
120
+ * Get the JSON Schema for a form configuration.
121
+ *
122
+ * @param uiIntegration - The UI framework integration to use
123
+ * @param options - Optional JSON Schema generation options
124
+ * @returns JSON Schema for the form configuration
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * const jsonSchema = getFormConfigJsonSchema('material');
129
+ * // Use in MCP tool definition or LLM prompts
130
+ * ```
131
+ */
132
+ export declare function getFormConfigJsonSchema(uiIntegration: UiIntegration, options?: JsonSchemaOptions): JsonSchemaType;
133
+
134
+ /**
135
+ * Get the JSON Schema for all leaf fields of a UI integration (full union).
136
+ *
137
+ * WARNING: This returns a large schema (~258KB). Consider using
138
+ * getFieldTypeJsonSchema() for individual field types instead.
139
+ *
140
+ * @param uiIntegration - The UI framework integration
141
+ * @returns JSON Schema for all leaf field types
142
+ */
143
+ export declare function getLeafFieldJsonSchema(uiIntegration: UiIntegration): JsonSchemaType;
144
+
145
+ /** Get a specific UI adapter by library name */
146
+ export declare function getUIAdapter(library: UiIntegration): UIAdapterInfo | undefined;
147
+
148
+ /** Get UI adapter field type configuration */
149
+ export declare function getUIAdapterFieldType(library: UiIntegration, fieldType: string): UIAdapterFieldType | undefined;
150
+
151
+ /** Get all UI adapters */
152
+ export declare function getUIAdapters(): UIAdapterInfo[];
153
+
154
+ /** Get a specific validator by type */
155
+ export declare function getValidator(type: string): ValidatorInfo | undefined;
156
+
157
+ /** Get all available validators */
158
+ export declare function getValidators(): ValidatorInfo[];
159
+
160
+ /** Get validators by category */
161
+ export declare function getValidatorsByCategory(category: 'built-in' | 'custom' | 'async' | 'http'): ValidatorInfo[];
162
+
163
+ /**
164
+ * Type guard for checking if a value is a valid form config for an integration.
165
+ */
166
+ export declare function isValidFormConfig(uiIntegration: UiIntegration, config: unknown): boolean;
167
+
168
+ /**
169
+ * Options for JSON Schema generation.
170
+ */
171
+ declare interface JsonSchemaOptions {
172
+ /**
173
+ * Name for the schema (used in $id).
174
+ */
175
+ name?: string;
176
+ /**
177
+ * Base URI for $ref resolution.
178
+ */
179
+ basePath?: string;
180
+ }
181
+
182
+ /**
183
+ * JSON Schema type (simplified for export).
184
+ */
185
+ declare type JsonSchemaType = Record<string, unknown>;
186
+
187
+ export declare interface PropertyInfo {
188
+ name: string;
189
+ type: string;
190
+ description: string;
191
+ required: boolean;
192
+ default?: unknown;
193
+ }
194
+
195
+ /** Run the MCP server with stdio transport */
196
+ export declare function runStdioServer(): Promise<void>;
197
+
198
+ export declare const SERVER_NAME = "ng-forge-mcp";
199
+
200
+ export declare const SERVER_VERSION: string;
201
+
202
+ export declare interface UIAdapterFieldType {
203
+ type: string;
204
+ componentName: string;
205
+ additionalProps: Record<string, PropertyInfo>;
206
+ }
207
+
208
+ export declare interface UIAdapterInfo {
209
+ library: string;
210
+ package: string;
211
+ fieldTypes: UIAdapterFieldType[];
212
+ providerFunction: string;
213
+ }
214
+
215
+ /**
216
+ * Supported UI integrations for form config schemas.
217
+ */
218
+ export declare type UiIntegration = 'material' | 'bootstrap' | 'primeng' | 'ionic';
219
+
220
+ export declare function validateFormConfig(uiIntegration: UiIntegration, config: unknown): ValidationResult;
221
+
222
+ /**
223
+ * Validation result for form configuration.
224
+ */
225
+ export declare interface ValidationResult {
226
+ /**
227
+ * Whether the configuration is valid.
228
+ */
229
+ valid: boolean;
230
+ /**
231
+ * Parsed configuration if valid, undefined otherwise.
232
+ */
233
+ data?: unknown;
234
+ /**
235
+ * Validation errors if invalid.
236
+ */
237
+ errors?: FormattedValidationError[];
238
+ /**
239
+ * Human-readable error summary.
240
+ */
241
+ errorSummary?: string;
242
+ }
243
+
244
+ export declare interface ValidatorInfo {
245
+ type: string;
246
+ category: 'built-in' | 'custom' | 'async' | 'http';
247
+ description: string;
248
+ parameters: Record<string, PropertyInfo>;
249
+ example: string;
250
+ }
251
+
252
+ export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-forge/dynamic-form-mcp",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.0.0",
4
4
  "description": "MCP server for ng-forge dynamic forms - AI-assisted form schema generation",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -29,17 +29,19 @@
29
29
  "ng-forge-mcp": "./bin/ng-forge-mcp.js"
30
30
  },
31
31
  "main": "./src/index.js",
32
- "types": "./src/index.d.ts",
32
+ "types": "./index.d.ts",
33
33
  "exports": {
34
34
  ".": {
35
- "import": "./src/index.js",
36
- "types": "./src/index.d.ts"
35
+ "types": "./index.d.ts",
36
+ "import": "./src/index.js"
37
37
  }
38
38
  },
39
39
  "files": [
40
40
  "src",
41
41
  "bin",
42
- "README.md"
42
+ "index.d.ts",
43
+ "README.md",
44
+ "LICENSE"
43
45
  ],
44
46
  "engines": {
45
47
  "node": ">=24.0.0"
@@ -47,15 +49,16 @@
47
49
  "sideEffects": false,
48
50
  "dependencies": {
49
51
  "@modelcontextprotocol/sdk": "^1.0.0",
50
- "ts-morph": "^23.0.0",
51
- "zod": "^3.25.76"
52
+ "ts-morph": "^28.0.0",
53
+ "zod": "^3.25.76",
54
+ "zod-to-json-schema": "^3.23.0"
52
55
  },
53
56
  "devDependencies": {
54
- "@ng-forge/dynamic-forms": "^1.0.0-rc.4",
55
- "@ng-forge/dynamic-forms-bootstrap": "^1.0.0-rc.4",
56
- "@ng-forge/dynamic-forms-ionic": "^1.0.0-rc.4",
57
- "@ng-forge/dynamic-forms-material": "^1.0.0-rc.4",
58
- "@ng-forge/dynamic-forms-primeng": "^1.0.0-rc.4",
57
+ "@ng-forge/dynamic-forms": "^1.0.0",
58
+ "@ng-forge/dynamic-forms-bootstrap": "^1.0.0",
59
+ "@ng-forge/dynamic-forms-ionic": "^1.0.0",
60
+ "@ng-forge/dynamic-forms-material": "^1.0.0",
61
+ "@ng-forge/dynamic-forms-primeng": "^1.0.0",
59
62
  "tsx": "^4.19.0"
60
63
  }
61
64
  }