terminal-mcp

v0.3.1
io.github.mkpvishnu/terminal-mcp Checked 17 hours ago Published 9 months ago

MCP server for interactive terminal sessions — SSH, REPLs, database CLIs, TUI apps

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

session_create

Spawn a persistent PTY terminal session. Returns a session_id used by all other session_* tools. Supports interactive shells, SSH, REPLs, and database CLIs.

ParameterTypeDescription
command *stringShell command to run (e.g. 'bash', 'python3', 'ssh user@host')
colsintegerTerminal width in columns
enable_snapshotbooleanEnable pyte screen buffer for snapshot reads
idle_timeoutintegerSeconds before auto-closing idle session
labelstringHuman-readable label for the session
rowsintegerTerminal height in rows
scrollback_linesintegerNumber of scrollback history lines to keep (requires enable_snapshot)

session_send

Send input text, a control character, or a special key to an active session. Use control_char for signals (e.g. 'c' for Ctrl-C). Use key for special keys (e.g. 'up', 'tab', 'f1').

ParameterTypeDescription
session_id *stringSession ID returned by session_create
control_charstringControl character to send: 'c' (SIGINT), 'd' (EOF), 'z' (SIGTSTP), 'l' (clear), ']' (telnet)
inputstringText to send to the session
keystringSpecial key to send (arrow keys, function keys, etc.)
passwordstringPassword or secret to send (will not be logged)
press_enterbooleanAppend carriage return after input

session_resize

Resize the terminal window of an active session. Sends SIGWINCH to the process.

ParameterTypeDescription
cols *integerNew terminal width in columns
rows *integerNew terminal height in rows
session_id *stringSession ID returned by session_create

session_read

Read output from a session. Stream mode waits for output to settle; snapshot mode returns the current terminal screen (requires enable_snapshot=true).

ParameterTypeDescription
session_id *stringSession ID returned by session_create
modestringRead mode: 'stream' (default) or 'snapshot'
scrollbackintegerLines of scrollback history to include (snapshot mode only)
strip_ansibooleanStrip ANSI escape sequences from output
timeoutnumberSettle timeout in seconds (stream mode)

session_close

Terminate a session gracefully. Sends EOF, then SIGHUP, then SIGKILL.

ParameterTypeDescription
session_id *stringSession ID to close

session_list

List all active terminal sessions with their status and idle time.

session_exec

Execute a command in a temporary session and return the output. The session is automatically cleaned up after execution.

ParameterTypeDescription
exec *stringCommand to execute in the session
colsintegerTerminal width in columns
commandstringShell to use (default: bash)
rowsintegerTerminal height in rows
timeoutnumberSeconds to wait for command output