scrn-mgr
A GNU screen session manager: CLI first, with a Rich/Textual TUI and an
MCP server, so sessions can be driven the same way from a terminal, a
human-friendly UI, or an AI assistant. Sessions can live on the local
machine or on remote nodes reachable over SSH -- scrn-mgr keeps a small
registry at ~/.scrn-mgr/registry.json recording which host (hostname +
best-effort IP) each session is on. That registry can itself be shared
across a cluster (e.g. a networked $HOME): every operation figures out
whether a recorded host is actually this machine and runs screen
directly when it is, or over SSH (by hostname, falling back to the
recorded IP) when it isn't.
Install
pip install scrn-mgr
Development
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest -q
Quick start (Python API)
from scrn_mgr import ScreenSessionManager
manager = ScreenSessionManager()
manager.new_session("work") # local
manager.new_session("train", host="user@gpu01") # remote, over SSH
manager.send_command("work", "python script.py")
output = manager.capture("work")
CLI usage
scrn-mgr new work # alias: create
scrn-mgr new train --host user@gpu01 # started on a remote node over SSH
scrn-mgr send work "echo hello"
scrn-mgr send-commands work -c "echo 1" -c "echo 2"
scrn-mgr send-file work script.sh
scrn-mgr capture work
scrn-mgr list --all
scrn-mgr attach work # interactive; ssh -t under the hood if remote
scrn-mgr new-or-attach work # alias: create-or-attach
scrn-mgr kill work
scrn-mgr cleanup work # or: scrn-mgr cleanup --all
scrn-mgr tui # Textual UI (alias: scrn-mgr-tui)
scrn-mgr serve # MCP server (stdio)
MCP server
scrn-mgr serve runs an MCP server over stdio exposing every non-interactive
operation: list_sessions, new_session, send_command, send_commands,
send_file, capture, cleanup_session, kill_session. Interactive
attach is intentionally not exposed over MCP -- it needs to take over a
real terminal/PTY for the life of the session, which doesn't fit a single
tool call/response. Use the CLI (scrn-mgr attach NAME) or the TUI for that.
Because the MCP server always runs locally next to its client and reaches
remote sessions the same way the CLI does (one ssh round trip per call,
using the host recorded in the registry), no special transport is needed for
SSH-remote sessions -- plain stdio is sufficient.
Example client config:
{
"mcpServers": {
"scrn-mgr": {
"command": "scrn-mgr",
"args": ["serve"]
}
}
}
Configuration
| Variable | Effect |
|---|---|
SCRN_MGR_HOME |
Overrides the state directory (default ~/.scrn-mgr) that holds registry.json and its lock file |
Clusters and shared registries
A session's host is recorded automatically: with no --host, scrn-mgr
detects this machine's real hostname ($HOST, then $HOSTNAME, then
socket.gethostname()) and its resolved IP, rather than a bare "local"
placeholder. This matters when ~/.scrn-mgr lives on shared storage (a
networked $HOME across a cluster): every command -- from any node -- can
tell whether a session's recorded host is the machine it's currently
running on, and:
- If it is (including landing back on the exact node that created it),
everything runs
screendirectly, no SSH involved. - If it isn't,
list/send/capture/kill/cleanuptransparently go over SSH to that host (by hostname, falling back to the recorded IP). A session whose host can't currently be reached shows statusunknownrather thandead-- it just means the check couldn't be done, not that the session is gone. attachneeds a real terminal, so it isn't attempted blindly over SSH to a host we can't otherwise confirm is reachable in the same way: if the session isn't on this machine,scrn-mgr attach NAMErunsssh -t <host> screen -r NAME, and if that SSH connection itself fails, it suggests connecting manually (ssh <host>, thenscrn-mgr attach NAMEthere) instead of just erroring out.
Requirements
- Python 3.10+
- The
screenbinary (brew install screen/apt install screen) - For remote sessions: SSH access to the target host (via your normal
~/.ssh/config) withscreeninstalled there too
Releasing
Pushing a v* tag runs .github/workflows/release.yml,
which builds the sdist/wheel, publishes them to PyPI via
Trusted Publishing (no stored
secrets), and attaches the build artifacts to a GitHub release.
One-time setup (already done for this repo, kept here for reference): on the PyPI project's "Publishing" settings (or, for the very first release, on https://pypi.org/manage/account/publishing/), add a trusted publisher with:
| Field | Value |
|---|---|
| PyPI project name | scrn-mgr |
| Owner | this repository's GitHub owner (user or org) |
| Repository name | scrn-mgr |
| Workflow name | release.yml |
| Environment name | pypi |
Cutting a release:
# 1. bump the version in pyproject.toml, e.g. 0.1.0 -> 0.1.1, and commit it
git commit -am "Bump version to 0.1.1"
# 2. tag it (must match pyproject.toml's version, with a v prefix) and push both
git push
git tag v0.1.1
git push origin v0.1.1
The workflow refuses to publish if the tag and pyproject.toml's version
disagree.
Metadata
Release files for scrn-mgr 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrn_mgr-0.1.2.tar.gz | 21.4 kB | With provenance | Details for scrn_mgr-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrn_mgr-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for scrn_mgr-0.1.2-py3-none-any.whl |
Total release size: 42.1 kB
Release files / scrn_mgr-0.1.2.tar.gz
| Download URL | scrn_mgr-0.1.2.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6513b2aa2cfc8f38881af6ee11ebdcc6e15adb5752676ff1d96a3bc9a43a9ba
|
|
BLAKE2b-256 checksum How to use checksums |
adc83145057a6bec7d9155051003aebfe995b8da0f9c36c0f7dbbbf5b5f41aa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logRelease files / scrn_mgr-0.1.2-py3-none-any.whl
| Download URL | scrn_mgr-0.1.2-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e70453d0632363ff352631749df236f858bfad5c62ac242f902cb48801c053a
|
|
BLAKE2b-256 checksum How to use checksums |
f590a6748eca8e82e2135a8442df354aa199f74e89cf848f14af6165a29f77ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logSecurity for scrn-mgr 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for scrn_mgr-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.