MladenSU_cli-mcp-server
The CLI MCP Server is a secure Model Context Protocol server designed to execute command-line operations safely and efficiently. It includes security features like command whitelisting and shell operator protection, making it ideal for controlled CLI access to LLM applications.
CLI MCP Server
A secure Model Context Protocol (MCP) server implementation for executing command-line operations with comprehensive security features.
Features
- Secure command execution with strict validation
- Configurable command and flag whitelisting
- Path traversal prevention and shell operator injection protection
- Execution timeouts and length limits
- Detailed error reporting and async operation support
Configuration
Configure the server using environment variables such as ALLOWED_DIR
, ALLOWED_COMMANDS
, ALLOWED_FLAGS
, MAX_COMMAND_LENGTH
, and COMMAND_TIMEOUT
.
Security Features
- Command whitelist enforcement
- Flag validation and path traversal prevention
- Shell operator blocking and execution timeouts
Error Handling
The server provides detailed error messages for security violations, command timeouts, and execution failures.
Development
Requires Python 3.10+ and MCP protocol library. Build and publish processes include syncing dependencies, building distributions, and publishing to PyPI.