LabscoMCP early access ↗
abda11ahMCP SERVER

Serencp

Type into a VM's serial console and read what comes back — with a live terminal window opened alongside.

by abda11ah ↗Editors, Terminals & Local Dev EnvironmentCommunity

LABSCO SUMMARY

It survives the VM going away, which is the whole problem with serial consoles.

A disconnect triggers an automatic restart with exponential backoff — starting at 1 second, capped at 60, tracked per VM and reset on a successful connection — so a rebooting guest does not turn into a reconnection storm. The ring buffer holds the last 1000 lines within a 10MB cap per VM, and a newly attached client is sent 60 lines of history, which is what makes joining midway through useful rather than confusing.

What it is

A Perl bridge between an MCP client and a virtual machine's serial console. It holds a pseudo-terminal open against the VM's console port and exposes two Unix sockets, one for input and one for output, so an agent and a human can both be attached at once.

What you get

  • start opens the bridge for a named VM on a port, and spawns a graphical terminal window attached to the same session so you can watch what the agent is doing
  • write sends a command to the console, and read returns whatever the console has produced
  • status reports whether the bridge is running and how much is buffered; stop tears down the pseudo-terminal, child processes and sockets
  • Live output arrives as MCP resource notifications on a vm://<vm_name>/output URI once the client subscribes, so you are not obliged to poll
  • Terminal detection covers Ghostty, WezTerm, iTerm, Terminal.app, kitty, alacritty, foot, konsole, gnome-terminal, tilix, terminator, xfce4-terminal, xterm and urxvt, with an override if you want a specific one
  • Binary output from the VM is converted to UTF-8 safely, with non-printable characters escaped rather than breaking the transport

Requirements

A Unix-like system — Linux, macOS or BSD; Windows is not supported except through WSL. Perl with the IO::Pty module. A VM whose serial console is bound to a TCP port, with the default starting at 4555, and a guest configured to run a getty on that serial line. No root permissions needed. The client launches it as perl serencp.pl; an experimental variant serves the same five tools over streamable HTTP on port 8080 instead.

Setup effort

Build from source — Install the non-core Perl module IO::Pty, e.g. cpan IO::Pty