Remote Command MCP Server

Remote Command MCP Server

site icon
2025.03.25 0
JavaScript远程命令执行跨平台工具开发效率
Remote-Command-MCP 是一个基于 Model Context Protocol (MCP) 的服务器,旨在提供跨平台的远程命令执行功能。它通过统一的接口执行 shell 命令,并自动处理 Windows 和 Unix 类系统之间的平台差异。
View on GitHub

Overview

基本能力

产品定位

Remote-Command-MCP 是一个跨平台的远程命令执行服务器,旨在简化不同操作系统间的命令执行和管理。

核心功能

  • 跨平台命令执行
  • 自动命令规范化(Windows 和 Unix 之间)
  • 内置错误处理和输出流
  • 支持工作目录指定
  • 平台特定的 shell 选择

适用场景

  • 系统管理
  • 开发工具链集成
  • 自动化脚本执行
  • 跨平台应用开发
  • 远程服务器管理

工具列表

  • execute_remote_command: 执行任何有效的 shell 命令
  • 参数:
    • command (必需): 可在主机操作系统上执行的任何有效 shell 命令
    • cwd (可选): 命令执行的工作目录

常见问题解答

  1. 安全性问题: 由于可以执行任何系统命令,建议限制访问权限并验证命令
  2. 跨平台兼容性: 服务器会自动处理平台差异,如命令转换和 shell 选择
  3. 错误处理: 提供详细的错误消息,包括 stdout 和 stderr

使用教程

使用依赖

  1. 确保已安装 Node.js 和 npm

安装教程

  1. 克隆仓库:
git clone https://github.com/deepsuthar496/Remote-Command-MCP
cd remote-command-server
  1. 安装依赖:
npm install
  1. 构建服务器:
npm run build
  1. 在配置文件中配置 MCP 服务器:

对于 Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "remote-command": {
      "command": "node",
      "args": ["path/to/remote-command-server/build/index.js"],
      "disabled": false,
      "autoApprove": []
    }
  }
}

对于 VSCode Cline Extension (cline_mcp_settings.json):

{
  "mcpServers": {
    "remote-command": {
      "command": "node",
      "args": ["path/to/remote-command-server/build/index.js"],
      "disabled": false,
      "autoApprove": []
    }
  }
}

调试方式

  1. 运行构建后的服务器:
node build/index.js
  1. 使用示例命令测试功能,如:
curl -X POST -d '{"command":"uname -a"}' http://localhost:port/execute
  1. 检查日志输出以确认服务器正常运行

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。