lite
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"iterm-mcp": {
"args": [
"-y",
"iterm-mcp"
],
"command": "npx"
}
}
}
可用工具 (3 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
write_to_terminal
Writes text to the active iTerm terminal - often used to run a command in the terminal
该工具无需必填参数,直接调用即可
read_terminal_output
Reads the output from the active iTerm terminal
该工具无需必填参数,直接调用即可
send_control_character
Sends a control character to the active iTerm terminal (e.g., Control-C, or special sequences like ] for telnet escape)
该工具无需必填参数,直接调用即可
服务介绍
iterm-mcp
一个提供访问你iTerm会话的Model Context Protocol服务器。

特性
高效的令牌使用: 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
json
{
"mcpServers": {
"iterm-mcp": {
"command": "npx",
"args": [
"-y",
"iterm-mcp"
]
}
}
}
通过Smithery安装
要通过Smithery自动为Claude Desktop安装iTerm:
bash
npx -y @smithery/cli install iterm-mcp --client claude
开发
安装依赖:
bash
yarn install
构建服务器:
bash
yarn run build
开发时自动重建:
bash
yarn run watch
调试
由于MCP服务器通过标准输入输出进行通信,调试可能会有挑战。我们推荐使用MCP Inspector,它作为包脚本可用:
bash
yarn run inspector
yarn debug
Inspector将提供一个URL,以便您在浏览器中访问调试工具。