MCP Hub
Back to servers

iterm2-mcp

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.

glama
Updated
Apr 19, 2026

iterm2-mcp

An MCP server that provides full control over iTerm2.

Prerequisites

  1. iTerm2 running on macOS.
  2. Preferences > General > Magic > "Enable Python API" must be checked.
  3. Install iTerm2 shell integration in your shell. run_command and session variables like path/jobName depend on it. Without it, run_command falls back to its timeout.

The first time the server connects, iTerm2 will prompt you to approve the binary. Approve once; subsequent launches are automatic.

Install

uv tool install iterm2-mcp

Or from source:

git clone https://github.com/lorencarvalho/iterm2-mcp.git
cd iterm2-mcp
uv sync

Register with Claude

Claude Code:

claude mcp add iterm2 -- uvx iterm2-mcp

Claude Desktop — add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "iterm2": {
      "command": "uvx",
      "args": ["iterm2-mcp"]
    }
  }
}

Security

This server can type into terminals, run commands, and close sessions — anything you can do in iTerm2. Only connect it to MCP clients you trust. It has no sandboxing beyond what iTerm2 itself provides.

Tools

Most tools accept an optional session_id — omit it to target the currently active session.

ToolPurpose
list_sessionsTree of windows/tabs/sessions with IDs
get_active_sessionID and name of the focused session
focus_sessionBring a session to the foreground
write_to_terminalSend text (optionally with newline)
send_control_characterSend Ctrl-C, Ctrl-D, Ctrl-Z, ESC, etc.
send_escape_sequenceSend a raw ANSI escape (e.g. \x1b[2J)
read_screenRead the visible screen as plain text
get_cursor_positionCurrent cursor (x, y)
run_commandSend a command and wait for COMMAND_END
create_windowOpen a new iTerm2 window
create_tabOpen a new tab
split_paneSplit a pane horizontally or vertically
close_sessionClose a specific session
set_session_nameRename a session
set_badgeSet the iTerm2 badge text
clear_bufferClear screen and scrollback
list_profilesEnumerate iTerm2 profiles
get_variableRead an iTerm2 session variable

Development

uv sync
uv run ruff check
uv run ruff format
uv run ty check

License

MIT

Reviews

No reviews yet

Sign in to write a review