MCP Shell Server
MCP 셸 서버
셸 명령을 실행하기 위한 보안 서버로, MCP(Model Context Protocol)를 구현합니다. 이 서버는 stdin을 통한 입력을 지원하여 권한이 있는 셸 명령을 원격으로 실행할 수 있도록 합니다.
특징
보안 명령 실행 : 권한이 있는 명령만 실행할 수 있습니다.
표준 입력 지원 : stdin을 통해 명령에 입력을 전달합니다.
종합 출력 : stdout, stderr, 종료 코드 및 실행 시간을 반환합니다.
셸 연산자를 사용한 보안 : 셸 연산자(;, &&, ||, |) 뒤에 오는 명령을 검증합니다.
시간 초과 제어 : 명령에 대한 최대 실행 시간을 설정합니다.
Related MCP server: Shell MCP Server
Claude.app에서 MCP 클라이언트 구성
출판된 버전
지엑스피1
{
"mcpServers": {
"shell": {
"command": "uvx",
"args": [
"mcp-shell-server"
],
"env": {
"ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find"
}
},
}
}로컬 버전
설정
code ~/Library/Application\ Support/Claude/claude_desktop_config.json{
"mcpServers": {
"shell": {
"command": "uv",
"args": [
"--directory",
".",
"run",
"mcp-shell-server"
],
"env": {
"ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find"
}
},
}
}설치
pip install mcp-shell-server사용
서버 시작
ALLOW_COMMANDS="ls,cat,echo" uvx mcp-shell-server
# Ou usando o alias
ALLOWED_COMMANDS="ls,cat,echo" uvx mcp-shell-serverALLOW_COMMANDS 환경 변수(또는 별칭 ALLOWED_COMMANDS )는 실행할 수 있는 명령을 지정합니다. 명령어는 쉼표로 구분할 수 있으며, 선택적으로 공백을 사용할 수 있습니다.
ALLOW_COMMANDS 또는 ALLOWED_COMMANDS에 유효한 형식:
ALLOW_COMMANDS="ls,cat,echo" # Formato básico
ALLOWED_COMMANDS="ls ,echo, cat" # Com espaços (usando alias)
ALLOW_COMMANDS="ls, cat , echo" # Múltiplos espaços요청 형식
# Execução básica de comando
{
"command": ["ls", "-l", "/tmp"]
}
# Comando com entrada stdin
{
"command": ["cat"],
"stdin": "Hello, World!"
}
# Comando com timeout
{
"command": ["long-running-process"],
"timeout": 30 # Tempo máximo de execução em segundos
}
# Comando com diretório de trabalho e timeout
{
"command": ["grep", "-r", "pattern"],
"directory": "/path/to/search",
"timeout": 60
}응답 형식
성공적인 응답:
{
"stdout": "saída do comando",
"stderr": "",
"status": 0,
"execution_time": 0.123
}오류 응답:
{
"error": "Comando não permitido: rm",
"status": 1,
"stdout": "",
"stderr": "Comando não permitido: rm",
"execution_time": 0
}보안
서버는 여러 가지 보안 조치를 구현합니다.
명령어 허용 목록 : 명시적으로 허용된 명령어만 실행할 수 있습니다.
Shell 연산자 검증 : Shell 연산자(;, &&, ||, |) 뒤에 오는 명령도 허용 목록에 대해 검증됩니다.
셸 주입 없음 : 셸 해석 없이 명령이 직접 실행됩니다.
개발
개발 환경 설정
저장소를 복제합니다
git clone https://github.com/yourusername/mcp-shell-server.git
cd mcp-shell-server테스트 요구 사항을 포함한 종속성 설치
pip install -e ".[test]"테스트 실행
pytestAPI 참조
요청 인수
필드 | 유형 | 필수적인 | 설명 |
명령 | 끈[] | 예 | 명령과 해당 인수를 배열 요소로 사용 |
표준입력 | 끈 | 아니요 | 명령에 전달될 입력 |
예배 규칙서 | 끈 | 아니요 | 명령을 실행하기 위한 작업 디렉토리 |
타임아웃 | 전체 | 아니요 | 최대 실행 시간(초) |
응답 필드
필드 | 유형 | 설명 |
표준 출력 | 끈 | 명령의 표준 출력 |
표준 에러 | 끈 | 명령 오류 출력 |
상태 | 전체 | 종료 상태 코드 |
실행 시간 | 뜨다 | 실행에 걸리는 시간(초) |
오류 | 끈 | 오류 메시지(실패한 경우에만 표시됨) |
요구 사항
Python 3.11 이상
mcp>=1.1.0
특허
MIT 라이선스 - 자세한 내용은 라이선스 파일을 참조하세요.
Available Tools
1 toolshell_executeC
Execute um comando shell Comandos permitidos:
Inputs: command (required), directory (required), stdin, timeout.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility for confusion or overlap between tools. The tool 'shell_execute' has a single, clearly defined purpose of executing shell commands, so disambiguation is perfect.
Since there is only one tool, naming consistency is inherently perfect. The tool name 'shell_execute' follows a clear verb_noun pattern, but with no other tools to compare, it sets no pattern to deviate from.
A single tool is too few for a server named 'MCP Shell Server', which implies broader shell-related functionality. While the tool covers basic command execution, the scope feels thin, lacking tools for tasks like listing files, checking processes, or managing environment variables that are typical in shell operations.
The tool set is severely incomplete for a shell server. It only provides execution, missing essential operations like file manipulation (e.g., read, write, delete), directory navigation, process management, or system information retrieval. This will likely cause agent failures when trying to perform common shell tasks beyond simple command execution.
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
Related MCP Servers
- AlicenseAqualityAmaintenanceA secure shell command execution server implementing the Model Context Protocol (MCP). This server allows remote execution of whitelisted shell commands with support for stdin input.1202MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows LLMs to execute shell commands and receive their output in a controlled manner.7MIT
- AlicenseBqualityDmaintenanceA secure terminal execution server that enables controlled command execution with security features and resource limits via the Model Context Protocol (MCP).14 npm11MIT
- AlicenseBqualityFmaintenanceA server that uses the Model Context Protocol (MCP) to allow AI agents to safely execute shell commands on a host system.180 npm9MIT