MCP Shell 执行服务器

MCP Shell 执行服务器

为 Claude 等 MCP 兼容 AI 助手提供持久化 Shell 命令执行功能的服务器。

快速入门

  1. 克隆仓库并安装依赖: git clone https://github.com/samihalawa/mcp-server-shell-exec.git cd mcp-server-shell-exec npm install

  2. 构建服务器: npm run build

  3. 启动服务器: npm start

  4. 配置 MCP 客户端,在配置文件中添加服务信息,例如: { "servers": { "shell-exec-server": { "command": "/path/to/node", "args": ["/path/to/mcp-server-shell-exec/build/index.js"], "enabled": true, "port": 3006 } } }

  5. 使用 execute-command 和 reset-shell 工具与服务器交互。

示例

  • 执行命令:execute-command(command: "ls -la")
  • 运行后台任务:execute-command(command: "sleep 60 && echo 'Done'", runInBackground: true)
  • 重置会话:reset-shell()