@netpad/mcp-server 2.3.0 → 2.3.1

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/dist/index.d.ts CHANGED
@@ -1,2 +1,721 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
1
2
 
2
- export { }
3
+ declare const FIELD_TYPES: ({
4
+ type: string;
5
+ category: string;
6
+ description: string;
7
+ muiComponent: string;
8
+ example: {
9
+ path: string;
10
+ label: string;
11
+ type: string;
12
+ included: boolean;
13
+ required?: undefined;
14
+ validation?: undefined;
15
+ options?: undefined;
16
+ layout?: undefined;
17
+ };
18
+ } | {
19
+ type: string;
20
+ category: string;
21
+ description: string;
22
+ muiComponent: string;
23
+ example: {
24
+ path: string;
25
+ label: string;
26
+ type: string;
27
+ included: boolean;
28
+ required: boolean;
29
+ validation?: undefined;
30
+ options?: undefined;
31
+ layout?: undefined;
32
+ };
33
+ } | {
34
+ type: string;
35
+ category: string;
36
+ description: string;
37
+ muiComponent: string;
38
+ example: {
39
+ path: string;
40
+ label: string;
41
+ type: string;
42
+ included: boolean;
43
+ validation: {
44
+ min: number;
45
+ max: number;
46
+ maxSize?: undefined;
47
+ accept?: undefined;
48
+ };
49
+ required?: undefined;
50
+ options?: undefined;
51
+ layout?: undefined;
52
+ };
53
+ } | {
54
+ type: string;
55
+ category: string;
56
+ description: string;
57
+ muiComponent: string;
58
+ example: {
59
+ path: string;
60
+ label: string;
61
+ type: string;
62
+ included: boolean;
63
+ options: {
64
+ label: string;
65
+ value: string;
66
+ }[];
67
+ required?: undefined;
68
+ validation?: undefined;
69
+ layout?: undefined;
70
+ };
71
+ } | {
72
+ type: string;
73
+ category: string;
74
+ description: string;
75
+ muiComponent: string;
76
+ example: {
77
+ path: string;
78
+ label: string;
79
+ type: string;
80
+ included: boolean;
81
+ layout: {
82
+ type: string;
83
+ title: string;
84
+ subtitle: string;
85
+ content?: undefined;
86
+ height?: undefined;
87
+ imageUrl?: undefined;
88
+ alignment?: undefined;
89
+ };
90
+ required?: undefined;
91
+ validation?: undefined;
92
+ options?: undefined;
93
+ };
94
+ } | {
95
+ type: string;
96
+ category: string;
97
+ description: string;
98
+ muiComponent: string;
99
+ example: {
100
+ path: string;
101
+ label: string;
102
+ type: string;
103
+ included: boolean;
104
+ layout: {
105
+ type: string;
106
+ content: string;
107
+ title?: undefined;
108
+ subtitle?: undefined;
109
+ height?: undefined;
110
+ imageUrl?: undefined;
111
+ alignment?: undefined;
112
+ };
113
+ required?: undefined;
114
+ validation?: undefined;
115
+ options?: undefined;
116
+ };
117
+ } | {
118
+ type: string;
119
+ category: string;
120
+ description: string;
121
+ muiComponent: string;
122
+ example: {
123
+ path: string;
124
+ label: string;
125
+ type: string;
126
+ included: boolean;
127
+ layout: {
128
+ type: string;
129
+ title?: undefined;
130
+ subtitle?: undefined;
131
+ content?: undefined;
132
+ height?: undefined;
133
+ imageUrl?: undefined;
134
+ alignment?: undefined;
135
+ };
136
+ required?: undefined;
137
+ validation?: undefined;
138
+ options?: undefined;
139
+ };
140
+ } | {
141
+ type: string;
142
+ category: string;
143
+ description: string;
144
+ muiComponent: string;
145
+ example: {
146
+ path: string;
147
+ label: string;
148
+ type: string;
149
+ included: boolean;
150
+ layout: {
151
+ type: string;
152
+ height: number;
153
+ title?: undefined;
154
+ subtitle?: undefined;
155
+ content?: undefined;
156
+ imageUrl?: undefined;
157
+ alignment?: undefined;
158
+ };
159
+ required?: undefined;
160
+ validation?: undefined;
161
+ options?: undefined;
162
+ };
163
+ } | {
164
+ type: string;
165
+ category: string;
166
+ description: string;
167
+ muiComponent: string;
168
+ example: {
169
+ path: string;
170
+ label: string;
171
+ type: string;
172
+ included: boolean;
173
+ layout: {
174
+ type: string;
175
+ imageUrl: string;
176
+ alignment: string;
177
+ title?: undefined;
178
+ subtitle?: undefined;
179
+ content?: undefined;
180
+ height?: undefined;
181
+ };
182
+ required?: undefined;
183
+ validation?: undefined;
184
+ options?: undefined;
185
+ };
186
+ } | {
187
+ type: string;
188
+ category: string;
189
+ description: string;
190
+ muiComponent: string;
191
+ example: {
192
+ path: string;
193
+ label: string;
194
+ type: string;
195
+ included: boolean;
196
+ validation: {
197
+ maxSize: number;
198
+ min?: undefined;
199
+ max?: undefined;
200
+ accept?: undefined;
201
+ };
202
+ required?: undefined;
203
+ options?: undefined;
204
+ layout?: undefined;
205
+ };
206
+ } | {
207
+ type: string;
208
+ category: string;
209
+ description: string;
210
+ muiComponent: string;
211
+ example: {
212
+ path: string;
213
+ label: string;
214
+ type: string;
215
+ included: boolean;
216
+ validation: {
217
+ accept: string;
218
+ min?: undefined;
219
+ max?: undefined;
220
+ maxSize?: undefined;
221
+ };
222
+ required?: undefined;
223
+ options?: undefined;
224
+ layout?: undefined;
225
+ };
226
+ })[];
227
+ declare const OPERATORS: ({
228
+ operator: string;
229
+ label: string;
230
+ description: string;
231
+ requiresValue: boolean;
232
+ example: {
233
+ field: string;
234
+ operator: string;
235
+ value: string;
236
+ };
237
+ } | {
238
+ operator: string;
239
+ label: string;
240
+ description: string;
241
+ requiresValue: boolean;
242
+ example: {
243
+ field: string;
244
+ operator: string;
245
+ value: number;
246
+ };
247
+ } | {
248
+ operator: string;
249
+ label: string;
250
+ description: string;
251
+ requiresValue: boolean;
252
+ example: {
253
+ field: string;
254
+ operator: string;
255
+ value?: undefined;
256
+ };
257
+ })[];
258
+ declare const FORMULA_FUNCTIONS: {
259
+ name: string;
260
+ category: string;
261
+ description: string;
262
+ syntax: string;
263
+ example: string;
264
+ }[];
265
+ declare const VALIDATION_OPTIONS: ({
266
+ property: string;
267
+ type: string;
268
+ description: string;
269
+ fieldLevel: boolean;
270
+ example: {
271
+ required: boolean;
272
+ validation?: undefined;
273
+ };
274
+ validationLevel?: undefined;
275
+ } | {
276
+ property: string;
277
+ type: string;
278
+ description: string;
279
+ validationLevel: boolean;
280
+ example: {
281
+ validation: {
282
+ min: number;
283
+ max?: undefined;
284
+ minLength?: undefined;
285
+ maxLength?: undefined;
286
+ pattern?: undefined;
287
+ errorMessage?: undefined;
288
+ };
289
+ required?: undefined;
290
+ };
291
+ fieldLevel?: undefined;
292
+ } | {
293
+ property: string;
294
+ type: string;
295
+ description: string;
296
+ validationLevel: boolean;
297
+ example: {
298
+ validation: {
299
+ max: number;
300
+ min?: undefined;
301
+ minLength?: undefined;
302
+ maxLength?: undefined;
303
+ pattern?: undefined;
304
+ errorMessage?: undefined;
305
+ };
306
+ required?: undefined;
307
+ };
308
+ fieldLevel?: undefined;
309
+ } | {
310
+ property: string;
311
+ type: string;
312
+ description: string;
313
+ validationLevel: boolean;
314
+ example: {
315
+ validation: {
316
+ minLength: number;
317
+ min?: undefined;
318
+ max?: undefined;
319
+ maxLength?: undefined;
320
+ pattern?: undefined;
321
+ errorMessage?: undefined;
322
+ };
323
+ required?: undefined;
324
+ };
325
+ fieldLevel?: undefined;
326
+ } | {
327
+ property: string;
328
+ type: string;
329
+ description: string;
330
+ validationLevel: boolean;
331
+ example: {
332
+ validation: {
333
+ maxLength: number;
334
+ min?: undefined;
335
+ max?: undefined;
336
+ minLength?: undefined;
337
+ pattern?: undefined;
338
+ errorMessage?: undefined;
339
+ };
340
+ required?: undefined;
341
+ };
342
+ fieldLevel?: undefined;
343
+ } | {
344
+ property: string;
345
+ type: string;
346
+ description: string;
347
+ validationLevel: boolean;
348
+ example: {
349
+ validation: {
350
+ pattern: string;
351
+ errorMessage: string;
352
+ min?: undefined;
353
+ max?: undefined;
354
+ minLength?: undefined;
355
+ maxLength?: undefined;
356
+ };
357
+ required?: undefined;
358
+ };
359
+ fieldLevel?: undefined;
360
+ } | {
361
+ property: string;
362
+ type: string;
363
+ description: string;
364
+ validationLevel: boolean;
365
+ example: {
366
+ validation: {
367
+ errorMessage: string;
368
+ min?: undefined;
369
+ max?: undefined;
370
+ minLength?: undefined;
371
+ maxLength?: undefined;
372
+ pattern?: undefined;
373
+ };
374
+ required?: undefined;
375
+ };
376
+ fieldLevel?: undefined;
377
+ })[];
378
+ declare const THEME_OPTIONS: {
379
+ colors: {
380
+ property: string;
381
+ description: string;
382
+ default: string;
383
+ }[];
384
+ spacing: ({
385
+ value: string;
386
+ description: string;
387
+ default?: undefined;
388
+ } | {
389
+ value: string;
390
+ description: string;
391
+ default: boolean;
392
+ })[];
393
+ inputStyle: ({
394
+ value: string;
395
+ description: string;
396
+ default: boolean;
397
+ } | {
398
+ value: string;
399
+ description: string;
400
+ default?: undefined;
401
+ })[];
402
+ borderRadius: {
403
+ property: string;
404
+ description: string;
405
+ default: number;
406
+ }[];
407
+ other: ({
408
+ property: string;
409
+ description: string;
410
+ default: string;
411
+ values?: undefined;
412
+ } | {
413
+ property: string;
414
+ values: string[];
415
+ description: string;
416
+ default: string;
417
+ } | {
418
+ property: string;
419
+ description: string;
420
+ default?: undefined;
421
+ values?: undefined;
422
+ })[];
423
+ };
424
+
425
+ interface FieldConfig {
426
+ path: string;
427
+ label: string;
428
+ type: string;
429
+ included: boolean;
430
+ required?: boolean;
431
+ disabled?: boolean;
432
+ readOnly?: boolean;
433
+ placeholder?: string;
434
+ helpText?: string;
435
+ fieldWidth?: 'full' | 'half' | 'third' | 'quarter';
436
+ defaultValue?: unknown;
437
+ options?: Array<{
438
+ label: string;
439
+ value: string | number;
440
+ }>;
441
+ validation?: {
442
+ min?: number;
443
+ max?: number;
444
+ minLength?: number;
445
+ maxLength?: number;
446
+ pattern?: string;
447
+ errorMessage?: string;
448
+ };
449
+ conditionalLogic?: ConditionalLogic;
450
+ computed?: ComputedConfig;
451
+ layout?: LayoutConfig;
452
+ }
453
+ interface ConditionalLogic {
454
+ action: 'show' | 'hide';
455
+ logicType: 'all' | 'any';
456
+ conditions: FieldCondition[];
457
+ }
458
+ interface FieldCondition {
459
+ field: string;
460
+ operator: string;
461
+ value?: string | number | boolean;
462
+ }
463
+ interface ComputedConfig {
464
+ formula: string;
465
+ dependencies: string[];
466
+ outputType?: 'string' | 'number' | 'boolean' | 'date';
467
+ }
468
+ interface LayoutConfig {
469
+ type: string;
470
+ title?: string;
471
+ subtitle?: string;
472
+ content?: string;
473
+ imageUrl?: string;
474
+ height?: number;
475
+ alignment?: 'left' | 'center' | 'right';
476
+ }
477
+ interface FormPage {
478
+ id: string;
479
+ title: string;
480
+ description?: string;
481
+ fields: string[];
482
+ }
483
+ interface MultiPageConfig {
484
+ enabled: boolean;
485
+ pages: FormPage[];
486
+ showProgressBar?: boolean;
487
+ showPageTitles?: boolean;
488
+ allowSkip?: boolean;
489
+ showReview?: boolean;
490
+ }
491
+ interface FormTheme {
492
+ primaryColor?: string;
493
+ backgroundColor?: string;
494
+ surfaceColor?: string;
495
+ textColor?: string;
496
+ errorColor?: string;
497
+ successColor?: string;
498
+ borderRadius?: number;
499
+ spacing?: 'compact' | 'comfortable' | 'spacious';
500
+ inputStyle?: 'outlined' | 'filled' | 'standard';
501
+ mode?: 'light' | 'dark';
502
+ }
503
+ interface FormConfiguration {
504
+ name: string;
505
+ description?: string;
506
+ fieldConfigs: FieldConfig[];
507
+ multiPage?: MultiPageConfig;
508
+ theme?: FormTheme;
509
+ submitButtonText?: string;
510
+ successMessage?: string;
511
+ }
512
+ interface GenerateFormOptions {
513
+ multiPage?: boolean;
514
+ theme?: boolean;
515
+ }
516
+ declare function generateFormSchema(description: string, formName: string, options?: GenerateFormOptions): FormConfiguration;
517
+ declare function generateFieldConfig(params: {
518
+ path: string;
519
+ label: string;
520
+ type: string;
521
+ required?: boolean;
522
+ options?: Array<{
523
+ label: string;
524
+ value: string;
525
+ }>;
526
+ placeholder?: string;
527
+ helpText?: string;
528
+ fieldWidth?: 'full' | 'half' | 'third' | 'quarter';
529
+ validation?: {
530
+ min?: number;
531
+ max?: number;
532
+ minLength?: number;
533
+ maxLength?: number;
534
+ pattern?: string;
535
+ errorMessage?: string;
536
+ };
537
+ }): FieldConfig;
538
+ declare function generateConditionalLogic(action: 'show' | 'hide', logicType: 'all' | 'any', conditions: Array<{
539
+ field: string;
540
+ operator: string;
541
+ value?: string | number | boolean;
542
+ }>): ConditionalLogic;
543
+ declare function generateComputedField(path: string, label: string, formula: string, outputType?: 'string' | 'number' | 'boolean' | 'date'): FieldConfig;
544
+ declare function generateMultiPageConfig(pages: Array<{
545
+ id: string;
546
+ title: string;
547
+ description?: string;
548
+ fields: string[];
549
+ }>, options?: {
550
+ showProgressBar?: boolean;
551
+ showPageTitles?: boolean;
552
+ allowSkip?: boolean;
553
+ showReview?: boolean;
554
+ }): MultiPageConfig;
555
+ interface ValidationResult {
556
+ valid: boolean;
557
+ errors: string[];
558
+ warnings: string[];
559
+ }
560
+ declare function validateFormConfig(config: unknown): ValidationResult;
561
+
562
+ declare const DOCUMENTATION: {
563
+ readme: string;
564
+ architecture: string;
565
+ apiClient: string;
566
+ extensions: string;
567
+ };
568
+ declare const QUICK_START_GUIDE = "# Quick Start Guide\n\n## 1. Installation\n\n```bash\nnpm install @netpad/forms @mui/material @mui/icons-material @emotion/react @emotion/styled\n```\n\n## 2. Create Your First Form\n\n```tsx\nimport { FormRenderer } from '@netpad/forms';\nimport type { FormConfiguration } from '@netpad/forms';\n\n// Define your form configuration\nconst contactFormConfig: FormConfiguration = {\n name: 'Contact Form',\n fieldConfigs: [\n {\n path: 'name',\n label: 'Your Name',\n type: 'short_text',\n included: true,\n required: true,\n placeholder: 'Enter your full name',\n },\n {\n path: 'email',\n label: 'Email Address',\n type: 'email',\n included: true,\n required: true,\n placeholder: 'you@example.com',\n },\n {\n path: 'subject',\n label: 'Subject',\n type: 'dropdown',\n included: true,\n options: [\n { label: 'General Inquiry', value: 'general' },\n { label: 'Support', value: 'support' },\n { label: 'Feedback', value: 'feedback' },\n ],\n },\n {\n path: 'message',\n label: 'Message',\n type: 'long_text',\n included: true,\n required: true,\n placeholder: 'How can we help you?',\n validation: {\n minLength: 10,\n errorMessage: 'Please enter at least 10 characters',\n },\n },\n ],\n submitButtonText: 'Send Message',\n successMessage: 'Thank you! We will get back to you soon.',\n};\n\n// Create your form component\nexport function ContactPage() {\n const handleSubmit = async (data: Record<string, unknown>) => {\n // Send data to your API\n const response = await fetch('/api/contact', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(data),\n });\n\n if (!response.ok) {\n throw new Error('Submission failed');\n }\n };\n\n return (\n <div style={{ maxWidth: 600, margin: '0 auto', padding: 24 }}>\n <FormRenderer\n config={contactFormConfig}\n onSubmit={handleSubmit}\n mode=\"create\"\n />\n </div>\n );\n}\n```\n\n## 3. Add Conditional Logic\n\nShow fields based on other field values:\n\n```tsx\n{\n path: 'phoneNumber',\n label: 'Phone Number',\n type: 'phone',\n included: true,\n conditionalLogic: {\n action: 'show',\n logicType: 'any',\n conditions: [\n { field: 'subject', operator: 'equals', value: 'support' },\n ],\n },\n}\n```\n\n## 4. Create a Multi-Page Form\n\n```tsx\nconst wizardConfig: FormConfiguration = {\n name: 'Registration',\n fieldConfigs: [\n // Personal info fields\n { path: 'firstName', label: 'First Name', type: 'short_text', included: true, required: true },\n { path: 'lastName', label: 'Last Name', type: 'short_text', included: true, required: true },\n { path: 'email', label: 'Email', type: 'email', included: true, required: true },\n // Account fields\n { path: 'username', label: 'Username', type: 'short_text', included: true, required: true },\n { path: 'password', label: 'Password', type: 'short_text', included: true, required: true },\n // Preferences\n { path: 'newsletter', label: 'Subscribe to newsletter', type: 'checkbox', included: true },\n { path: 'interests', label: 'Interests', type: 'checkboxes', included: true, options: [...] },\n ],\n multiPage: {\n enabled: true,\n showProgressBar: true,\n showPageTitles: true,\n pages: [\n {\n id: 'personal',\n title: 'Personal Information',\n fields: ['firstName', 'lastName', 'email'],\n },\n {\n id: 'account',\n title: 'Account Setup',\n fields: ['username', 'password'],\n },\n {\n id: 'preferences',\n title: 'Preferences',\n fields: ['newsletter', 'interests'],\n },\n ],\n },\n};\n```\n\n## 5. Add Computed Fields\n\n```tsx\n{\n path: 'quantity',\n label: 'Quantity',\n type: 'number',\n included: true,\n validation: { min: 1 },\n},\n{\n path: 'unitPrice',\n label: 'Unit Price',\n type: 'number',\n included: true,\n},\n{\n path: 'total',\n label: 'Total',\n type: 'number',\n included: true,\n disabled: true, // Read-only\n computed: {\n formula: 'quantity * unitPrice',\n dependencies: ['quantity', 'unitPrice'],\n outputType: 'number',\n },\n}\n```\n\n## Next Steps\n\n- Explore all 28+ field types\n- Add custom validation rules\n- Customize the theme\n- Connect to the NetPad platform\n";
569
+ declare const ARCHITECTURE_GUIDE: string;
570
+ declare const EXAMPLES = "# @netpad/forms Examples\n\n## Contact Form\n\n```typescript\nconst contactForm: FormConfiguration = {\n name: 'Contact Us',\n fieldConfigs: [\n { path: 'name', label: 'Full Name', type: 'short_text', included: true, required: true, fieldWidth: 'half' },\n { path: 'email', label: 'Email', type: 'email', included: true, required: true, fieldWidth: 'half' },\n { path: 'phone', label: 'Phone', type: 'phone', included: true, fieldWidth: 'half' },\n { path: 'company', label: 'Company', type: 'short_text', included: true, fieldWidth: 'half' },\n { path: 'subject', label: 'Subject', type: 'dropdown', included: true, required: true,\n options: [\n { label: 'General Inquiry', value: 'general' },\n { label: 'Sales', value: 'sales' },\n { label: 'Support', value: 'support' },\n { label: 'Partnership', value: 'partnership' },\n ]\n },\n { path: 'message', label: 'Message', type: 'long_text', included: true, required: true,\n validation: { minLength: 20, errorMessage: 'Please provide more details (at least 20 characters)' }\n },\n { path: 'newsletter', label: 'Subscribe to our newsletter', type: 'checkbox', included: true },\n ],\n submitButtonText: 'Send Message',\n successMessage: 'Thank you for contacting us! We will respond within 24 hours.',\n};\n```\n\n## Customer Survey (Multi-Page)\n\n```typescript\nconst surveyForm: FormConfiguration = {\n name: 'Customer Satisfaction Survey',\n fieldConfigs: [\n // Page 1: About You\n { path: 'name', label: 'Your Name (optional)', type: 'short_text', included: true },\n { path: 'email', label: 'Email (optional)', type: 'email', included: true },\n { path: 'howHeard', label: 'How did you hear about us?', type: 'dropdown', included: true,\n options: [\n { label: 'Search Engine', value: 'search' },\n { label: 'Social Media', value: 'social' },\n { label: 'Friend/Colleague', value: 'referral' },\n { label: 'Advertisement', value: 'ad' },\n { label: 'Other', value: 'other' },\n ]\n },\n // Page 2: Your Experience\n { path: 'overallSatisfaction', label: 'Overall Satisfaction', type: 'rating', included: true, required: true },\n { path: 'npsScore', label: 'How likely are you to recommend us?', type: 'nps', included: true, required: true },\n { path: 'likedMost', label: 'What did you like most?', type: 'checkboxes', included: true,\n options: [\n { label: 'Product Quality', value: 'quality' },\n { label: 'Customer Service', value: 'service' },\n { label: 'Ease of Use', value: 'ease' },\n { label: 'Price', value: 'price' },\n { label: 'Features', value: 'features' },\n ]\n },\n { path: 'improvements', label: 'What could we improve?', type: 'long_text', included: true },\n // Page 3: Follow-up\n { path: 'canContact', label: 'May we contact you for follow-up?', type: 'yes_no', included: true },\n { path: 'preferredContact', label: 'Preferred contact method', type: 'radio', included: true,\n options: [\n { label: 'Email', value: 'email' },\n { label: 'Phone', value: 'phone' },\n ],\n conditionalLogic: {\n action: 'show',\n logicType: 'all',\n conditions: [{ field: 'canContact', operator: 'isTrue' }],\n }\n },\n { path: 'additionalComments', label: 'Any additional comments?', type: 'long_text', included: true },\n ],\n multiPage: {\n enabled: true,\n showProgressBar: true,\n showPageTitles: true,\n pages: [\n { id: 'about', title: 'About You', fields: ['name', 'email', 'howHeard'] },\n { id: 'experience', title: 'Your Experience', fields: ['overallSatisfaction', 'npsScore', 'likedMost', 'improvements'] },\n { id: 'followup', title: 'Follow-up', fields: ['canContact', 'preferredContact', 'additionalComments'] },\n ],\n },\n submitButtonText: 'Submit Survey',\n successMessage: 'Thank you for your feedback!',\n};\n```\n\n## Order Form with Computed Fields\n\n```typescript\nconst orderForm: FormConfiguration = {\n name: 'Product Order',\n fieldConfigs: [\n // Product selection\n { path: 'product', label: 'Product', type: 'dropdown', included: true, required: true, fieldWidth: 'half',\n options: [\n { label: 'Basic Plan - $10/mo', value: 'basic' },\n { label: 'Pro Plan - $25/mo', value: 'pro' },\n { label: 'Enterprise - $99/mo', value: 'enterprise' },\n ]\n },\n { path: 'quantity', label: 'Quantity (months)', type: 'number', included: true, required: true, fieldWidth: 'half',\n defaultValue: 1,\n validation: { min: 1, max: 24 }\n },\n { path: 'unitPrice', label: 'Unit Price', type: 'number', included: true, disabled: true, fieldWidth: 'third' },\n { path: 'discount', label: 'Discount (%)', type: 'number', included: true, fieldWidth: 'third',\n defaultValue: 0,\n validation: { min: 0, max: 50 }\n },\n { path: 'total', label: 'Total', type: 'number', included: true, disabled: true, fieldWidth: 'third',\n computed: {\n formula: 'quantity * unitPrice * (1 - discount / 100)',\n dependencies: ['quantity', 'unitPrice', 'discount'],\n outputType: 'number',\n }\n },\n // Customer info\n { path: 'sectionCustomer', label: 'Customer Information', type: 'section-header', included: true,\n layout: { type: 'section-header', title: 'Customer Information' }\n },\n { path: 'customerName', label: 'Name', type: 'short_text', included: true, required: true },\n { path: 'customerEmail', label: 'Email', type: 'email', included: true, required: true },\n // Billing address\n { path: 'billing.street', label: 'Street Address', type: 'short_text', included: true, required: true },\n { path: 'billing.city', label: 'City', type: 'short_text', included: true, required: true, fieldWidth: 'half' },\n { path: 'billing.state', label: 'State', type: 'short_text', included: true, required: true, fieldWidth: 'quarter' },\n { path: 'billing.zip', label: 'ZIP', type: 'short_text', included: true, required: true, fieldWidth: 'quarter' },\n ],\n submitButtonText: 'Place Order',\n};\n```\n\n## Employee Onboarding (Complex Multi-Page)\n\n```typescript\nconst onboardingForm: FormConfiguration = {\n name: 'Employee Onboarding',\n fieldConfigs: [\n // Personal Information\n { path: 'firstName', label: 'First Name', type: 'short_text', included: true, required: true, fieldWidth: 'half' },\n { path: 'lastName', label: 'Last Name', type: 'short_text', included: true, required: true, fieldWidth: 'half' },\n { path: 'email', label: 'Email', type: 'email', included: true, required: true, fieldWidth: 'half' },\n { path: 'phone', label: 'Phone', type: 'phone', included: true, required: true, fieldWidth: 'half' },\n { path: 'dateOfBirth', label: 'Date of Birth', type: 'date', included: true, required: true, fieldWidth: 'half' },\n { path: 'address.street', label: 'Street Address', type: 'short_text', included: true, required: true },\n { path: 'address.city', label: 'City', type: 'short_text', included: true, required: true, fieldWidth: 'half' },\n { path: 'address.state', label: 'State', type: 'short_text', included: true, required: true, fieldWidth: 'quarter' },\n { path: 'address.zip', label: 'ZIP Code', type: 'short_text', included: true, required: true, fieldWidth: 'quarter' },\n\n // Employment Details\n { path: 'department', label: 'Department', type: 'dropdown', included: true, required: true,\n options: [\n { label: 'Engineering', value: 'engineering' },\n { label: 'Product', value: 'product' },\n { label: 'Design', value: 'design' },\n { label: 'Marketing', value: 'marketing' },\n { label: 'Sales', value: 'sales' },\n { label: 'HR', value: 'hr' },\n { label: 'Finance', value: 'finance' },\n ]\n },\n { path: 'jobTitle', label: 'Job Title', type: 'short_text', included: true, required: true },\n { path: 'startDate', label: 'Start Date', type: 'date', included: true, required: true },\n { path: 'workLocation', label: 'Work Location', type: 'radio', included: true, required: true,\n options: [\n { label: 'Remote', value: 'remote' },\n { label: 'Hybrid', value: 'hybrid' },\n { label: 'On-site', value: 'onsite' },\n ]\n },\n { path: 'officeLocation', label: 'Office Location', type: 'dropdown', included: true,\n options: [\n { label: 'New York', value: 'nyc' },\n { label: 'San Francisco', value: 'sf' },\n { label: 'London', value: 'london' },\n { label: 'Singapore', value: 'singapore' },\n ],\n conditionalLogic: {\n action: 'show',\n logicType: 'any',\n conditions: [\n { field: 'workLocation', operator: 'equals', value: 'hybrid' },\n { field: 'workLocation', operator: 'equals', value: 'onsite' },\n ],\n }\n },\n\n // Emergency Contact\n { path: 'emergencyContact.name', label: 'Emergency Contact Name', type: 'short_text', included: true, required: true },\n { path: 'emergencyContact.relationship', label: 'Relationship', type: 'short_text', included: true, required: true, fieldWidth: 'half' },\n { path: 'emergencyContact.phone', label: 'Phone', type: 'phone', included: true, required: true, fieldWidth: 'half' },\n ],\n multiPage: {\n enabled: true,\n showProgressBar: true,\n showPageTitles: true,\n pages: [\n {\n id: 'personal',\n title: 'Personal Information',\n description: 'Please provide your personal details',\n fields: ['firstName', 'lastName', 'email', 'phone', 'dateOfBirth', 'address.street', 'address.city', 'address.state', 'address.zip'],\n },\n {\n id: 'employment',\n title: 'Employment Details',\n description: 'Information about your role',\n fields: ['department', 'jobTitle', 'startDate', 'workLocation', 'officeLocation'],\n },\n {\n id: 'emergency',\n title: 'Emergency Contact',\n description: 'In case of emergency',\n fields: ['emergencyContact.name', 'emergencyContact.relationship', 'emergencyContact.phone'],\n },\n ],\n },\n submitButtonText: 'Complete Onboarding',\n successMessage: 'Welcome to the team! Your onboarding form has been submitted.',\n};\n```\n\n## Form with Layout Elements\n\n```typescript\nconst applicationForm: FormConfiguration = {\n name: 'Job Application',\n fieldConfigs: [\n // Header section\n { path: 'headerSection', label: '', type: 'section-header', included: true,\n layout: { type: 'section-header', title: 'Job Application', subtitle: 'Please complete all required fields' }\n },\n { path: 'instructions', label: '', type: 'description', included: true,\n layout: { type: 'description', content: 'Thank you for your interest in joining our team. This application should take about 10 minutes to complete.' }\n },\n { path: 'divider1', label: '', type: 'divider', included: true, layout: { type: 'divider' } },\n\n // Personal section\n { path: 'personalHeader', label: '', type: 'section-header', included: true,\n layout: { type: 'section-header', title: 'Personal Information' }\n },\n { path: 'firstName', label: 'First Name', type: 'short_text', included: true, required: true, fieldWidth: 'half' },\n { path: 'lastName', label: 'Last Name', type: 'short_text', included: true, required: true, fieldWidth: 'half' },\n { path: 'email', label: 'Email', type: 'email', included: true, required: true, fieldWidth: 'half' },\n { path: 'phone', label: 'Phone', type: 'phone', included: true, fieldWidth: 'half' },\n\n { path: 'spacer1', label: '', type: 'spacer', included: true, layout: { type: 'spacer', height: 16 } },\n\n // Position section\n { path: 'positionHeader', label: '', type: 'section-header', included: true,\n layout: { type: 'section-header', title: 'Position' }\n },\n { path: 'position', label: 'Position Applied For', type: 'dropdown', included: true, required: true,\n options: [\n { label: 'Software Engineer', value: 'swe' },\n { label: 'Product Manager', value: 'pm' },\n { label: 'Designer', value: 'design' },\n ]\n },\n { path: 'experience', label: 'Years of Experience', type: 'number', included: true, required: true, fieldWidth: 'half' },\n { path: 'salary', label: 'Expected Salary', type: 'number', included: true, fieldWidth: 'half' },\n\n // Documents\n { path: 'coverLetter', label: 'Cover Letter', type: 'long_text', included: true, required: true,\n helpText: 'Tell us why you would be a great fit for this role',\n validation: { minLength: 100 }\n },\n\n // Agreement\n { path: 'divider2', label: '', type: 'divider', included: true, layout: { type: 'divider' } },\n { path: 'agreeTerms', label: 'I certify that all information provided is accurate', type: 'checkbox', included: true, required: true },\n ],\n submitButtonText: 'Submit Application',\n};\n```\n";
571
+
572
+ /**
573
+ * Extension Generation Tools for NetPad MCP Server
574
+ *
575
+ * Provides tools for creating custom NetPad extensions with workflow nodes.
576
+ * Extensions can add custom functionality to NetPad installations through
577
+ * modular, independently deployable packages.
578
+ */
579
+ /**
580
+ * Node categories available for workflow nodes
581
+ */
582
+ type NodeCategory = 'triggers' | 'logic' | 'integrations' | 'actions' | 'data' | 'ai' | 'forms' | 'custom' | 'annotations';
583
+ /**
584
+ * Configuration field types for node editor UI
585
+ */
586
+ type ConfigFieldType = 'text' | 'textarea' | 'number' | 'boolean' | 'select' | 'json' | 'expression' | 'connection';
587
+ /**
588
+ * Configuration field definition for workflow node editor
589
+ */
590
+ interface NodeConfigField {
591
+ name: string;
592
+ label: string;
593
+ type: ConfigFieldType;
594
+ defaultValue?: unknown;
595
+ placeholder?: string;
596
+ helpText?: string;
597
+ required?: boolean;
598
+ options?: Array<{
599
+ label: string;
600
+ value: string;
601
+ }>;
602
+ }
603
+ /**
604
+ * Node output definition
605
+ */
606
+ interface NodeOutput {
607
+ id: string;
608
+ label: string;
609
+ description?: string;
610
+ primary?: boolean;
611
+ }
612
+ /**
613
+ * Workflow node definition for extension
614
+ */
615
+ interface WorkflowNodeDefinition {
616
+ type: string;
617
+ label: string;
618
+ description: string;
619
+ category: NodeCategory;
620
+ color: string;
621
+ icon: string;
622
+ version: string;
623
+ configFields?: NodeConfigField[];
624
+ outputs?: NodeOutput[];
625
+ }
626
+ /**
627
+ * Extension metadata
628
+ */
629
+ interface ExtensionMetadata {
630
+ id: string;
631
+ name: string;
632
+ version: string;
633
+ description?: string;
634
+ author?: string;
635
+ }
636
+ /**
637
+ * Options for generating an extension
638
+ */
639
+ interface GenerateExtensionOptions {
640
+ /** Extension metadata */
641
+ metadata: ExtensionMetadata;
642
+ /** Workflow nodes provided by this extension */
643
+ workflowNodes?: Array<{
644
+ definition: Omit<WorkflowNodeDefinition, 'type'> & {
645
+ type?: string;
646
+ };
647
+ /** Description of what the handler should do */
648
+ handlerDescription?: string;
649
+ /** Sample handler implementation (optional) */
650
+ handlerCode?: string;
651
+ }>;
652
+ /** Feature flags this extension provides */
653
+ features?: string[];
654
+ /** Whether to include API routes scaffolding */
655
+ includeRoutes?: boolean;
656
+ /** Whether to include services scaffolding */
657
+ includeServices?: boolean;
658
+ }
659
+ /**
660
+ * Available node categories with descriptions
661
+ */
662
+ declare const NODE_CATEGORIES: Record<NodeCategory, {
663
+ label: string;
664
+ description: string;
665
+ }>;
666
+ /**
667
+ * Available config field types with descriptions
668
+ */
669
+ declare const CONFIG_FIELD_TYPES: Record<ConfigFieldType, {
670
+ label: string;
671
+ description: string;
672
+ }>;
673
+ /**
674
+ * Common MUI icon names for workflow nodes
675
+ */
676
+ declare const COMMON_ICONS: string[];
677
+ /**
678
+ * Suggested colors for workflow nodes
679
+ */
680
+ declare const SUGGESTED_COLORS: {
681
+ orange: string;
682
+ blue: string;
683
+ green: string;
684
+ purple: string;
685
+ pink: string;
686
+ teal: string;
687
+ amber: string;
688
+ indigo: string;
689
+ cyan: string;
690
+ red: string;
691
+ grey: string;
692
+ lime: string;
693
+ };
694
+ /**
695
+ * Generate a valid extension ID from a name
696
+ */
697
+ declare function generateExtensionId(name: string): string;
698
+ /**
699
+ * Generate a complete extension package
700
+ */
701
+ declare function generateExtensionPackage(options: GenerateExtensionOptions): {
702
+ files: Array<{
703
+ path: string;
704
+ content: string;
705
+ }>;
706
+ metadata: ExtensionMetadata;
707
+ };
708
+
709
+ /**
710
+ * Create a configured NetPad MCP server instance.
711
+ * This factory function can be used by both the CLI (stdio) and remote (HTTP) servers.
712
+ *
713
+ * @param options - Optional configuration for the server
714
+ * @returns A configured McpServer instance
715
+ */
716
+ declare function createNetPadMcpServer(options?: {
717
+ name?: string;
718
+ version?: string;
719
+ }): McpServer;
720
+
721
+ export { ARCHITECTURE_GUIDE, COMMON_ICONS, CONFIG_FIELD_TYPES, type ConfigFieldType, DOCUMENTATION, EXAMPLES, FIELD_TYPES, FORMULA_FUNCTIONS, type GenerateExtensionOptions, NODE_CATEGORIES, type NodeCategory, OPERATORS, QUICK_START_GUIDE, SUGGESTED_COLORS, THEME_OPTIONS, VALIDATION_OPTIONS, createNetPadMcpServer, generateComputedField, generateConditionalLogic, generateExtensionId, generateExtensionPackage, generateFieldConfig, generateFormSchema, generateMultiPageConfig, validateFormConfig };