iterm-logs-mcp
This is a local macOS/iTerm2 MCP server for inspecting and controlling terminal sessions via AppleScript; the provided schema exposes only read-only inspection tools, though the README documents additional command/window-management tools.
List tabs/sessions (
list_iterm_tabs): enumerate every open iTerm2 window/tab/session withsession_id,window_index,tab_index,name,tty,cwd, andjob, so an agent can choose a target tab.Read scrollback (
get_iterm_tab_logs): fetch the lastmax_lines(default 500) lines of output for a givensession_id.Not in the exposed schema but documented in the README: run arbitrary shell commands in a session (
send_iterm_command), open new windows/tabs (open_iterm_window,open_iterm_tab), interrupt/stop processes (stop_iterm_process), and close windows/tabs (close_iterm_window,close_iterm_tab).Agent-side matching: the server does no fuzzy matching — the caller must decide which tab to read by comparing
cwd/jobfromlist_iterm_tabs.Setup prerequisite: the first call triggers a one-time macOS Automation permission prompt.
Click on "Deploy 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., "@iterm-logs-mcp list my open terminal tabs"
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.
iterm-logs-mcp
Local MCP server exposing iTerm2 tab/session logs to any MCP-capable agent. Reads terminal
state via AppleScript — the agent decides which tab to read by matching on cwd/job, no
built-in fuzzy-matching logic on the server side.
macOS + iTerm2 only. Local stdio server — not deployed anywhere.
Tools
list_iterm_tabs()— enumerates every open window/tab/session:session_id,window_index,tab_index,name,tty,cwd,job.get_iterm_tab_logs(session_id, max_lines=500)— returns the lastmax_lineslines of scrollback for that session.send_iterm_command(session_id, command, press_enter=True)— typescommandinto that session and presses Enter (unlesspress_enter=False). Doesn't wait for output; follow up withget_iterm_tab_logs. This runs arbitrary commands in your real terminals — keep the tool on "ask" in your MCP client rather than auto-approving it.open_iterm_window(cwd=None)— opens a new iTerm2 window with the default profile and returns itssession_id. Ifcwdis given,cds into it first.open_iterm_tab(session_id, cwd=None)— opens a new tab in the existing window containing that session and returns the new tab'ssession_id. Ifcwdis given,cds into it first.stop_iterm_process(session_id, timeout=5.0, force=False)— sends Ctrl-C to that session and waits up totimeoutseconds for it to return to its shell. Withforce=True, anything still running afterwards gets SIGTERM. Returnsstopped, themethodused, and anyremainingprocesses. Running state comes from the tty's foreground process group (ps), not iTerm2'sjobName, which can readzshwhile a child is still running.close_iterm_window(session_id, force=False)— closes the whole window containing that session, all tabs included. Refuses and lists the busy sessions if any tab is still running something, unlessforce=True.close_iterm_tab(session_id, force=False)— closes the tab containing that session, split panes included; other tabs stay open, and closing a window's last tab closes the window. Refuses and lists the busy sessions if the tab is still running something, unlessforce=True.
Related MCP server: it2mcp
First run
The first AppleScript call against iTerm2 triggers a one-time macOS Automation permission prompt for whichever process runs this script (Terminal, iTerm2, or your MCP client host). Grant it once in System Settings → Privacy & Security → Automation.
Run it
uv run --directory /path/to/iterm-logs-mcp server.pyRegister with Claude Code
claude mcp add iterm-logs -- uv run --directory /path/to/iterm-logs-mcp server.pyRegister with Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"iterm-logs": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/iterm-logs-mcp",
"server.py"
]
}
}
}Available Tools
2 toolsget_iterm_tab_logsA
Get scrollback/log contents for one iTerm2 session, identified by the session_id returned from list_iterm_tabs. Returns the last max_lines lines.
Inputs: session_id (required), max_lines. Returns: result
list_iterm_tabsA
List every open iTerm2 window/tab/session with its cwd and running job, so the caller can pick which one to read logs from.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one lists all open tabs with session IDs, the other retrieves logs for a specific session. There is no overlap or confusion.
Both names follow a consistent verb_noun pattern in snake_case: list_iterm_tabs and get_iterm_tab_logs. The naming is clear and predictable.
With only 2 tools, the set is minimal but covers the basic workflow of listing tabs and retrieving logs. However, it feels thin for a server claiming to provide log access, and could benefit from additional filtering or search tools.
The tool surface covers the core use case of listing tabs and reading logs. Minor gaps exist, such as no tool for retrieving full logs without a line limit or for searching within logs, but these are not critical.
Maintenance
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to control the macOS Terminal.app using AppleScript and the zmx session manager. It allows agents to send keystrokes, type text, and capture screen output in real-time.-
- AlicenseAqualityDmaintenanceAn MCP server that enables AI assistants to control iTerm2 sessions, windows, tabs, and profiles using the official iTerm2 Python API. It includes a security model with session tagging and tiered permissions to ensure safe and controlled terminal interactions.402MIT
- AlicenseAqualityBmaintenanceAn 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.18163 PyPI1MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that exposes iTerm2 tab control as native tools, designed for the conductor pattern where one Claude/Codex session drives sibling tabs.-