Skip to main content
MCP server CX Codex

terminal-mcp — Claude Code MCP server: what it does, setup

Gives an AI agent persistent terminal sessions for SSH, REPLs, database CLIs, and TUI apps. Useful when commands need to share state.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env TERMINAL_MCP_MAX_SESSIONS=<TERMINAL_MCP_MAX_SESSIONS> --env TERMINAL_MCP_IDLE_TIMEOUT=<TERMINAL_MCP_IDLE_TIMEOUT> --transport stdio terminal-mcp -- uvx terminal-mcp
Open on GitHub

What terminal-mcp does

terminal-mcp exposes persistent PTY sessions that remain available across tool calls. An agent can submit commands, inspect output, send keys, and interact with programs that expect a live terminal. Its tools include session_create, session_interact, session_read, session_send, session_wait_for, session_exec, and session_close.

The server supports SSH connections, Python REPL work, psql queries, TUI navigation, and waiting for a build to match a completion or error pattern. Diff reads return changed screen lines, while risky commands require confirmation. Running it through uvx requires Python 3.10+.

What it helps with

  • keep an SSH connection across commands
  • run code inside an interactive Python REPL
  • maintain a database CLI session
  • control a TUI app with key presses
  • wait for a long build to finish by pattern

Example prompts for the agent

  • Connect to the server over SSH, create a session labeled prod, run df -h, and then show the result of docker ps.
  • Open a persistent Python session, load data.csv with pandas, and print a summary of the table.
  • Start npm run build in a separate session and wait for Build complete|ERROR for up to 120 seconds.

How to install terminal-mcp

Platform CLI

claude mcp add --env TERMINAL_MCP_MAX_SESSIONS=<TERMINAL_MCP_MAX_SESSIONS> --env TERMINAL_MCP_IDLE_TIMEOUT=<TERMINAL_MCP_IDLE_TIMEOUT> --transport stdio terminal-mcp -- uvx terminal-mcp

Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from terminal-mcp <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about terminal-mcp

How do I install terminal-mcp in Claude Code?

Run claude mcp add terminal-mcp -- uvx terminal-mcp.

What does terminal-mcp do?

It gives an agent persistent terminal sessions for SSH, REPLs, database CLIs, TUI apps, and long-running processes.

Which session settings can terminal-mcp use?

Set the session limit and idle period with TERMINAL_MCP_MAX_SESSIONS and TERMINAL_MCP_IDLE_TIMEOUT.

Similar MCP servers

All MCP servers for Agent setup: memory, context, orchestration →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor