Token导航 LogoToken导航TokenDH.com
Win CLI MCP Server logo
开发工具stdio官方级别未说明来源级核验

Win CLI MCP Server

MCP Server

@simonb97/server-win-cli

Model Context Protocol server for secure command-line interactions on Windows systems

工具数

9

提示词数

0

GitHub Stars

268

资源数

0
命令行工具JavaScriptClaude安全控制ClaudeClaude Desktop

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

SimonB97

提供方

SimonB97

最后核验

2026/5/18 04:55

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx @simonb97/server-win-cli --init-config ./config.json

详细介绍

Windows CLI MCP服务器

\[!小心\] 项目已弃用 -不再维持。 使用https://github.com/wonderwhy-er/DesktopCommanderMCP而是用于类似的功能。

](https://www.npmjs.com/package/@simonb97/server-win-cli) ](https://www.npmjs.com/package/@simonb97/server-win-cli?activeTab=versions) ](https://smithery.ai/server/@simonb97/server-win-cli)

\[!重要\] 此MCP服务器通过SSH提供对系统命令行界面和远程系统的直接访问。启用后,它授予对文件、环境变量、命令执行功能和远程服务器管理的访问权限。 - 检查并限制允许的路径和SSH连接 - 启用目录限制 - 配置命令块 - 考虑安全影响 看 配置 了解更多详情。

- 配置位置 - 默认配置 - 配置设置 - 安全设置 - 外壳配置 - SSH配置

- 工具 - 资源

特性

  • 多壳支持:在PowerShell、命令提示符(CMD)和Git Bash中执行命令
  • SSH支持:通过SSH在远程系统上执行命令
  • 资源暴露:将SSH连接、当前目录和配置作为MCP资源查看
  • 安全控制:

- 命令和SSH命令阻止(完整路径,大小写变化) - 工作目录验证 - 最大命令长度限制 - 命令记录和历史跟踪 - 智能论证验证

  • 可配置的:

- 自定义安全规则 - 外壳特定设置 - SSH连接配置文件 - 路径限制 - 已阻止的命令列表

请参阅 API 有关服务器为MCP客户端提供的工具和资源的更多详细信息,请参阅第节。

备注:服务器只允许在配置的目录内、使用允许的命令和配置的SSH连接上进行操作。

使用Claude Desktop

将此添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "windows-cli": {
      "command": "npx",
      "args": ["-y", "@simonb97/server-win-cli"]
    }
  }
}

要与特定的配置文件一起使用,请添加 --config 标志:

{
  "mcpServers": {
    "windows-cli": {
      "command": "npx",
      "args": [
        "-y",
        "@simonb97/server-win-cli",
        "--config",
        "path/to/your/config.json"
      ]
    }
  }
}

配置后,您可以:

  • 使用可用工具直接执行命令
  • 在参考资料部分查看配置的SSH连接和服务器配置
  • 通过提供的工具管理SSH连接

配置

服务器使用JSON配置文件来定制其行为。您可以指定安全控制、shell配置和SSH连接的设置。

  1. 要创建默认配置文件,请执行以下操作之一:

复制 config.json.exampleconfig.json,或

b 运行:

npx @simonb97/server-win-cli --init-config ./config.json
  1. 然后设置 --config 标记指向配置文件,如中所述 使用Claude Desktop 部分。

配置位置

服务器在以下位置查找配置(按顺序):

  1. 指定的路径 --config 旗帜
  2. 当前目录中的./config.json
  3. ~/.win-cli-mcp/config.json位于用户的主目录中

如果找不到配置文件,服务器将使用默认(受限)配置:

默认配置

备注:默认配置被设计为具有限制性和安全性。在中查找有关每个设置的更多详细信息 配置设置 部分。

{
  "security": {
    "maxCommandLength": 2000,
    "blockedCommands": [
      "rm",
      "del",
      "rmdir",
      "format",
      "shutdown",
      "restart",
      "reg",
      "regedit",
      "net",
      "netsh",
      "takeown",
      "icacls"
    ],
    "blockedArguments": [
      "--exec",
      "-e",
      "/c",
      "-enc",
      "-encodedcommand",
      "-command",
      "--interactive",
      "-i",
      "--login",
      "--system"
    ],
    "allowedPaths": ["User's home directory", "Current working directory"],
    "restrictWorkingDirectory": true,
    "logCommands": true,
    "maxHistorySize": 1000,
    "commandTimeout": 30,
    "enableInjectionProtection": true
  },
  "shells": {
    "powershell": {
      "enabled": true,
      "command": "powershell.exe",
      "args": ["-NoProfile", "-NonInteractive", "-Command"],
      "blockedOperators": ["&", "|", ";", "`"]
    },
    "cmd": {
      "enabled": true,
      "command": "cmd.exe",
      "args": ["/c"],
      "blockedOperators": ["&", "|", ";", "`"]
    },
    "gitbash": {
      "enabled": true,
      "command": "C:\\Program Files\\Git\\bin\\bash.exe",
      "args": ["-c"],
      "blockedOperators": ["&", "|", ";", "`"]
    }
  },
  "ssh": {
    "enabled": false,
    "defaultTimeout": 30,
    "maxConcurrentSessions": 5,
    "keepaliveInterval": 10000,
    "keepaliveCountMax": 3,
    "readyTimeout": 20000,
    "connections": {}
  }
}

