Build the side-effect-free launch descriptor for the active profile.
Source code in packages/axm-mcp/src/axm_mcp/daemon.py
| Python |
|---|
| def daemon_descriptor() -> Mapping[str, Mapping[str, object]]:
"""Build the side-effect-free launch descriptor for the active profile."""
profile = current_profile()
port = resolve_http_port()
pid_file = resolve_pid_file()
environment = {"AXM_PROFILE": profile}
explicit_port = os.environ.get("AXM_MCP_PORT")
if explicit_port is not None:
environment["AXM_MCP_PORT"] = explicit_port
#: The liveness path, not the bare origin: the server answers `/` with 404,
#: which a supervisor reads as unresponsive. It then reports a live server
#: as stopped and its caller starts a second one, which dies on the address
#: already in use.
probe = {"kind": "http", "url": health_url("127.0.0.1", port)}
service: dict[str, object] = {
"argv": ["axm-mcp", "serve", "--port", str(port)],
"pid_file": str(pid_file),
"log_file": str(pid_file.with_name("mcp-server.log")),
"probe": probe,
"environment": environment,
}
return {_service_id(profile): service}
|