interactive-cli
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@interactive-cliUse interactive-cli to run 'eas build --platform ios' and choose the production profile."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
interactive-cli
MCP server that lets AI coding agents interact with interactive CLI processes. Uses a real PTY + xterm headless to render terminal output as clean text — no ANSI escape soup.
Works with Claude Code, Cursor, Windsurf, or any MCP-compatible client.
Why
AI agents can run shell commands, but they choke on anything interactive:
$ eas build --platform ios
✔ Select a build profile › (waiting for input...)This MCP server bridges that gap — spawn the process, read the screen, send keystrokes.
Related MCP server: pty-mcp
Quick Start
Claude Code
claude mcp add-json interactive-cli '{"command":"npx","args":["-y","interactive-cli-mcp"]}'Or add to ~/.claude/settings.json manually:
{
"mcpServers": {
"interactive-cli": {
"command": "npx",
"args": ["-y", "interactive-cli-mcp"]
}
}
}From Source
git clone https://github.com/ohernandezdev/interactive-cli.git
cd interactive-cli
npm install && npm run buildclaude mcp add-json interactive-cli '{"command":"node","args":["/absolute/path/to/interactive-cli/dist/index.js"]}'Other MCP Clients
Point your client's MCP config at:
command: node
args: ["/path/to/interactive-cli/dist/index.js"]
transport: stdioTools
Tool | Description | Read-only |
| Start an interactive process in a PTY | No |
| Type text (appends Enter by default) | No |
| Send special keys in sequence (arrows, ctrl combos, etc.) | No |
| Capture current terminal screen, optional regex search | Yes |
| Block until a regex pattern appears in output | No |
| Block until the process exits | No |
| Change terminal dimensions | No |
| List all active sessions | Yes |
| Kill process, clean up session | No |
Typical Flow
sequenceDiagram
participant Agent as AI Agent
participant MCP as interactive-cli
participant PTY as Process (PTY)
Agent->>MCP: spawn("eas build --platform ios")
MCP->>PTY: Start process in PTY
PTY-->>MCP: Initial output
MCP-->>Agent: sessionId + screen
Agent->>MCP: get_screen(sessionId)
MCP-->>Agent: "Select profile: ❯ dev staging prod"
Agent->>MCP: send_keys(["down","down","enter"])
MCP->>PTY: ↓ ↓ ⏎
PTY-->>MCP: "✔ Selected: production"
MCP-->>Agent: updated screen
Agent->>MCP: wait_for("Build complete|error", 600s)
loop Every 1s
MCP->>PTY: check output
end
PTY-->>MCP: "Build complete"
MCP-->>Agent: matched + screen
Agent->>MCP: close(sessionId)
MCP->>PTY: SIGTERM
MCP-->>Agent: final screen + exit codespawn
spawn({
command: "ssh user@server.com", // full command string
cwd: "/path/to/project", // optional working directory
env: { "NODE_ENV": "production" }, // optional extra env vars
cols: 120, // terminal width (default 120)
rows: 30, // terminal height (default 30)
waitMs: 3000, // ms to wait for initial output (default 2000)
})Commands run through your shell ($SHELL or /bin/zsh), so pipes, redirects, and builtins work.
send_input
send_input({
sessionId: "s1",
text: "yes", // text to type
pressEnter: true, // append Enter (default true). false for password fields
waitMs: 2000, // ms to wait for response (default 2000)
})send_keys
Send one or more keys in sequence with a small delay between each:
send_keys({
sessionId: "s1",
keys: ["down", "down", "enter"], // navigate menu
delayBetweenMs: 50, // ms between keys (default 50)
waitMs: 1500, // ms to wait after last key (default 1500)
})Supported keys: enter tab escape space up down left right backspace delete home end page_up page_down f1–f12 ctrl+c ctrl+d ctrl+z ctrl+l ctrl+a ctrl+e ctrl+r ctrl+w ctrl+u ctrl+k ctrl+p ctrl+n y n 0–9
get_screen
get_screen({
sessionId: "s1",
search: "error|warning", // optional regex to highlight matching lines
})
// Returns: { screen, cursor: { row, col }, searchResults, stats }wait_for
wait_for({
sessionId: "s1",
pattern: "\\$|#|>", // regex to match (case-insensitive)
timeoutMs: 30000, // max wait (default 30s)
intervalMs: 1000, // check interval (default 1s)
})
// Returns: { matched: true/false, screen, elapsed }wait_for_exit
wait_for_exit({
sessionId: "s1",
timeoutMs: 60000,
})
// Returns: { alive: false, exitCode: 0, screen }Resources
Sessions are exposed as MCP resources:
interactive-cli://sessions— JSON list of all sessionsinteractive-cli://sessions/{id}/screen— live screen content
Prompt Templates
Pre-built prompt templates for common flows (appear as slash commands in Claude Code):
eas_build— EAS build with credential handlingssh_session— SSH connection with command executionrepl_session— Start a REPL (Python, Node, psql, etc.)docker_interactive— Run an interactive Docker container
How It Works
graph LR
A[AI Agent] <-->|MCP Protocol| B[interactive-cli server]
B --> C[Session Manager]
C --> D[node-pty<br/><i>real PTY</i>]
C --> E[xterm headless<br/><i>screen render</i>]
C --> F[Truncation<br/><i>80K limit</i>]
D <--> G[Child Process<br/>ssh, eas, python...]node-pty spawns a real pseudo-terminal, so the child process thinks it's talking to a human
xterm headless maintains a virtual terminal buffer that renders ANSI sequences into a clean 2D text grid
Output is truncated at 80K chars (MCP clients like Claude Code cap at 100K) with smart middle-truncation preserving start and end
Tool annotations (
readOnlyHint,destructiveHint) tell the client which tools are safe to run in parallel and which need permission
Requirements
Node.js >= 18
macOS or Linux (node-pty uses native PTY)
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Develop, manage, and debug Railway projects, services, and deployments from within agents.
Control real Android and iOS devices with LLM agents — tap, swipe, type, automate flows.
- emisarOAuthdev.emisar
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage interactive pseudo-terminal (PTY) sessions for programs requiring full terminal emulation like vim, ssh, and interactive REPLs. It provides tools to spawn sessions, send input with escape sequences, and read buffered terminal output.11 npmMIT
- AlicenseNot gradedqualityDmaintenanceProvides a pseudo-terminal (PTY) interface that allows AI agents to interact with command-line tools requiring interactive prompts. It enables agents to autonomously spawn processes, read output, and send inputs for workflows like database migrations and project scaffolding.11 npm1MIT
- FlicenseAqualityCmaintenanceEnables AI agents to start and manage pseudo-terminal sessions, run shell commands and interact with REPLs programmatically.7-
- AlicenseNot gradedqualityCmaintenanceProvides AI agents with fully interactive terminal sessions, including TUI support, keyboard control, and screen capture across Windows, Linux, and Mac.MIT