mcp-shell
mcp-shell
シェルコマンドを実行する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-shellRelated MCP server: MCP Shell Server
設定方法
セキュアモードがデフォルトです。 設定ファイルがない場合、mcp-shell は読み取り専用ユーティリティ(ls、cat、grep、find、head、tail など)の狭い許可リストに制限されたセキュアモードで起動します。ポリシーを拡張または変更するには、設定ファイルが必要なだけです。完全に無制限で実行するには、明示的にオプトインする必要があります:
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
パラメータ | 型 | 説明 |
| string | 実行するシェルコマンド(必須) |
| boolean | stdout/stderr を base64 でエンコード(デフォルト: false) |
レスポンスには status、exit_code、stdout、stderr、command、execution_time、およびオプションの security_info が含まれます。
環境変数
変数 | 説明 |
| セキュリティYAMLへのパス(組み込みのセキュアデフォルトを上書き) |
|
|
| サーバー名(デフォルト: "mcp-shell 🐚") |
| debug、info、warn、error、fatal |
| json、console |
| 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)は許可リストに含まれていてもハード拒否され、ツールごとのポリシーはデフォルトで拒否です。管理対象バイナリ(git、find、sort、tar)では、明示的に安全なフラグのみが受け入れられ、それ以外のすべて(未知のフラグや将来のエスケープハッチフラグを含む)は拒否されます(git -c/config、find -exec/-fls、sort -o/--compress-program、tar -I/-C)。Gitは読み取り専用サブコマンドに制限されます。これは早期拒否レイヤーであり、サンドボックスではありません。無制限:
MCP_SHELL_ALLOW_UNSAFE=trueの場合のみ。完全なアクセス。ローカル開発には問題ありませんが、それ以外では危険です。Docker: 非root、Alpineベースで実行。本番環境で使用してください。OSサンドボックス(読み取り専用ファイルシステム、ケーパビリティ削除)と組み合わせて多層防御とするのが最適です。
コントリビューション
フォークして、ブランチを作成し、make fmt test を実行し、PRを開いてください。
This server cannot be installed
Maintenance
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
- FlicenseNot gradedqualityNot gradedmaintenanceA secure and pluggable MCP server to run terminal commands on your local machine or cloud server — remotely, safely, and with LLMs or agentic clients.
- AlicenseNot gradedqualityFmaintenanceA secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.1435MIT
- AlicenseNot gradedqualityCmaintenanceUniversal MCP server that wraps any CLI tool, enabling AI assistants to run commands via natural language.MIT
- AlicenseAqualityBmaintenanceAn MCP server that enables AI clients to execute shell, Python, and Node commands on the local machine across platforms.31MIT
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.
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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