MCP ExplorerExplorer

Shell Command Mcp

@kaznakon a year ago
4 MIT
FreeCommunity
AI Systems
This is an MCP (Model Context Protocol) server that allows executing shell commands within a Docker container. It provides a secure and isolated environment for running commands without giving access to the host Docker daemon.

Overview

What is Shell Command Mcp

shell-command-mcp is an MCP (Model Context Protocol) server that enables the execution of shell commands within a secure and isolated Docker container environment, without granting access to the host Docker daemon.

Use cases

Use cases include executing scripts in a controlled environment, managing Kubernetes resources using kubectl, and automating tasks in a CI/CD workflow while maintaining security and isolation.

How to use

To use shell-command-mcp, configure your Docker settings in the Claude for Desktop configuration file, specifying the directory to mount for the container. Then, you can execute shell commands using the provided MCP interface.

Key features

Key features include the ability to run shell commands via a simple MCP interface, inclusion of Kubernetes tools such as kubectl, helm, kustomize, k9s, an isolated environment with a non-root user, and it is built with TypeScript and the MCP SDK.

Where to use

shell-command-mcp can be used in development environments, CI/CD pipelines, and any scenario where secure execution of shell commands is required without exposing the host system.

Content

OBSOLETE

I recommend using Claude Code by running claude mcp serve instead of this MCP server.
I have created ai-agent-workspace as a container to run Claude Code.
Please use it as needed.

Shell Command MCP Server

This is an MCP (Model Context Protocol) server that allows executing shell commands within a Docker container. It provides a secure and isolated workspace for running commands without giving access to the host Docker daemon.

Features

  • Run shell scripts through a simple MCP interface
    • synchronous execution
    • asynchronous execution with 4 different modes
      • complete: notify when the command is completed
      • line: notify on each line of output
      • chunk: notify on each chunk of output
      • character: notify on each character of output
  • Kubernetes tools included: kubectl, helm, kustomize, hemfile
  • Isolated Docker container environment with non-root user
    • host-container userid/groupid mapping implemented. this allows the container to run as the same user as the host, ensuring that files created by the container have the same ownership and permissions as those created by the host.
    • mount a host directory to the container /home/mcp directory for persistence. it become the home directory the AI works in.
    • if the host directory is empty, the initial files will be copied form the backup in the container.

Design Philosophy

This MCP server provides AI with a workspace similar to that of a human.
Authorization is limited not by MCP functions, but by container isolation and external authorization restrictions.

It provides more general tools such as shell script execution, so that they can be used without specialized knowledge of tool use.

The server implementation is kept as simple as possible to facilitate code auditing.

Getting Started

Prerequisites

  • Docker

Usage with Claude for Desktop

Add the following configuration to your Claude for Desktop configuration file.

MacOS:

Replace /Users/user-name/ClaudeWorks with the directory you want to make available to the container.

Windows:

Feed some prompts

To Operate the files in the mounted directory.

Available MCP Tools

Security Considerations

  • The MCP server runs as a non-root user within the container
  • The container does not have access to the host Docker daemon
  • User workspace is mounted from the host for persistence

License

MIT

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers