Provides comprehensive tools for managing iTerm2 terminal sessions, windows, tabs, and profiles, including the ability to read screen contents, execute commands, and control window layouts.
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., "@it2mcplist my open sessions and read the content of the active one"
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.
it2mcp
MCP server for controlling iTerm2 from AI assistants, editors, and other MCP clients.
Built on iTerm2's official Python API, it2mcp exposes 40 tools for managing sessions, windows, tabs, profiles, and more — with a security model that keeps you in control.
Prerequisites
macOS with iTerm2 installed
Python 3.10+
uv (recommended) or pip
iTerm2's Python API enabled: Preferences → General → Magic → Enable Python API
Installation
git clone https://github.com/youruser/it2mcp.git
cd it2mcp
uv syncUsage
Add to Claude Code
claude mcp add -s user it2mcp -- uv --directory /path/to/it2mcp run it2mcpAdd to other MCP clients
Add to your MCP client configuration:
{
"mcpServers": {
"it2mcp": {
"command": "uv",
"args": ["--directory", "/path/to/it2mcp", "run", "it2mcp"]
}
}
}Run standalone
uv run it2mcpSecurity
it2mcp ships secure by default. Two mechanisms protect your terminal sessions:
Session tagging
Sessions must be explicitly tagged before MCP can interact with them. Untagged sessions are invisible to all tools except session_list (which shows their mcp_enabled status so you know what to tag).
Tag a session (run this in the session's terminal):
# Using the it2 CLI
it2 session set-var user.mcp_enabled true
# Or using iTerm2's escape sequence (no dependencies)
printf '\033]1337;SetUserVar=%s=%s\007' mcp_enabled $(echo -n true | base64)Untag a session:
it2 session set-var user.mcp_enabled falseTags are not persistent — they reset when the session ends. This is intentional: you opt in per-session, per-lifetime.
Permission tiers
Tools are grouped into three tiers:
Tier | Tools | Description |
read |
| Observation only |
interact |
| Can send input and modify layout |
destructive |
| Can terminate sessions and close windows |
By default, only read is enabled.
Audit log
Every tool invocation is logged to ~/.local/share/it2mcp/audit.jsonl with timestamp, tool name, parameters, and result.
Configuration
Create ~/.config/it2mcp/config.yaml:
# Which permission tiers to enable
permissions:
- read
- interact
# - destructive
# Require sessions to have user.mcp_enabled set (default: true)
require_tag: true
# Audit log path (set to null to disable)
audit_log: ~/.local/share/it2mcp/audit.jsonlOverride the config path with the IT2MCP_CONFIG environment variable.
Tools
Session
Tool | Tier | Description |
| read | List all sessions with IDs, names, sizes, and |
| read | Read visible screen contents |
| read | Get a session variable (e.g. |
| interact | Send text without pressing Enter |
| interact | Execute a command (text + Enter) |
| interact | Split into a new pane |
| interact | Clear screen (Ctrl+L) |
| interact | Activate a specific session |
| interact | Set session name |
| interact | Set a session variable |
| destructive | Close a session |
| destructive | Restart a session |
Window
Tool | Tier | Description |
| read | List all windows with positions and sizes |
| read | List saved window arrangements |
| interact | Create a new window |
| interact | Activate a specific window |
| interact | Move window to screen position |
| interact | Resize a window |
| interact | Set fullscreen on/off/toggle |
| interact | Save current arrangement |
| interact | Restore a saved arrangement |
| destructive | Close a window |
Tab
Tool | Tier | Description |
| read | List all tabs with IDs and active state |
| interact | Create a new tab |
| interact | Select tab by ID or index |
| interact | Switch to next tab |
| interact | Switch to previous tab |
| interact | Move tab to its own window |
| destructive | Close a tab |
App
Tool | Tier | Description |
| read | Get focused window/tab/session info |
| read | Get iTerm2 version |
| read | Get or set theme |
| interact | Bring iTerm2 to front |
Broadcast
Tool | Tier | Description |
| interact | Enable broadcasting to all sessions in current tab |
| interact | Disable broadcasting |
| interact | Create broadcast group with specific sessions |
Profile
Tool | Tier | Description |
| read | List all profiles |
| read | Show profile details |
| interact | Apply a profile to a session |
Batch
Tool | Tier | Description |
| interact | Execute multiple operations in a single iTerm2 connection |
The batch tool accepts a list of operations and runs them sequentially over one connection. Supports a sleep operation for timing between steps. Each operation's tier is checked individually.
[
{"op": "session_run", "command": "echo hello"},
{"op": "sleep", "seconds": 1.0},
{"op": "session_read"}
]Acknowledgments
Built on top of it2 by @mkusaka — a powerful CLI for controlling iTerm2 via its Python API. it2mcp wraps the same underlying iterm2 Python API and was heavily inspired by it2's command structure.
License
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.