Linux Bash MCP Server
Linux Bash MCP Server
A powerful Model Context Protocol (MCP) server that enables Claude Desktop to execute bash commands and scripts in any WSL2 Linux distribution on Windows. Features universal Linux compatibility, intelligent distribution detection, and comprehensive safety measures.
š Quick Start
# 1. Clone the repository
git clone https://github.com/yourusername/linux-bash-mcp-server.git
cd linux-bash-mcp-server
# 2. Run automated setup
npm run fix
# 3. Restart Claude Desktop
# 4. Start using Linux commands in Claude!⨠Features
š§ Universal Linux Support - Works with Ubuntu, Debian, Fedora, openSUSE, Alpine, and more
š Smart Distribution Detection - Automatically detects and configures available WSL distributions
š”ļø Safe Configuration Merging - Preserves existing MCP servers when setting up
š§ Comprehensive Diagnostics - Built-in troubleshooting and auto-fix tools
ā” High Performance - Optimized command execution with configurable timeouts
š Detailed Logging - Debug mode for troubleshooting and monitoring
š Easy Management - Simple scripts for setup, testing, and maintenance
š ļø Available Tools
Tool | Description | Example Use |
| Run single bash commands |
|
| Execute bash scripts with args | Run monitoring scripts |
| Create new bash scripts | Generate automation scripts |
| List directory contents | Browse file systems |
| Comprehensive system info | Check OS, memory, disk usage |
| WSL and distribution status | Verify connectivity |
š Prerequisites
Windows with WSL2 installed
Any Linux distribution in WSL2 (Ubuntu, Debian, etc.)
Node.js 18+
Claude Desktop App
šÆ Installation & Setup
Option 1: Automated Setup (Recommended)
git clone https://github.com/yourusername/linux-bash-mcp-server.git
cd linux-bash-mcp-server
npm run fixOption 2: Manual Setup
# Install dependencies
npm install
# Run interactive setup
npm run setup
# Test functionality
npm testOption 3: Quick Diagnostics
# Check for issues
npm run debug
# Verify configuration
npm run check-configāļø Configuration
The server automatically detects your WSL distributions and configures itself. Manual configuration is available in config.json:
{
"wslDistribution": "auto-detect",
"defaultTimeout": 30000,
"scriptTimeout": 60000,
"maxBufferSize": 10485760,
"debugMode": false
}š§ Available Scripts
Command | Description |
| Auto-fix common issues and setup |
| Interactive configuration wizard |
| Comprehensive diagnostics |
| Test all functionality |
| Verify configurations |
| Start the MCP server |
š§ Supported Linux Distributions
Ubuntu (most common)
Debian
Fedora
openSUSE
Alpine Linux
Kali Linux
Oracle Linux
And many more...
š” Usage Examples
Once configured, use these commands in Claude Desktop:
System Administration
"Show comprehensive system information for my Linux environment"
"Check disk usage and available space"
"List running processes sorted by CPU usage"
File Operations
"List all files in /var/log with detailed information"
"Find files modified in the last 24 hours"
"Show directory sizes in /home"
Development Tasks
"Check if Docker is running"
"Show git status for repositories in my home directory"
"List installed Python packages"
Automation
"Create a backup script for my documents"
"Generate a system monitoring script"
"Create a log rotation script"
š”ļø Safety Features
Configuration Preservation - Never overwrites existing MCP servers
Automatic Backups - Creates backups of corrupted configurations
Input Validation - Validates all commands and parameters
Timeout Protection - Prevents hanging commands
Error Handling - Comprehensive error reporting and recovery
š Troubleshooting
Quick Fixes
npm run fix # Auto-resolve common issues
npm run debug # Detailed diagnosticsCommon Issues
WSL Not Found
wsl --install
wsl --install -d UbuntuDependencies Missing
npm installConfiguration Issues
npm run check-config
npm run setupServer Not Starting
npm run debugSee TROUBLESHOOTING.md for detailed solutions.
š¤ Integration with Other MCP Servers
This server works seamlessly alongside:
PowerShell MCP Server (Windows commands)
Memory MCP Server (Persistent notes)
File MCP Server (File operations)
Git MCP Server (Version control)
Any other MCP servers
š Project Structure
linux-bash-mcp-server/
āāā src/
ā āāā index.js # Main MCP server
āāā test/
ā āāā test.js # Comprehensive tests
āāā examples/
ā āāā system_info.sh # Example monitoring script
ā āāā file_operations.sh # Example file operations
āāā config.json # Server configuration
āāā setup.js # Interactive setup
āāā debug.js # Diagnostic tool
āāā quick-fix.js # Auto-fix utility
āāā check-config.js # Configuration checker
āāā README.md # This fileš Version History
v1.0.0 (Current)
ā Universal Linux distribution support
ā Intelligent WSL distribution detection
ā Safe configuration merging
ā Comprehensive diagnostic tools
ā Auto-fix utilities
ā Enhanced error handling
ā Debug mode support
š¤ Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Update documentation
Submit a pull request
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Support
Issues: GitHub Issues
Documentation: Project Wiki
Discussions: GitHub Discussions
š Acknowledgments
Anthropic for the Model Context Protocol
Microsoft for WSL2 technology
The open-source community for Linux distributions and tools
Made with ā¤ļø for the Claude Desktop and Linux community
ā Star this repository if you find it useful!
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/gunjanjp/linuxshell-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server