Bash MCP
Execute shell commands without permission prompts.
bash-mcp
A simple MCP (Model Context Protocol) server that enables Claude to execute shell commands without permission prompts.
ā ļø Security Warning: This server executes arbitrary shell commands. Use with caution and only in trusted environments.
Installation
# Install globally
npm install -g bash-mcp
# Or use with npx
npx bash-mcp
Quick Start
For Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"bash": {
"command": "npx",
"args": ["bash-mcp"]
}
}
}
For Claude Code (Cursor, VS Code)
- Open command palette (Cmd/Ctrl + Shift + P)
- Run "MCP: Add Server"
- Select "NPM" as the server type
- Enter:
bash-mcp
Available Tools
run - Execute a command
// Simple command
run("ls -la")
// With working directory
run("npm test", { cwd: "/path/to/project" })
// With timeout (milliseconds)
run("long-running-command", { timeout: 60000 })
run_background - Start a background process
// Start a dev server
run_background("npm run dev", "frontend")
// Start backend service with working directory
run_background("./gradlew bootRun", "backend", { cwd: "./backend" })
kill_background - Stop a background process
kill_background("frontend")
list_background - List all background processes
list_background()
Example Usage
User: Start the development servers
Assistant: I'll start both frontend and backend servers for you.
[Uses run_background tool]
Started frontend server (PID: 12345)
Started backend server (PID: 12346)
User: Check if they're running
Assistant: [Uses list_background tool]
Both servers are running successfully!
Response Format
All tools return JSON formatted responses:
{
"success": true,
"stdout": "command output",
"stderr": "error output if any",
"command": "executed command"
}
For background processes:
{
"success": true,
"name": "frontend",
"pid": 12345,
"command": "npm run dev",
"message": "Started background process 'frontend' (PID: 12345)"
}
Features
- Execute any shell command without permission prompts
- Run long-running processes in the background
- Manage background processes (list, kill)
- Capture stdout and stderr
- Set working directory for commands
- Configure timeout for commands
- Automatic cleanup on server shutdown
- NEW: Automatic output truncation with full output saved to temp files
- NEW: Configurable output size limits and temp directory via environment variables
Environment Variables
BASH_MCP_MAX_OUTPUT_SIZE: Maximum output size in bytes before truncation (default: 51200/50KB)BASH_MCP_TEMP_DIR: Directory for storing full output when truncated (default: system temp directory)
Example Configuration
{
"mcpServers": {
"bash": {
"command": "npx",
"args": ["bash-mcp"],
"env": {
"BASH_MCP_MAX_OUTPUT_SIZE": "102400",
"BASH_MCP_TEMP_DIR": "/tmp/bash-mcp-outputs"
}
}
}
}
Output Overflow Handling
When command output exceeds BASH_MCP_MAX_OUTPUT_SIZE:
- Output is truncated to the specified limit
- Full output is saved to a temporary file
- The response includes the file path where full output can be found
- If custom temp directory fails, falls back to system temp directory
Security Considerations
This MCP server executes arbitrary shell commands with the same privileges as the Node.js process. Only use in development environments or trusted contexts.
Requirements
- Node.js >= 16.0.0
- npm or npx
License
MIT
Author
tinywind [email protected]
Contributing
Issues and pull requests are welcome at GitHub.
Server Terkait
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
UML-MCP-Server
Generate various UML diagrams from natural language or PlantUML code. Returns PlantUML code, image URLs, and saves diagrams locally.
Claude Swarm MCP Server
An MCP server for multi-agent orchestration using Claude AI via Claude Desktop.
NodeMCU MCP
An MCP service for managing NodeMCU (ESP8266) IoT devices.
Replicate Recraft V3
Generate high-quality images using the Recraft V3 model via the Replicate API.
App Store Rejections MCP
Catch App Store rejections before they happen
mcp-airflow-simple
simple mcp server for Airflow 3 (API version 2)
chuk-mcp
A Python client for the Model Context Protocol (MCP), an open standard for connecting AI assistants to external data and tools.
Everything MCP Server
A test server that demonstrates all features of the MCP protocol, including prompts, tools, resources, and sampling.
Grafana
Search dashboards, investigate incidents and query datasources in your Grafana instance
Webhook Tester MCP Server
Interact with webhook-test.com to automate and manage webhook tokens, inspect incoming requests, and perform analytics.