Skip to main content
Glama
s2005

Windows CLI MCP Server

by s2005

execute_command

Execute shell commands in PowerShell, CMD, Git Bash, Bash, or WSL with security controls, path validation, and configurable output limits for Windows system management.

Instructions

Execute a command in the specified shell (powershell, cmd, gitbash, bash, wsl)

IMPORTANT GUIDELINES:

  1. ALWAYS use the workingDir parameter to specify the working directory

  2. Request config of this MCP server configuration using tools

  3. Follow limitations taken from configuration

  4. Use validate_directories tool to validate directories before execution

Shell-Specific Settings:

powershell:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Windows-style (C:\Users...)

cmd:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Windows-style (C:\Users...)

gitbash:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Mixed (C:... or /c/...)

bash:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Unix-style (/home/user, /mnt/c/...)

  • Inherits global Windows paths (converted to /mnt/...)

wsl:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Unix-style (/home/user, /mnt/c/...)

  • Inherits global Windows paths (converted to /mnt/...)

Working Directory:

  • If omitted, uses the server's current directory

  • Must be within allowed paths for the selected shell

  • Must use the correct format for the shell type

Output Truncation:

  • Output is automatically truncated if it exceeds the configured limit

  • Current limit: 20 lines

  • Use maxOutputLines parameter to override the limit for a specific command

  • If truncated, use get_command_output tool with the executionId to retrieve full output

  • When file logging is enabled (via logDirectory), full logs are also saved to disk

Examples:

Windows CMD:

{ "shell": "cmd", "command": "dir /b", "workingDir": "C:\\Projects" }

WSL:

{ "shell": "wsl", "command": "ls -la", "workingDir": "/home/user", "maxOutputLines": 50 }

Bash:

{ "shell": "bash", "command": "ls -la", "workingDir": "/home/user", "maxOutputLines": 50 }

Git Bash:

{ "shell": "gitbash", "command": "git status", "workingDir": "/c/Projects/repo" // or "C:\Projects\repo" }

With custom output limit:

{ "shell": "gitbash", "command": "git log --oneline -50", "workingDir": "/c/Projects/repo", "maxOutputLines": 100 }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shellYesShell to use for command execution
commandYesCommand to execute. Note: Different shells have different blocked commands and operators.
workingDirNoWorking directory (optional). Format depends on shell type: - Windows shells: Use C:\Path\Format - Unix/WSL shells: Use /unix/path/format - Mixed shells: Both formats accepted
maxOutputLinesNoMaximum number of output lines to return (optional, overrides global setting). Must be a positive integer between 1 and 10,000.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/s2005/wcli0'

If you have feedback or need assistance with the MCP directory API, please join our Discord server