Terminal Mcp

io.github.mkpvishnuPublished by GitHub account mkpvishnuv0.3.1Updated Oct 27, 2026

MCP server for interactive terminal sessions — SSH, REPLs, database CLIs, TUI apps

The publisher's own server: Terminal Tax

VerifiedSTDIODesktop onlyCloud & InfrastructureDeveloper Tools

Overview

AI-generated overview

Gives an AI assistant persistent interactive terminal sessions (PTY) so it can run commands, SSH, REPLs, database CLIs and TUI apps across tool calls.

What you can do
  • Create, list, resize and close persistent terminal sessions backed by a real PTY
  • Send text, special keys and control characters, and read output in stream, snapshot, auto or diff mode
  • Send input and read the result in one call, or wait for a regex pattern in the output
  • Run one-off commands in a single call
  • Work with SSH connections, Python/Node REPLs, psql/mysql/redis CLIs, TUI apps like htop or vim, and long-running builds or dev servers
When to use it
Useful when the assistant needs state that survives between commands: an open SSH session, an interactive interpreter, a database CLI connection, a TUI program, or a build or log stream it must keep watching. Not needed for simple one-shot shell commands.
Requirements
Runs locally as a stdio process, installed with uvx or pip (Python). Configured in the client's MCP config file. Optional TERMINAL_MCP_* environment variables tune max sessions, idle timeout, safety gate, buffer size and truncation. Desktop clients only.
Before you install
The assistant gets real shell access on your machine, including SSH to remote hosts and database CLIs, so anything typed there actually runs. A dangerous-command gate blocks patterns such as rm -rf, DROP TABLE and curl piped to sh and asks for confirmation, but it is a heuristic and can be turned off via TERMINAL_MCP_SAFETY_GATE. Sessions persist until closed or idle timeout, and output is buffered and truncated.

Installation

In SourceWeft

  1. Open Terminal Mcp in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

[terminal-mcp banner]

Give your AI a real terminal. Persistent sessions. Interactive programs. Zero limitations.

[PyPI] [Python 3.10+] [License: MIT] [CI] [CodeQL]

[Install in VS Code] [Install in VS Code Insiders] [Install in Cursor] [Install in Claude Desktop]

[terminal-mcp demo]


The Problem

Every AI coding tool hits the same wall: no real terminal access.

Claude Code's Bash tool, GitHub Copilot, and Codex all run commands in isolated subprocesses. Each command starts fresh. No state carries over. That means:

  • No SSH sessions - Can't connect to a remote server and run multiple commands
  • No REPLs - Can't use Python, Node, or Ruby interpreters interactively
  • No database CLIs - Can't maintain a psql, mysql, or redis-cli connection
  • No TUI apps - Can't navigate htop, vim, or fzf with arrow keys
  • No long-running processes - Can't monitor builds, watch logs, or run dev servers

The Solution

terminal-mcp gives AI agents a real terminal. Persistent PTY sessions that survive across tool calls. Send commands, read output, press keys, navigate TUIs - exactly like a human at a terminal.

uvx terminal-mcp

One command. Works with Claude Code, Claude Desktop, VS Code, Cursor, and Windsurf.


Quick Start

1. Install (30 seconds)

bash
# No install needed - run directlyuvx terminal-mcp
# Or install globallypip install terminal-mcp

2. Connect to Your AI Client

Claude Code

Add to ~/.claude.json or project .mcp.json:

json
{  "mcpServers": {    "terminal": {      "command": "uvx",      "args": ["terminal-mcp"]    }  }}
Claude Desktop

Add to claude_desktop_config.json:

json
{  "mcpServers": {    "terminal": {      "command": "uvx",      "args": ["terminal-mcp"]    }  }}
VS Code / Cursor

Click the one-click install badge above, or add to .vscode/mcp.json:

json
{  "servers": {    "terminal-mcp": {      "command": "uvx",      "args": ["terminal-mcp"]    }  }}
Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "terminal": {      "command": "uvx",      "args": ["terminal-mcp"]    }  }}

3. Verify

session_exec  exec="echo hello from terminal-mcp"

What Can You Do With It?

SSH Into Remote Servers

session_create   command="ssh [email protected]"   label="prod"session_interact session_id="a1b2c3d4"  input="df -h"  wait_for="\$"session_interact session_id="a1b2c3d4"  input="docker ps"  wait_for="\$"session_close    session_id="a1b2c3d4"

Run Interactive REPLs

session_create   command="python3"  label="python"session_interact session_id="e5f6g7h8"  input="import pandas as pd"  wait_for=">>>"session_interact session_id="e5f6g7h8"  input="df = pd.read_csv('data.csv')"  wait_for=">>>"session_interact session_id="e5f6g7h8"  input="df.describe()"  wait_for=">>>"session_close    session_id="e5f6g7h8"

Query Databases

