Executes secure shell commands with configurable directory, shell, and timeout validation.
🚀 Add secure shell command execution capabilities to your AI applications with the Shell MCP Server! Built for the Model Context Protocol.
# Using pip
pip install shell-mcp-server
# Using uv (recommended)
uv pip install shell-mcp-server
Add this to your Claude Desktop config to enable shell command execution:
{
"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"
]
}
}
}
# 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"
)
# 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"
)
# 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"
)
# 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"
)
# 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"
)
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)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
Contributions are welcome! Feel free to:
MIT License - see LICENSE for details.
Built for the Model Context Protocol | Made with ❤️ by the MCP Community
Interact with Jupyter notebooks running in any JupyterLab environment, supporting real-time control and smart execution of notebook cells.
A remote MCP server deployable on Cloudflare Workers with OAuth login support and local development capabilities.
Generate mermaid diagram and chart with AI MCP dynamically.
A modular trading automation project using the Zerodha Kite Connect API for tool-based and resource-based automation.
An SSE-based MCP server that allows LLM-powered applications to interact with OCI registries. It provides tools for retrieving information about container images, listing tags, and more.
An MCP server for the DeepSeek API, providing code review, file management, and account management.
Introspects Laravel codebases to provide structured information about views, routes, classes, and models using the mateffy/laravel-introspect package.
Integrates with the Hyperlane protocol for cross-chain messaging and smart contract interactions.
A customizable MCP service with flexible tool selection and configuration. Requires a 302AI API key.
Token-efficient access to OpenAPI/Swagger specs via MCP Resources