/** * Container orchestrator abstraction. Implementations can back onto Docker, Podman, or Kubernetes. */ export interface ContainerSpec { /** Docker/OCI image reference */ image: string; /** Human-readable name (used as container name prefix) */ name: string; /** Custom command to run (overrides image CMD) */ command?: string[]; /** Environment variables */ env?: Record; /** Host port to bind (null = auto-assign) */ hostPort?: number | null; /** Container port to expose */ containerPort?: number; /** Memory limit in bytes (default: 512 MB) */ memoryLimit?: number; /** CPU period quota (nanoCPUs, default: 0.5 CPU) */ nanoCpus?: number; /** Labels for identification / filtering */ labels?: Record; /** Network name to attach to */ network?: string; } export interface ContainerInfo { containerId: string; name: string; state: 'running' | 'stopped' | 'starting' | 'error' | 'unknown'; port?: number; createdAt: Date; } export interface ContainerLogs { stdout: string; stderr: string; } export interface McpOrchestrator { /** Pull an image if not present locally */ pullImage(image: string): Promise; /** Create and start a container */ createContainer(spec: ContainerSpec): Promise; /** Stop a running container */ stopContainer(containerId: string, timeoutSeconds?: number): Promise; /** Remove a stopped container */ removeContainer(containerId: string, force?: boolean): Promise; /** Get container info */ inspectContainer(containerId: string): Promise; /** Get container logs */ getContainerLogs(containerId: string, opts?: { tail?: number; since?: number }): Promise; /** Check if the orchestrator runtime is available */ ping(): Promise; } /** Default resource limits */ export const DEFAULT_MEMORY_LIMIT = 512 * 1024 * 1024; // 512 MB export const DEFAULT_NANO_CPUS = 500_000_000; // 0.5 CPU