A Model Context Protocol (MCP) server for interacting with iTerm2 on macOS.
╔╦╗╔═╗╔═╗ ╦╔╦╗╔═╗╦═╗╔╦╗
║║║║ ╠═╝ ║ ║ ║╣ ╠╦╝║║║
╩ ╩╚═╝╩ ═══ ╩ ╩ ╚═╝╩╚═╩ ╩
┌─┐┌─┐┌┬┐┌┬┐┌─┐┌┐┌┌┬┐ ┌─┐┬─┐┌─┐┌┬┐┌─┐┌─┐┌─┐┬
│ │ │││││││├─┤│││ ││ ├─┘├┬┘│ │ │ │ ││ │ ││
└─┘└─┘┴ ┴┴ ┴┴ ┴┘└┘─┴┘ ┴ ┴└─└─┘ ┴ └─┘└─┘└─┘┴─┘
Sometimes you don't just want the CLI tool to run once and return. Sometimes you want your AI to manage multiple long running process(e.g. "Launch a Web server for the backend" and "a typescript build server for the frontend".)
Instead of sending one off commands, ItermMCP let's manage a long running iterm process and you allows your AI to monitor running jobs.
- Create new iTerm tabs
- List the content of tabs
- Run commands in tabs
- Send control codes to tabs
- Get information about running tabs
- macOS
- iTerm2 installed
- Node.js >= 18.0.0
# Install globally from npm
npm install -g mcp-iterm
After installing via npm, add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"mcp-iterm": {
"command": "mcp-iterm"
}
}
}
# Clone the repository
git clone https://github.com/nbardy/mcp-iterm.git
cd mcp-iterm
# Install dependencies
npm install
# Build the project
npm run build
If installed via npm:
# Start the server
mcp-iterm
If running from source:
# Start the server
npm start
# Or with debugging
npm run debug
If the server doesn't start properly:
- Make sure iTerm2 is running
- Check the permissions on the index.js file (
chmod +x index.js
) - Check the log output in
/tmp/mcp-iterm.log
or via console - Try running it in debug mode:
npm run debug
The MCP server provides the following tools:
iterm_new_tab
: Creates a new tabiterm_tail_tab_all
: Lists all tabs with their output tailsiterm_tail_tab_single
: Shows the last N lines from a specific tabiterm_run_command_blocking
: Runs a command and waits for completioniterm_run_command_async
: Runs a command without waitingiterm_control_code
: Sends a control code (e.g., Ctrl+C)iterm_get_all_tabs_info
: Gets information about all tabs
Logs are written to /tmp/mcp-iterm.log
and also to the console.
MIT