MCP Connector

Control iTerm Terminal with LLMs

MCP server giving an AI assistant access to your iTerm session to run commands, use REPLs, and monitor output.

Works with iterm2node

91
Spark score
out of 100
Updated 10 months ago
Version 1.2.6
Models
universal

Add to Favorites

Why it matters

Empower Large Language Models to interact directly with your iTerm2 terminal. This allows LLMs to execute commands, read output, and control terminal applications, enabling sophisticated automation and analysis.

Outcomes

What it gets done

01

Execute commands in your iTerm terminal via LLM prompts.

02

Read and analyze terminal output for LLM-driven insights.

03

Interact with REPLs and send control characters (e.g., Ctrl+C) for full terminal control.

04

Delegate complex tasks to LLMs and observe their step-by-step execution within the terminal.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-iterm-mcp | bash

Capabilities

Tools your agent gets

write_to_terminal

Writes to the active iTerm terminal, commonly used to execute commands.

read_terminal_output

Reads the requested number of lines from the active iTerm terminal.

send_control_character

Sends a control character to the active iTerm terminal.

Overview

iTerm MCP Server

An MCP server giving an AI assistant access to a live iTerm session: writing commands, reading back only the requested output lines for token efficiency, and sending control characters, with full REPL interaction support. Use when an AI assistant needs to run and monitor commands in your iTerm session or interact with REPLs; not needed off macOS/iTerm2 or if unreviewed command execution is unacceptable.

What it does

iTerm MCP Server is an MCP server that gives an AI assistant access to your iTerm session, letting it read only the terminal output it's interested in - typically the last few lines, even for long-running commands - for efficient token use. You share iTerm with the model directly: you can ask questions about what's currently on screen, or delegate a task to the model and watch as it performs each step in the same terminal. It's built with minimal dependencies, runnable via npx, and designed to be easy to add to Claude Desktop and other MCP clients.

When to use - and when NOT to

Use this when you want an AI assistant to run and monitor commands in your actual iTerm session, interact with REPLs, send control characters like ctrl-c or ctrl-z, or watch it perform a delegated multi-step terminal task while you can interrupt at any point.

Not needed if you're not on macOS with iTerm2, or for tasks where you're unwilling to let a model execute unreviewed commands in a live terminal - iterm-mcp has no built-in restrictions and makes no attempt to evaluate the safety of the commands it runs, so the user is responsible for monitoring activity and aborting when appropriate, especially for multi-step tasks that could go off track; it's a good idea to start with smaller, focused tasks until you're familiar with how the model behaves.

Capabilities

Three tools: write_to_terminal (writes to the active iTerm terminal, typically to run a command, returning the number of output lines produced), read_terminal_output (reads a requested number of lines from the active terminal), and send_control_character (sends a control character, such as ctrl-c, to the active terminal).

How to install

Requires iTerm2 running and Node 18 or greater. Add to Claude Desktop's config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%/Claude/claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "iterm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "iterm-mcp"
      ]
    }
  }
}

Can also be installed automatically via Smithery: npx -y @smithery/cli install iterm-mcp --client claude. For development, install dependencies with yarn install, build with yarn run build, or use yarn run watch for auto-rebuild; since MCP servers communicate over stdio, debugging is done via the MCP Inspector (yarn run inspector, yarn debug <command>), which provides a browser-based debugging URL.

Who it's for

Developers who want to share their iTerm session with an AI assistant to run commands, interact with REPLs, and delegate multi-step terminal tasks, while staying able to watch and interrupt if the model goes off track.

Source README

iterm-mcp

A Model Context Protocol server that provides access to your iTerm session.

Features

Efficient Token Use: iterm-mcp gives the model the ability to inspect only the output that the model is interested in. The model typically only wants to see the last few lines of output even for long running commands.

Natural Integration: You share iTerm with the model. You can ask questions about what's on the screen, or delegate a task to the model and watch as it performs each step.

Full Terminal Control and REPL support: The model can start and interact with REPL's as well as send control characters like ctrl-c, ctrl-z, etc.

Easy on the Dependencies: iterm-mcp is built with minimal dependencies and is runnable via npx. It's designed to be easy to add to Claude Desktop and other MCP clients. It should just work.

Safety Considerations

  • The user is responsible for using the tool safely.
  • No built-in restrictions: iterm-mcp makes no attempt to evaluate the safety of commands that are executed.
  • Models can behave in unexpected ways. The user is expected to monitor activity and abort when appropriate.
  • For multi-step tasks, you may need to interrupt the model if it goes off track. Start with smaller, focused tasks until you're familiar with how the model behaves.

Tools

  • write_to_terminal - Writes to the active iTerm terminal, often used to run a command. Returns the number of lines of output produced by the command.
  • read_terminal_output - Reads the requested number of lines from the active iTerm terminal.
  • send_control_character - Sends a control character to the active iTerm terminal.

Requirements

  • iTerm2 must be running
  • Node version 18 or greater

Installation

To use with Claude Desktop, add the server config:

On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "iterm-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "iterm-mcp"
      ]
    }
  }
}

Installing via Smithery

To install iTerm for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install iterm-mcp --client claude

smithery badge

Development

Install dependencies:

yarn install

Build the server:

yarn run build

For development with auto-rebuild:

yarn run watch

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:

yarn run inspector
yarn debug <command>

The Inspector will provide a URL to access debugging tools in your browser.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.