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. That is what the cli mcp server brings to an AI assistant: the same capability, reachable through the Model Context Protocol rather than a separate app or dashboard.

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

Getting it running

Installation goes through your MCP client rather than a global install: point it at @smithery/cli on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

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

Configuration is passed through the environment: ALLOWED_DIR, ALLOWED_COMMANDS, ALLOWED_FLAGS, MAX_COMMAND_LENGTH, COMMAND_TIMEOUT, ALLOW_SHELL_OPERATORS, YOUR_PYPI_API_TOKEN. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

  • Python 3.10+ - MCP protocol library

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

How it compares

Plenty of file and storage access servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Cli's toolset — run_command, show_security_rules, Prerequisites and 1 more — is a fair guide to whether it matches your workflow. It is maintained by MladenSU; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Available tools

ToolWhat it does
run_commandExecutes whitelisted CLI commands within allowed directories.
show_security_rulesDisplays current security configuration and restrictions, including: - Working directory - Allowed commands - Allowed flags - Security limits (max command length and timeout)
PrerequisitesThe Prerequisites tool exposed by this server.
DebuggingSince MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector).

How to install the Cli MCP server

> Published Servers Configuration

```json
{
  "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",
        "ALLOW_SHELL_OPERATORS": "false"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Python 3.10+ - MCP protocol library
VariableDescriptionRequired
ALLOWED_DIRFilesystem location the server is allowed to use.Optional
ALLOWED_COMMANDSConfiguration value read at startup.Optional
ALLOWED_FLAGSConfiguration value read at startup.Optional
MAX_COMMAND_LENGTHConfiguration value read at startup.Optional
COMMAND_TIMEOUTConfiguration value read at startup.Optional
ALLOW_SHELL_OPERATORSConfiguration value read at startup.Optional
YOUR_PYPI_API_TOKENCredential the server authenticates with.Yes

Example prompts to try

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

Frequently asked questions

It connects Cli to MCP-compatible AI assistants such as Claude and Cursor, exposing 4 tools (run_command, show_security_rules, Prerequisites, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Cli directly.