The Windows CLI MCP Server allows secure command-line interactions on Windows systems, enabling MCP clients like Claude Desktop to perform operations via PowerShell, CMD, Git Bash, and SSH connections. It provides controlled access with configurable security restrictions to protect your system.
You can install the Windows CLI MCP Server using npm:
npx -y @simonb97/server-win-cli
To create a default configuration file, run:
npx @simonb97/server-win-cli --init-config ./config.json
To use this server with Claude Desktop, add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"windows-cli": {
"command": "npx",
"args": ["-y", "@simonb97/server-win-cli"]
}
}
}
If you want to use a specific configuration file:
{
"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. It looks for configuration in the following locations (in order):
--config
flagThe security section controls access and permissions:
{
"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
}
}
Configure which shells are available and how they operate:
{
"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": ["&", "|", ";", "`"]
}
}
}
Enable and configure SSH connections:
{
"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"
}
}
}
}
Execute commands in different shells:
execute_command(shell, command, workingDir)
shell
: "powershell", "cmd", or "gitbash"command
: The command to executeworkingDir
(optional): Working directoryRetrieve execution history:
get_command_history(limit)
limit
(optional): Maximum number of entries to returnExecute commands on remote systems:
ssh_execute(connectionId, command)
connectionId
: ID of the SSH connectioncommand
: Command to execute remotelyManage SSH connections:
ssh_disconnect(connectionId)
create_ssh_connection(connectionId, connectionConfig)
read_ssh_connections()
update_ssh_connection(connectionId, connectionConfig)
delete_ssh_connection(connectionId)
Get current directory:
get_current_directory()
The server provides several resources:
ssh://{connectionId}
- Details about specific SSH connectionsssh://config
- Overall SSH settingscli://currentdir
- Current working directorycli://config
- Server configurationThe server includes several security features:
Be aware that commands can access environment variables and file systems within allowed paths, so configure security settings carefully.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "windows-cli" '{"command":"npx","args":["-y","@simonb97/server-win-cli"]}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"windows-cli": {
"command": "npx",
"args": [
"-y",
"@simonb97/server-win-cli"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"windows-cli": {
"command": "npx",
"args": [
"-y",
"@simonb97/server-win-cli"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect