execute_command
Execute commands in bash shell with configurable working directory, output limit, and timeout for secure Windows CLI interactions.
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/...)
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
Command Timeout:
Each shell has a default command timeout (see Shell-Specific Settings above)
Use
timeoutparameter to override the timeout for a specific commandTimeout must be a positive integer between 1 and 3,600 seconds (1 hour)
If the timeout is exceeded, the command will be terminated
Examples:
Windows CMD:
{
"shell": "cmd",
"command": "dir /b",
"workingDir": "C:\\Projects"
}WSL:
{
"shell": "wsl",
"command": "ls -la",
"workingDir": "/home/user",
"maxOutputLines": 50
}With custom timeout:
{
"shell": "wsl",
"command": "long-running-command",
"workingDir": "/home/user",
"timeout": 120
}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
| 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. | |
| timeout | No | Command timeout in seconds (optional, overrides global setting). Must be a positive integer between 1 and 3,600 (1 hour). |