Shell MCP Server
🖥️ シェル MCP サーバー
🚀 Shell MCP サーバーを使用して、AI アプリケーションに安全なシェル コマンド実行機能を追加します。モデル コンテキスト プロトコル用に構築されています。
✨ 特徴
🔒セキュア実行- コマンドは指定されたディレクトリ内でのみ実行されます
🐚複数のシェル- bash、sh、cmd、powershell をサポート
⏱️タイムアウト制御- 長時間実行されるコマンドの自動終了
🌍クロスプラットフォーム- Unix と Windows の両方のシステムで動作します
🛡️デフォルトで安全- ディレクトリとシェルの検証が組み込まれています
Related MCP server: Terminal MCP Server
🚀 クイックスタート
インストール
# Using pip
pip install shell-mcp-server
# Using uv (recommended)
uv pip install shell-mcp-server🔌 クロード デスクトップ統合
シェル コマンドの実行を有効にするには、Claude Desktop 構成にこれを追加します。
{
"mcpServers": {
"shell-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/path/to/shell-mcp-server",
"run",
"shell-mcp-server",
"/path/to/allowed/dir1",
"/path/to/allowed/dir2",
"--shell", "bash", "/bin/bash",
"--shell", "zsh", "/bin/zsh"
]
}
}
}🎮 使用例
基本的なファイル操作
# List directory contents
result = execute_command(
command="ls -la",
shell="bash",
cwd="/path/to/project"
)
# Find files by pattern
result = execute_command(
command="find . -name '*.py'",
shell="bash",
cwd="/path/to/project"
)プロジェクト管理
# Git operations
result = execute_command(
command="git status && git diff",
shell="bash",
cwd="/path/to/repo"
)
# Package management
result = execute_command(
command="pip list --outdated",
shell="bash",
cwd="/path/to/python/project"
)システム情報
# Resource usage
result = execute_command(
command="df -h && free -h",
shell="bash",
cwd="/path/to/dir"
)
# Process monitoring
result = execute_command(
command="ps aux | grep python",
shell="bash",
cwd="/path/to/dir"
)ファイル処理
# Search file content
result = execute_command(
command="grep -r 'TODO' .",
shell="bash",
cwd="/path/to/project"
)
# File manipulation
result = execute_command(
command="awk '{print $1}' data.csv | sort | uniq -c",
shell="bash",
cwd="/path/to/data"
)Windows固有の例
# List processes
result = execute_command(
command="Get-Process | Where-Object {$_.CPU -gt 10}",
shell="powershell",
cwd="C:\\path\\to\\dir"
)
# System information
result = execute_command(
command="systeminfo | findstr /B /C:'OS'",
shell="cmd",
cwd="C:\\path\\to\\dir"
)⚙️ 構成
コマンドライン引数を使用して動作を構成します。
口論 | 説明 |
| 📁 許可されたディレクトリのリスト |
| 🐚 シェルの仕様(名前とパス) |
環境変数:
COMMAND_TIMEOUT: ⏱️ 最大実行時間(秒)(デフォルト: 30)
🛡️ セキュリティ機能
🔐ディレクトリ分離: コマンドは指定されたディレクトリ内でのみ実行できます
🔒シェル制御: 設定されたシェルのみが許可されます
⏰タイムアウト保護: すべてのコマンドには設定可能なタイムアウトがあります
🛑パス検証: 作業ディレクトリの検証によりトラバーサル攻撃を防止
👤権限分離: コマンドはサーバープロセスと同じ権限で実行されます
🛠️ 開発
開発環境をセットアップします。
# Create and activate virtual environment
uv venv
source .venv/bin/activate
# Install development dependencies
uv pip install -e ".[test]"
# Run tests
python -m pytest
# Run tests with coverage
python -m pytest --cov=shell_mcp_server🤝 貢献する
貢献大歓迎!お気軽にどうぞ:
🐛 バグを報告する
💡 機能を提案する
🔧 プルリクエストを送信する
📚 ドキュメントの改善
📜 ライセンス
MIT ライセンス - 詳細についてはライセンスを参照してください。
🌟 セキュア シェル アクセスで AI を強化しましょう! 🌟
モデルコンテキストプロトコル向けに構築 | MCPコミュニティによって愛を込めて作成
Available Tools
1 toolexecute_commandB
Execute a shell command in a specified directory using a specified shell
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | The shell command to execute | |
| shell | Yes | Shell to use for execution. Available: ['bash', 'sh'] | |
| cwd | Yes | Working directory for command execution |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'execute a shell command' implies a potentially risky operation, the description lacks critical details such as security implications, error handling, output format, or execution limits. It fails to address what happens if the command fails or how results are returned.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is front-loaded and appropriately sized for its function, with zero waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of executing shell commands (a high-risk operation with no annotations and no output schema), the description is insufficient. It lacks details on behavioral traits, error handling, security warnings, and output expectations, making it incomplete for safe and effective use by an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, meaning the input schema already documents all parameters thoroughly. The description adds no additional meaning beyond what the schema provides, such as examples or edge cases. However, it does not contradict the schema, so it meets the baseline for high coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('execute a shell command') and resources involved ('in a specified directory using a specified shell'). It uses precise verbs and distinguishes what this tool does without ambiguity, even though there are no sibling tools to differentiate from.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or any context for its application. It simply states what the tool does without indicating appropriate scenarios or constraints.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
- First observed
execute_command
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clear and distinct purpose.
A single tool inherently has perfect naming consistency, as there are no other tools to compare it against for patterns or conventions.
A single tool is generally too few for a server's purpose, as it limits functionality and scope. For a shell server, this feels thin and may not cover common use cases effectively.
The tool surface is severely incomplete for a shell domain. It lacks operations for file management, process control, environment variables, or other common shell tasks, leading to significant gaps that will cause agent failures.
Maintenance
Related MCP Connectors
I run shell commands on your private cloud environment (bash, sh, zsh)
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Related MCP Servers
- AlicenseBqualityCmaintenanceA secure server for executing terminal commands within predefined paths, allowing safe interaction by Large Language Models with operating system environments.145 npm18MIT
- FlicenseNot gradedqualityDmaintenanceEnables safe execution of terminal commands across different shells (bash, cmd, PowerShell) with configurable timeouts, working directories, and resource limits for command-line operations through AI assistants.-
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables users to execute arbitrary shell commands through a terminal tool. It supports custom working directories, configurable execution timeouts, and safe command parsing using shlex.-
- AlicenseAqualityFmaintenanceEnables AI assistants to execute terminal commands on a host machine with configurable, granular permission controls and safety protections. It features multiple security modes, including allowlists and manual approval, to ensure safe command execution within specified directories.6Apache 2.0