
mladensu/cli-mcp-server 是从 https://github.com/mladensu/cli-mcp-server. 导入的 MCP 服务器候选
概览
mladensu/cli-mcp-server 是从 https://github.com/mladensu/cli-mcp-server. 导入的 MCP 服务器候选
概述(AI 翻译)
一个安全的模型上下文协议(MCP)服务器实现,用于执行受控命令行操作,且 全面的安全功能。
目录
- 概述
- 功能
- 配置
- 可用工具
- run_command
- show_security_rules
- 使用 Claude Desktop
- 开发/未发布服务器配置
- 已发布服务器配置
- 安全特征
- 错误处理
- 发展
- 先决条件
- 建筑与出版
- 调试
- 许可
概述
该MCP服务器支持安全的命令行执行,并支持强大的安全措施,包括命令白名单、路径 验证和执行控制。非常适合在保持安全的同时,对LLM应用进行受控的CLI访问。
特色
- 🔒 通过严格验证确保命令执行安全
- ⚙️ 可配置命令和标志白名单,支持“全部”选项
- 🛡️ 路径穿越预防与验证
- 🚫 炮弹操作员注射保护
- ⏱️ 执行超时和长度限制
- 📝 详细的错误报告
- 🔄 支持异步操作
- 🎯 工作目录限制与验证
配置
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
CLI MCP Server
A secure Model Context Protocol (MCP) server implementation for executing controlled command-line operations with comprehensive security features.
Table of Contents
- Overview
- Features
- Configuration
- Available Tools
- Usage with Claude Desktop
- Security Features
- Error Handling
- Development
- License
Overview
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.
Features
- 🔒 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
- 🔄 Async operation support
- 🎯 Working directory restriction and validation
Configuration
Configure the server using environment variables:
| Variable | Description | Default |
|---|---|---|
ALLOWED_DIR |
Base directory for command execution (Required) | None (Required) |
ALLOWED_COMMANDS |
Comma-separated list of allowed commands or ‘all’ | ls,cat,pwd |
ALLOWED_FLAGS |
Comma-separated list of allowed flags or ‘all’ | -l,-a,--help |
MAX_COMMAND_LENGTH |
Maximum command string length | 1024 |
COMMAND_TIMEOUT |
Command execution timeout (seconds) | 30 |
安装
uvx 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"
}
}
}
}