bash-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@bash-mcpRun 'df -h' to check disk space"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Bash MCP Server (bash-mcp)
A Model Context Protocol (MCP) server that provides robust Bash execution capabilities across Windows, macOS, and Linux. Built with Python 3.12+ and managed with uv.
Key Features
Cross-Platform Multi-Runtime Support:
Windows: Automatically detects and supports Git Bash (
C:\Program Files\Git\bin\bash.exe), WSL (Windows Subsystem for Linux), and MSYS2.macOS / Linux: Native POSIX
bash.Custom Override: Override runtime with the
BASH_PATHenvironment variable across all platforms. The target executable is expected to implement Bash semantics and accept standard-c <command>arguments.
Process Lifecycle Management & Containment Model:
Windows (Git Bash / MSYS2): Windows Job assignment is best-effort and occurs immediately after process creation; a short pre-assignment execution window exists. Processes assigned to the dedicated Windows Job Object (
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE) have termination attempts performed on their entire process tree on timeout, cancellation, or error.WSL (Linux VM): Employs PID-marker-based process-group signaling and clean group termination (
SIGTERM->SIGKILL) to terminate background Linux processes inside the VM on timeout or cancellation. (Note: commands that detach into independent sessions viasetsidor modify supervisor markers require container-level isolation such as Docker/cgroups for full sandbox containment).POSIX (macOS / Linux): Creates isolated process groups (
start_new_session=True) and performs phased shutdown (SIGTERM-> 0.2s grace interval ->SIGKILL).Cancellation-Safe: Shielded cleanup performs bounded reader-drain and process-reap attempts, and closes pipe transports even under repeated task cancellation.
Exact Bash Semantics:
WSL commands are passed directly as raw positional parameters without outer shell interpolation, preserving exact variable scoping, literal single-quotes, and quoted heredocs.
PE Binary Screening:
Checks expected DOS/PE signatures (
MZ,PE\0\0) for Windows binary executables, rejecting plain-text or corrupt files.
Bounded Stream Capture & Truncation Metadata:
Streams are drained concurrently with per-stream byte limits (default 1 MB) to prevent unbounded memory consumption from noisy commands.
Output truncation is clearly indicated in results with byte-accurate counts.
Partial output emitted prior to timeouts is preserved.
Modern Transport Protocols:
stdio(default, recommended for local clients like Antigravity, Claude Desktop, Cursor).streamable-http(recommended modern network transport).sse(legacy network transport).Strict loopback protection: only canonical loopback addresses (
127.0.0.1,localhost,::1) are permitted without explicit--allow-remoteopt-in.
Related MCP server: Bash MCP Server
Exposed Tools
1. execute_bash
Executes a Bash command, pipeline, or multi-line script.
Parameter | Type | Default | Description |
|
| (required) | The Bash command or multi-line script to run. |
|
|
| Working directory. Accepts Windows paths or native POSIX paths (e.g. |
|
|
| Execution timeout in seconds (must be between 1 and 3600). |
|
|
| Execution environment ( |
Tool Annotations:
destructive_hint=Trueopen_world_hint=Trueread_only_hint=False
2. get_bash_environments
Returns diagnostic details about all detected Bash runtimes, executable paths, and the active default environment.
Installation & Setup
Ensure uv is installed.
# Clone or navigate to the repository
cd bash-mcp
# Install dependencies and sync the virtual environment
uv syncRunning the Server
Stdio Transport (Default)
uv run bash-mcpStreamable HTTP Transport (Recommended for Network)
uv run bash-mcp --transport streamable-http --host 127.0.0.1 --port 8000Legacy SSE Transport
uv run bash-mcp --transport sse --host 127.0.0.1 --port 8000Security Note: Binding to non-loopback interfaces requires passing
--allow-remote. Because command execution runs with host user privileges, network deployments should be secured with TLS, authentication proxies, or container isolation.
Integrating with Antigravity / MCP Clients
Antigravity Global Configuration (~/.gemini/config/mcp_config.json)
{
"mcpServers": {
"bash": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\User\\stuff\\bash-mcp",
"run",
"bash-mcp"
]
}
}
}Running Tests
Run the test suite with pytest:
uv run pytestAvailable Tools
2 toolsexecute_bashBDestructive
Execute a Bash command or script with robust process lifecycle management. Automatically detects and uses Git Bash or WSL on Windows, and native Bash on POSIX.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| command | Yes | ||
| env_type | No | auto | |
| timeout_seconds | No | Execution timeout in seconds (1-3600). |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare destructiveHint=true and openWorldHint=true, and the description's 'Execute a Bash command or script' is consistent with those. The description adds useful context about automatic Git Bash/WSL detection and process lifecycle management, though 'robust process lifecycle management' is vague and does not detail side effects or termination behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise at two sentences and front-loads the core action. The phrase 'robust process lifecycle management' adds little concrete detail, but the overall length is appropriate and not bloated.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a destructive, open-world command executor with four parameters, the description gives useful but incomplete context. It covers environment auto-detection, but omits cwd semantics, return/output behavior, and does not mention when to call get_bash_environments. The output schema and annotations partially compensate for these gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is low at 25%; only timeout_seconds has an inline description. The description partially covers env_type by mentioning automatic Git Bash/WSL detection, but it does not explain the command parameter, cwd, or env_type enum values beyond the schema. cwd is left entirely to inference.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a clear action ('Execute') and a specific resource ('Bash command or script'), so an agent can understand the core function immediately. It does not explicitly differentiate from the sibling get_bash_environments, but the tool names and general purpose are clear enough.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no explicit guidance about when to use this tool versus alternatives like get_bash_environments. It states what the tool does, but selection criteria are left entirely to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_bash_environmentsARead-only
Inspect detected Bash runtime environments and paths on the current system.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds useful context by stating that this inspects 'detected' environments on the 'current system,' implying local discovery rather than exhaustive enumeration. This goes beyond the annotations without contradicting them.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence with no filler. The core action and resource are front-loaded, making it easy for an agent to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
This is a simple zero-parameter inspection tool with a rich output schema and annotations indicating read-only, non-destructive behavior. The description sufficiently explains what the tool returns information about, and nothing essential is missing for safe invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters and schema description coverage is 100%, so there is no parameter ambiguity. The baseline for zero-parameter tools is 4, and the description needs to communicate nothing further about arguments.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Inspect') and a specific resource ('detected Bash runtime environments and paths on the current system'). This clearly distinguishes it from sibling execute_bash, which is about running commands rather than inspecting environment information.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool is for inspecting discovered Bash environments, but it does not explicitly state when to prefer this over execute_bash or provide any exclusion criteria. An agent can infer the usage context, but the guidance is not explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.1.0- First observed
execute_bash - First observed
get_bash_environments
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one executes commands, the other inspects the environment. There is no overlap or ambiguity between them.
Both tool names follow a consistent verb_noun pattern: execute_bash and get_bash_environments. The naming style is uniform and predictable.
Two tools is minimal but appropriate for a narrowly scoped bash execution server. The environment inspection tool supplements the primary execution capability without unnecessary bloat.
The core domain of executing bash commands is fully covered by execute_bash, and environment introspection adds useful context. While more convenience tools could exist, most operations can be accomplished through command execution.
Maintenance
Related MCP Connectors
I run shell commands on your private cloud environment (bash, sh, zsh)
Remote MCP for 1,500+ APIs. Vault-managed credentials; OAuth or API key. Search, load, and execute.
Run commands and read/write files on your servers over Termalin's keyless tunnels (hosted MCP).
Browserless MCP — wraps the Browserless headless-Chromium REST API (browserless.io)
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables execution of bash commands with support for timeouts and background jobs, allowing file operations, build commands, system inspection, and long-running tasks.36 npm9MIT
- AlicenseAqualityCmaintenanceAn MCP server that enables the execution of arbitrary bash commands and returns detailed output including stdout, stderr, and exit codes. It supports customizable working directories, execution timeouts, and environment variable configurations.1MIT
- AlicenseAqualityCmaintenanceEnables execution of bash commands via MCP, allowing clients to run shell commands and set a working directory.234MIT
- AlicenseBqualityDmaintenanceEnables secure execution of whitelisted shell commands through MCP, with support for stdin input, timeout control, and comprehensive output including stdout, stderr, and execution time.1MIT