CLI

by hdresearch

30 stars
4.9k downloads
Not rated
GitHub

About

Secure shell command execution server for AI models to interact with local systems while maintaining strict security controls.

Details

Author
hdresearch
Repository
hdresearch/mcp-shell
GitHub stars
30
Downloads
4,890
License
MIT License
Categories
Productivity, Developer Tools, Design, File Management, AI, Search, Security, Frontend, Infrastructure
Tags
#mobile

- MCP-compliant server implementation
- Secure command execution with blacklist protection
- Command existence validation
- Standard I/O based transport
- Error handling and graceful shutdown

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name CLI
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Run npx mcp-shell.

To add it to Claude Desktop, run npx mcp-shell config. Or add npx -y mcp-shell to your config manually.

Start (or restart) Claude Desktop and you should see the MCP tool listed on the landing page.

run_command

Executes a shell command and returns its output. Input: command (string). Response: Command output as plain text or an error message as plain text.

The server provides one tool:

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "cli": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

Shell MCP Server

A Node.js implementation of the Model Context Protocol (MCP) that provides secure shell command execution capabilities. This server allows AI models to execute shell commands in a controlled environment with built-in security measures. Easily integrates with Claude Desktop for connecting Claude with your shell.

<a href="https://glama.ai/mcp/servers/jwkd5nmnh7">
Shell Server MCP server
</a>

Features

- MCP-compliant server implementation
- Secure command execution with blacklist protection
- Command existence validation
- Standard I/O based transport
- Error handling and graceful shutdown

Installation

Run npx mcp-shell.

To add it to Claude Desktop, run npx mcp-shell config. Or add npx -y mcp-shell to your config manually.

Start (or restart) Claude Desktop and you should see the MCP tool listed on the landing page.

Security Features

The server implements several security measures:

1. Command Blacklisting

- Prevents execution of dangerous system commands
- Blocks access to critical system modifications
- Protects against file system destruction
- Prevents privilege escalation

2. Command Validation
- Verifies command existence before execution
- Validates against the blacklist
- Returns clear error messages for invalid commands

Available Tools

The server provides one tool:

run_command

Executes a shell command and returns its output.

Input Schema:

{
  "type": "object",
  "properties": {
    "command": { "type": "string" }
  }
}

Response:

- Success: Command output as plain text
- Error: Error message as plain text

Blacklisted Commands

The following command categories are blocked for security:

- File System Destruction Commands (rm, rmdir, del)
- Disk/Filesystem Commands (format, mkfs, dd)
- Permission/Ownership Commands (chmod, chown)
- Privilege Escalation Commands (sudo, su)
- Code Execution Commands (exec, eval)
- System Communication Commands (write, wall)
- System Control Commands (shutdown, reboot, init)

Error Handling

The server includes comprehensive error handling:

- Command not found errors
- Blacklisted command errors
- Execution errors
- MCP protocol errors
- Graceful shutdown on SIGINT

Implementation Details

The server is built using:

- Model Context Protocol SDK
- StdioServerTransport for communication
- execa for command execution
- command-exists for command validation

Development

To modify the security settings, you can:

1. Edit the BLACKLISTED_COMMANDS set to adjust blocked commands
2. Modify the validateCommand function to add additional validation rules
3. Enhance the command parsing logic in the CallToolRequestSchema handler

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.