/** * @ng-forge/dynamic-form-mcp * * MCP server for ng-forge dynamic forms - AI-assisted form schema generation * @packageDocumentation */ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; export declare interface AddonTypeInfo { /** Discriminant matching `addon.type` in form configs. */ type: string; /** Source category — core ships from the library, adapter from a UI-integration package. */ category: 'core' | 'adapter'; /** Provider package; `'core'` means @ng-forge/dynamic-forms. */ package: string; /** Adapter that ships this type, or `null` for core types. */ adapter: UiIntegration | null; /** One-line description of what this type renders. */ description: string; /** * Whether the type survives `JSON.stringify`/`parse`. JSON-safe types may * be referenced from server-driven configs; code-only types are dropped by * the lenient validator when the config came from JSON. */ jsonSafe: boolean; /** Per-type config props (excludes universal `slot`, `className`, `hidden`, `disabled`). */ props: Record; /** Full inline example for documentation. */ example: string; /** Minimal valid config (just required props). */ minimalExample: string; } /** Create and configure the MCP server */ export declare function createServer(): McpServer; /** * Per-field-type addon support metadata. Records which slots and types a * field type accepts at runtime — feeds the validator's allowed-list checks. */ export declare interface FieldAddonSupportInfo { /** Field type discriminant (matches `FieldDef.type`). */ fieldType: string; /** Adapter shipping the field — null for core fields. */ adapter: UiIntegration | null; /** Slots this field accepts. */ slots: ('prefix' | 'suffix' | string)[]; /** Whitelist of allowed types (omitted = any registered type). */ allowedTypes?: string[]; } export declare interface FieldTypeInfo { type: string; category: 'value' | 'container' | 'button' | 'display'; description: string; valueType?: string; baseInterface?: string; props: Record; validationSupported: boolean; example: string; /** Field types that this container can contain (for containers only) */ canContain?: string[]; /** Field types that this container CANNOT contain (for containers only) */ cannotContain?: string[]; /** Where this field type is allowed to be placed */ allowedIn?: string[]; /** Where this field type is NOT allowed to be placed */ notAllowedIn?: string[]; /** Whether this field type is part of core library or requires an adapter */ source: 'core' | 'adapter'; /** Minimal valid example (just required properties) */ minimalExample?: string; } /** * Formatted validation error for easy consumption. */ export declare interface FormattedValidationError { /** * Path to the invalid field (e.g., 'fields[0].props.type'). */ path: string; /** * Error message. */ message: string; /** * Expected value or type. */ expected?: string; /** * Received value. */ received?: string; } /** Look up a single addon type by its discriminant. */ export declare function getAddonType(type: string): AddonTypeInfo | undefined; /** Get every registered addon type. */ export declare function getAddonTypes(): AddonTypeInfo[]; /** Filter addon types by source (`'core'` / `'adapter'`). */ export declare function getAddonTypesByCategory(category: 'core' | 'adapter'): AddonTypeInfo[]; /** Get the per-field-type addon support map. */ export declare function getFieldAddonSupport(): FieldAddonSupportInfo[]; /** Get a specific field type by name */ export declare function getFieldType(type: string): FieldTypeInfo | undefined; /** Get all available field types */ export declare function getFieldTypes(): FieldTypeInfo[]; /** Get field types by category */ export declare function getFieldTypesByCategory(category: 'value' | 'container' | 'button' | 'display'): FieldTypeInfo[]; /** * Get the JSON Schema for a form configuration. * * @param uiIntegration - The UI framework integration to use * @param options - Optional JSON Schema generation options * @returns JSON Schema for the form configuration * * @example * ```typescript * const jsonSchema = getFormConfigJsonSchema('material'); * // Use in MCP tool definition or LLM prompts * ``` */ export declare function getFormConfigJsonSchema(uiIntegration: UiIntegration, options?: JsonSchemaOptions): JsonSchemaType; /** * Get the JSON Schema for all leaf fields of a UI integration (full union). * * WARNING: This returns a large schema (~258KB). Consider using * getFieldTypeJsonSchema() for individual field types instead. * * @param uiIntegration - The UI framework integration * @returns JSON Schema for all leaf field types */ export declare function getLeafFieldJsonSchema(uiIntegration: UiIntegration): JsonSchemaType; /** Get a specific UI adapter by library name */ export declare function getUIAdapter(library: UiIntegration): UIAdapterInfo | undefined; /** Get UI adapter field type configuration */ export declare function getUIAdapterFieldType(library: UiIntegration, fieldType: string): UIAdapterFieldType | undefined; /** Get all UI adapters */ export declare function getUIAdapters(): UIAdapterInfo[]; /** Get a specific validator by type */ export declare function getValidator(type: string): ValidatorInfo | undefined; /** Get all available validators */ export declare function getValidators(): ValidatorInfo[]; /** Get validators by category */ export declare function getValidatorsByCategory(category: 'built-in' | 'custom' | 'async' | 'http'): ValidatorInfo[]; /** * Type guard for checking if a value is a valid form config for an integration. */ export declare function isValidFormConfig(uiIntegration: UiIntegration, config: unknown): boolean; /** * Options for JSON Schema generation. */ declare interface JsonSchemaOptions { /** * Name for the schema (used in $id). */ name?: string; /** * Base URI for $ref resolution. */ basePath?: string; } /** * JSON Schema type (simplified for export). */ declare type JsonSchemaType = Record; export declare interface PropertyInfo { name: string; type: string; description: string; required: boolean; default?: unknown; } /** Run the MCP server with stdio transport */ export declare function runStdioServer(): Promise; export declare const SERVER_NAME = "ng-forge-mcp"; export declare const SERVER_VERSION: string; export declare interface UIAdapterFieldType { type: string; componentName: string; additionalProps: Record; } export declare interface UIAdapterInfo { library: string; package: string; fieldTypes: UIAdapterFieldType[]; providerFunction: string; } /** * Supported UI integrations for form config schemas. */ export declare type UiIntegration = 'material' | 'bootstrap' | 'primeng' | 'ionic'; export declare function validateFormConfig(uiIntegration: UiIntegration, config: unknown): ValidationResult; /** * Validation result for form configuration. */ export declare interface ValidationResult { /** * Whether the configuration is valid. */ valid: boolean; /** * Parsed configuration if valid, undefined otherwise. */ data?: unknown; /** * Validation errors if invalid. */ errors?: FormattedValidationError[]; /** * Human-readable error summary. */ errorSummary?: string; } export declare interface ValidatorInfo { type: string; category: 'built-in' | 'custom' | 'async' | 'http'; description: string; parameters: Record; example: string; } export { }