Skip to main content
Glama

iterm-mcp

MCP server that lets Claude Code agents control iTerm2 — discover terminal sessions, read their output, and send them input.

Built for a specific use case: running multiple Claude Code agents in different iTerm2 panes and having them coordinate with each other.

Tools

list_sessions — Enumerate all windows, tabs, and panes. Returns session IDs, names, TTYs, working directories, profiles, and terminal dimensions. Use this first to find what you want to talk to.

read_output — Read the last N lines from a session. Pulls from the scrollback buffer, so you can see history, not just what's currently visible.

write_input — Type text into a session. Sends Enter by default, pass newline: false to type without submitting.

send_control — Send control characters (ctrl-c, ctrl-d, ctrl-z, etc.) to a session.

Related MCP server: iterm2-mcp

How it works

AppleScript via osascript. No iTerm2 Python API to enable, no plugins to install. Working directory resolution uses lsof against the session's TTY.

All commands go through execFile (not exec), session IDs are validated as UUIDs before being interpolated, and text is escaped for AppleScript string literals.

Setup

npm install
npm run build

Add to ~/.claude.json:

{
  "mcpServers": {
    "iterm": {
      "type": "stdio",
      "command": "node",
      "args": ["/absolute/path/to/iterm-mcp/dist/index.js"]
    }
  }
}

Restart Claude Code. The tools show up as mcp__iterm__list_sessions, etc.

Requirements

  • macOS (AppleScript)

  • iTerm2

  • Node.js 18+

Available Tools

8 tools
check_activityA

Scan all iTerm2 sessions and report which are active vs idle. Returns each session's foreground process, last few lines of output, and an idle/active assessment. Use this to discover which sessions are worth watching or placing in a layout grid.

Inputs: tail_lines.

create_tabA

Create a new tab in the same window as an existing session. This is the preferred way to create new sessions — use this instead of create_window. Returns the session ID of the new tab's session.

Inputs: session_id (required), cwd, command, profile.

create_windowA

Create a new iTerm2 window. Prefer create_tab over this — new windows clutter the workspace. Only use create_window when the task genuinely needs a separate window. Returns the session ID of the new session.

Inputs: cwd, command, profile.

list_sessionsA

List all iTerm2 windows, tabs, and panes with their session IDs, names, and working directories. Use this to discover which terminal is running which agent.

Inputs: no named parameters.

read_outputA

Read the last N lines of output from a specific iTerm2 session by its session ID.

Inputs: session_id (required), lines.

send_controlA

PREFER SendMessage when you want another Claude Code session to stop, change course, or do something else — interrupting it by keystroke races whatever it is doing and discards its in-flight work, where a message is delivered cleanly at its next turn. Reach for send_control for genuine terminal control: killing a runaway process, ending stdin, clearing a screen. Send a control character (e.g. ctrl-c to interrupt) to a specific iTerm2 session.

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

split_paneA

Split an existing session's pane vertically or horizontally, creating a new pane. Returns the session ID of the new pane.

Inputs: session_id (required), cwd, command, profile, +1 more.

write_inputA

PREFER SendMessage when the target is another Claude Code session. SendMessage delivers an addressed, queued message straight into that session's conversation; it does not depend on which pane has focus, does not race whatever the session is mid-way through, and is not silently swallowed if the session is busy. Reach for write_input only for terminal work SendMessage cannot do: driving a shell, REPL or TUI, answering an interactive prompt, or starting a program in a pane. Send text input to a specific iTerm2 session. By default presses Enter after the text. When sending to a Claude Code session anyway, set submit: true — this writes the text without a trailing newline, then sends a separate Enter keystroke to trigger submission (Claude Code buffers pasted text and needs a distinct Enter to submit).

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

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 8 tools

    Disambiguation4/5

    list_sessions and check_activity both serve session discovery, but descriptions clearly differentiate structural listing (IDs, cwd) from activity/idle assessment. write_input and send_control overlap slightly but are well delineated as text vs control characters. create_window/create_tab/split_pane are cleanly distinct creation paths.

    Naming Consistency5/5

    All eight tools follow a consistent snake_case verb_noun pattern (check_activity, list_sessions, read_output, write_input, send_control, create_window, create_tab, split_pane). No casing or verb-style deviations.

    Tool Count5/5

    Eight tools is well-scoped for a terminal-control server, covering discovery, I/O, control signals, and layout creation. Each tool earns its place with no redundant or filler entries.

    Completeness3/5

    The surface covers discovery, reading, writing, control, and creation (window/tab/pane), but lacks any close/kill session or tab/window operation, so layout lifecycle isn't fully manageable. Agents can partially work around via send_control (ctrl-c/exit), but there is no clean teardown or focus/select operation.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides advanced iTerm2 terminal automation using Python API integration, enabling AI assistants to create and manage terminal sessions, split panes, execute commands, broadcast to multiple panes, and monitor terminal state in real-time.
      10 npm
      5
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      An MCP server that provides full control over iTerm2 terminal sessions on macOS. It enables users to manage windows, tabs, and panes, run commands, read screen content, and interact with terminal sessions through Claude.
      18
      35 PyPI
      1
      MIT