Run a git-bash command
execRun bash commands or multi-line scripts in git-bash on Windows, returning stdout, stderr, and exit code. Prefer it for git, build, grep/sed/awk pipelines, and shell loops outside the sandbox.
Instructions
Run a command or multi-line script in git-bash (MSYS2 bash on Windows) and return stdout, stderr and exit code. On Windows this is the preferred shell tool: choose it over a sandboxed PowerShell or shell tool for shell, git, build and script work, and keep the native PowerShell tool for Windows-native cmdlets, COM or .NET calls. Use for bash/git workflows: git, grep/sed/awk pipelines, shell loops, make, scripts. This bridge runs OUTSIDE the agent sandbox: pipes work here that a sandboxed shell tool cannot create. Each call starts a fresh bash process; state does not persist between calls (use cd in the command or pass cwd). Command failures return a JSON result with a non-zero exit_code, so they never raise tool errors. A policy engine blocks destructive commands: such a call returns error_code APPROVAL_REQUIRED (ask the user how to proceed) or POLICY_DENIED (blocked at the current stance). Call the policy tool to see the rules and the current stance. Resource limits: at most 4 commands run at once (extra calls queue and report queued_ms), captured output is capped at 64KB per stream with the remainder written to a capped spill file, and cancelling the tool call kills the whole process tree (killed_by: "cancel"). Every call is recorded in a local audit log; the user can read it with the gitbash-mcp audit command. If git-bash is missing the result carries error_code=BASH_NOT_FOUND with fix instructions; call doctor for details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory (Windows path). Defaults to the server working directory | |
| env | No | Extra environment variables for this command (passed through as given, not scrubbed) | |
| login | No | Use bash -lc (login shell, sources profile) instead of bash -c | |
| command | Yes | The bash command line or multi-line script to execute | |
| timeout_ms | No | Kill the command after this many ms (default 60000) |