Shell MCP Server
Executes secure shell commands with configurable directory, shell, and timeout validation.
đĽď¸ Shell MCP Server
đ Add secure shell command execution capabilities to your AI applications with the Shell MCP Server! Built for the Model Context Protocol.
⨠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:
| Argument | Description |
|---|---|
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.
Server Terkait
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Just Prompt
A unified interface for various Large Language Model (LLM) providers, including OpenAI, Anthropic, Google Gemini, Groq, DeepSeek, and Ollama.
oclif MCP Server Plugin
An oclif CLI plugin that automatically discovers and serves commands via the Model Context Protocol (MCP).
MCPJungle
A self-hosted MCP Server registry for private AI agents, supporting both PostgreSQL and SQLite databases.
Simple Loki MCP Server
An MCP server for querying Loki logs via logcli.
Zeek-MCP
Integrates Zeek network analysis with conversational AI clients. Requires an external Zeek installation.
Remote MCP Server (Authless)
An example of a remote MCP server without authentication, deployable on Cloudflare Workers.
Stability AI
Integrates with the Stability AI API for image generation, editing, and upscaling.
MCP-scala
A Model Context Protocol server implementation written in Scala 3.
Perfetto
Turn natural language into powerful Perfetto trace analysis. Quickly explain jank, diagnose ANRs, spot CPU hot threads, uncover lock contention, and find memory leaks.
ęłľęłľ API ě°ë MCP ěí
Integrates the Korea Meteorological Administration's public weather API to provide climate data.