Skip to main content
Glama
sonirico

mcp-shell

by sonirico

mcp-shell

Trust Score glama

シェルコマンドを実行するMCPサーバーです。LLMにはツールが与えられ、あなたは何をどのように実行するかを制御できます。

mark3labs/mcp-go 上に構築されています。Goで書かれています。


実行方法

Docker(最も簡単):

docker run -it --rm -v /tmp/mcp-workspace:/tmp/mcp-workspace sonirico/mcp-shell:latest

ソースから:

git clone https://github.com/sonirico/mcp-shell && cd mcp-shell
make install
mcp-shell

Related MCP server: MCP Shell Server

設定方法

セキュアモードがデフォルトです。 設定ファイルがない場合、mcp-shell は読み取り専用ユーティリティ(lscatgrepfindheadtail など)の狭い許可リストに制限されたセキュアモードで起動します。ポリシーを拡張または変更するには、設定ファイルが必要なだけです。完全に無制限で実行するには、明示的にオプトインする必要があります:

MCP_SHELL_ALLOW_UNSAFE=true mcp-shell   # disables all validation - do not use in production

ポリシーをカスタマイズするには、YAML設定を指定します:

export MCP_SHELL_SEC_CONFIG_FILE=/path/to/security.yaml
mcp-shell

セキュアモード(推奨)— シェル解釈なし、実行可能ファイルの許可リストのみ:

security:
  enabled: true
  use_shell_execution: false
  allowed_executables:
    - ls
    - cat
    - grep
    - find
    - echo
  # WARNING: never add shell/language interpreters (bash, sh, python, perl,
  # ruby, node) or alias-capable tools (git) here - the interpreter executes
  # whatever it is handed, bypassing secure mode entirely. mcp-shell warns at
  # startup if it finds one.
  blocked_patterns:          # optional: restrict args on allowed commands
    - '(^|\s)remote\s+(-v|--verbose)(\s|$)'
  max_execution_time: 30s
  max_output_size: 1048576
  working_directory: /tmp/mcp-workspace
  audit_log: true

レガシーモード — シェル実行、コマンド文字列による許可/拒否リスト(注意しないとインジェクションに対して脆弱):

security:
  enabled: true
  use_shell_execution: true
  allowed_commands: [ls, cat, grep, echo]
  blocked_patterns: ['rm\s+-rf', 'sudo\s+']
  max_execution_time: 30s
  audit_log: true

接続方法

Claude Desktop — MCP設定に追加:

{
  "mcpServers": {
    "shell": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "sonirico/mcp-shell:latest"],
      "env": { "MCP_SHELL_LOG_LEVEL": "info" }
    }
  }
}

カスタム設定の場合は、ファイルをマウントして環境変数を設定します:

{
  "command": "docker",
  "args": ["run", "--rm", "-i", "-v", "/path/to/security.yaml:/etc/mcp-shell/security.yaml", "-e", "MCP_SHELL_SEC_CONFIG_FILE=/etc/mcp-shell/security.yaml", "sonirico/mcp-shell:latest"]
}

ツールAPI

パラメータ

説明

command

string

実行するシェルコマンド(必須)

base64

boolean

stdout/stderr を base64 でエンコード(デフォルト: false)

レスポンスには statusexit_codestdoutstderrcommandexecution_time、およびオプションの security_info が含まれます。


環境変数

変数

説明

MCP_SHELL_SEC_CONFIG_FILE

セキュリティYAMLへのパス(組み込みのセキュアデフォルトを上書き)

MCP_SHELL_ALLOW_UNSAFE

true に設定するとすべての検証を無効化し、無制限で実行(オプトイン)

MCP_SHELL_SERVER_NAME

サーバー名(デフォルト: "mcp-shell 🐚")

MCP_SHELL_LOG_LEVEL

debug、info、warn、error、fatal

MCP_SHELL_LOG_FORMAT

json、console

MCP_SHELL_LOG_OUTPUT

stdout、stderr、file


開発

make install dev-tools   # deps + goimports, golines
make fmt test lint
make docker-build       # build image locally
make release            # binary + docker image

セキュリティ

  • デフォルト: セキュアモード。読み取り専用ユーティリティの狭い許可リストに制限。インタープリタなし。

  • セキュアモードuse_shell_execution: false): コマンドはシェルASTに解析され、単一の完全にリテラルな単純コマンドのみが受け入れられます(パイプ、リスト、置換、リダイレクト、グロブは不可)。その実行可能ファイルは許可リストに含まれている必要があります。インタープリタ(bash/sh/python)は許可リストに含まれていてもハード拒否され、ツールごとのポリシーはデフォルトで拒否です。管理対象バイナリ(gitfindsorttar)では、明示的に安全なフラグのみが受け入れられ、それ以外のすべて(未知のフラグや将来のエスケープハッチフラグを含む)は拒否されます(git -c/configfind -exec/-flssort -o/--compress-programtar -I/-C)。Gitは読み取り専用サブコマンドに制限されます。これは早期拒否レイヤーであり、サンドボックスではありません。

  • 無制限: MCP_SHELL_ALLOW_UNSAFE=true の場合のみ。完全なアクセス。ローカル開発には問題ありませんが、それ以外では危険です。

  • Docker: 非root、Alpineベースで実行。本番環境で使用してください。OSサンドボックス(読み取り専用ファイルシステム、ケーパビリティ削除)と組み合わせて多層防御とするのが最適です。


コントリビューション

フォークして、ブランチを作成し、make fmt test を実行し、PRを開いてください。

A
license - permissive license
Not graded
quality - not tested
A
maintenance

Maintenance

Maintainers
<1hResponse time
7wRelease cycle
8Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A secure and pluggable MCP server to run terminal commands on your local machine or cloud server — remotely, safely, and with LLMs or agentic clients.
  • A
    license
    Not graded
    quality
    F
    maintenance
    A secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.
    143
    5
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Universal MCP server that wraps any CLI tool, enabling AI assistants to run commands via natural language.
    MIT

View all related MCP servers

Related MCP Connectors

  • Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.

  • MCP server for AI dialogue using various LLM models via AceDataCloud

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sonirico/mcp-shell'

If you have feedback or need assistance with the MCP directory API, please join our Discord server