Fast Bash
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Fast Bash MCP Server for Claude Code
A high-performance MCP server that provides fast bash command execution for Claude Code, bypassing the slow haiku-based pre-flight checks that cause 30+ second delays.
The Problem
Claude Code's built-in Bash tool makes two LLM API calls per command:
bash_extract_prefix- Pre-flight check before executionbash_extract_command_paths- Post-execution file path extraction
These calls go through the configured haiku model and can add 30+ seconds of latency per bash command, even for simple operations like git status or ls.
Investigation Findings
Factor | Impact | Status |
Shell profile startup | 95ms | Not the issue |
Proxy latency | 1-2s | Not the issue |
Bubblewrap sandbox | Minimal | Not the issue |
Command injection check | Minimal | Not the issue |
Haiku LLM calls | 30+ seconds | Root cause |
Related GitHub Issues
#10181 - Shell profile interference
#3505 - 2-minute timeout issues
#19585 - Shell snapshot creation timing out
#4049 - Pre-flight Haiku model access denied
#19247 - Basic tool calls hanging
Related MCP server: Interactive Shell MCP
The Solution
This MCP server provides direct bash execution without LLM pre-flight checks, giving you the speed of Claude Code's ! prefix but accessible to agents programmatically.
Features
Tool | Description |
| Single command execution with all options |
| Run multiple commands concurrently with summary |
| Run commands sequentially in a single shell session |
fast_bash Parameters
Parameter | Type | Default | Description |
| string | required | The bash command to execute |
| string | project dir | Working directory |
| number | 420000 | Timeout in ms (max 600000) |
| string | - | Short description for logging |
| string | bash | Shell: bash, zsh, or sh |
| object | - | Additional environment variables |
| string | - | Input to pipe to command |
| number | 30000 | Truncation limit (chars) |
| string | - | Save full stdout to file |
| string | - | Save full stderr to file |
| boolean | true | Run as login shell (-l flag) to source profiles |
fast_bash_parallel Parameters
Parameter | Type | Default | Description |
| array | required | Array of command objects (see fast_bash) |
| string | project dir | Default working directory for all commands |
| number | 420000 | Default timeout for all commands (ms) |
| string | - | Save combined output to file |
fast_bash_sequence Parameters
Parameter | Type | Default | Description |
| array | required | Array of {command, description?} objects |
| boolean | true | Stop execution if a command fails |
| number[] | [0] | Exit codes considered success |
| string | project | Initial working directory |
| number | 420000 | Overall timeout for all commands (ms) |
| string | bash | Shell: bash, zsh, or sh |
| object | - | Additional environment variables |
| string | - | Save full output to file |
v3.2 Features
7-minute default timeout: All tools default to 420s (7 minutes), overridable per-request up to 10 minutes
Security hardening (toggleable via
FAST_BASH_HARDENED):Path traversal and system directory write protection for
output_file/stderr_fileEnvironment variable injection filtering (
LD_PRELOAD,DYLD_INSERT_LIBRARIES, etc.)max_outputceiling (10MB)
OOM protection: 50MB memory cap on stdout/stderr accumulation (always active)
Sudo rejection: Commands containing
sudoare blocked with a message to ask the humanLogin shell by default: Sources
.bashrc/.profileso PATH and aliases are availableSequential execution:
fast_bash_sequenceruns commands in a single shell session wherecdandexportpersist between commandsIndexed output: Parallel commands show
[N]prefix with failure summaryError classification: Returns
error_type(timeout, killed, spawn_error, command_not_found, permission_denied, cwd_not_found)CWD validation: Clear error messages when working directory doesn't exist
Graceful timeout: SIGTERM first, SIGKILL after 5-second grace period
Output file redirection: Save full output before truncation with
output_file/stderr_fileMiddle-truncation: Preserves beginning and end of large outputs
Quick Install
Using Claude CLI (Recommended)
# Clone the repo
git clone https://github.com/nikketryhard/fast-bash-mcp.git ~/.claude/mcp-servers/fast-bash
# Install dependencies
cd ~/.claude/mcp-servers/fast-bash && bun install
# Add MCP server using Claude CLI
claude mcp add --transport stdio -e FAST_BASH_DEFAULT_CWD='${PWD}' fast-bash -- bun run ~/.claude/mcp-servers/fast-bash/src/index.ts
# Restart Claude CodeScope Options
# User scope (default) - available in all projects
claude mcp add fast-bash -- bun run ~/.claude/mcp-servers/fast-bash/src/index.ts
# Project scope - only in current project (.claude/settings.local.json)
claude mcp add --scope project fast-bash -- bun run ~/.claude/mcp-servers/fast-bash/src/index.ts
# Local scope - gitignored, only your machine (.claude/settings.local.json)
claude mcp add --scope local fast-bash -- bun run ~/.claude/mcp-servers/fast-bash/src/index.tsManual Installation
# Clone the repo
git clone https://github.com/nikketryhard/fast-bash-mcp.git ~/.claude/mcp-servers/fast-bash
# Install dependencies
cd ~/.claude/mcp-servers/fast-bash && bun install
# Restart Claude CodeThen add to ~/.claude.json:
{
"mcpServers": {
"fast-bash": {
"command": "bun",
"args": ["run", "/home/YOUR_USERNAME/.claude/mcp-servers/fast-bash/src/index.ts"],
"env": {
"FAST_BASH_DEFAULT_CWD": "${PWD}"
}
}
}
}Configuration
Environment Variables
Variable | Default | Description |
| process.cwd() | Default working directory |
| off | Set to |
Security Hardening
By default, hardened mode is off. To enable it, set FAST_BASH_HARDENED=1 in your MCP config:
{
"mcpServers": {
"fast-bash": {
"command": "bun",
"args": ["run", "/path/to/fast-bash-mcp/src/index.ts"],
"env": {
"FAST_BASH_DEFAULT_CWD": "${PWD}",
"FAST_BASH_HARDENED": "1"
}
}
}
}When hardened mode is enabled:
Protection | Description |
Path sanitization |
|
Env var filtering | Blocks |
Output ceiling |
|
Always active (regardless of hardened mode):
Sudo rejection — commands containing
sudoare blockedOOM protection — 50MB memory cap on stdout/stderr accumulation
Timeout cap — maximum 10 minutes (600,000ms) per command
MCP Server Configuration (~/.claude.json)
Add mcpServers to your ~/.claude.json:
{
"mcpServers": {
"fast-bash": {
"command": "bun",
"args": ["run", "/path/to/fast-bash-mcp/src/index.ts"],
"env": {
"FAST_BASH_DEFAULT_CWD": "${PWD}"
}
}
}
}Disable Built-in Bash (Optional)
Add to ~/.claude/settings.json:
{
"permissions": {
"deny": ["Bash"]
}
}Instruct Claude to Use Fast Bash
Add to ~/.claude/CLAUDE.md:
BASH COMMANDS 0. ALWAYS use fast-bash MCP tools instead of the built-in Bash tool.
1. Use mcp**fast-bash**fast_bash for single commands
2. Use mcp**fast-bash**fast_bash_parallel for multiple independent commands
3. Use mcp**fast-bash**fast_bash_sequence for sequential commands where cd/export persist
4. Commands run from project directory by default. Pass cwd parameter to override.Usage Examples
Single Command
{
"command": "git status",
"description": "Check git status"
}Single Command with Output File
{
"command": "npm test",
"output_file": "/tmp/test-output.txt",
"stderr_file": "/tmp/test-errors.txt"
}Parallel Commands
{
"commands": [
{ "command": "git status", "description": "Git status" },
{ "command": "npm test", "description": "Run tests" },
{ "command": "npm run build", "description": "Build project" }
],
"default_cwd": "/path/to/project"
}Output includes indexed results and summary:
[1] === Git status ===
$ git status
...
[exit code: 0]
[52ms]
[2] === Run tests ===
...
=== Summary ===
Total: 1523ms | Succeeded: 2 | Failed: 1
Failed: [3]
Longest: [2] Run tests (1200ms)Sequential Commands (Stateful)
{
"commands": [
{ "command": "cd /tmp", "description": "Change dir" },
{ "command": "export FOO=bar", "description": "Set env" },
{ "command": "echo $FOO && pwd", "description": "Verify" }
],
"stop_on_failure": true,
"continue_on_codes": [0]
}Unlike parallel, cd and export persist between commands.
How It Works
Claude Code's Bash Tool
Command -> Haiku LLM (prefix extraction) -> Execute -> Haiku LLM (path extraction) -> Result
~15-30 seconds ~15-30 secondsFast Bash MCP
Command -> Execute -> Result
~50msThe MCP server uses Node.js child_process.spawn directly, bypassing all LLM-based checks.
Working Directory Behavior
Commands run from project directory by default (where Claude Code was started)
${PWD}is captured when Claude Code launches and passed via env varFor
fast_bashandfast_bash_parallel:cddoes not persist between callsFor
fast_bash_sequence:cdpersists within the sequence (single shell session)Use
cd dir && commandor pass explicitcwdparameter
Comparison with Built-in Bash
Feature | Built-in Bash | Fast Bash MCP |
Speed | 30+ seconds | ~50ms |
Pre-flight LLM check | Yes | No |
Post-flight LLM check | Yes | No |
Sandbox | Yes (bubblewrap) | No |
cwd persistence | Yes | Yes (sequence only) |
Output truncation | Yes (30k) | Yes (configurable) |
Parallel commands | No | Yes |
Sequential commands | No | Yes |
Error classification | No | Yes |
Output file redirect | No | Yes |
Graceful timeout | No | Yes (SIGTERM+SIGKILL) |
Default timeout | 10 minutes | 7 minutes |
OOM protection | No | Yes (50MB cap) |
Security hardening | Sandbox-based | Toggleable (env var) |
Requirements
Bun runtime
Claude Code 2.0+
License
MIT
Contributing
PRs welcome! Please open an issue first to discuss changes.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
I run shell commands on your private cloud environment (bash, sh, zsh)
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables execution of bash commands with support for timeouts and background jobs, allowing file operations, build commands, system inspection, and long-running tasks.362275 npm9MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to create and manage persistent, interactive shell sessions with full terminal emulation and PTY support. It allows for sequential command execution and supports interactive programs like vim or htop through specialized streaming and snapshot output modes.5MIT
- AlicenseNot gradedqualityCmaintenanceProvides AI assistants with direct terminal access to execute commands, manage files, and run persistent REPL sessions. It features automated installation scripts that educate AI assistants on its capabilities for seamless integration.MIT
- AlicenseBqualityBmaintenanceEnables LLMs and automation agents to securely connect to and operate Linux/Unix hosts over standard OpenSSH, including command execution, interactive PTY sessions, SFTP file management, and dynamic multi-host connection handling. It also includes safety rules that block dangerous commands and truncates large outputs to protect model context.3135 npm1Apache 2.0