MCP PTY server providing AI agents with real interactive terminal access
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
A PTY-based MCP server with strong Windows support, giving MCP-capable AI clients and their agents persistent, interactive shell access via pseudo-terminals (node-pty).
Unlike simple exec-based approaches, this keeps PTY-backed shell sessions alive across steps, with bidirectional communication for interactive CLI tools, incremental reads, and session state that carries forward.
See the Changelog for recent updates.
Install this if you want a more consistent terminal workflow across AI clients, instead of relying on whatever built-in terminal behavior a single client happens to provide.
This MCP is most useful when you want:
terminal_wait, terminal_retry, terminal_run_paged, and terminal_get_history are easier to reuse across teams and clients, with less lock-in to one client's terminal behavior.vim, npm prompts, or interactive installers that often hang on standard piped stdin. Support full interactive sessions with REPLs, Ctrl+C, arrow keys, and dynamic prompts.If your AI client already provides a stable, stateful, interactive terminal with good output handling, you may not need this MCP for basic command execution. The main reason to add it is to make terminal-driven workflows more explicit, reusable, and portable across clients.
Think of this as a controlled keyboard + terminal for an agent running inside an MCP client. It opens a persistent PTY-backed shell session so the agent can send commands and keystrokes, read output, and continue working in the same session.
terminal_exec uses unique markers so it can tell when a command has finished.terminal_exec reports the current folder after each command.terminal_write + terminal_read support prompts, REPLs, and other interactive programs without leaving the current session.terminal_read accepts a since byte position to return only new output since the last read, avoiding re-reading the full buffer on every poll.terminal_wait can pause until specific text appears, such as server listening on port.terminal_watch waits for trigger patterns in session output, returning only on match, quiet, timeout, or exit. Eliminates poll-loop token waste.terminal_exec can return early when output goes silent (quietExitMs), instead of waiting for a hard timeout.terminal_retry can re-run flaky commands with bounded backoff and optional output matching.terminal_exec / terminal_wait calls can emit notifications/progress when the client provides a progress token.terminal_exec and terminal_read shorten very large output by returning the beginning and the end.terminal_run_paged returns large read-only output one page at a time instead of sending the full result at once.terminal_diff compares two command results and returns a unified diff.terminal_stop can capture a tail snapshot or write a full transcript to disk before stopping.terminal_run executes binaries directly with cmd + args and shell=false for more predictable automation.GIT_PAGER=cat, PAGER=cat), suppresses PowerShell progress output, and sets UTF-8 for cmd.exe on Windows.terminal_stop kills the entire process group on Unix, preventing orphan child processes.calm-reef).pwsh.exe > powershell.exe > cmd.exe. Linux/macOS: $SHELL > bash > sh.Progress notifications are not the same as full stdout streaming. They currently send periodic status updates for terminal_exec and terminal_wait, usually based on elapsed time and the latest output line. Whether you see them depends on your MCP client.
This MCP does not magically compress terminal output, but it can help agents use fewer tokens in terminal-heavy workflows by returning smaller, more targeted responses and making it easier to revisit output only when needed.
The main benefit is model-context efficiency, not guaranteed savings in the underlying command's runtime or total bytes produced.
terminal_read({ since }) to read incrementally. Each call returns only new output since the last position, instead of re-reading the full buffer. Reduces token usage by up to ~87% on repeated polling.terminal_watch instead of a manual poll loop when waiting for a specific pattern. A single call returns on match, quiet, timeout, or exit β reduces token usage by up to ~99% for log-watching workflows.terminal_exec({ quietExitMs }) for long-running commands (dev servers, watchers) that never produce a completion marker. Returns early when output stops, instead of waiting for a hard timeout. Reduces token usage by up to ~94%.terminal_run_paged for large read-only output when the agent wants one page of the returned result at a time.maxLines, pageSize, or tailLines when the agent only needs a narrow slice of the output.summary: true or parseOnly: true with terminal_run when the agent benefits more from structured results than raw text.terminal_wait({ returnMode: "match-only" }) when the agent only needs to know whether a pattern appeared.terminal_get_history when the agent needs to revisit earlier output without re-dumping the whole session into the conversation.terminal_stop({ transcriptPath }) to offload large session history to disk instead of returning it in the response.In practice, this lets agents inspect terminal state more selectively instead of repeatedly dumping large logs back into the conversation.
By default, the 8 most-used tools are registered with full schemas and 8 convenience tools are collected behind a single lightweight terminal_extra meta-tool (~30 tokens instead of ~1,700).
Default core tools: terminal_start, terminal_exec, terminal_run, terminal_read, terminal_write, terminal_wait, terminal_stop, terminal_list
Default extra tools (behind terminal_extra): terminal_run_paged, terminal_retry, terminal_diff, terminal_resize, terminal_send_key, terminal_get_history, terminal_write_file, terminal_watch
Extra tools are not hidden β the agent sees the tool names in the terminal_extra description and can:
terminal_extra({ list: true }) β returns full parameter schemasterminal_extra({ tool: "terminal_resize", args: { sessionId: "...", cols: 200, rows: 50 } })Use SMART_TERMINAL_DISABLED_TOOLS to customize which tools are extra, or set it to an empty string to register all 15 tools with full schemas:
All tools with full schemas (no meta-tool):
Minimal setup β only terminal_exec for simple command execution:
5 core tools + terminal_extra holding 9 tools on demand.
Agent-focused setup -- terminal_run instead of terminal_exec:
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/smart-terminal)<a href="https://allmcps.com/mcp/smart-terminal"><img src="https://allmcps.com/api/badge/smart-terminal?style=directory" alt="Smart Terminal on AllMCPs" /></a>