Skip to content

Settings

settings

Runtime settings for the MCP serving process.

health_url(host, port)

Build the liveness URL a supervisor or the CLI should poll.

Source code in packages/axm-mcp/src/axm_mcp/settings.py
Python
def health_url(host: str, port: int) -> str:
    """Build the liveness URL a supervisor or the CLI should poll."""
    return f"http://{host}:{port}{HEALTH_PATH}"

resolve_http_port()

Resolve the MCP HTTP port for the active state profile.

A listening point is a profile-owned resource, so the decision belongs to :func:axm_config.service_port: it keeps the adopted 9427 under production, derives a per-profile port elsewhere, and still honours the historical AXM_MCP_PORT variable through its alias registry. Reading that variable here as well would race that precedence instead of deferring to it.

Source code in packages/axm-mcp/src/axm_mcp/settings.py
Python
def resolve_http_port() -> int:
    """Resolve the MCP HTTP port for the active state profile.

    A listening point is a profile-owned resource, so the decision belongs to
    :func:`axm_config.service_port`: it keeps the adopted 9427 under
    production, derives a per-profile port elsewhere, and still honours the
    historical ``AXM_MCP_PORT`` variable through its alias registry. Reading
    that variable here as well would race that precedence instead of
    deferring to it.
    """
    return service_port("mcp")

resolve_pid_file()

Resolve the MCP server PID file for the active profile.

Source code in packages/axm-mcp/src/axm_mcp/settings.py
Python
def resolve_pid_file() -> Path:
    """Resolve the MCP server PID file for the active profile."""
    root = profile_root()
    if root is not None:
        return root / "mcp-server.pid"
    return Path.home() / ".axm" / "mcp-server.pid"

resolve_serve_mode(explicit=None)

Resolve serving mode with explicit > environment > file > default.

Source code in packages/axm-mcp/src/axm_mcp/settings.py
Python
def resolve_serve_mode(explicit: str | None = None) -> ServeMode:
    """Resolve serving mode with explicit > environment > file > default."""
    resolved = (
        explicit
        if explicit is not None
        else get("mcp", "serve_mode", default="dedicated")
    )
    match resolved:
        case "shared":
            return "shared"
        case "dedicated":
            return "dedicated"
        case _:
            msg = f"invalid serve mode: {resolved!r}"
            raise ValueError(msg)