
Claude AI 的安全壳命令执行 MCP 服务器。在指定目录内实现受控壳层访问。
概览
🚀 通过Shell MCP服务器为您的AI应用添加安全的壳级命令执行能力!为模型上下文协议构建。 - 🔒 - 命令仅在指定目录中运行 - 🐚 - 支持 bash、sh、cmd、powershell - ⏱️ - 自动终止长时间运行命令 - 🌍 - 支持 Unix 和 Windows 系统 - 🛡️ - 内置目录和 shell 验证 把这个添加到你的Claude Desktop配置中,以启用shell命令执行: 用命令行参数配置行为: 环境变量:- COMMAND_TIMEOUT:⏱️最大执行时间(秒数)(默认:30秒) - 🔐 : 命令只能在指定的目录中执行 - 🔒 : 仅允许配置的 shell - ⏰ : 所有命令都有可配置的超时 - 🛑 : 工作目录验证防止遍历攻击 - 👤 : 命令运行权限与服务器进程相同 欢迎大家的贡献!
概述(AI 翻译)
🚀 通过 Shell MCP 服务器为您的 AI 应用添加安全的 shell 命令执行能力!为模型上下文协议构建。
✨ 特色
- 🔒 安全执行 - 命令仅在指定目录中运行
- 🐚 **多壳支持:bash、sh、cmd、powershell
- ⏱️ 超时控制 - 自动终止长时间运行命令
- 🌍 跨平台 - 支持Unix和Windows系统
- 🛡️ 默认安全 - 内置目录和壳验证功能
🚀 快速启动
安装
🔌 Claude桌面集成
把这个添加到你的Claude Desktop配置中,以启用shell命令执行:
📝 点击查看配置
🎮 使用示例
基本文件操作
项目管理
系统信息
文件处理
Windows特定示例
⚙️ 配置
用命令行参数配置行为:
| 论证 | 描述 |
|---|---|
directories |
📁允许目录列表 |
--shell name path |
🐚壳体规格(名称和路径) |
环境变量:
COMMAND_TIMEOUT:⏱️最大执行时间(秒数)(默认:30秒)
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
🖥️ 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:
🎮 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",
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"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"
]
}
}
}