CD

codelion/dynamic-shell-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

42 stars 7 forks 质量 62 趋势 0Apache-2.0

codelion/dynamic-shell-server 是从 https://github.com/codelion/dynamic-shell-server. 导入的 MCP 候选服务器

概览

codelion/dynamic-shell-server 是从 https://github.com/codelion/dynamic-shell-server. 导入的 MCP 候选服务器

概述(AI 翻译)

一个模型上下文协议(MCP)服务器,支持通过动态批准系统安全执行壳级命令。该服务器允许运行任意命令,同时通过用户审批和审计日志维护安全性。

特色

  • 🔐 动态命令批准系统
  • 📝 持续存储已批准命令
  • 📊 全面的审计日志
  • ⏱️ 命令超时保护
  • 🔄 命令撤销能力

安装

  1. 克隆此仓库:

  2. 创建一个虚拟环境并激活它:

  3. 安装依赖:

用途

独立模式

直接运行服务器:

Claude桌面集成

  1. 打开您的Claude桌面配置:
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 窗口:%APPDATA%\Claude\claude_desktop_config.json
  1. 添加服务器配置:

  2. 重启 Claude Desktop

指挥审批流程

第一次运行命令时,你会被提示:

可用工具

  1. execute_command:执行壳牌命令
  • 参数:
  • command:执行命令
  • args:可选命令参数列表

本页由 AI 翻译,技术细节请以原文为准。

README

Dynamic Shell Command MCP Server

A Model Context Protocol (MCP) server that enables secure execution of shell commands with a dynamic approval system. This server allows running arbitrary commands while maintaining security through user approval and audit logging.

Features

  • 🔐 Dynamic command approval system
  • 📝 Persistent storage of approved commands
  • 📊 Comprehensive audit logging
  • ⏱️ Command timeout protection
  • 🔄 Command revocation capability

Installation

  1. Clone this repository:
git clone 
cd dynamic-shell-server
  1. Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate  # On Windows use: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Usage

Standalone Mode

Run the server directly:

python dynamic_shell_server.py

Claude Desktop Integration

  1. Open your Claude Desktop configuration:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add the server configuration:

{
    "mcpServers": {
        "shell": {
            "command": "/absolute/path/to/.venv/bin/python",
            "args": ["/absolute/path/to/dynamic_shell_server.py"]
        }
    }
}
  1. Restart Claude Desktop

Command Approval Process

When running a command for the first time, you’ll be prompted with:

Command Approval Required

Command: 
Arguments: 

This command has not been previously approved. Do you want to:
1. Allow this command once
2. Allow this command and remember for future use
3. Deny execution

Please choose an option (1-3):

Available Tools

  1. execute_command: Execute a shell command

    • Parameters:
      • command: The command to execute
      • args: Optional list of command arguments
  2. revoke_command_approval: Revoke approval for a previously approved command

    • Parameters:
      • command: The command to revoke approval for

Available Resources

  1. commands://approved: Lists all approved commands with their approval dates

Data Storage

The server stores its data in ~/.config/mcp-shell-server/:

  • approved_commands.json: List of approved commands and their approval dates
  • audit.log: Detailed execution history of all commands

Security Features

  • User approval required for first-time command execution
  • Persistent storage of approved commands
  • Comprehensive audit logging
  • 5-minute command timeout
  • No shell execution (prevents injection attacks)
  • Command revocation capability

Example Usage

Through Claude Desktop:

Human: Run 'npm install' in my project directory
Assistant: I'll help you run that command. Since this is the first time running 'npm install', you'll need to approve it.
[Command approval prompt appears]
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "shell": { "command": "/absolute/path/to/.venv/bin/python", "args": ["/absolute/path/to/dynamic_shell_server.py"] } } }