MCP server that gives Claude full control over iTerm2 via the iTerm2 Python API.
Project description
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-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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iterm2_mcp-0.1.0.tar.gz.
File metadata
- Download URL: iterm2_mcp-0.1.0.tar.gz
- Upload date:
- Size: 62.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5db89f2ae9ebeea0728875a20b37e90eb481bc0fa8b7a0e5c2e6d994c965df6
|
|
| MD5 |
fd07ccf7bae5ec406709dc1d085c6b79
|
|
| BLAKE2b-256 |
59da4a4660c890d8c90a2814ce445fd0af001e3149eed08b271a9ef9e0dcf033
|
Provenance
The following attestation bundles were made for iterm2_mcp-0.1.0.tar.gz:
Publisher:
publish.yml on lorencarvalho/iterm2-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iterm2_mcp-0.1.0.tar.gz -
Subject digest:
d5db89f2ae9ebeea0728875a20b37e90eb481bc0fa8b7a0e5c2e6d994c965df6 - Sigstore transparency entry: 1340008547
- Sigstore integration time:
-
Permalink:
lorencarvalho/iterm2-mcp@7bbaa6d8017466695936306b7656045ebd8916ec -
Branch / Tag:
refs/tags/0.0.1 - Owner: https://github.com/lorencarvalho
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7bbaa6d8017466695936306b7656045ebd8916ec -
Trigger Event:
release
-
Statement type:
File details
Details for the file iterm2_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iterm2_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f04a185ced3bbe02d91d1298b2ca974d18c5c33393166ececb25fb19536e5777
|
|
| MD5 |
fe3f088c9f8c0022811c248a5232fe43
|
|
| BLAKE2b-256 |
cbb7be2a2a7ab70476aa386449d87b451c82bf47d2368a79f534a9afe90fa440
|
Provenance
The following attestation bundles were made for iterm2_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on lorencarvalho/iterm2-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iterm2_mcp-0.1.0-py3-none-any.whl -
Subject digest:
f04a185ced3bbe02d91d1298b2ca974d18c5c33393166ececb25fb19536e5777 - Sigstore transparency entry: 1340008597
- Sigstore integration time:
-
Permalink:
lorencarvalho/iterm2-mcp@7bbaa6d8017466695936306b7656045ebd8916ec -
Branch / Tag:
refs/tags/0.0.1 - Owner: https://github.com/lorencarvalho
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7bbaa6d8017466695936306b7656045ebd8916ec -
Trigger Event:
release
-
Statement type: