Sponsored by Deepsite.site

Dynamic Shell Server

Created By
codeliona year ago
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.
Content

# 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: ```bash git clone cd dynamic-shell-server ```

  2. Create a virtual environment and activate it: ```bash python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate ```

  3. Install dependencies: ```bash pip install -r requirements.txt ```

Usage

Standalone Mode

Run the server directly:

```bash 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: ```json { "mcpServers": { "shell": { "command": "/absolute/path/to/.venv/bin/python", "args": ["/absolute/path/to/dynamic_shell_server.py"] } } } ```

  3. 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]

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
ChatWiseThe second fastest AI chatbot™
CursorThe AI Code Editor
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Amap Maps高德地图官方 MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Playwright McpPlaywright MCP server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Serper MCP ServerA Serper MCP Server
WindsurfThe new purpose-built IDE to harness magic
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp