Skip to main content
The Mirage server is a FastAPI app. It holds workspaces and serves them over the HTTP routes, MCP and RPC, and over SSH when ssh_port is set. The TypeScript server speaks the same protocol, so a client of one works against the other.

Install

The ssh extra adds asyncssh, needed only for the SSH server.

Run it

build_app returns the app. Run it with any ASGI server; it serves until you stop it.

Started by the CLI

The CLI runs the same app as a daemon, mirage.server.daemon:app, on 127.0.0.1:8765 in local auth mode, logging to ~/.mirage/daemon.log. That entry adds the two daemon behaviors: it writes $MIRAGE_HOME/daemon.pid for mirage daemon stop and kill, and exits 30 seconds (MIRAGE_IDLE_GRACE_SECONDS) after its last workspace is deleted. Its settings are on the CLI page.

What is particular to this server

The protocol is the same on both servers. These are the differences in how this one serves it:
  • SSH output streams. A line’s output over SSH is sent as the line produces it. The TypeScript server sends it when the line finishes.
  • Legacy scp -O. The SCP protocol is served, as well as SFTP.
  • authorized_keys options. asyncssh enforces OpenSSH’s options (from=, command=, …), and command= forces the line that runs. mirage-profile binds the key to a profile.
  • Terminal line limit. 1024 characters.
  • A thread per workspace. Each workspace runs on its own thread and event loop through a WorkspaceRunner, so a busy workspace does not hold up another or the HTTP server.

Code map