Skip to main content
Glama

Terminal MCP

Cross-platform MCP server for managing visible terminal sessions.

Features

  • Cross-platform: Supports macOS, Windows, Linux, and WSL

  • Visible terminals: Opens real terminal windows that users can see and interact with

  • Multiple sessions: Manage multiple terminal sessions simultaneously

  • Auto-cleanup: Automatically closes terminals when MCP server stops

Related MCP server: MCP Terminal Server

Installation

Since this package is not published on PyPI, install it directly from the repository:

uv pip install "git+https://github.com/Hor1zonZzz/terminal-mcp.git"

Option 2: Install from a local clone

git clone https://github.com/Hor1zonZzz/terminal-mcp.git
cd terminal-mcp
uv pip install -e .

Usage

Claude Desktop Configuration

Add to your Claude Desktop config (claude_desktop_config.json):

{
  "mcpServers": {
    "terminal": {
      "command": "uv",
      "args": ["run", "terminal-mcp"]
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "terminal": {
      "command": "terminal-mcp"
    }
  }
}

Available Tools

terminal_create_or_get

Create a new visible terminal window or get an existing one by name.

Parameters:

  • name (optional): Name for the terminal session

  • working_dir (optional): Working directory for the terminal

Returns: Session ID, name, platform, and status message

terminal_send_input

Send input (command or text) to a terminal.

Parameters:

  • session_id: The terminal session ID

  • text: The command/text to send

terminal_get_output

Get the output from a terminal.

Parameters:

  • session_id: The terminal session ID

  • lines (optional): Number of lines to retrieve (default: 100, max: 1000)

terminal_list

List all active terminal sessions.

terminal_close

Close a terminal session.

Parameters:

  • session_id: The terminal session ID to close

Platform Support

Platform

Terminal Used

macOS

Terminal.app (via AppleScript)

Windows

Windows Terminal (wt.exe) or cmd.exe

Linux

gnome-terminal, konsole, xfce4-terminal, xterm, etc.

WSL

Windows Terminal from WSL

How It Works

  1. Terminal Creation: Opens a real terminal window using platform-specific methods

  2. Communication: Uses named pipes (Unix) or file polling (Windows) for bidirectional communication

  3. Output Capture: Logs terminal output to temporary files for retrieval

  4. Cleanup: Automatically closes all terminals when the MCP server stops (via atexit and signal handlers)

License

MIT

Available Tools

5 tools
terminal_closeA
DestructiveIdempotent

Close a terminal session.

Closes the terminal window and cleans up associated resources.

Args:
    session_id: The terminal session ID to close.

Returns:
    dict: Contains success status and message.

Inputs: session_id (required).

terminal_create_or_getA
Idempotent

Create a new visible terminal window or get an existing one by name.

The terminal opens in a visible window that the user can interact with directly.
Commands sent to this terminal will be executed in that visible window.

Args:
    name: Optional name for the terminal. If a terminal with this name
          already exists and is still alive, it will be returned instead
          of creating a new one.
    working_dir: Optional working directory for the terminal.
                 If not specified, uses the current working directory.

Returns:
    dict: Contains session_id, name, platform, and a status message.
          Use the session_id for subsequent operations.

Examples:
    - Create unnamed terminal: terminal_create_or_get()
    - Create named terminal: terminal_create_or_get(name="dev-server")
    - Get existing terminal: terminal_create_or_get(name="dev-server")

Inputs: name, working_dir.

terminal_get_outputA
Read-onlyIdempotent

Get the output from a terminal.

Retrieves the recent output from the terminal's history. This includes
both command inputs and their outputs.

Args:
    session_id: The terminal session ID returned by terminal_create_or_get.
    lines: Number of lines to retrieve from the end (default: 100, max: 1000).

Returns:
    dict: Contains success status, session_id, and the output text.

Examples:
    - Get last 100 lines: terminal_get_output(session_id="abc123")
    - Get last 50 lines: terminal_get_output(session_id="abc123", lines=50)

Note:
    Output may have a slight delay as it's captured asynchronously from
    the terminal process.

Inputs: session_id (required), lines.

terminal_listA
Read-onlyIdempotent

List all active terminal sessions.

Returns information about all terminal sessions that are currently
open and active.

Returns:
    dict: Contains a list of terminal sessions with their details.

Inputs: no named parameters.

terminal_send_inputA
Destructive

Send input (command or text) to a terminal.

The input is sent to the visible terminal window and executed there.
The user can see the command being executed in real-time.

Args:
    session_id: The terminal session ID returned by terminal_create_or_get.
    text: The text/command to send. This will be executed as a shell command.

Returns:
    dict: Contains success status, session_id, and the sent text.

Examples:
    - Run a command: terminal_send_input(session_id="abc123", text="ls -la")
    - Start a server: terminal_send_input(session_id="abc123", text="npm start")
    - Run Python: terminal_send_input(session_id="abc123", text="python script.py")

Note:
    The command is executed asynchronously. Use terminal_get_output to
    retrieve the results after the command completes.

Inputs: session_id (required), text (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no ambiguity. terminal_create_or_get creates/retrieves sessions, terminal_send_input sends commands, terminal_get_output retrieves output, terminal_list shows active sessions, and terminal_close terminates sessions. The boundaries between these operations are well-defined and non-overlapping.

    Naming Consistency5/5

    All tools follow a perfect verb_noun pattern with 'terminal_' prefix and snake_case throughout. The naming is highly predictable: terminal_create_or_get, terminal_send_input, terminal_get_output, terminal_list, terminal_close. This consistency makes the tool set immediately understandable.

    Tool Count5/5

    Five tools is ideal for this terminal management domain. The set covers the complete lifecycle: create/retrieve, send input, get output, list sessions, and close sessions. Each tool earns its place with no redundancy, and the count is neither too sparse nor overwhelming for the scope.

    Completeness5/5

    The tool surface provides complete CRUD/lifecycle coverage for terminal management. It supports creating/retrieving terminals, sending commands, getting output, listing active sessions, and closing sessions. There are no obvious gaps or dead ends for agents working with terminal operations.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to interact with terminal environments through multiple concurrent PTY sessions. Supports cross-platform terminal operations including command execution, session management, and real-time communication.
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides cross-platform terminal access through MCP, enabling AI assistants to create and manage interactive terminal sessions, execute commands, and capture visual snapshots on Windows, Linux, and macOS.
      1
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables interactive terminal sessions within Claude Code and Desktop, allowing users and AI to execute commands and manage multiple tabs.
      2
      -