Interactive Terminal MCP
Provides stateful, interactive terminal access for LLMs to spawn and maintain persistent processes like SSH sessions, debuggers, and REPLs with continuous input/output interaction across commands.
README
Interactive Terminal MCP
English | 中文
A Model Context Protocol (MCP) server that provides stateful, interactive terminal access.
Unlike standard command execution tools that run in isolation, this server allows LLMs to spawn persistent processes (like ssh, ipython, or gdb), maintain session context, and interact with shells via standard input/output streams.
Why use this MCP?
Standard command execution tools usually run in isolation (stateless). This MCP server allows for persistent sessions (stateful), which is critical for remote management and debugging tools.
Side-by-Side Comparison
| Scenario | Without this MCP (Stateless) | With Interactive-Terminal-MCP (Stateful) |
|---|---|---|
| 1. Remote SSH Session | Context Lost: Must reconnect for every command.<br><br>> ssh user@host "cd /var/www" (exits)<br>> ssh user@host "ls" (starts in home dir) |
Context Preserved: Maintains one connection.<br><br>1. spawn_process(["ssh", "user@host"])<br>2. send_command(id, "cd /var/www")<br>3. send_command(id, "ls") -> index.php |
| 2. Interactive Debugging | Unsupported: Cannot handle interactive prompts or wait for specific output patterns. | Supported: Can drive interactive tools.<br><br>1. spawn_process(["gdb", "./binary"])<br>2. send_command(id, "break main")<br>3. send_command(id, "run") |
Features
- Stateful Sessions: Environment variables, working directories, and process states persist between commands.
- Interactive Support: Specifically designed for REPLs and interactive CLIs that require continuous input.
- Output Control: Supports waiting for specific output patterns (regex) to ensure commands complete before returning.
- Session Management: Handle multiple concurrent terminal sessions.
- History: Access full session logs via MCP resources.
Usage
Running Directly
uvx interactive-terminal-mcp
Integration with Claude Code
You can add this server to Claude Code uvx.
Using pipx:
claude mcp add --transport stdio interactive-terminal-mcp -- uvx interactive-terminal-mcp
Manual Configuration (claude_config.json):
{
"mcpServers": {
"interactive-terminal": {
"command": "uvx",
"args": ["interactive-terminal-mcp"]
}
}
}
Available Tools
spawn_process
Starts a new interactive process.
- Arguments:
command(List[str]): The command to run (e.g.,["bash"],["python3", "-i"]).
- Returns:
session_id(str)
send_command
Sends input to an active session and waits for output.
- Arguments:
session_id(str): The target session ID.cmd(str): The command string to send.wait_for(str, optional): Regex pattern to wait for (e.g.,\$\s*). Defaults to a short timeout if not provided.timeout(int, optional): Maximum time to wait in seconds.
read_buffer
Reads any pending output from the session buffer without sending new commands.
- Arguments:
session_id(str)
kill_session
Terminates a specific session.
- Arguments:
session_id(str)
Resources
cli://{session_id}/history: Retrieves the full interaction history (inputs and outputs) for a specific session.
Roadmap
- [ ] Session Recording: Support saving interaction logs in standard formats (e.g., asciinema) for replay and auditing.
- [ ] Human Intervention: Enable mechanisms for users to pause, terminate, or manually intervene in active shell sessions managed by the Agent.
[!WARNING] Security Warning: This tool provides full terminal access to the connected LLM. The LLM will have the same permissions as the user running the MCP server. Use only in trusted environments or sandboxed containers (e.g., Docker) to prevent unauthorized system modifications.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.