Skip to main content

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.

> ssh user@host "cd /var/www" (exits)
> ssh user@host "ls" (starts in home dir)
Context Preserved: Maintains one connection.

1. spawn_process(["ssh", "user@host"])
2. send_command(id, "cd /var/www")
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.

1. spawn_process(["gdb", "./binary"])
2. send_command(id, "break main")
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.

Metadata

Release files for iflow-mcp_WangYihang-interactive-terminal-mcp 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp_WangYihang-interactive-terminal-mcp 0.1.5
File Size Uploaded
iflow_mcp_wangyihang_interactive_terminal_mcp-0.1.5.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp_WangYihang-interactive-terminal-mcp 0.1.5
File Interpreter ABI Platform
iflow_mcp_wangyihang_interactive_terminal_mcp-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / iflow_mcp_wangyihang_interactive_terminal_mcp-0.1.5.tar.gz

Download URL iflow_mcp_wangyihang_interactive_terminal_mcp-0.1.5.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
007a6659b968f258079ecfb2f3c678e2582d243d602ee129f5448cedd3e3c608
BLAKE2b-256 checksum
How to use checksums
0250e8392a0392c1d2c43aed2ba0863c3409e1ec7cf009542e3da6162d8f9b46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iflow_mcp_wangyihang_interactive_terminal_mcp-0.1.5-py3-none-any.whl

Download URL iflow_mcp_wangyihang_interactive_terminal_mcp-0.1.5-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efda91ceeb4ba4fb21ea19059de47ac3c8e007de7eb50ad5460cb4348c268c34
BLAKE2b-256 checksum
How to use checksums
c2b06daf2d33974fc1c3944fe65a24d3a89a5be552f31bf8883b1ef2ab52a274
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page