Cover image
Try Now
2025-02-27

3 years

Works with Finder

1

Github Watches

4

Github Forks

6

Github Stars

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 <repository-url>
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: <command>
Arguments: <args>

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]

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • Khalid kalib
  • Write professional emails

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • ANGEL LEON
  • A world class elite tech co-founder entrepreneur, expert in software development, entrepreneurship, marketing, coaching style leadership and aligned with ambition for excellence, global market penetration and worldy perspectives.

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • zhaoyunxing92
  • MCP(消息连接器协议)服务

    Reviews

    5 (1)
    Avatar
    user_ViEJB3ok
    2025-04-16

    Dynamic-Shell-Server by codelion has truly revolutionized my workflow. This powerful tool provides seamless shell access with impressive dynamic capabilities. It’s a must-have for any developer seeking efficiency and reliability. Highly recommend checking out the project on GitHub!