# SmartCLI drive-tui [Health: Active]

**Category:** 🖥️ Command Line  
**Repository:** https://github.com/dwgx/SmartCLI  
**GitHub Stars:** 5  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/smartcli-drive-tui

## Description
Drive interactive terminal programs (TUIs, REPLs, menus) through a PTY: perceive, send keys, wait.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "smartcli-drive-tui": {
    "command": "uvx",
    "args": ["--from","smartcli-toolkit","smartcli-mcp"]
  }
}
```

## Documentation

## What the SmartCLI drive-tui MCP server does

The SmartCLI drive-tui MCP server gives an MCP client control of interactive terminal applications. It can launch a command inside a pseudo-terminal, inspect the terminal display, provide keyboard input, wait for a visible condition, and end the session. This makes it suitable for programs whose behavior depends on terminal modes, menus, cursor movement, or full-screen rendering.

The package is part of the Python-based SmartCLI project and is distributed on PyPI as `smartcli-toolkit`. The MCP entry point is `smartcli-mcp`. The same underlying drive-tui functionality is also available through the `smartcli-tui` command-line interface.

Typical targets include Python REPLs, `vim`, `lazygit`, `htop`, and other interactive programs. The README demonstrates navigating lazygit, opening a commit diff, highlighting a branch, and driving vim through editing and saving a file.

## How it works

A session runs the target process under a PTY rather than treating it as a simple byte stream. SmartCLI feeds terminal output into a `pyte` screen model that represents the display as cells. Agents can therefore wait for what is visibly present on the screen, including a prompt, menu state, or other matching text.

The interaction pattern is perceive, act, and confirm: read the current screen, send input, then wait until the expected screen state appears. `wait-regex` is designed for this purpose and avoids depending on blind sleep intervals. The CLI example starts a Python REPL, waits for `>>> `, sends an expression, waits for `42`, and then closes the session.

The PTY implementation is not tied to tmux. The project describes support for Windows through ConPTY using `pywinpty`, with POSIX PTYs or tmux available in other environments. The package requires Python 3.10 or newer.

## Setup and configuration

Install the package with:

```bash
pip install smartcli-toolkit
```

Start the stdio MCP server with:

```bash
smartcli-mcp
```

```bash
uvx --from smartcli-toolkit smartcli-mcp
```

Configure the selected command as a stdio MCP server in the client that will use it. For direct CLI use, `smartcli-tui start` accepts a command and terminal dimensions such as `--cols 80 --rows 24`; the returned session identifier is passed to later operations.

## Tools and capabilities

The documented drive-tui operations include:

- Start a persistent terminal session for a command.
- Send a complete input line with `send-line`.
- Send keyboard input through the driver’s key-sending operations.
- Wait for a regular expression with `wait-regex` and an optional timeout.
- Read the cell grid produced after a matching screen state.
- Close a session with `close`.

The MCP version attaches the per-session token to these interactions. The screen model also accounts for alternate-screen behavior used by full-screen applications, allowing the driver to observe and restore the main screen when supported by the implementation.

## Limitations and notes

The driver depends on the target application’s terminal behavior and on the PTY environment where it runs. It is intended for interactive terminal programs, not ordinary noninteractive commands that only need standard input and output.

The README emphasizes confirming state after input because rapid key sequences can arrive before an application has processed earlier keys. Waiting for a visible condition can expose that timing issue.

SmartCLI drive-tui is MIT-licensed. The PyPI distribution name is `smartcli-toolkit`, while the importable Python package is `smartcli_core`.

_Full upstream README: https://allmcps.com/mcp/smartcli-drive-tui/readme_

