terminal-mcp
v0.3.1MCP 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.
| Parameter | Type | Description |
|---|---|---|
command * | string | Shell command to run (e.g. 'bash', 'python3', 'ssh user@host') |
cols | integer | Terminal width in columns |
enable_snapshot | boolean | Enable pyte screen buffer for snapshot reads |
idle_timeout | integer | Seconds before auto-closing idle session |
label | string | Human-readable label for the session |
rows | integer | Terminal height in rows |
scrollback_lines | integer | Number 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').
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Session ID returned by session_create |
control_char | string | Control character to send: 'c' (SIGINT), 'd' (EOF), 'z' (SIGTSTP), 'l' (clear), ']' (telnet) |
input | string | Text to send to the session |
key | string | Special key to send (arrow keys, function keys, etc.) |
password | string | Password or secret to send (will not be logged) |
press_enter | boolean | Append carriage return after input |
session_resize
Resize the terminal window of an active session. Sends SIGWINCH to the process.
| Parameter | Type | Description |
|---|---|---|
cols * | integer | New terminal width in columns |
rows * | integer | New terminal height in rows |
session_id * | string | Session 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).
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Session ID returned by session_create |
mode | string | Read mode: 'stream' (default) or 'snapshot' |
scrollback | integer | Lines of scrollback history to include (snapshot mode only) |
strip_ansi | boolean | Strip ANSI escape sequences from output |
timeout | number | Settle timeout in seconds (stream mode) |
session_close
Terminate a session gracefully. Sends EOF, then SIGHUP, then SIGKILL.
| Parameter | Type | Description |
|---|---|---|
session_id * | string | Session 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.
| Parameter | Type | Description |
|---|---|---|
exec * | string | Command to execute in the session |
cols | integer | Terminal width in columns |
command | string | Shell to use (default: bash) |
rows | integer | Terminal height in rows |
timeout | number | Seconds to wait for command output |