配置设置

配置文件分为三个主要部分: security, shells,以及 ssh.

安全设置

{
  "security": {
    // Maximum allowed length for any command
    "maxCommandLength": 1000,

    // Commands to block - blocks both direct use and full paths
    // Example: "rm" blocks both "rm" and "C:\\Windows\\System32\\rm.exe"
    // Case-insensitive: "del" blocks "DEL.EXE", "del.cmd", etc.
    "blockedCommands": [
      "rm", // Delete files
      "del", // Delete files
      "rmdir", // Delete directories
      "format", // Format disks
      "shutdown", // Shutdown system
      "restart", // Restart system
      "reg", // Registry editor
      "regedit", // Registry editor
      "net", // Network commands
      "netsh", // Network commands
      "takeown", // Take ownership of files
      "icacls" // Change file permissions
    ],

    // Arguments that will be blocked when used with any command
    // Note: Checks each argument independently - "cd warm_dir" won't be blocked just because "rm" is in blockedCommands
    "blockedArguments": [
      "--exec", // Execution flags
      "-e", // Short execution flags
      "/c", // Command execution in some shells
      "-enc", // PowerShell encoded commands
      "-encodedcommand", // PowerShell encoded commands
      "-command", // Direct PowerShell command execution
      "--interactive", // Interactive mode which might bypass restrictions
      "-i", // Short form of interactive
      "--login", // Login shells might have different permissions
      "--system" // System level operations
    ],

    // List of directories where commands can be executed
    "allowedPaths": ["C:\\Users\\YourUsername", "C:\\Projects"],

    // If true, commands can only run in allowedPaths
    "restrictWorkingDirectory": true,

    // If true, saves command history
    "logCommands": true,

    // Maximum number of commands to keep in history
    "maxHistorySize": 1000,

    // Timeout for command execution in seconds (default: 30)
    "commandTimeout": 30,

    // Enable or disable protection against command injection (covers ;, &, |, \`)
    "enableInjectionProtection": true
  }
}

外壳配置

{
  "shells": {
    "powershell": {
      // Enable/disable this shell
      "enabled": true,
      // Path to shell executable
      "command": "powershell.exe",
      // Default arguments for the shell
      "args": ["-NoProfile", "-NonInteractive", "-Command"],
      // Optional: Specify which command operators to block
      "blockedOperators": ["&", "|", ";", "`"]  // Block all command chaining
    },
    "cmd": {
      "enabled": true,
      "command": "cmd.exe",
      "args": ["/c"],
      "blockedOperators": ["&", "|", ";", "`"]  // Block all command chaining
    },
    "gitbash": {
      "enabled": true,
      "command": "C:\\Program Files\\Git\\bin\\bash.exe",
      "args": ["-c"],
      "blockedOperators": ["&", "|", ";", "`"]  // Block all command chaining
    }
  }
}

SSH配置

{
  "ssh": {
    // Enable/disable SSH functionality
    "enabled": false,

    // Default timeout for SSH commands in seconds
    "defaultTimeout": 30,

    // Maximum number of concurrent SSH sessions
    "maxConcurrentSessions": 5,

    // Interval for sending keepalive packets (in milliseconds)
    "keepaliveInterval": 10000,

    // Maximum number of failed keepalive attempts before disconnecting
    "keepaliveCountMax": 3,

    // Timeout for establishing SSH connections (in milliseconds)
    "readyTimeout": 20000,

    // SSH connection profiles
    "connections": {
      // NOTE: these examples are not set in the default config!
      // Example: Local Raspberry Pi
      "raspberry-pi": {
        "host": "raspberrypi.local", // Hostname or IP address
        "port": 22, // SSH port
        "username": "pi", // SSH username
        "password": "raspberry", // Password authentication (if not using key)
        "keepaliveInterval": 10000, // Override global keepaliveInterval
        "keepaliveCountMax": 3, // Override global keepaliveCountMax
        "readyTimeout": 20000 // Override global readyTimeout
      },
      // Example: Remote server with key authentication
      "dev-server": {
        "host": "dev.example.com",
        "port": 22,
        "username": "admin",
        "privateKeyPath": "C:\\Users\\YourUsername\\.ssh\\id_rsa", // Path to private key
        "keepaliveInterval": 10000,
        "keepaliveCountMax": 3,
        "readyTimeout": 20000
      }
    }
  }
}

