r

rishabkoul

@rishabkoul/iTerm-MCP-Server
Hosted
0 Stars 308 次浏览 rishabkoul 更新于 2026-08-23

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "terminal": {
      "args": [
        "iterm_mcp_server"
      ],
      "command": "npx"
    }
  }
}

可用工具 (5 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

open-terminal

Open a new terminal instance

该工具无需必填参数,直接调用即可

execute-command

Execute a command in a specific terminal

该工具无需必填参数,直接调用即可

read-output

Read the output from a specific terminal

该工具无需必填参数,直接调用即可

close-terminal

Close a specific terminal

该工具无需必填参数,直接调用即可

list-terminals

List all active terminals and their information

该工具无需必填参数,直接调用即可

服务介绍

iTerm MCP 服务器

这是一个为 iTerm2 终端集成实现的 Model Context Protocol (MCP) 服务器。该服务器允许 AI 助手通过 Model Context Protocol 与 iTerm2 终端进行交互。

特性

  • 创建和管理 iTerm2 终端会话
  • 在终端中执行命令
  • 读取终端输出
  • 列出活动终端
  • 关闭终端

要求

  • Node.js >= 14.x
  • iTerm2
  • macOS(因为 iTerm2 仅支持 macOS)

配置

标准配置

服务器使用标准的 MCP 配置选项。无需额外配置。

Cursor 配置

要将此服务器与 Cursor 一起使用,请在您的 ~/.cursor/mcp.json 文件中添加以下配置:

json
{
"mcpServers": {
"terminal": {
"command": "npx",
"args": ["iterm_mcp_server"]
}
}
}

工具

  • open_terminal: 打开一个新的终端实例
  • execute_command: 在特定终端中执行命令
  • read_output: 从特定终端读取输出
  • close_terminal: 关闭特定终端
  • list_terminals: 列出所有活动终端及其信息

安全考虑

  • 服务器使用 Zod 模式验证所有输入
  • 命令在隔离的终端会话中执行
  • 实现了适当的错误处理和输入清理

贡献

欢迎贡献!请随时提交 Pull Request。

许可证

ISC

作者

Rishab Koul

相关 MCP 服务