This MCP server enables secure command-line interactions on Windows systems, providing controlled access to PowerShell, CMD, Git Bash shells, and remote systems via SSH. It allows MCP clients like Claude Desktop to perform operations on your system with configurable security restrictions.
To configure Claude Desktop to use this MCP server, add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"windows-cli": {
"command": "npx",
"args": ["-y", "@simonb97/server-win-cli"]
}
}
}
To use a specific configuration file, include the --config
flag:
{
"mcpServers": {
"windows-cli": {
"command": "npx",
"args": [
"-y",
"@simonb97/server-win-cli",
"--config",
"path/to/your/config.json"
]
}
}
}
The server uses a JSON configuration file to customize its behavior. You can specify settings for security controls, shell configurations, and SSH connections.
Create a default configuration file using one of these methods:
npx @simonb97/server-win-cli --init-config ./config.json
--config
flag as shown in the installation section.The server looks for configuration in the following locations (in order):
--config
flag./config.json
in current directory~/.win-cli-mcp/config.json
in user's home directoryIf no configuration file is found, the server will use a default (restrictive) configuration.
The configuration file is divided into three main sections:
{
"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": ["C:\\Users\\YourUsername", "C:\\Projects"],
"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": {
"raspberry-pi": {
"host": "raspberrypi.local",
"port": 22,
"username": "pi",
"password": "raspberry"
},
"dev-server": {
"host": "dev.example.com",
"port": 22,
"username": "admin",
"privateKeyPath": "C:\\Users\\YourUsername\\.ssh\\id_rsa"
}
}
}
}
Once configured, you can use the MCP server through Claude Desktop or other MCP clients. The server provides the following tools and resources:
Execute commands in different shells:
execute_command
: Run commands in PowerShell, CMD, or Git Bash
shell
(powershell/cmd/gitbash), command
, optional workingDir
// Example using execute_command
execute_command("powershell", "Get-Process", "C:\\Users\\username\\Documents")
get_command_history
: Retrieve previously executed commands
limit
(number of commands to return)ssh_execute
: Run commands on remote systems via SSH
connectionId
, command
ssh_disconnect
: Disconnect from an SSH server
connectionId
create_ssh_connection
: Set up a new SSH connection
connectionId
, connectionConfig
objectread_ssh_connections
: Get all configured SSH connectionsupdate_ssh_connection
: Modify an existing SSH connection
connectionId
, connectionConfig
objectdelete_ssh_connection
: Remove an SSH connection
connectionId
get_current_directory
: Get the server's current working directoryThe server provides access to the following resources:
ssh://{connectionId}
- Shows details for specific SSH connectionsssh://config
- Shows overall SSH configurationcli://currentdir
- Shows current working directorycli://config
- Shows server configurationThe server implements multiple security measures:
Always review your configuration to ensure:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.