session_create   command="psql -U admin mydb"  label="db"session_interact session_id="x1y2z3w4"  input="SELECT count(*) FROM users;"  wait_for="row"session_interact session_id="x1y2z3w4"  input="\dt"  wait_for="#"session_close    session_id="x1y2z3w4"

Navigate TUI Apps

session_create   command="htop"  label="monitor"session_read     session_id="a1b2c3d4"# Auto-detects TUI, returns screen snapshot
session_send     session_id="a1b2c3d4"  key="F6"session_read     session_id="a1b2c3d4"  mode="diff"# Returns only changed lines - saves tokens
session_send     session_id="a1b2c3d4"  key="F10"session_close    session_id="a1b2c3d4"

Monitor Long-Running Builds

session_create   command="bash"  label="build"session_send     session_id="a1b2c3d4"  input="npm run build"session_wait_for session_id="a1b2c3d4"  pattern="Build complete|ERROR"  timeout=120

Run One-Off Commands

session_exec  exec="git log --oneline -10"session_exec  exec="docker compose ps"  timeout=10

Features at a Glance

FeatureWhat It Does
Persistent SessionsReal PTY sessions that survive across tool calls
Send + Read in One Callsession_interact halves LLM round trips
Pattern-Based Readswait_for blocks until regex matches - no guessing timeouts
Auto TUI DetectionDetects htop, vim, etc. and auto-switches to screen snapshot mode
Output Diff ModeReturns only changed screen lines - minimizes tokens
Special KeysArrow keys, Tab, F1-F12, Home/End, Page Up/Down
Control CharactersCtrl-C, Ctrl-D, Ctrl-Z, Ctrl-L, telnet escape
Dangerous Command GateBlocks rm -rf, DROP TABLE, curl|sh - requires confirmation
OSC 133 Shell IntegrationAuto-detects command boundaries and exit codes
Smart TruncationFour strategies to prevent context overflow
Secret InputSend passwords without logging
Dynamic ResizeResize terminal on the fly with SIGWINCH
Idle CleanupAuto-closes idle sessions
Cross-PlatformLinux, macOS, and Windows support

Tools Reference

terminal-mcp exposes 9 MCP tools. Full details in docs/tools.md.

ToolPurpose
session_createSpawn a persistent terminal session
session_sendSend text, keys, or control characters
session_readRead output (stream, snapshot, auto, diff modes)
session_interactSend + read in one call
session_wait_forWait for regex pattern in output
session_execOne-shot command execution
session_closeClose a session gracefully
session_resizeResize terminal dimensions
session_listList active sessions

Architecture

mermaid
flowchart LR    Client[AI Client] -->|MCP JSON-RPC| Server[terminal-mcp]    Server --> SM[Session Manager]    SM --> S1[PTY 1: bash]    SM --> S2[PTY 2: python3]    SM --> S3[PTY 3: ssh user@host]    S1 & S2 & S3 -.->|PTY output| Reader[Reader Thread]    Reader -.->|buffer| Server

Each session is backed by a real PTY via pexpect.spawn (or PopenSpawn on Windows). For full architecture details, see docs/architecture.md.


Configuration

All settings configurable via TERMINAL_MCP_* environment variables. Full reference in docs/configuration.md.

SettingEnv VarDefault
Max sessionsTERMINAL_MCP_MAX_SESSIONS10
Idle timeoutTERMINAL_MCP_IDLE_TIMEOUT1800 (30 min)
Safety gateTERMINAL_MCP_SAFETY_GATEon
Buffer capTERMINAL_MCP_MAX_BUFFER_BYTES1000000 (1MB)
TruncationTERMINAL_MCP_TRUNCATION_MODEtail

Example with custom settings:

json
{  "mcpServers": {    "terminal": {      "command": "uvx",      "args": ["terminal-mcp"],      "env": {        "TERMINAL_MCP_MAX_SESSIONS": "20",        "TERMINAL_MCP_IDLE_TIMEOUT": "3600",        "TERMINAL_MCP_TRUNCATION_MODE": "head_tail"      }    }  }}

Documentation

DocumentDescription
Tools ReferenceComplete API for all 9 MCP tools
ArchitectureHow terminal-mcp works under the hood
ConfigurationAll settings and environment variables
Safety & SecurityDangerous command detection and safety gate
Use Cases & ExamplesReal-world recipes and patterns
ChangelogVersion history and release notes
ContributingHow to contribute

Supported Clients

ClientStatusInstall
Claude Code (CLI)Supported~/.claude.json or .mcp.json
Claude DesktopSupportedOne-click install
VS Code (Copilot Chat)SupportedOne-click install or .vscode/mcp.json
CursorSupportedOne-click install or Settings
WindsurfSupported~/.codeium/windsurf/mcp_config.json

Running Tests

bash
pip install -e ".[dev]"pytest tests/ -v

Contributing

Contributions welcome! See docs/contributing.md for guidelines.

License

MIT

Source: README.md at commit 6e094a2

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.3.1LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

Other Terminal integrations