
一个在当前 iTerm 会话中执行命令的模型上下文协议服务器——对 REPL 和 CLI 辅助非常有用
概览
一个提供访问你iTerm会话的模型上下文协议服务器。 iterm-mcp 赋予模型只检查其感兴趣输出的能力。模型通常只想看到输出的最后几行,即使是长时间运行的命令。 你和模型共享iTerm。你可以问屏幕上显示的内容,或者把任务交给模型,观察它完成每一步。 模型可以启动并与 REPL 交互,并发送控制字符如 ctrl-c、ctrl-z 等。 iterm-mcp 依赖最小,可以通过 NPX 运行。它设计得易于添加到 Claude Desktop 和其他 MCP 客户端。它应该能正常工作。 * 用户需负责安全使用工具。* 无内置限制:iterm-mcp 不尝试评估执行命令的安全性。* 模型可能表现出意想不到的行为。用户需监控活动并在适当时中止。
概述(AI 翻译)
一个提供访问你iTerm会话的模型上下文协议服务器。
特色
高效令牌使用: iterm-mcp 赋予模型只检查其感兴趣输出的能力。模型通常只想看到输出的最后几行,即使是长时间运行的命令。
自然集成: 你与模型共享iTerm。你可以询问屏幕上的内容,或者委托一个任务给模型,观察它完成每一步。
完全支持终端控制和REPL: 模型可以启动并与REPL交互,还能发送控制字符如ctrl-c、ctrl-z等。
对依赖关系要宽松: iterm-mcp 构建时依赖极少,可以通过 npx 运行。它设计得方便添加到 Claude Desktop 和其他 MCP 客户端。应该能正常工作。
安全考量
- 用户需负责安全使用该工具。
- 无内置限制:iterm-mcp 不尝试评估执行命令的安全性。
- 模型可能会表现出意想不到的行为。用户需要监控活动并在适当时中止。
本页由 AI 翻译,技术细节请以原文为准。
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
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
The Inspector will provide a URL to access debugging tools in your browser.
安装
npx -y iterm-mcp配置
{
"mcpServers": {
"iterm-mcp": {
"command": "npx",
"args": [
"-y",
"iterm-mcp"
]
}
}
}