iTerm MCP Server

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides access to the user's iTerm terminal session, allowing the model to read terminal output, write commands to the terminal, and send control characters for full terminal control.

iterm-mcp

提供对您的 iTerm 会话的访问的模型上下文协议服务器。

特征

高效的令牌使用: iterm-mcp 使模型能够仅检查模型感兴趣的输出。即使对于长时间运行的命令,模型通常也只想查看最后几行输出。

**自然集成:**您可以与模型共享 iTerm。您可以针对屏幕上的内容提问,或将任务委托给模型,并观察其执行每个步骤。

**完全终端控制和 REPL 支持:**该模型可以启动并与 REPL 交互,以及发送控制字符,如 ctrl-c、ctrl-z 等。

依赖关系极少: iterm-mcp 构建时依赖关系极少,可通过 npx 运行。它易于添加到 Claude Desktop 和其他 MCP 客户端。它应该能够正常工作。

安全考虑

  • 用户有责任安全使用该工具。
  • 没有内置限制:iterm-mcp 不会尝试评估所执行命令的安全性。
  • 模型可能会以意想不到的方式运行。用户应监控模型活动并在适当的时候中止运行。
  • 对于多步骤任务,如果模型偏离轨道,你可能需要中断它。从较小、重点突出的任务开始,直到你熟悉模型的行为方式。

工具

  • write_to_terminal - 写入活动的 iTerm 终端,通常用于运行命令。返回该命令生成的输出行数。
  • read_terminal_output - 从活动的 iTerm 终端读取请求的行数。
  • send_control_character - 向活动的 iTerm 终端发送控制字符。

要求

  • iTerm2 必须正在运行
  • Node 版本 18 或更高版本

安装

要与 Claude Desktop 一起使用,请添加服务器配置:

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

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

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 iTerm:

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

发展

安装依赖项:

yarn install

构建服务器:

yarn run build

对于使用自动重建的开发:

yarn run watch

调试

由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。我们推荐使用MCP Inspector ,它以包脚本的形式提供:

yarn run inspector yarn debug <command>

检查器将提供一个 URL 来访问浏览器中的调试工具。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

该 MCP 服务器通过与 Claude Desktop 集成,使用户能够于当前 iTerm2 会话中执行 shell 命令,从而通过模型上下文协议实现无缝命令执行。

  1. Features
    1. Safety Considerations
      1. Tools
      2. Requirements
    2. Installation
      1. Installing via Smithery
    3. Development
      1. Debugging
    ID: h89lr05ty6