mcp-shell-server

by tumf

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Code coverage reporting integration shown by the codecov badge in the README header, displaying test coverage metrics for the project.

MCP 셸 서버

모델 컨텍스트 프로토콜(MCP)을 구현하는 보안 셸 명령 실행 서버입니다. 이 서버는 stdin 입력을 지원하여 허용 목록에 있는 셸 명령을 원격으로 실행할 수 있도록 합니다.

특징

  • 보안 명령 실행 : 허용 목록에 있는 명령만 실행할 수 있습니다.
  • 표준 입력 지원 : stdin을 통해 명령에 입력 전달
  • 종합 출력 : stdout, stderr, 종료 상태 및 실행 시간을 반환합니다.
  • Shell Operator Safety : Shell 연산자(;, &&, ||, |) 다음에 나오는 명령을 검증합니다.
  • 시간 제한 제어 : 명령에 대한 최대 실행 시간 설정

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 # Or using the alias ALLOWED_COMMANDS="ls,cat,echo" uvx mcp-shell-server

ALLOW_COMMANDS (또는 별칭 ALLOWED_COMMANDS ) 환경 변수는 실행 가능한 명령을 지정합니다. 명령은 쉼표로 구분할 수 있으며, 공백을 사용하여 구분할 수도 있습니다.

ALLOW_COMMANDS 또는 ALLOWED_COMMANDS에 유효한 형식:

ALLOW_COMMANDS="ls,cat,echo" # Basic format ALLOWED_COMMANDS="ls ,echo, cat" # With spaces (using alias) ALLOW_COMMANDS="ls, cat , echo" # Multiple spaces

요청 형식

# Basic command execution { "command": ["ls", "-l", "/tmp"] } # Command with stdin input { "command": ["cat"], "stdin": "Hello, World!" } # Command with timeout { "command": ["long-running-process"], "timeout": 30 # Maximum execution time in seconds } # Command with working directory and timeout { "command": ["grep", "-r", "pattern"], "directory": "/path/to/search", "timeout": 60 }

응답 형식

성공적인 응답:

{ "stdout": "command output", "stderr": "", "status": 0, "execution_time": 0.123 }

오류 응답:

{ "error": "Command not allowed: rm", "status": 1, "stdout": "", "stderr": "Command not allowed: rm", "execution_time": 0 }

보안

서버는 여러 가지 보안 조치를 구현합니다.

  1. 명령 허용 목록 : 명시적으로 허용된 명령만 실행할 수 있습니다.
  2. Shell 연산자 검증 : Shell 연산자(;, &&, ||, |) 뒤에 오는 명령도 허용 목록에 대해 검증됩니다.
  3. 셸 주입 없음 : 셸 해석 없이 명령이 직접 실행됩니다.

개발

개발 환경 설정

  1. 저장소를 복제합니다
git clone https://github.com/yourusername/mcp-shell-server.git cd mcp-shell-server
  1. 테스트 요구 사항을 포함한 종속성 설치
pip install -e ".[test]"

테스트 실행

pytest

API 참조

요청 인수

필드유형필수의설명
명령[]명령과 해당 인수를 배열 요소로 사용
표준입력아니요명령에 전달될 입력
예배 규칙서아니요명령 실행을 위한 작업 디렉토리
타임아웃정수아니요최대 실행 시간(초)

응답 필드

필드유형설명
표준 출력명령의 표준 출력
표준 에러명령의 표준 오류 출력
상태정수종료 상태 코드
실행 시간뜨다실행에 걸리는 시간(초)
오류오류 메시지(실패한 경우에만 표시됨)

요구 사항

  • Python 3.11 이상
  • mcp>=1.1.0

특허

MIT 라이선스 - 자세한 내용은 라이선스 파일을 참조하세요.

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

모델 컨텍스트 프로토콜(MCP)을 구현하는 보안 셸 명령 실행 서버입니다. 이 서버는 stdin 입력을 지원하여 허용 목록에 있는 셸 명령을 원격으로 실행할 수 있도록 합니다.

  1. Features
    1. MCP client setting in your Claude.app
      1. Published version
      2. Local version
    2. Usage
      1. Starting the Server
      2. Request Format
      3. Response Format
    3. Security
      1. Development
        1. Setting up Development Environment
        2. Running Tests
      2. API Reference
        1. Request Arguments
        2. Response Fields
      3. Requirements
        1. License
          ID: rt2d4pbn22