iterm2-mcp

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.

Category
Visit Server

README

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.

Tool Purpose
list_sessions Tree of windows/tabs/sessions with IDs
get_active_session ID and name of the focused session
focus_session Bring a session to the foreground
write_to_terminal Send text (optionally with newline)
send_control_character Send Ctrl-C, Ctrl-D, Ctrl-Z, ESC, etc.
send_escape_sequence Send a raw ANSI escape (e.g. \x1b[2J)
read_screen Read the visible screen as plain text
get_cursor_position Current cursor (x, y)
run_command Send a command and wait for COMMAND_END
create_window Open a new iTerm2 window
create_tab Open a new tab
split_pane Split a pane horizontally or vertically
close_session Close a specific session
set_session_name Rename a session
set_badge Set the iTerm2 badge text
clear_buffer Clear screen and scrollback
list_profiles Enumerate iTerm2 profiles
get_variable Read an iTerm2 session variable

Development

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

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured