troll 0.4.0

The port manager that guards the bridge: permanent claims, expiring leases, and a live view of who listens where.
troll-0.4.0 is not a library.

troll port manager banner

troll

The port manager for one machine: permanent TCP & UDP claims, expiring leases, and a live view of who listens where (including passive read-only Docker/Podman container attribution). One Rust binary providing the CLI, local HTTP API, embedded three-screen web console, and MCP stdio server across Linux (x86_64 & arm64), macOS (arm64 & x86_64), and Windows (x86_64).

Install

  • Cargo (Linux, macOS, Windows):
cargo install troll --locked
  • Shell installer (Linux & macOS, SHA-256 verified):
curl -fsSL https://raw.githubusercontent.com/michelabboud/troll/main/scripts/install.sh | sh
  • PowerShell installer (Windows, SHA-256 verified):
irm https://raw.githubusercontent.com/michelabboud/troll/main/scripts/install.ps1 | iex
  • Homebrew (macOS & Linux):
brew tap michelabboud/troll https://github.com/michelabboud/troll
brew install michelabboud/troll/troll

Prebuilt archives (x86_64-linux, aarch64-linux, aarch64-macos, x86_64-macos, x86_64-windows + SHA256SUMS.txt) are also published on GitHub Releases, and WinGet manifests live in packaging/winget/.

Quick start

troll init
troll check 8123
troll claim 8123 --project demo --service web
troll lease --project demo --purpose preview --json
troll with --project demo -- sh -c 'printf "Leased port %s\n" "$PORT"'
troll explain 8123
troll list
troll doctor
troll serve

Four surfaces, one locked registry

  • Command line (troll ...): manage TCP & UDP claims (--proto tcp|udp), leases, named [pools], apps, declarative troll.toml (sync), atomic env --write, red zones, 30-day removal history (with atomic restore), drift inspection, explain, and doctor. Add --json for machine output or --llm-guide for agent instructions.
  • Web console (troll serve): local loopback HTTP API and embedded three-screen browser console (Console, Apps, History) with six themes, passive service detection, and one-click copy/restore actions.
  • MCP server (troll mcp): Model Context Protocol server over stdio for coding agents (troll setup claude / troll setup codex).
  • Background service (troll setup service): writes a systemd user unit on Linux, a launchd user agent plist on macOS, or a Task Scheduler XML definition on Windows.

troll web console screenshot

Guarantees

  • Never kills arbitrary processes: sweeps remove only reclaimable leases from registry.toml and leave running processes alone (the sole documented signal exception is troll with forwarding a received stop signal unchanged to its own child).
  • Safe locked writes: file-locked atomic updates with a backup copy on every change.
  • Loopback only: troll serve binds 127.0.0.1, enforces an exact Host allowlist, and requires a session token and matching Origin for mutations.
  • Zero unsafe code across the workspace.

Workspace crates

This binary crate is built on two companion library crates:

  • troll (this crate) — CLI, troll serve HTTP API + embedded web console, troll mcp stdio server, setup wizard, and OS service installers.
  • troll-core — platform-free registry model, file-locked atomic store, claims, leases, pools, red zones, 30-day history, drift, and sweep engine.
  • troll-probe — read-only OS listener, ephemeral/excluded range, process liveness, and owner-classification probe for Linux, macOS, and Windows.

Documentation

Licence

MIT — see LICENSE.