Purpose
win-cli-mcp-server is a Model Context Protocol (MCP) server designed to provide secure command-line interaction capabilities for Windows systems. It enables MCP clients (such as Claude Desktop) to perform operations on the user's system like Open Interpreter, including accessing files, environment variables, executing commands, and managing remote servers.
Note: This project has been marked as DEPRECATED and is no longer maintained. The official recommendation is to use https://github.com/wonderwhy-er/DesktopCommanderMCP to obtain similar functionality.
Main Capabilities
- Multi-Shell Support: Can execute commands in PowerShell, Command Prompt (CMD), and Git Bash.
- SSH Support: Can execute commands on remote systems via SSH.
- Resource Exposure: View SSH connections, the current directory, and configuration as MCP resources.
- Security Controls:
- Command and SSH command blocking (supports full paths and case variants)
- Working directory validation
- Maximum command length limit
- Command logging and history tracking
- Intelligent argument validation
- Configurability: Custom security rules, Shell-specific settings, SSH connection configuration files, path restrictions, and blocked command lists.
The server only allows operations within configured directories, using allowed commands, and on configured SSH connections.
Usage
Use with Claude Desktop
Add the following content to claude_desktop_config.json (the complete specific configuration content is not fully shown in the provided materials). If you need to use a specific configuration file, you can add the --config flag.
After configuration is complete, you can:
- Use the available tools to execute commands directly
- View the configured SSH connections and server configuration in the Resources section
- Manage SSH connections through the provided tools
Configuration File
The server uses a JSON configuration file to customize behavior, and you can specify security controls, Shell configuration, and SSH connection settings.
How to create the default configuration file:
- a) Copy
config.json.exampleasconfig.json, or - b) Generate it by other means (the materials do not fully explain this)
Then, as described in the "Use with Claude Desktop" section, set the --config flag to point to the configuration file.
The server searches for configuration in the following order:
- The path specified by the
--configflag - The
./config.jsonin the current directory - The
~/.win-cli-mcp/config.json
in the user's home directory
If no configuration file is found, the server will use the default (restricted) configuration. The default configuration is designed to be restrictive and secure.
The configuration file is divided into three main sections:security、shells and ssh.
API Tools and Resources
Tools
- execute_command: Execute a command in the specified Shell. Input:
shell(string, optional "powershell", "cmd", or "gitbash"),command(string),workingDir(optional string). Returns the command output text or an error message. - get_command_history: Gets the history of executed commands. Input:
limit(optional number). Returns the command history with timestamps and output. - ssh_execute: Executes a command on a remote system via SSH. Input:
connectionId(string),command(string). Returns the command output text or an error message. - ssh_disconnect: Disconnects from the SSH server. Input:
connectionId(string). Returns a confirmation message. - create_ssh_connection: Creates a new SSH connection. Input:
connectionId(string),connectionConfig(object containing host, port, username, and password or private key path). Returns a confirmation message. - read_ssh_connections: Reads all configured SSH connections. Returns a list of all SSH connections in the configuration.
- update_ssh_connection: Updates an existing SSH connection. Input:
connectionId(string),connectionConfig(object). Returns a confirmation message. - delete_ssh_connection: Deletes an SSH connection. Input:
connectionId(string). Returns a confirmation message. - get_current_directory: Gets the server's current working directory. Returns the current working directory path.
Resources
- SSH connection: URI format
ssh://{connectionId}, containing connection details (sensitive information masked), one resource per configured SSH connection. For example,ssh://raspberry-pishows the configuration of the "raspberry-pi" connection. - SSH configuration: URI
ssh://config, containing the overall SSH configuration and all connections (passwords masked), showing settings such asdefaultTimeout、maxConcurrentSessionsand the connection list. - Current directory: URI
cli://currentdir, containing the CLI server's current working directory, showing the path where commands are executed by default. - CLI configuration: URI
cli://config, containing the CLI server configuration (excluding sensitive data), showing security settings, Shell configuration, and SSH settings.
Security Considerations
Built-in Security Features (Always Enabled)
The following security features are hardcoded in the server and cannot be disabled:
- Case-insensitive command blocking: All command blocking is case-insensitive (for example, if
delis inblockedCommands, then "DEL.EXE", "del.cmd", etc. are all blocked). - Smart path resolution: The server resolves full command paths to prevent bypass attempts (if
rmis blocked, then "C:\Windows\System32\rm.exe" is also blocked). - Smart command parsing: Avoids false positives (for example,
warm_dirwill not be blocked merely becausermis inblockedCommands). - Input validation: All user input is validated before execution.
- Shell process management: Processes are properly terminated after execution or on timeout.
- Sensitive data masking: Passwords in resources are automatically masked (replaced with
********).
Configurable Security Features (Enabled by Default)
The following security features can be configured via config.json :
- Command blocking: Commands specified in the
blockedCommandsarray are blocked (by default including dangerous commands such asrm、del、format). - Argument blocking: Arguments specified in the
blockedArgumentsarray are blocked (by default including potentially dangerous flags). - Command injection protection: Prevents command chaining (by default via
enableInjectionProtection: trueenabled). - Working directory restriction: Restricts command execution to a specified directory (enabled by default via
restrictWorkingDirectory: trueenabled). - Command length limit: Limits the maximum command length (default: 2000 characters).
- Command timeout: Terminates commands that run for too long (default: 30 seconds).
- Command logging: Records command history (enabled by default via
logCommands: trueenabled).
Important Security Warnings
- Environment access: Commands may access environment variables, which may contain sensitive information.
- File system access: Commands can read and write files within allowed paths—please configure
allowedPathscarefully to prevent access to sensitive data.
Use Cases
- Scenarios that require controlled command-line operations on Windows through an MCP client (such as Claude Desktop).
- Scenarios that require managing multiple SSH connections and executing commands on remote systems.
- Scenarios that require security auditing and restrictions for command execution.
Limitations
- The project is deprecated and no longer maintained; the official recommendation is to switch to DesktopCommanderMCP.
- Only Windows systems are supported.
- The server only allows operations within configured directories, using allowed commands, and on configured SSH connections.
- The default configuration is a restrictive security configuration and may limit some operations.
License
This project uses the MIT License.