iterm2-mcp
Provides full control over iTerm2 terminal emulator on macOS, including managing windows/tabs/sessions, sending commands and control characters, reading screen content, and accessing session variables.
Click on "Install 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., "@iterm2-mcprun ls -la in the current terminal"
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.
iterm2-mcp
An MCP server that provides full control over iTerm2.
Prerequisites
iTerm2 running on macOS.
Preferences > General > Magic > "Enable Python API" must be checked.
Install iTerm2 shell integration in your shell.
run_commandand session variables likepath/jobNamedepend on it. Without it,run_commandfalls 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-mcpOr from source:
git clone https://github.com/lorencarvalho/iterm2-mcp.git
cd iterm2-mcp
uv syncRegister with Claude
Claude Code:
claude mcp add iterm2 -- uvx iterm2-mcpClaude 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 |
| Tree of windows/tabs/sessions with IDs |
| ID and name of the focused session |
| Bring a session to the foreground |
| Send text (optionally with newline) |
| Send Ctrl-C, Ctrl-D, Ctrl-Z, ESC, etc. |
| Send a raw ANSI escape (e.g. |
| Read the visible screen as plain text |
| Current cursor |
| Send a command and wait for |
| Open a new iTerm2 window |
| Open a new tab |
| Split a pane horizontally or vertically |
| Close a specific session |
| Rename a session |
| Set the iTerm2 badge text |
| Clear screen and scrollback |
| Enumerate iTerm2 profiles |
| Read an iTerm2 session variable |
Development
uv sync
uv run ruff check
uv run ruff format
uv run ty checkLicense
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lorencarvalho/iterm2-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server