Cli MCP Server

A secure Model Context Protocol (MCP) server implementation for executing controlled command-line operations with comprehensive security features.

Local serverstdioPython

What is the Cli MCP Server?

A secure Model Context Protocol (MCP) server implementation for executing controlled command-line operations with comprehensive security features.

The short version

This MCP server enables secure command-line execution with robust security measures including command whitelisting, path validation, and execution controls. Perfect for providing controlled CLI access to LLM applications while maintaining security.

  • 🔒 Secure command execution with strict validation
  • ⚙️ Configurable command and flag whitelisting with 'all' option
  • 🛡️ Path traversal prevention and validation
  • 🚫 Shell operator injection protection
  • ⏱️ Execution timeouts and length limits
  • 📝 Detailed error reporting

The tools it exposes

The server publishes 4 tools. What each one is for:

  • run_command — Executes whitelisted CLI commands within allowed directories
  • show_security_rules — Displays current security configuration and restrictions, including: - Working directory - Allowed commands - Allowed flags - Security limits (max
  • Prerequisites — The Prerequisites tool exposed by this server
  • Debugging — Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the [MCP

What it needs from you

  • Python 3.10+ - MCP protocol library

Recorded tools

  • run_command — Executes whitelisted CLI commands within allowed directories.
  • show_security_rules — Displays current security configuration and restrictions, including: - Working directory - Allowed commands - Allowed flags - Security limits (max command length and timeout)

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
run_command
show_security_rules

How to install the Cli MCP Server

{
  "mcpServers": {
    "cli-mcp-server": {
      "command": "uv",
      "args": [
        "--directory",
        "<path/to/the/repo>/cli-mcp-server",
        "run",
        "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",
        "ALLOW_SHELL_OPERATORS": "false"
      }
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Configuration

  • Python 3.10+ - MCP protocol library
VariableDescriptionRequired
ALLOWED_DIRDeclared in the maintainer’s client configuration.Yes
ALLOWED_COMMANDSDeclared in the maintainer’s client configuration.Check documentation
ALLOWED_FLAGSDeclared in the maintainer’s client configuration.Check documentation
MAX_COMMAND_LENGTHDeclared in the maintainer’s client configuration.Check documentation
COMMAND_TIMEOUTDeclared in the maintainer’s client configuration.Check documentation
ALLOW_SHELL_OPERATORSDeclared in the maintainer’s client configuration.Check documentation

Example prompts to try

  • “Use Cli to run command.”
  • “Use Cli to show security rules.”
  • “Use Cli to Prerequisites.”

Frequently asked questions

A secure Model Context Protocol (MCP) server implementation for executing controlled command-line operations with comprehensive security features. Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.