Skip to main content
Glama
mcp-interactive-terminal

mcp-interactive-terminal

by hugo94z

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

Interactive terminal server. It gives you real PTY sessions (ConPTY on Windows, pty on Linux and macOS) running PowerShell, PowerShell 7 (pwsh), CMD, bash, sh, or any executable.

Typical flow:

  1. terminal_start(cwd="C:/work") -> session_id + first screen (powershell on Windows, bash elsewhere).

  2. terminal_run(session_id, text="npm install") -> waits for the prompt and returns the screen. Use terminal_send + terminal_wait when you need finer control.

  3. terminal_wait(session_id, prompt=true) waits until the shell is idle at its prompt. terminal_wait(session_id, until="ready in|Done|error", timeout_ms=120000) waits for a regex.

  4. terminal_screen(session_id, history=200) shows the rendered screen plus scrollback.

  5. terminal_read(session_id) returns raw incremental output (cursor based, no duplicates).

Guidelines:

  • Prefer terminal_screen over terminal_read when the shell is PowerShell: PSReadLine repaints the line and raw output contains cursor movements.

  • Never poll in a loop: terminal_wait blocks until a prompt, a regex, quiet output, or timeout.

  • A session stays alive between calls. Stop it with terminal_stop when finished.

  • terminal_exec is the one-shot shortcut (command -> output + exit code) when no interaction is needed.

  • Commands run with the privileges of the user running the MCP server. Guardrails can be enabled with MCP_TERMINAL_ALLOW, MCP_TERMINAL_DENY and MCP_TERMINAL_ROOT; they are not a sandbox.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
terminal_startA

Start an interactive terminal session and return its id plus the initial screen.

Args: shell: "powershell" (Windows PowerShell 5.1), "pwsh" (PowerShell 7), "cmd", "bash" or "sh", or an absolute path to any executable. Defaults to powershell on Windows and bash elsewhere. cwd: Working directory. Defaults to the server's current directory (or MCP_TERMINAL_ROOT when that guardrail is configured). env: Extra environment variables merged into the inherited environment. cols: Terminal width in columns (default 120). rows: Terminal height in rows (default 30). name: Session id. Auto-generated (t1, t2, ...) when omitted. replace: Kill an existing session with the same name and start a fresh one. args: Extra arguments passed to the shell or executable.

Returns: session_id, shell, cwd, pid, size, prompt, ready reason and the rendered screen.

terminal_sendA

Send text and/or named keys to a session.

Args: session_id: Session returned by terminal_start. text: Literal text to type (not followed by Enter unless enter=true). keys: Named keys, e.g. ["ctrl-c"], ["up"], ["tab"], ["f5"], ["text:abc"]. Supported: enter, tab, backtab, esc, space, backspace, up, down, left, right, home, end, pageup, pagedown, insert, delete, f1..f12, ctrl-a..ctrl-z, ctrl-space, ctrl-break. enter: Append a carriage return after text/keys. repeat: Repeat the whole sequence 1..100 times.

Returns: session_id, sent_chars and running state.

terminal_runA

Type a command, wait for it to finish, and return the resulting screen in one call.

By default it waits until the shell is back at its prompt. Provide until to wait for a regex instead, or quiet_ms to wait for output to go quiet.

Args: session_id: Session returned by terminal_start. text: Literal command to type. keys: Named keys to send instead of text (see terminal_send). enter: Append Enter after text/keys (default true). until: Case-insensitive regex to wait for instead of the prompt. quiet_ms: Wait for this long without output instead of the prompt. timeout_ms: Give up after this long. max_chars: Maximum characters returned in the screen. history: Number of scrollback lines to prepend to the screen.

Returns: reason ("prompt" | "matched" | "quiet" | "exited" | "timeout"), matched, sent_chars, screen, cursor, running and exit_code.

terminal_readA

Read incremental raw output from a session, without duplicates.

Each call returns only what arrived after the previous read. Use the returned cursor with since to resume from an explicit position.

Args: session_id: Session returned by terminal_start. since: Absolute character offset to read from. Defaults to the last read position. max_chars: Maximum characters returned (head+tail with an explicit omission marker). grep: Keep only lines matching this regular expression. tail: Keep only the last N lines (applied after grep). strip_ansi: Remove ANSI escape sequences.

Returns: text, cursor (pass as since), dropped, truncated, running, exit_code.

