CLI MCP Server
Command line interface for MCP clients with secure execution and customizable security policies
Overview
CLI MCP Server is a secure Model Context Protocol (MCP) server that allows executing controlled command-line operations while implementing comprehensive security measures.
To use CLI MCP Server, configure it using environment variables to set allowed commands and directories, then run the server to execute the whitelisted CLI commands safely.
- 🔒 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 with support for async operations
- Providing secure CLI access for applications that require command execution
- Running trusted scripts in a controlled environment for automation tasks
- Integrating with LLM applications to ensure safety in command execution
Add to your AI client
Use these steps to connect CLI MCP Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"cli-mcp-server-mladensu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cli-mcp-server-mladensu"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"cli-mcp-server-mladensu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cli-mcp-server-mladensu"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"cli-mcp-server-mladensu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cli-mcp-server-mladensu"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"cli-mcp-server-mladensu": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cli-mcp-server-mladensu"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"cli-mcp-server-mladensu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cli-mcp-server-mladensu"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"cli-mcp-server-mladensu": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-cli-mcp-server-mladensu"
]
}
}
}FAQ
What command types does CLI MCP Server support?
It supports any whitelisted commands configured in the environment variables like 'ls', 'cat', and 'pwd'.
How do I configure the allowed commands?
You can configure allowed commands by setting the 'ALLOWED_COMMANDS' environment variable to a comma-separated list of commands.
Is it secure to use CLI MCP Server?
Yes! It includes multiple security features such as command whitelisting, timeout mechanisms, and path validation.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":132,"uuid":"97c38ccc-a397-49cd-9e12-92580ac41010","name":"cli-mcp-server","title":"CLI MCP Server","description":"Command line interface for MCP clients with secure execution and customizable security policies","avatar_url":"https://avatars.githubusercontent.com/u/53565817?v=4","created_at":"2024-12-13T09:01:19.401Z","updated_at":"2024-12-13T09:39:15.540Z","status":"created","author_name":"MladenSU","author_avatar_url":"https://avatars.githubusercontent.com/u/53565817?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/MladenSU/cli-mcp-server","target":"_self","content":"$29","summary":"$2a","img_url":"https://camo.githubusercontent.com/6581c31c16c1b13ddc2efb92e2ad69a93ddc4a92fd871ff15d401c4c6c9155a4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667","type":null,"metadata":"{\"star\":\"103\",\"license\":\"MIT license\",\"language\":\"Python\",\"is_official\":false,\"latest_commit_time\":\"2025-04-22 00:39:35\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]