# libtmux_mcp.tools.server_tools.list_servers

- **Module:** libtmux_mcp.tools.server_tools
- **Package:** libtmux-mcp
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/tools/server_tools.py#L298
- **Page:** https://libtmux.org/en/py/latest/mcp/reference/libtmux_mcp-tools-server_tools-list_servers/

```
libtmux_mcp.tools.server_tools.list_servers(extra_socket_paths: list[str] | None = None) -> list[ServerInfo]
```

Discover live tmux servers under the current user's ``$TMUX_TMPDIR``.

Scans ``${TMUX_TMPDIR:-/tmp}/tmux-<uid>/`` for socket files — the
canonical location where tmux creates per-server sockets (see
tmux.c's ``expand_paths`` + ``TMUX_SOCK`` template). Only sockets
with a live listener are reported; stale inodes (a common case on
long-running systems where ``$TMUX_TMPDIR`` can carry thousands of
orphans) are silently filtered.

**Scope caveat**: custom ``tmux -S /some/path/...`` servers that
live OUTSIDE ``$TMUX_TMPDIR`` are not returned by the scan alone —
there is no canonical registry for arbitrary socket paths. Supply
known paths via ``extra_socket_paths`` to include them in the
result, or pass the path to other tools via their ``socket_name``
/ ``socket_path`` parameters once known.

## Parameters

- `extra_socket_paths` (list[str] | None): Additional filesystem paths to probe alongside the
``$TMUX_TMPDIR`` scan. Each path is checked for liveness (UNIX
``connect()``) and queried for server metadata. Paths that do
not exist, are not sockets, or have no listener are silently
skipped.

## Returns

list[ServerInfo]
    One entry per live tmux server found. Canonical-directory
    results come first, followed by successful ``extra_socket_paths``
    probes in the supplied order. Empty when nothing lives under
    ``$TMUX_TMPDIR`` and no extras are supplied or reachable.
