Design Engineer Logo
Visit Repo
Open Graph preview

CLI MCP Serve

Command line interface for MCP clients with customizable security policies

Site favicon
⚡️ System Operation

Overview

CLI MCP Server

Description:
A secure command-line execution server with comprehensive security features and controls

Category: Command Line Tools & System Utilities

Overview:
This server implementation enables secure command-line operations with robust security measures. It features command whitelisting, path validation, and strict execution controls, making it ideal for providing controlled CLI access to LLM applications.

Key features:

  • Secure command execution with validation
  • Command and flag whitelisting
  • Path traversal prevention
  • Shell injection protection
  • Execution timeouts and limits
  • Async operation support
  • Detailed error reporting

Installation:

npx @smithery/cli install cli-mcp-server --client claude

Configuration Example:

{
  "mcpServers": {
    "cli-mcp-server": {
      "command": "uvx",
      "args": ["cli-mcp-server"],
      "env": {
        "ALLOWED_DIR": "</your/desired/dir>",
        "ALLOWED_COMMANDS": "ls,cat,pwd,echo",
        "ALLOWED_FLAGS": "-l,-a,--help,--version",
        "MAX_COMMAND_LENGTH": "1024",
        "COMMAND_TIMEOUT": "30"
      }
    }
  }
}

Available Tools:

  • run_command: Executes whitelisted CLI commands
  • show_security_rules: Displays security configuration

Security Features:

  • Command whitelist enforcement
  • Flag validation
  • Path traversal prevention
  • Shell operator blocking
  • Command length limits
  • Execution timeouts
  • Working directory restrictions

Development Requirements:

  • Python 3.10+
  • MCP protocol library

For debugging, use the MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory /your-source-code-path/cli-mcp-server run cli-mcp-server