namespace MCPForUnity.Editor.Services { /// /// Interface for server management operations /// public interface IServerManagementService { /// /// Clear the local uvx cache for the MCP server package /// /// True if successful, false otherwise bool ClearUvxCache(); /// /// Start the local HTTP server headless (no terminal window), redirecting its output to a /// per-port launch log. Stops any existing server on the port and clears stale artifacts first. /// /// When true, skip confirmation dialogs (used by auto-start). /// True if server was started successfully, false otherwise bool StartLocalHttpServer(bool quiet = false); /// /// Gets the launch-log path for the configured local HTTP server port, or null if unavailable. /// string GetLocalHttpServerLaunchLogPath(); /// /// Returns true while the most-recently launched headless server process is still alive. /// Used by callers to keep waiting for reachability instead of declaring failure prematurely. /// bool IsManagedServerLaunchProcessAlive(); /// /// True when this domain launched the local HTTP server and still holds its Process /// handle. Handles do not survive domain reloads, so false also means "unknown" — /// callers should wait rather than fail fast. /// bool HasManagedServerLaunchHandle { get; } /// /// Writes a launch-failure report to the Console (Error): the tail of the launch log, /// the log path, and a copy-command hint pointing at the Manual Server Launch foldout. /// void LogLocalHttpServerLaunchFailure(); /// /// Stop the local HTTP server by finding the process listening on the configured port /// bool StopLocalHttpServer(); /// /// Stop the Unity-managed local HTTP server if a handshake/pidfile exists, /// even if the current transport selection has changed. /// bool StopManagedLocalHttpServer(); /// /// Best-effort detection: returns true if a local MCP HTTP server appears to be running /// on the configured local URL/port (used to drive UI state even if the session is not active). /// bool IsLocalHttpServerRunning(); /// /// Fast reachability check: returns true if a local TCP listener is accepting connections /// for the configured local URL/port (used for UI state without process inspection). /// bool IsLocalHttpServerReachable(); /// /// Attempts to get the command that will be executed when starting the local HTTP server /// /// The command that will be executed when available /// Reason why a command could not be produced /// True if a command is available, false otherwise bool TryGetLocalHttpServerCommand(out string command, out string error); /// /// Check if the configured HTTP URL is a local address /// /// True if URL is local (localhost, 127.0.0.1, etc.) bool IsLocalUrl(); /// /// Check if the local HTTP server can be started /// /// True if HTTP transport is enabled and URL satisfies local launch security policy bool CanStartLocalServer(); } }