import { z } from 'zod'; import { Tool } from '@modelcontextprotocol/sdk/types.js'; /** * MCP Server Type Definitions * * Shared types for the Model Context Protocol server infrastructure, * tool registry, and server management. */ export interface MCPTool extends Tool { category: ToolCategory; requiresConnection: boolean; requiresVersion?: string; handler: ToolHandler; } export declare enum ToolCategory { CONNECTION = "connection", DEVICES = "devices", CLIENTS = "clients", FIREWALL_LEGACY = "firewall-legacy", FIREWALL_ZBF = "firewall-zbf", NETWORKS = "networks", GROUPS = "groups", MONITORING = "monitoring", AUTOMATION = "automation" } export type ToolHandler = (params: Record) => Promise; export interface ToolResult { success: boolean; data?: any; error?: { code: string; message: string; details?: any; }; warnings?: string[]; metadata?: { executionTime: number; timestamp: Date; version?: string; }; } export declare const ServerConfigSchema: z.ZodObject<{ name: z.ZodDefault; version: z.ZodDefault; description: z.ZodOptional; author: z.ZodOptional; capabilities: z.ZodDefault; resources: z.ZodDefault; prompts: z.ZodDefault; }, "strip", z.ZodTypeAny, { tools: boolean; resources: boolean; prompts: boolean; }, { tools?: boolean | undefined; resources?: boolean | undefined; prompts?: boolean | undefined; }>>; features: z.ZodDefault; enableLegacyFirewall: z.ZodDefault; enableMonitoring: z.ZodDefault; enableAutomation: z.ZodDefault; enableCache: z.ZodDefault; }, "strip", z.ZodTypeAny, { enableZBFTools: boolean; enableLegacyFirewall: boolean; enableMonitoring: boolean; enableAutomation: boolean; enableCache: boolean; }, { enableZBFTools?: boolean | undefined; enableLegacyFirewall?: boolean | undefined; enableMonitoring?: boolean | undefined; enableAutomation?: boolean | undefined; enableCache?: boolean | undefined; }>>; rateLimit: z.ZodDefault; concurrent: z.ZodDefault; }, "strip", z.ZodTypeAny, { perMinute: number; concurrent: number; }, { perMinute?: number | undefined; concurrent?: number | undefined; }>>; cache: z.ZodDefault; maxSize: z.ZodDefault; }, "strip", z.ZodTypeAny, { ttlSeconds: number; maxSize: number; }, { ttlSeconds?: number | undefined; maxSize?: number | undefined; }>>; }, "strip", z.ZodTypeAny, { name: string; version: string; capabilities: { tools: boolean; resources: boolean; prompts: boolean; }; features: { enableZBFTools: boolean; enableLegacyFirewall: boolean; enableMonitoring: boolean; enableAutomation: boolean; enableCache: boolean; }; rateLimit: { perMinute: number; concurrent: number; }; cache: { ttlSeconds: number; maxSize: number; }; description?: string | undefined; author?: string | undefined; }, { name?: string | undefined; version?: string | undefined; description?: string | undefined; author?: string | undefined; capabilities?: { tools?: boolean | undefined; resources?: boolean | undefined; prompts?: boolean | undefined; } | undefined; features?: { enableZBFTools?: boolean | undefined; enableLegacyFirewall?: boolean | undefined; enableMonitoring?: boolean | undefined; enableAutomation?: boolean | undefined; enableCache?: boolean | undefined; } | undefined; rateLimit?: { perMinute?: number | undefined; concurrent?: number | undefined; } | undefined; cache?: { ttlSeconds?: number | undefined; maxSize?: number | undefined; } | undefined; }>; export type ServerConfig = z.infer; export interface ConnectionState { isConnected: boolean; isAuthenticated: boolean; lastConnected?: Date; lastError?: string; retryCount: number; gatewayInfo?: { ip: string; version: string; model: string; siteId: string; }; } export interface ConnectionPool { primary: ConnectionState; backup?: ConnectionState; healthCheck: { lastCheck: Date; isHealthy: boolean; latency: number; }; } export interface FeatureCapabilities { version: string; supportsZBF: boolean; supportsLegacyFirewall: boolean; supportedEndpoints: string[]; deprecatedEndpoints: string[]; hardwareCapabilities: { model: string; supportsAdvancedFirewall: boolean; maxFirewallRules: number; maxZones: number; }; } export interface ToolAvailability { [toolName: string]: { available: boolean; reason?: string; alternativeTool?: string; minimumVersion?: string; }; } export declare enum ErrorCode { CONNECTION_FAILED = "CONNECTION_FAILED", AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED", NETWORK_TIMEOUT = "NETWORK_TIMEOUT", SSL_ERROR = "SSL_ERROR", API_KEY_INVALID = "API_KEY_INVALID", API_RATE_LIMITED = "API_RATE_LIMITED", API_ENDPOINT_NOT_FOUND = "API_ENDPOINT_NOT_FOUND", API_PERMISSION_DENIED = "API_PERMISSION_DENIED", FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED", HARDWARE_INCOMPATIBLE = "HARDWARE_INCOMPATIBLE", VERSION_INCOMPATIBLE = "VERSION_INCOMPATIBLE", VALIDATION_ERROR = "VALIDATION_ERROR", PARAMETER_MISSING = "PARAMETER_MISSING", PARAMETER_INVALID = "PARAMETER_INVALID", RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND", RESOURCE_CONFLICT = "RESOURCE_CONFLICT", RESOURCE_LIMIT_EXCEEDED = "RESOURCE_LIMIT_EXCEEDED", INTERNAL_ERROR = "INTERNAL_ERROR", CONFIG_ERROR = "CONFIG_ERROR", CACHE_ERROR = "CACHE_ERROR", INITIALIZATION_ERROR = "INITIALIZATION_ERROR", TOOL_REGISTRATION_ERROR = "TOOL_REGISTRATION_ERROR", TOOL_NOT_FOUND = "TOOL_NOT_FOUND", TOOL_DISABLED = "TOOL_DISABLED", CONNECTION_REQUIRED = "CONNECTION_REQUIRED", FEATURE_NOT_AVAILABLE = "FEATURE_NOT_AVAILABLE", EXECUTION_ERROR = "EXECUTION_ERROR", UNKNOWN_FEATURE = "UNKNOWN_FEATURE", CAPABILITY_DETECTION_FAILED = "CAPABILITY_DETECTION_FAILED", INVALID_DATA = "INVALID_DATA", SYSTEM_INFO_ERROR = "SYSTEM_INFO_ERROR", RULE_CREATION_FAILED = "RULE_CREATION_FAILED", RULE_UPDATE_FAILED = "RULE_UPDATE_FAILED", RULE_DELETION_FAILED = "RULE_DELETION_FAILED", RULE_TOGGLE_FAILED = "RULE_TOGGLE_FAILED", BLOCK_FAILED = "BLOCK_FAILED", UNBLOCK_FAILED = "UNBLOCK_FAILED", KICK_FAILED = "KICK_FAILED", RESTART_FAILED = "RESTART_FAILED", ADOPTION_FAILED = "ADOPTION_FAILED", UPGRADE_FAILED = "UPGRADE_FAILED" } export interface CacheEntry { key: string; data: T; createdAt: Date; expiresAt: Date; hits: number; category: string; } export interface CacheStats { totalEntries: number; hitRate: number; missRate: number; evictions: number; memoryUsage: number; categories: Record; } export declare enum CacheCategory { SYSTEM_INFO = "system_info", DEVICE_LIST = "device_list", CLIENT_LIST = "client_list", NETWORK_CONFIG = "network_config", FIREWALL_RULES = "firewall_rules", ZONE_POLICIES = "zone_policies", STATISTICS = "statistics" } export interface RateLimitEntry { key: string; requests: number; resetTime: Date; category: string; } export interface RateLimitConfig { perMinute: number; concurrent: number; burstAllowance: number; backoffMultiplier: number; } export declare enum LogLevel { ERROR = "error", WARN = "warn", INFO = "info", DEBUG = "debug", TRACE = "trace" } export interface LogEntry { timestamp: Date; level: LogLevel; message: string; category: string; metadata?: Record; error?: Error; requestId?: string; toolName?: string; executionTime?: number; } export interface ServerMetrics { uptime: number; totalRequests: number; successfulRequests: number; failedRequests: number; averageResponseTime: number; activeConnections: number; cacheStats: CacheStats; toolUsage: Record; errorCounts: Record; lastUpdated: Date; } export interface ToolRegistryEntry { tool: MCPTool; registered: Date; enabled: boolean; usageCount: number; lastUsed?: Date; averageExecutionTime: number; errorCount: number; dependencies: string[]; } export interface ToolRegistry { tools: Map; categories: Map; dependencies: Map; } export interface HealthCheckResult { name: string; status: 'healthy' | 'warning' | 'unhealthy'; message: string; details?: Record; timestamp: Date; responseTime: number; } export interface SystemHealth { overall: 'healthy' | 'warning' | 'unhealthy'; checks: HealthCheckResult[]; uptime: number; version: string; timestamp: Date; } export interface PluginManifest { name: string; version: string; description: string; author: string; tools: string[]; dependencies: string[]; apiVersion: string; } export interface PluginContext { unifiClient: any; logger: any; config: ServerConfig; cache: any; } export interface Plugin { manifest: PluginManifest; initialize(context: PluginContext): Promise; getTools(): MCPTool[]; shutdown(): Promise; } declare const ToolResultSchema: z.ZodObject<{ success: z.ZodBoolean; data: z.ZodOptional; error: z.ZodOptional; }, "strip", z.ZodTypeAny, { code: string; message: string; details?: any; }, { code: string; message: string; details?: any; }>>; warnings: z.ZodOptional>; metadata: z.ZodOptional; }, "strip", z.ZodTypeAny, { executionTime: number; timestamp: Date; version?: string | undefined; }, { executionTime: number; timestamp: Date; version?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { success: boolean; error?: { code: string; message: string; details?: any; } | undefined; data?: any; warnings?: string[] | undefined; metadata?: { executionTime: number; timestamp: Date; version?: string | undefined; } | undefined; }, { success: boolean; error?: { code: string; message: string; details?: any; } | undefined; data?: any; warnings?: string[] | undefined; metadata?: { executionTime: number; timestamp: Date; version?: string | undefined; } | undefined; }>; declare const HealthCheckResultSchema: z.ZodObject<{ name: z.ZodString; status: z.ZodEnum<["healthy", "warning", "unhealthy"]>; message: z.ZodString; details: z.ZodOptional>; timestamp: z.ZodDate; responseTime: z.ZodNumber; }, "strip", z.ZodTypeAny, { message: string; status: "warning" | "healthy" | "unhealthy"; name: string; timestamp: Date; responseTime: number; details?: Record | undefined; }, { message: string; status: "warning" | "healthy" | "unhealthy"; name: string; timestamp: Date; responseTime: number; details?: Record | undefined; }>; export type Awaitable = T | Promise; export type DeepPartial = { [P in keyof T]?: T[P] extends object ? DeepPartial : T[P]; }; export type RequiredKeys = T & Required>; export type OptionalKeys = Omit & Partial>; export { ToolResultSchema, HealthCheckResultSchema }; //# sourceMappingURL=types.d.ts.map