UNPKG

@hivetechs/hive-ai

Version:

Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API

102 lines (101 loc) 2.53 kB
/** * MCP Port Manager for Hive AI HTTP+SSE Transport * * Manages port allocation, conflict detection, and configuration * for the HTTP+SSE MCP server across different environments. */ export interface PortManagerOptions { defaultPort?: number; portRange?: { min: number; max: number; }; } export interface PortStatus { port: number; available: boolean; inUse: boolean; processInfo?: string; } export interface PortConfiguration { port: number; autoDetected: boolean; lastUpdated: string; } export declare class MCPPortManager { private defaultPort; private portRange; constructor(options?: PortManagerOptions); /** * Check if a specific port is available */ isPortAvailable(port: number): Promise<boolean>; /** * Get detailed information about a port */ getPortStatus(port: number): Promise<PortStatus>; /** * Get process information for a port */ private getProcessInfoForPort; /** * Get process name by PID */ private getProcessName; /** * Find an available port within the configured range */ findAvailablePort(): Promise<number>; /** * Get OS-assigned available port (bulletproof for all users globally) */ private getOSAssignedPort; /** * Get the configured port from database */ getConfiguredPort(): Promise<number | null>; /** * Save port configuration to database */ savePortConfiguration(port: number, autoDetected?: boolean): Promise<void>; /** * Get current port configuration */ getPortConfiguration(): Promise<PortConfiguration | null>; /** * Simple port availability check with fallback */ resolvePortConflict(): Promise<{ resolved: boolean; port: number; changes: string[]; }>; /** * Get the best port to use for the current environment */ getBestPort(): Promise<{ port: number; reason: string; }>; /** * Validate port configuration */ validatePort(port: number): Promise<{ valid: boolean; error?: string; }>; /** * Get simple port status report */ getPortReport(): Promise<{ currentPort?: number; defaultPort: number; portRange: { min: number; max: number; }; availablePorts: number[]; configuration?: PortConfiguration; }>; } export default MCPPortManager;