win-cli-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@win-cli-mcp-server Check disk space using PowerShell"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
win-cli-mcp-server
Hardened MCP server for Windows CLI and SSH interactions. Provides controlled access to PowerShell, CMD, Git Bash, and remote systems via SSH from MCP clients like Claude Desktop.
Fork Lineage
This is a maintained, hardened fork:
SimonB97/win-cli-mcp-server (original, development stalled) -> delorenj/super-win-cli-mcp-server (super-win-cli variant) -> this repo (bug fixes, hardening, dependency updates)
The original project is no longer actively maintained. This fork fixes critical bugs, updates dependencies, and is used in production daily.
Related MCP server: Super Shell MCP Server
What This Fork Fixes
Critical
GUI window popups -- Added
windowsHide: truetochild_process.spawn(). Shell windows no longer flash on screen during MCP execution.SSH event listener leak -- Reconnection cycles accumulated duplicate handlers on the ssh2
Clientinstance, causing memory leaks. Fixed by creating a freshClienton each reconnect and using.once()for connection-scoped events.SSH stderr silently dropped -- When stdout had content, stderr was discarded (
output || errorOutput). Now both streams are combined.Silent config fallback on BOM -- UTF-8 BOM in
config.jsoncausedJSON.parse()to throw, silently falling back to restrictive defaults. BOM is now stripped before parsing.
High
Dead dependency removed --
@modelcontextprotocol/server-memory-dynamicpointed tofile:../servers/src/memory(author's local dev path). Removed.SSH agent auth support -- Config validation required
passwordorprivateKeyPath. If neither was specified, the entire config load failed. Now optional -- ssh2 falls back to ssh-agent automatically.SIGTERM handler -- Only SIGINT triggered cleanup. When the parent process sends SIGTERM (common when Claude Desktop restarts), SSH connections now close gracefully.
MCP SDK updated -- Jumped from v1.0.1 to v1.29.0 (28 versions of bug fixes, security patches, protocol improvements). Zero breaking changes.
npm audit clean -- All known vulnerabilities resolved.
Cleanup
Dead code removed --
resolveCommandPath,isPathAllowed,validateWorkingDirectory,normalizeWindowsPath(exported but never imported). Unused imports (exec,promisify) also removed.@types/ssh2moved to devDependencies -- Type packages don't belong in production deps.Output size cap -- Shell output is now capped at 1MB to prevent OOM on commands that dump large outputs. Truncated output includes a notice.
Installation
Add to your claude_desktop_config.json:
{
"mcpServers": {
"win-cli": {
"command": "node",
"args": [
"C:/path/to/win-cli-mcp-server/dist/index.js",
"--config",
"C:/path/to/win-cli-mcp-server/config.json"
]
}
}
}Or clone and set up:
git clone https://github.com/mhprol/win-cli-mcp-server.git
cd win-cli-mcp-server
npm install
npm run buildConfiguration
Copy config.example.json to config.json and customize:
{
"security": {
"maxCommandLength": 50000,
"blockedCommands": [],
"blockedArguments": [],
"allowedPaths": [],
"restrictWorkingDirectory": false,
"logCommands": true,
"maxHistorySize": 2000,
"commandTimeout": 600,
"enableInjectionProtection": false
},
"shells": {
"powershell": {
"enabled": true,
"command": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"args": ["-NoProfile", "-NoLogo", "-NonInteractive", "-Command"],
"blockedOperators": []
},
"cmd": {
"enabled": true,
"command": "cmd.exe",
"args": ["/c"],
"blockedOperators": []
},
"gitbash": {
"enabled": true,
"command": "C:\\Program Files\\Git\\bin\\bash.exe",
"args": ["--norc", "-c"],
"blockedOperators": []
}
},
"ssh": {
"enabled": true,
"defaultTimeout": 30,
"maxConcurrentSessions": 5,
"keepaliveInterval": 10000,
"keepaliveCountMax": 3,
"readyTimeout": 20000,
"connections": {
"my-server": {
"host": "192.168.1.100",
"port": 22,
"username": "user",
"privateKeyPath": "C:\\Users\\you\\.ssh\\id_ed25519"
}
}
}
}SSH authentication priority: explicit key > password > ssh-agent (automatic).
Config notes:
File must be valid JSON without BOM (UTF-8, no BOM). Most editors default to this.
config.jsonis gitignored to protect credentials. Useconfig.example.jsonas template.Shell
commandpaths should point to the actual executable (e.g.,pwsh.exefor PS7, notpowershell.exefor PS5.1).
Tools
Tool | Description |
| Run a command in PowerShell, CMD, or Git Bash |
| Retrieve history of executed commands |
| Execute a command on a configured remote host |
| Close an SSH connection |
Security
This server provides direct access to your system's command line and remote systems via SSH. The default configuration is intentionally open for trusted single-user environments. For shared or exposed setups:
Enable
restrictWorkingDirectoryand setallowedPathsPopulate
blockedCommandsandblockedArgumentsEnable
enableInjectionProtectionSet
blockedOperatorsper shellUse key-based SSH auth, never store passwords in config
Credits
Simon Benedict -- Original
win-cli-mcp-serverauthordelorenj --
super-win-clifork with extended configHardening, bug fixes, and maintenance by Matt Prol
License
MIT -- see LICENSE.
Available Tools
4 toolsexecute_commandB
Execute a command in the specified shell (powershell, cmd, or gitbash)
Example usage (PowerShell):
{
"shell": "powershell",
"command": "Get-Process | Select-Object -First 5",
"workingDir": "C:\Users\username"
}Example usage (CMD):
{
"shell": "cmd",
"command": "dir /b",
"workingDir": "C:\Projects"
}Example usage (Git Bash):
{
"shell": "gitbash",
"command": "ls -la",
"workingDir": "/c/Users/username"
}Inputs: shell (required), command (required), workingDir.
get_command_historyA
Get the history of executed commands
Example usage:
{
"limit": 5
}Example response:
[
{
"command": "Get-Process",
"output": "...",
"timestamp": "2024-03-20T10:30:00Z",
"exitCode": 0
}
]Inputs: limit.
ssh_disconnectA
Disconnect from an SSH server
Example usage:
{
"connectionId": "raspberry-pi"
}Use this to cleanly close SSH connections when they're no longer needed.
Inputs: connectionId (required).
ssh_executeA
Execute a command on a remote host via SSH
Example usage:
{
"connectionId": "raspberry-pi",
"command": "uname -a"
}Configuration required in config.json:
{
"ssh": {
"enabled": true,
"connections": {
"raspberry-pi": {
"host": "raspberrypi.local",
"port": 22,
"username": "pi",
"password": "raspberry"
}
}
}
}Inputs: command (required), connectionId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: local execution, history retrieval, remote execution, and remote disconnection. There is no overlap or ambiguity between the four tools.
Names are mostly predictable: local tools use simple verb_noun (execute_command, get_command_history), while SSH tools consistently use the ssh_ prefix (ssh_execute, ssh_disconnect). The slight inconsistency is that ssh_execute uses 'execute' while the local counterpart is 'execute_command' with an extra noun.
Four tools is well-scoped for a Windows CLI MCP server. Each tool serves a core function without unnecessary bloat.
The local command execution and history retrieval cover the primary workflow. SSH execute and disconnect provide a basic remote capability, though there is no explicit ssh_connect (likely implied by ssh_execute) and no way to manage connections beyond disconnecting.
Maintenance
Related MCP Connectors
Remote MCP access to user-authorized Linux, Windows and Intel Mac devices for AI assistants.
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
Termalin's hosted MCP server. Claude, ChatGPT or any MCP client runs commands, moves files over SFTP, queries databases and reads server metrics and monitoring alerts on your servers, keylessly through Termalin Connectors: no SSH key is handed over and no inbound port is opened. Per-host command policy and an audit log. Needs a termal.in Pro or Team account (new accounts start with a 14-day Pro trial).
Related MCP Servers
- AlicenseBqualityFmaintenanceA 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.9372 npm265MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables secure execution of shell commands across Windows, macOS, and Linux with built-in whitelisting and approval mechanisms for enhanced security.9114 npm23MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables remote SSH command execution and bidirectional file transfers through a standardized interface. It allows AI assistants to securely manage remote servers while keeping credentials isolated and applying command-level security controls.ISC
- AlicenseBqualityCmaintenanceA secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.13215 npm6MIT