Skip to main content

Module spawn

Module spawn 

Source
Expand description

Spawn the daemon as a detached background process.

When an MCP client starts and no daemon is running, it spawns one using the current binary with the daemon subcommand. The spawned process is fully detached so it outlives the parent MCP session.

Functions§

client_should_take_over
Pure version comparison: returns true if the client should take over the daemon. Only returns true when both versions parse successfully AND client > daemon. Unparseable versions or equal/older client always return false (reuse daemon).
ensure_daemon
Ensure a daemon is running and return its info. If a daemon is found (via discovery file or port scan), we MAY take it over if the client is newer. Otherwise we spawn a fresh daemon on the first free port in the scan range.