tui-mcp
tui-mcp lets you launch, interact with, and monitor any terminal application (TUI or CLI) through an AI agent, maintaining persistent interactive sessions in a real pseudo-terminal.
Launch terminal apps (
launch): Spawn any CLI or TUI application (vim, htop, mysql, ssh, etc.) in a managed pseudo-terminal with configurable dimensions and working directoryList active sessions (
list_sessions): View all currently running terminal sessions with their IDs, commands, and dimensionsKill sessions (
kill): Terminate a running session and its underlying processResize the terminal (
resize): Change terminal dimensions on-the-fly; the app receives a SIGWINCH signal to adapt its layoutTake screenshots (
screenshot): Capture the terminal as a PNG image showing exact colors, styling, and layoutText snapshots (
snapshot): Capture the terminal buffer as plain text — faster and cheaper than a screenshotRead a region (
read_region): Extract text from a specific rectangular area of the terminal bufferGet cursor position (
cursor): Retrieve the current cursor location in the terminalSend keystrokes (
send_keys): Send special keys and shortcuts (Enter, Ctrl+C, arrow keys, F1–F12, etc.) individually or in sequenceType text (
send_text): Type a literal string of characters directly into the terminal appSend mouse events (
send_mouse): Simulate mouse press, release, or scroll events at specific coordinates (for mouse-enabled apps)Wait for text (
wait_for_text): Poll the terminal buffer until a regex pattern appears — useful for detecting prompts or outputWait for idle (
wait_for_idle): Wait until the terminal stops changing, ensuring the app has finished rendering before proceeding
This enables complex workflows like SSH authentication, interactive installers, git rebase editors, log tailing, and interacting with legacy CLI systems — compatible with any TUI framework (ncurses, bubbletea, textual, ink, etc.).
Allows for launching and interacting with htop in a managed pseudo-terminal, providing tools to capture screenshots, read the terminal buffer, and send keystrokes to monitor system resources.
Allows for launching and interacting with Vim in a managed pseudo-terminal, providing tools to capture screenshots, read text, and send keystrokes to automate text editing and navigation.
tui-mcp
What Chrome DevTools MCP is for the browser, tui-mcp is for the terminal.
Launch any terminal app in a managed pty, take screenshots, read text, send keystrokes. The app thinks it's running in a real terminal. Works with any TUI framework or no framework at all - vim, htop, bubbletea, textual, ink, inquirer, trend, ncurses, whatever.
How is this different from a bash tool?
A bash tool runs discrete commands - each invocation is fire-and-forget. The process exits, the output comes back. tui-mcp maintains a persistent, interactive session. The pty stays alive between calls. This matters when:
The tool has state - you're in a
mysqlshell, you'veUSEd a database, you're in a transaction. A bash tool can't hold that session open between calls.The tool has UI - htop, vim, k9s, lazygit. A bash tool gets garbage back because these apps paint full-screen interfaces with ANSI escape codes. tui-mcp renders them into a readable screenshot or text snapshot through xterm emulation.
The interaction is multi-step - SSH prompts for a password, then a 2FA code, then you're in. An interactive installer asks questions.
git rebase -idrops you into an editor. These are conversational flows that a stateless bash tool can't handle.You need to watch something - tail a log, monitor a build, wait for a deploy to finish. The session stays open, the agent can snapshot whenever it wants to check progress.
The tool requires a TTY - some CLIs behave differently (or refuse to run) without a real terminal. node-pty gives them a real pty with
xterm-256color, so everything works as expected.
A bash tool is exec(). tui-mcp is "sit down at a terminal and use it like a human." One runs commands, the other operates software.
Some example outputs of the screenshot tool:

