expty-mcp

v0.1.2
expty-mcp Checked 4 days ago Published 1 month ago

High-performance Model Context Protocol (MCP) server for interactive PTY processes, SSH, and Serial streams with zero-loss continuous ingestion and atomic…

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

spawn

Spawn a new persistent interactive process (bash, ssh, python, gdb, docker, etc.) in a PTY. Args: command: Command to execute (defaults to platform shell: bash or powershell.exe). name: Optional friendly name for this session (e.g. 'router-ssh'). cwd: Optional working directory. env: Optional environment variables dictionary. rows: Terminal rows (default: 40). cols: Terminal columns (default: 120).

ParameterTypeDescription
colsinteger
command
cwd
env
name
rowsinteger

serial

Connect to a hardware or virtual serial device (UART / router console / microcontroller). Args: port: Serial device path (e.g. '/dev/ttyUSB0', 'COM3'). baudrate: Baud rate (e.g. 115200, 9600, 57600). name: Optional friendly name for this session.

ParameterTypeDescription
baudrateinteger
name
portstring

list_ports

Enumerate attached physical and virtual serial ports on the host.

exec_expect

Execute a shell, REPL, or bootloader command and automatically wait for prompt to return. Output preserves original terminal stream (including command echo) as a causal anchor for AI analysis. ANSI escape codes are stripped and backspaces are folded for readability. Tip: You can pass session_id directly to run commands on a specific session without calling switch_session first. Returns a structured result with 'success', 'output', 'timeout', 'interrupted', 'prompt_recovered', 'process_exited', 'exit_code', and 'elapsed_seconds' fields. IMPORTANT: For long-ru…

ParameterTypeDescription
check_exit_code_cmd
cmd
command
expected_patterns
interrupt_on_timeout
prompts
session_id
timeoutnumber

expect

Atomically send an optional command and match incoming stream against prompt patterns. Ideal for multi-step authentication (SSH login/password), prompts, and U-Boot interception. Tip: You can pass session_id directly to run on a specific session without calling switch_session first. Args: patterns: List of regex/substring patterns to expect (e.g. ['password:', '# ']). command: Optional command/response to send before waiting. timeout: Maximum seconds to wait. Defaults to 10.0s. poll_cmd: Characters to repeatedly send during wait (e.g. ' '…

ParameterTypeDescription
cmd
command
expected_patterns
interrupt_on_timeout
patterns
poll_cmd
poll_intervalnumber
session_id
timeoutnumber

send

Send raw characters or escape sequences (e.g. '\x03' for Ctrl+C, '\x1b' for Escape, spaces). Tip: You can pass session_id directly to send to a specific session without calling switch_session first. Args: text: Raw text or escape sequence string. send_enter: If True, appends a newline. session_id: Target session ID (defaults to currently active session). You can pass this directly without calling switch_session first. data: Alias for text. input: Alias for text. command: Alias for text.

ParameterTypeDescription
command
data
input
send_enterboolean
session_id
text

read_buffer

Read newly accumulated text from the stream buffer without blocking. Tip: You can pass session_id directly without calling switch_session first. Args: clear: If True, flushes the read buffer after fetching. session_id: Target session ID (defaults to currently active session). You can pass this directly without calling switch_session first.

ParameterTypeDescription
clearboolean
session_id

get_history

Retrieve recent chronological line history captured by the background daemon. By default, each line is prefixed with an accurate wall-clock timestamp [YYYY-MM-DD HH:MM:SS.mmm] captured at the transport reception level. If a line was split across packets with a pause of >= 50ms (e.g. driver pause, delayed response), the continuation line is prefixed with '↳ ' and tagged with its own timestamp for precise correlation against test framework logs. Tip: You can pass session_id directly without calling switch_session first. Args: limit: Number of recent…

ParameterTypeDescription
limitinteger
session_id
with_timestampsboolean

list_sessions

List all active PTY and Serial sessions with runtime health status.

switch_session

Switch the default active session. Note: Most tools (exec_expect, send, expect, read_buffer, get_history, close_session, status) accept session_id directly. You only need to call switch_session if you want to change the ambient default session across multiple subsequent calls. Args: session_id: Target session ID to make active.

ParameterTypeDescription
session_id *string

close_session

Close and terminate an interactive session. Tip: You can pass session_id directly without calling switch_session first. Args: session_id: Target session ID to close (defaults to active session).

ParameterTypeDescription
session_id

status

Check connection health, buffer statistics, and background daemon status. Tip: You can pass session_id directly without calling switch_session first. Args: session_id: Target session ID (defaults to active session).

ParameterTypeDescription
session_id