mcpField
๐Ÿ–ฅ
๐Ÿ–ฅ๏ธ Shell MCP Server

๐Ÿ–ฅ๏ธ Shell MCP Server

Local
github.com/blazickjpDeveloper Tools23Updated 62w ago

About ๐Ÿ–ฅ๏ธ Shell MCP Server

Shell MCP Server is an MCP server for Claude AI that runs shell commands inside specified directories only. It suits developers who want AI assistants to use the command line within controlled limits. It provides directory isolation, configurable shells and command timeouts.

Key features

  1. 01Command execution limited to allowed directories
  2. 02Supports bash, sh, cmd and powershell
  3. 03Configurable command timeout
  4. 04Runs on Unix and Windows
  5. 05Working directory path validation

Use cases

  1. 01Check git status in a project directory
  2. 02Search files and file contents from an assistant
  3. 03Run PowerShell queries for system information on Windows

MCP support

This project is an MCP server that exposes shell command execution to MCP clients, restricted to configured directories and shells.

Configuration

Local server config is the same for every client. Copy it into your clientโ€™s MCP config file.

No install method listed yet

We havenโ€™t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

๐Ÿ–ฅ๏ธ Shell MCP Server

PyPI version License: MIT Python Code style: black

๐Ÿš€ Add secure shell command execution capabilities to your AI applications with the Shell MCP Server! Built for the Model Context Protocol.

Shell Server MCP server

โœจ Features

  • ๐Ÿ”’ Secure Execution - Commands run only in specified directories
  • ๐Ÿš Multiple Shells - Support for bash, sh, cmd, powershell
  • โฑ๏ธ Timeout Control - Automatic termination of long-running commands
  • ๐ŸŒ Cross-Platform - Works on both Unix and Windows systems
  • ๐Ÿ›ก๏ธ Safe by Default - Built-in directory and shell validation

๐Ÿš€ Quick Start

Installation
# Using pip
pip install shell-mcp-server

# Using uv (recommended)
uv pip install shell-mcp-server
๐Ÿ”Œ Claude Desktop Integration

Add this to your Claude Desktop config to enable shell command execution:

๐Ÿ“ Click to view configuration
{
    "mcpServers": {
        "shell-mcp-server": {
            "command": "uv",
            "args": [
                "--directory",
                "/path/to/shell-mcp-server",
                "run",
                "shell-mcp-server",
                "/path/to/allowed/dir1",
                "/path/to/allowed/dir2",
                "--shell", "bash", "/bin/bash",
                "--shell", "zsh", "/bin/zsh"
            ]
        }
    }
}

๐ŸŽฎ Usage Examples

Basic File Operations
# List directory contents
result = execute_command(
    command="ls -la",
    shell="bash",
    cwd="/path/to/project"
)

# Find files by pattern
result = execute_command(
    command="find . -name '*.py'",
    shell="bash",
    cwd="/path/to/project"
)
Project Management
# Git operations
result = execute_command(
    command="git status && git diff",
    shell="bash",
    cwd="/path/to/repo"
)

# Package management
result = execute_command(
    command="pip list --outdated",
    shell="bash",
    cwd="/path/to/python/project"
)
System Information
# Resource usage
result = execute_command(
    command="df -h && free -h",
    shell="bash",
    cwd="/path/to/dir"
)

# Process monitoring
result = execute_command(
    command="ps aux | grep python",
    shell="bash",
    cwd="/path/to/dir"
)
File Processing
# Search file content
result = execute_command(
    command="grep -r 'TODO' .",
    shell="bash",
    cwd="/path/to/project"
)

# File manipulation
result = execute_command(
    command="awk '{print $1}' data.csv | sort | uniq -c",
    shell="bash",
    cwd="/path/to/data"
)
Windows-Specific Examples
# List processes
result = execute_command(
    command="Get-Process | Where-Object {$_.CPU -gt 10}",
    shell="powershell",
    cwd="C:\\path\\to\\dir"
)

# System information
result = execute_command(
    command="systeminfo | findstr /B /C:'OS'",
    shell="cmd",
    cwd="C:\\path\\to\\dir"
)

โš™๏ธ Configuration

Configure behavior with command-line arguments:

ArgumentDescription
directories๐Ÿ“ List of allowed directories
--shell name path๐Ÿš Shell specifications (name and path)

Environment variables:

  • COMMAND_TIMEOUT: โฑ๏ธ Max execution time in seconds (default: 30)

๐Ÿ›ก๏ธ Security Features

  • ๐Ÿ” Directory Isolation: Commands can only execute in specified directories
  • ๐Ÿ”’ Shell Control: Only configured shells are allowed
  • โฐ Timeout Protection: All commands have a configurable timeout
  • ๐Ÿ›‘ Path Validation: Working directory validation prevents traversal attacks
  • ๐Ÿ‘ค Permission Isolation: Commands run with the same permissions as the server process

๐Ÿ› ๏ธ Development

Set up your development environment:

# Create and activate virtual environment
uv venv
source .venv/bin/activate

# Install development dependencies
uv pip install -e ".[test]"

# Run tests
python -m pytest

# Run tests with coverage
python -m pytest --cov=shell_mcp_server

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • ๐Ÿ› Report bugs
  • ๐Ÿ’ก Suggest features
  • ๐Ÿ”ง Submit pull requests
  • ๐Ÿ“š Improve documentation

๐Ÿ“œ License

MIT License - see LICENSE for details.


๐ŸŒŸ Enhance Your AI with Secure Shell Access! ๐ŸŒŸ

Built for the Model Context Protocol | Made with โค๏ธ by the MCP Community

๐ŸŽ‰ Star us on GitHub!
If you find this tool useful, consider giving it a star! It helps others discover the project.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.