Note: PowerShell (PSReadLine) repaints the current line with cursor movements, so raw output contains fragments. Use terminal_screen for an authoritative view.

terminal_waitA

Block until the shell is back at its prompt, output matches a regex, output goes quiet, the session exits, or timeout.

Args: session_id: Session returned by terminal_start. until: Case-insensitive regular expression to wait for, e.g. "PS C:\|>>>|Done". quiet_ms: Return when no output arrived for this long (0 disables quiet detection). Provide at least one of until, quiet_ms or prompt. timeout_ms: Give up after this long. ignore_echo: Ignore the echo of the last command line when matching until (prevents matching the command text itself). prompt: Return as soon as the shell shows its prompt again (recommended after a command). history: Number of scrollback lines included in the returned screen. max_chars: Optional cap on the returned screen (0 = no cap).

Returns: reason: "prompt" | "matched" | "quiet" | "exited" | "timeout", matched, running, exit_code, and the rendered screen.

terminal_screenA

Return the rendered terminal screen (VT emulation) with cursor position.

This is the clean view: cursor moves, erases and color codes are applied, so it shows exactly what a human would see, including the current prompt or TUI.

Args: session_id: Session returned by terminal_start. max_chars: Maximum characters returned (head+tail with an omission marker). history: Number of scrollback lines to prepend to the visible screen (0 = viewport only).

Returns: text, cursor {x,y}, cols, rows, running, exit_code, history_lines, history_available.

terminal_interruptA

Stop the command running in a session, keeping the shell alive.

Sends Ctrl+C first. Processes that ignore the control character are terminated after a grace period; the shell itself is preserved.

Args: session_id: Session returned by terminal_start. force: Skip the grace period and terminate child processes immediately.

Returns: session_id, sent, running, killed (pids terminated) and running_children.

terminal_resizeA

Resize the pseudo-terminal (affects wrapping and full-screen programs).

Args: session_id: Session returned by terminal_start. cols: New width, 2..1000. rows: New height, 2..500.

terminal_listA

List active sessions with their state, pid, cwd, size, idle time, prompt and buffer size.

terminal_stopB

Close a session and free its process.

Args: session_id: Session returned by terminal_start. force: Kill the whole process tree instead of requesting a graceful stop.

terminal_execA

Run a one-shot command to completion and return its output and exit code.

Use this for non-interactive commands. Use terminal_start + terminal_send for programs that need input, a TUI, or a persistent shell.

Args: command: Command line to execute. shell: "powershell", "pwsh", "cmd", "bash" or "sh". cwd: Working directory. Defaults to the server's current directory. env: Extra environment variables. timeout_ms: Kill the command after this long. max_chars: Maximum output characters returned. The full output is written to a temporary file when it is longer; its path is returned as output_file.

Returns: output, output_file, total_chars, exit_code, timed_out, duration_ms, truncated.

terminal_diagnosticsA

Report server diagnostics: version, platform, threads, buffers, VT errors and policy.

Useful when a session misbehaves: it shows write latency, buffer offsets, reader errors and whether an allowlist or cwd jail is active.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.9/5.0

Scored across 12 tools

Disambiguation4/5

Each tool has a distinct verb targeting a distinct aspect of PTY control, and descriptions explicitly steer between the tricky pairs (terminal_exec vs terminal_run vs terminal_send, terminal_screen vs terminal_read). Residual overlap remains: terminal_run is essentially terminal_send + terminal_wait fused, and an agent must decide among run/wait/screen/read for 'see what happened' — the docs help but the boundary is still judgment-based.

Naming Consistency5/5

Every tool uses the same terminal_<verb> pattern with single-word, lowercase verbs: start, run, wait, screen, read, send, interrupt, stop, list, resize, exec, diagnostics. No mixed casing or inconsistent verb styles anywhere in the set.

Tool Count5/5

12 tools for a full interactive terminal server is well-scoped: session lifecycle, input, output, waiting, and diagnostics each get a small number of tools. Nothing appears redundant enough to remove, and no obvious capability is crammed into an overloaded tool.

Completeness4/5

Coverage is strong: create/list/stop sessions, send keys, interrupt, resize, read raw or rendered output, wait strategies, one-shot exec, and diagnostics. Gaps are minor — no way to clear scrollback, export a session transcript, update env after start, or reattach to a detached/finished session's buffer.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues