Control iTerm2 Terminals with AI
MCP server for iTerm2 - open terminals, execute commands, read output, and manage sessions from an AI assistant.
Why it matters
Integrate AI assistants with your iTerm2 terminal on macOS. This asset allows AI to programmatically create, manage, and interact with terminal sessions, enabling automated command execution and output retrieval.
Outcomes
What it gets done
Open new iTerm2 terminal instances
Execute commands within specific terminals
Read and process terminal output
List and manage active terminal sessions
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-iterm-mcp-server | bash Capabilities
Tools your agent gets
Open a new terminal instance
Execute a command in a specific terminal
Read output from a specific terminal
Close a specific terminal
Display a list of all active terminals and their information
Overview
iTerm MCP Server
iTerm MCP Server lets an AI assistant open, run commands in, read output from, and manage iTerm2 terminal sessions on macOS. Use it for interactive shell workflows needing a persistent, inspectable terminal session; it only works on macOS since iTerm2 is macOS-only.
What it does
iTerm MCP Server lets an AI assistant create and manage iTerm2 terminal sessions directly: opening new terminals, executing commands in a specific terminal, reading back its output, listing all active terminals, and closing a terminal when done. All input is validated with Zod schemas, and commands run in isolated terminal sessions with sanitized input.
When to use - and when NOT to
Use this connector when you want an assistant to run shell commands and read their output through real iTerm2 sessions - useful for interactive workflows where the assistant needs to keep a terminal open across multiple steps and inspect its live output.
Do not use it on non-macOS systems - iTerm2 is macOS-only, so this connector only works there.
Inputs and outputs
open_terminal takes no required input and returns a terminal identifier. execute_command takes a terminal ID and a command string. read_output and close_terminal take a terminal ID. list_terminals takes no input. Outputs are terminal identifiers, command output text, or lists of active terminals with their info.
Capabilities
open_terminal: open a new iTerm2 terminal instanceexecute_command: execute a command in a specific terminalread_output: read the output from a specific terminallist_terminals: list all active terminals and their informationclose_terminal: close a specific terminal
How to install
For Cursor, add to ~/.cursor/mcp.json:
{
"mcpServers": {
"terminal": {
"command": "npx",
"args": ["iterm_mcp_server"]
}
}
}
Requires Node.js 14+, macOS, and iTerm2 installed. No additional configuration is needed beyond standard MCP setup.
Who it's for
macOS developers who want an AI assistant to run and monitor shell commands in real iTerm2 terminal sessions.
Source README
ITerm MCP Server
A Model Context Protocol (MCP) server implementation for iTerm2 terminal integration. This server allows AI assistants to interact with iTerm2 terminals through the Model Context Protocol.
Features
- Create and manage iTerm2 terminal sessions
- Execute commands in terminals
- Read terminal output
- List active terminals
- Close terminals
Requirements
- Node.js >= 14.x
- iTerm2
- macOS (since iTerm2 is macOS-only)
Configuration
Standard Configuration
The server uses the standard MCP configuration options. No additional configuration is required.
Cursor Configuration
To use this server with Cursor, add the following configuration to your ~/.cursor/mcp.json file:
{
"mcpServers": {
"terminal": {
"command": "npx",
"args": ["iterm_mcp_server"]
}
}
}
Tools
open_terminal: Open a new terminal instanceexecute_command: Execute a command in a specific terminalread_output: Read the output from a specific terminalclose_terminal: Close a specific terminallist_terminals: List all active terminals and their information
Security Considerations
- The server validates all input using Zod schemas
- Commands are executed in isolated terminal sessions
- Proper error handling and input sanitization is implemented
Author
Rishab Koul
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.