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:
ALWAYS use the
workingDirparameter to specify the working directoryRequest config of this MCP server configuration using tools
Follow limitations taken from configuration
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
maxOutputLinesparameter to override the limit for a specific commandIf truncated, use
get_command_outputtool with the executionId to retrieve full outputWhen file logging is enabled (via
logDirectory), full logs are also saved to disk
Examples:
Windows CMD:
WSL:
Bash:
Git Bash:
With custom output limit:
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| shell | Yes | Shell to use for command execution | |
| command | Yes | Command to execute. Note: Different shells have different blocked commands and operators. | |
| workingDir | No | Working 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 | |
| maxOutputLines | No | Maximum number of output lines to return (optional, overrides global setting). Must be a positive integer between 1 and 10,000. |