This repository provides a secure Model Context Protocol (MCP) server for controlled command-line execution, featuring command whitelisting, path validation, and protection against shell operator injection, ensuring secure LLM application integration.
A secure Model Context Protocol (MCP) server for executing controlled command-line operations with comprehensive security features.
This server enables secure command-line execution with robust security measures, including command whitelisting, path validation, and execution controls. It is designed for providing controlled CLI access to LLM applications while maintaining security.
Key Features: Secure command execution with validation, configurable command and flag whitelisting, path traversal prevention, shell operator injection protection, execution timeouts and length limits, detailed error reporting, async operation support, and working directory restriction.
Configuration: The server is configured using environment variables such as ALLOWED_DIR
, ALLOWED_COMMANDS
, ALLOWED_FLAGS
, MAX_COMMAND_LENGTH
, and COMMAND_TIMEOUT
.
Available Tools: run_command
executes whitelisted commands, and show_security_rules
displays the current security configuration.
Usage: Intended for use with Claude Desktop, with configuration examples provided for both development and published servers.
Security: Implements command whitelists, flag validation, path traversal prevention, shell operator blocking, command length limits, execution timeouts, and working directory restrictions.
MladenSU/cli-mcp-server
December 8, 2024
March 28, 2025
Python