远程命令 MCP 服务器
一个模型上下文协议 (MCP) 服务器,支持跨不同操作系统执行远程命令。该服务器提供统一的接口来执行 Shell 命令,自动处理 Windows 和类 Unix 系统之间的平台特定差异。
特征
- 跨平台命令执行
- Windows 和 Unix 之间的自动命令规范化
- 内置错误处理和输出流
- 工作目录规范支持
- 特定于平台的 shell 选择
安装
- 克隆存储库:
- 安装依赖项:
- 构建服务器:
- 在您的设置文件中配置 MCP 服务器:
对于 VSCode Cline 扩展( cline_mcp_settings.json
):
用法
该服务器提供了一个名为execute_remote_command
的工具,它可以在主机上执行任何有效的shell命令。其中包括:
- 系统命令
- 包管理器命令(apt、yum、chocolatey 等)
- 开发工具(git、npm、python等)
- 文件操作
- 网络命令
- 服务管理
- 以及系统上可用的任何其他 CLI 命令
工具:execute_remote_command
参数:
command
(必需):可以在主机操作系统上执行的任何有效 shell 命令cwd
(可选):命令执行的工作目录
示例
- 系统信息:
- 包管理:
- 网络运营:
- Git操作:
- 文件操作:
- 流程管理:
- 服务控制:
安全注意事项
由于此服务器可以执行任何系统命令,请考虑以下安全措施:
- 访问控制:仅限受信任的用户访问 MCP 服务器
- 命令验证:在应用程序逻辑中执行命令之前验证命令
- 工作目录:使用
cwd
参数将命令执行限制在特定目录中 - 环境:谨慎使用修改系统设置或敏感文件的命令
- 权限:使用适当的用户权限运行 MCP 服务器
跨平台命令处理
服务器自动处理特定于平台的差异:
- 命令翻译:
ls
⟷dir
(根据平台自动转换)- 适合每个平台的正确管道运算符格式
- 外壳选择:
- Windows:使用
cmd.exe
- Unix/Linux:使用
/bin/sh
- Windows:使用
错误处理
服务器提供详细的错误消息,并在响应中包含 stdout 和 stderr。如果命令失败,您将收到一条错误消息,其中包含有关错误的详细信息。
错误响应示例:
发展
项目结构
建筑
这将编译 TypeScript 代码并在build
目录中创建可执行文件。
贡献
- 分叉存储库
- 创建你的功能分支(
git checkout -b feature/amazing-feature
) - 提交您的更改(
git commit -m 'Add some amazing feature'
) - 推送到分支(
git push origin feature/amazing-feature
) - 打开拉取请求
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
模型上下文协议服务器,支持跨不同操作系统远程执行 shell 命令,自动处理 Windows 和类 Unix 系统之间的平台特定差异。
Related MCP Servers
- AsecurityAlicenseAqualityA secure shell command execution server implementing the Model Context Protocol (MCP). This server allows remote execution of whitelisted shell commands with support for stdin input.Last updated -174PythonMIT License
- -securityFlicense-qualityA Model Context Protocol server that allows LLMs to execute shell commands and receive their output in a controlled manner.Last updated -Python
- AsecurityAlicenseAqualityA Model Context Protocol server that provides secure command-line access to Windows systems, allowing MCP clients like Claude Desktop to safely execute commands in PowerShell, CMD, and Git Bash shells with configurable security controls.Last updated -9350105JavaScriptMIT License
- AsecurityFlicenseAqualityA Model Context Protocol server implementation that enables secure remote command execution via SSH, with features for managing and using SSH credentials.Last updated -53JavaScript