Skip to main content

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

Metadata

Release files for iterm2-mcp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iterm2-mcp 0.2.0
File Size Uploaded Provenance Actions
iterm2_mcp-0.2.0.tar.gz 64.0 kB With provenance Details for iterm2_mcp-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iterm2-mcp 0.2.0
File Interpreter ABI Platform Actions
iterm2_mcp-0.2.0-py3-none-any.whl Python 3 none any Details for iterm2_mcp-0.2.0-py3-none-any.whl

Total release size: 73.3 kB

Release files / iterm2_mcp-0.2.0.tar.gz

Download URL iterm2_mcp-0.2.0.tar.gz
Size 64.0 kB
Tags Source
SHA-256 checksum
How to use checksums
66effac2814ea27e86cd1b8a31e716e9c47009025ef8bb4502981ec935df7e3a
BLAKE2b-256 checksum
How to use checksums
dd9351b96c14d0c89d6424192adbadde557735548eba044ad6c5fd3db655e380
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / iterm2_mcp-0.2.0-py3-none-any.whl

Download URL iterm2_mcp-0.2.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89174afd78c1ab45c85498b586310e113274f72387c1609c9c3df48927638ef8
BLAKE2b-256 checksum
How to use checksums
c5484831e52e6b2fac7a440f09c6e19ff1f637ef3f75adc61d31d5c948d4ebc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for iterm2-mcp 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for iterm2_mcp-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page