API

工具

  • execute_命令

- 在指定的shell中执行命令 - 输入: - shell (string):要使用的Shell(“powershell”、“cmd”或“gitbash”) - command (string):要执行的命令 - workingDir (可选字符串):工作目录 - 以文本形式返回命令输出,如果执行失败,则返回错误消息

  • get_command_history

- 获取已执行命令的历史记录 - 输入: limit (可选编号) - 返回带有时间戳的命令历史记录及其输出

  • ssh执行

- 通过SSH在远程系统上执行命令 - 输入: - connectionId (string):要使用的SSH连接的ID - command (string):要执行的命令 - 以文本形式返回命令输出,如果执行失败,则返回错误消息

  • ssh断开连接

- 断开与SSH服务器的连接 - 输入: - connectionId (string):要断开的SSH连接的ID - 返回确认消息

  • create_ssh_connection

- 创建新的SSH连接 - 输入: - connectionId (string):新SSH连接的ID - connectionConfig (object):连接配置详细信息,包括主机、端口、用户名以及密码或privateKeyPath - 返回确认消息

  • read_ssh_连接

- 读取所有已配置的SSH连接 - 从配置中返回所有SSH连接的列表

  • update_ssh_connection

- 更新现有的SSH连接 - 输入: - connectionId (string):要更新的SSH连接的ID - connectionConfig (对象):新连接配置详细信息 - 返回确认消息

  • delete_ssh_connection

- 删除SSH连接 - 输入: - connectionId (string):要删除的SSH连接的ID - 返回确认消息

  • get_current目录

- 获取服务器的当前工作目录 - 返回当前工作目录路径

资源

  • SSH连接

- URI格式: ssh://{connectionId} - 包含隐藏敏感信息的连接详细信息 - 每个配置的SSH连接对应一个资源 - 例子: ssh://raspberry-pi 显示了“raspberry pi”连接的配置

  • SSH配置

- URI: ssh://config - 包含整体SSH配置和所有连接(密码被屏蔽) - 显示defaultTimeout、maxConcurrentSessions和连接列表等设置

  • 当前目录

- URI: cli://currentdir - 包含CLI服务器的当前工作目录 - 显示默认情况下执行命令的路径

  • CLI配置

- URI: cli://config - 包含CLI服务器配置(不包括敏感数据) - 显示安全设置、shell配置和SSH设置

安全考虑

内置安全功能(始终处于活动状态)

以下安全功能已硬编码到服务器中,无法禁用:

  • 不区分大小写的命令阻止:所有命令阻塞都不区分大小写(例如,如果“DEL”在blockedCommands中,则“DEL.EXE”、“DEL.cmd”等都会被阻塞)
  • 智能路径解析:服务器解析完整的命令路径以防止绕过尝试(如果“rm”被阻止,则阻止“C:\\Windows\\System32\\rm.exe”)
  • 命令解析智能:避免了误报(例如,“warm_dir”不会因为“rm”在blockedCommands中而被阻止)
  • 输入验证:所有用户输入在执行前都经过验证
  • 壳牌工艺管理:进程在执行或超时后正确终止
  • 敏感数据屏蔽:密码在资源中自动屏蔽(替换为\*\*\*\*\*\*)

可配置的安全功能(默认为活动)

这些安全功能可以通过config.json文件进行配置:

  • 命令阻止:中指定的命令 blockedCommands 数组被阻止(默认包括rm、del、format等危险命令)
  • 参数阻止:中指定的参数 blockedArguments 数组被阻止(默认包括潜在危险标志)
  • 指令注入保护:防止命令链(默认情况下通过启用 enableInjectionProtection: true)
  • 工作目录限制:将命令执行限制到指定目录(默认情况下通过启用 restrictWorkingDirectory: true)
  • 命令长度限制:限制最大命令长度(默认值:2000个字符)
  • 命令超时:终止运行时间过长的命令(默认值:30秒)
  • 命令记录:记录命令历史记录(默认情况下通过启用 logCommands: true)

重要安全警告

这些不是功能,而是需要注意的重要安全考虑因素:

  • 环境准入:命令可以访问可能包含敏感信息的环境变量
  • 文件系统访问:命令可以在允许的路径内读/写文件-请仔细配置 allowedPaths 防止访问敏感数据

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

目录标签

目录标签

命令行工具JavaScriptClaude安全控制os-automationmcpclaude-aimcp-servermodelcontextprotocol本地部署Windows开发远程管理多Shell支持

支持客户端

ClaudeClaude Desktop

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

@simonb97/server-win-cli

工具数量(toolCount,工具数)

9

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP