The Windows CLI MCP Server provides a secure way to execute commands on Windows systems via Model Context Protocol. It supports multiple shells (PowerShell, CMD, Git Bash) and remote SSH connections, allowing AI assistants like Claude Desktop to perform operations on your system with configurable security controls.
You can use the Windows CLI MCP Server directly with npx or install it globally:
# Use with npx (no installation needed)
npx -y @simonb97/server-win-cli
# Or install globally
npm install -g @simonb97/server-win-cli
To integrate with Claude Desktop, modify your claude_desktop_config.json
file:
{
"mcpServers": {
"windows-cli": {
"command": "npx",
"args": ["-y", "@simonb97/server-win-cli"]
}
}
}
To use a custom configuration file:
{
"mcpServers": {
"windows-cli": {
"command": "npx",
"args": [
"-y",
"@simonb97/server-win-cli",
"--config",
"path/to/your/config.json"
]
}
}
}
You can create a default configuration file in two ways:
# Option 1: Generate a default config file
npx @simonb97/server-win-cli --init-config ./config.json
# Option 2: Copy the example file (if available)
# copy config.json.example config.json
The server looks for configuration in these locations (in order):
--config
flag./config.json
in current directory~/.win-cli-mcp/config.json
in user's home directoryThe configuration file has three main sections. Here are key security settings:
{
"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're executed:
{
"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": ["&", "|", ";", "`"]
}
}
}
Configure SSH connections for remote command execution:
{
"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, Claude Desktop (or other MCP clients) can interact with your system using these tools:
Execute commands in your preferred shell:
// Example of how Claude would execute a command
execute_command({
shell: "powershell",
command: "Get-ChildItem",
workingDir: "C:\\Projects"
})
Execute commands on remote systems:
// Example of executing a command via SSH
ssh_execute({
connectionId: "raspberry-pi",
command: "ls -la"
})
Create, read, update, and delete SSH connections:
// Create a new SSH connection
create_ssh_connection({
connectionId: "new-server",
connectionConfig: {
host: "192.168.1.100",
port: 22,
username: "admin",
password: "secure_password"
}
})
// Get all configured SSH connections
read_ssh_connections()
// Update an existing connection
update_ssh_connection({
connectionId: "new-server",
connectionConfig: {
host: "192.168.1.100",
port: 2222,
username: "admin",
password: "updated_password"
}
})
// Delete a connection
delete_ssh_connection({
connectionId: "new-server"
})
// Get command history
get_command_history({
limit: 10
})
// Get current working directory
get_current_directory()
The server includes several security features:
Always review the security settings before using the server, particularly:
allowedPaths
to limit where commands can executeblockedCommands
based on your needsrestrictWorkingDirectory
enabledTo 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