Related MCP server: Forge
Setup
claude mcp add --scope user tui-mcp -- npx tui-mcpTools
Tool | Description |
launch | Spawn a TUI app in a managed pty |
kill | Terminate a session |
list_sessions | List sessions, including recently exited ones |
status | Get one session's state and exit code |
resize | Resize the terminal |
screenshot | Capture terminal as PNG |
snapshot | Capture terminal as plain text |
scrollback | Read the buffer including scrolled-off history |
output | Read the raw pty byte stream (escape sequences included) |
read_region | Read a rectangular area of the buffer |
cursor | Get cursor position |
send_keys | Send a keystroke or combo ( |
send_text | Type a string of characters |
send_mouse | Send mouse events |
wait_for_text | Wait for a regex pattern to appear |
wait_for_idle | Wait until the terminal stops changing |
wait_for_exit | Wait for the process to exit and get its exit code |
Interesting use cases
remote ops: agent SSHs into a production box, tails logs, greps for errors, restarts a service, watches it come back up. it's reading the same terminal output a human SRE would see. no custom APIs needed.
legacy system interaction: ncurses admin panels, mysql cli, redis-cli, psql - the agent can drive all of these. stuff that will never get a REST API.
multi-session orchestration: agent launches 3-4 sessions simultaneously. one running a dev server, one running tests, one tailing logs, one in a debugger. it's basically pair programming with an extra set of hands.
interactive debuggers: gdb, lldb, pdb, node --inspect. the agent can set breakpoints, step through code, inspect variables.
infrastructure as conversation: kubectl, terraform, docker, aws cli. agent doesn't need the kubernetes MCP server or the AWS MCP server. it just uses the CLIs directly, same as a human would.
Most MCP servers wrap one specific tool or API. tui-mcp wraps the terminal itself, which is the universal interface that all tools already speak. It's MCP's eval().
Monitor
Watch and control all active sessions from your terminal:
npx tui-mcp monitorSession list on the left, live ANSI-rendered terminal preview on the right. The monitor discovers every running tui-mcp server on the machine and aggregates their sessions.
Keys:
j/kor arrows to move through servers and their sessions,g/Gfor top/bottom, mouse click and scroll also workenteron a session attaches - everything you type passes through to its pty,ctrl+\detachesenteron a server opens the launch panel targeting itsfetches the session's full scrollback into a scrollable view,escreturns to livellaunches a new session on the selected row's server (ctrl+scycles the target)xtwice within 3 seconds kills the selected sessionqquits
Attach, launch, kill, and scrollback need the server to be 1.2 or newer; sessions on older servers are marked ro (read-only) and can still be watched.
How it works
your app <--> node-pty <--> xterm-headless <--> MCP tools
(pty) (terminal emulator) (screenshot, send_keys, etc.)The app runs in a real pseudo-terminal via node-pty. Its output is parsed by xterm-headless (the same terminal emulator that powers VS Code's terminal, but without a DOM). The MCP tools read and interact with that parsed buffer.
Available Tools
13 toolscursorGet CursorC
Get the current cursor position in the terminal.
Inputs: sessionId (required).
killKill SessionB
Terminate a TUI session and its underlying process.
Inputs: sessionId (required).
launchLaunch TUIA
Launch a TUI application in a managed pseudo-terminal. Returns a session ID for subsequent interactions.
Inputs: command (required), cols, rows, cwd.
list_sessionsList SessionsB
List all active TUI sessions with their IDs, commands, and dimensions.
Inputs: no named parameters.
read_regionRead RegionC
Read a rectangular region of the terminal buffer as text.
Inputs: sessionId (required), row (required), col (required), width (required), +1 more.
resizeResize TerminalB
Resize the terminal dimensions of a session. The TUI app will receive a SIGWINCH signal.
Inputs: sessionId (required), cols (required), rows (required).
screenshotScreenshotB
Capture the terminal as a PNG image. Shows exactly what a user would see - colors, styling, layout.
Inputs: sessionId (required).
send_keysSend KeysA
Send keystrokes to the TUI app. Use this for special keys and shortcuts, not for typing text (use send_text for that). Accepts a single key descriptor string or an array of key descriptors to send in sequence. Supports named keys (Enter, Tab, Escape, Up, Down, Left, Right, Backspace, Delete, Home, End, PageUp, PageDown, F1-F12, Space) and modifiers (Ctrl+, Alt+, Shift+). Examples: "Enter", "Ctrl+C", ["Down", "Down", "Down", "Enter"], ["Escape", ":wq", "Enter"].
Inputs: sessionId (required), keys (required).
send_mouseSend Mouse EventB
Send a mouse event to the TUI app (if the app has mouse support enabled).
Inputs: sessionId (required), action (required), x (required), y (required), +1 more.
send_textSend TextA
Type a string of characters into the TUI app. The text is sent exactly as provided - MCP JSON handles escaping, so do not double-escape. To type a literal backslash, send one backslash. Include a trailing newline (\n) if you want to press Enter after the text. Use send_keys instead for special keys like Ctrl+C or arrow keys.
Inputs: sessionId (required), text (required).
snapshotText SnapshotA
Capture the terminal buffer as plain text. Faster and cheaper than a screenshot - use this when you only need the text content.
Inputs: sessionId (required).
wait_for_idleWait For IdleA
Wait until the terminal buffer stops changing. Useful after sending keys to wait for the app to finish rendering.
Inputs: sessionId (required), timeout, debounce.
wait_for_textWait For TextA
Wait until a regex pattern appears in the terminal buffer. Useful for waiting for prompts, loading states, or specific output.
Inputs: sessionId (required), pattern (required), timeout.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool has a clearly distinct purpose with no overlap: cursor gets position, kill terminates, launch starts apps, list_sessions enumerates, read_region extracts text areas, resize changes dimensions, screenshot captures visual output, send_keys handles special keys, send_mouse sends mouse events, send_text types characters, snapshot captures text buffer, wait_for_idle waits for rendering, and wait_for_text waits for patterns. The descriptions explicitly differentiate similar tools like send_keys vs send_text and screenshot vs snapshot.
All tools follow a consistent verb_noun or verb_preposition_noun pattern (e.g., list_sessions, read_region, send_keys, wait_for_text). There are no deviations in style (all snake_case) or verb usage, making the naming predictable and readable throughout the set.
With 13 tools, the count is well-scoped for managing TUI applications, covering core operations like launching, interacting (keys, text, mouse), monitoring (cursor, sessions), capturing output (screenshot, snapshot, read_region), and waiting (idle, text). Each tool earns its place without redundancy or bloat for the domain.
The tool surface provides complete lifecycle coverage for TUI management: launch sessions, interact via keys/text/mouse, resize terminals, monitor state with cursor and sessions, capture output in multiple formats, and wait for conditions. There are no obvious gaps; agents can perform all typical TUI operations without dead ends.
Maintenance
Related MCP Connectors
Screenshot, diff, audit and sitemap-capture any web page — 5 MCP tools for AI agents.
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Live browser debugging for AI assistants — DOM, console, network via MCP.
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser through Chrome DevTools. Provides browser automation, performance analysis, debugging capabilities, and network request monitoring.1,868,745 npm55,025Apache 2.0
- AlicenseNot gradedqualityDmaintenanceTerminal MCP server for AI coding agents with persistent PTY sessions, ring-buffer incremental reads, headless xterm screen capture, multi-agent orchestration, and a real-time web dashboard.15 npm28MIT
- AlicenseAqualityDmaintenanceAn MCP server that lets AI agents launch, interact with, and inspect Textual TUI applications headlessly.124MIT
- AlicenseBqualityDmaintenanceLocal + remote terminal interaction control MCP Server. Lets AI agents control interactive TUI programs the way a human would.298 npmMIT