Linuxshell MCP
L

Linuxshell MCP

An MCP server based on Linux Bash, which supports executing Bash commands and scripts in the Windows WSL2 environment. It has intelligent Linux distribution detection, secure configuration merging, and comprehensive diagnostic functions.
2 points
5.2K

Installation

Copy the following command to your Client for configuration
Note: Your key is sensitive information, do not share it with anyone.

๐Ÿš€ 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. It 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
execute_bash_command Run single bash commands ps aux | grep nginx
execute_bash_script Execute bash scripts with args Run monitoring scripts
create_bash_script Create new bash scripts Generate automation scripts
list_directory List directory contents Browse file systems
get_system_info Comprehensive system info Check OS, memory, disk usage
check_wsl_status 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

Option 1: Automated Setup (Recommended)

git clone https://github.com/yourusername/linux-bash-mcp-server.git
cd linux-bash-mcp-server
npm run fix

Option 2: Manual Setup

# Install dependencies
npm install

# Run interactive setup
npm run setup

# Test functionality
npm test

Option 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
}

๐Ÿ’ป Usage Examples

Basic Usage

Once configured, you can use various 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 diagnostics

Common Issues

WSL Not Found

wsl --install
wsl --install -d Ubuntu

Dependencies Missing

npm install

Configuration Issues

npm run check-config
npm run setup

Server Not Starting

npm run debug

See 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

๐Ÿ“š Documentation

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:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Update documentation
  6. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

๐Ÿ™ 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!

Alternatives

M
MCP
The Microsoft official MCP server provides search and access functions for the latest Microsoft technical documentation for AI assistants
8.7K
5 points
A
Aderyn
Aderyn is an open - source Solidity smart contract static analysis tool written in Rust, which helps developers and security researchers discover vulnerabilities in Solidity code. It supports Foundry and Hardhat projects, can generate reports in multiple formats, and provides a VSCode extension.
Rust
5.2K
5 points
D
Devtools Debugger MCP
The Node.js Debugger MCP server provides complete debugging capabilities based on the Chrome DevTools protocol, including breakpoint setting, stepping execution, variable inspection, and expression evaluation.
TypeScript
5.6K
4 points
S
Scrapling
Scrapling is an adaptive web scraping library that can automatically learn website changes and re - locate elements. It supports multiple scraping methods and AI integration, providing high - performance parsing and a developer - friendly experience.
Python
8.4K
5 points
M
Mcpjungle
MCPJungle is a self-hosted MCP gateway used to centrally manage and proxy multiple MCP servers, providing a unified tool access interface for AI agents.
Go
0
4.5 points
C
Cipher
Cipher is an open-source memory layer framework designed for programming AI agents. It integrates with various IDEs and AI coding assistants through the MCP protocol, providing core functions such as automatic memory generation, team memory sharing, and dual-system memory management.
TypeScript
0
5 points
N
Nexus
Nexus is an AI tool aggregation gateway that supports connecting multiple MCP servers and LLM providers, providing tool search, execution, and model routing functions through a unified endpoint, and supporting security authentication and rate limiting.
Rust
0
4 points
S
Shadcn Ui MCP Server
An MCP server that provides shadcn/ui component integration for AI workflows, supporting React, Svelte, and Vue frameworks. It includes functions for accessing component source code, examples, and metadata.
TypeScript
12.3K
5 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
15.0K
4.5 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
25.0K
5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
17.1K
4.3 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
46.5K
4.3 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
19.6K
5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
45.8K
4.5 points
M
Minimax MCP Server
The MiniMax Model Context Protocol (MCP) is an official server that supports interaction with powerful text-to-speech, video/image generation APIs, and is suitable for various client tools such as Claude Desktop and Cursor.
Python
31.2K
4.8 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
15.2K
4.5 points