Bash MCP (Master Control Program)
A TypeScript application that allows Claude to safely execute bash commands with security safeguards. This project implements the Model Context Protocol (MCP) to provide a secure interface for executing bash commands from AI assistants like Claude.
Features
- Execute bash commands in a controlled environment
- Support for both stateless and stateful (interactive) command execution
- Security safeguards:
- Whitelisted commands
- Whitelisted directories
- Command validation
- Output sanitization
- Session management for interactive commands
- Comprehensive logging
- MCP server implementation for AI integration
Installation
Configuration
The configuration is stored in config/default.json
. You can customize:
- Allowed commands
- Allowed directories
- Session settings
- Security settings
- Logging settings
Example configuration:
Usage
As a Library
Simple Command Execution
Interactive Sessions
As an MCP Server
This project includes an MCP server implementation that can be used with Claude Desktop or other MCP clients:
See MCP.md
for detailed documentation on the MCP server implementation.
Security Considerations
This MCP is designed with security in mind, but it's important to:
- Keep the allowed commands and directories list as restrictive as possible
- Regularly review and update the configuration
- Monitor the logs for suspicious activity
- Keep the MCP and its dependencies up to date
Development
Building
Linting and Formatting
To check for linting issues:
To automatically fix linting and formatting issues:
Or manually:
Testing
MCP SDK Version
This project uses MCP SDK version 1.0.1.
This server cannot be installed
A TypeScript application that allows Claude to safely execute bash commands with security safeguards, providing a secure interface through the Model Context Protocol.