MCP Shell Server

MIT License
59
1
  • Linux
  • Apple

Integrations

  • Enables execution of Git commands through the shell interface, allowing AI agents to perform version control operations like commits, pulls, pushes, and branch management.

  • Supports running npm commands through the shell interface, enabling package management operations like installing, updating, and removing JavaScript packages.

  • Facilitates running pnpm commands through the shell interface, offering fast, disk-space efficient package management for JavaScript projects.

MCP 셸 서버

모델 컨텍스트 프로토콜(MCP)을 사용하여 셸 명령을 실행하는 서버입니다. AI 에이전트가 셸 명령을 안전하게 실행할 수 있도록 하는 브리지 역할을 합니다.

특징

  • 셸 명령 실행(단일 줄 및 다중 줄 지원)
  • 다양한 셸(bash, zsh, fish, powershell, cmd 등) 지원
  • 자세한 오류 처리 및 로깅
  • MCP Inspector 호환

설치

npm에서 (사용자로서)

지엑스피1

소스에서(개발용)

# Clone the repository git clone https://github.com/mkusaka/mcp-shell-server.git cd mcp-shell-server # Install dependencies pnpm install # Build the project pnpm build

MCP 구성

커서 구성

커서 구성 파일( ~/.cursor/config.json )에 다음을 추가합니다.

{ "mcpServers": { "shell": { "command": "npx", "args": ["-y", "@mkusaka/mcp-shell-server"] } } }

규칙 구성

커서 규칙 파일에 다음을 추가하세요.

You have tools at your disposal to solve the coding task. Follow these rules regarding tool calls: 1. ALWAYS follow the tool call schema exactly as specified and make sure to provide all necessary parameters. 2. The conversation may reference tools that are no longer available. NEVER call tools that are not explicitly provided. 3. **NEVER refer to tool names when speaking to the USER.** For example, instead of saying 'I need to use the shell_exec tool to execute your command', just say 'I will execute your command'. 4. Only calls tools when they are necessary. If the USER's task is general or you already know the answer, just respond without calling tools. 5. Before calling each tool, first explain to the USER why you are calling it.

용법

직접 실행

node dist/index.js # or as an executable ./dist/index.js

개발 모드

pnpm dev

MCP Inspector로 테스트

pnpm inspect

명령줄 인수

-s, --shell <shell> Specify the path to the shell to use -h, --help Display help message -V, --version Display version information

도구 참조

shell_exec

지정된 셸에서 명령을 실행합니다.

매개변수:

  • command (문자열, 필수): 실행할 셸 명령

리소스 참조

서버는 다음과 같은 시스템 정보를 리소스로 제공합니다.

호스트 이름

시스템의 호스트 이름을 반환합니다.

URI: hostname://

플랫폼

운영체제 플랫폼을 반환합니다.

URI: platform://

껍데기

서버에서 사용 중인 셸 경로를 반환합니다.

URI: shell://

사용자 이름

현재 사용자 이름을 반환합니다.

URI: username://

시스템 정보

다음을 포함하여 포괄적인 시스템 정보를 JSON 형식으로 반환합니다.

  • 호스트 이름
  • 플랫폼
  • 껍데기
  • 사용자 이름
  • CPU 수
  • 총 메모리
  • 여유 메모리
  • 시스템 가동 시간

사용 예

기본 명령 실행

{ "name": "shell_exec", "parameters": { "command": "echo Hello, World!" } }

다중 줄 명령(Heredoc) 실행

{ "name": "shell_exec", "parameters": { "command": "cat << EOF | grep 'example'\nThis is an example text.\nAnother line without the keyword.\nEOF" } }

개발

프로젝트 구조

src/ ├── index.ts # Main entry point └── shell-server/ ├── index.ts # Shell server implementation └── lib/ └── logger.ts # Logging configuration

벌채 반출

로그는 mcp-shell.log 파일에 기록됩니다.

특허

MIT

You must be authenticated.

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

AI 에이전트가 호스트 시스템에서 셸 명령을 안전하게 실행할 수 있도록 모델 컨텍스트 프로토콜(MCP)을 사용하는 서버입니다.

  1. Features
    1. Installation
      1. From npm (as a user)
      2. From source (for development)
    2. MCP Configuration
      1. Cursor Configuration
      2. Rule Configuration
    3. Usage
      1. Direct Execution
      2. Development Mode
      3. Testing with MCP Inspector
    4. Command Line Arguments
      1. Tool Reference
        1. shell_exec
      2. Resource Reference
        1. hostname
        2. platform
        3. shell
        4. username
        5. system-info
        6. Usage Examples
      3. Development
        1. Project Structure
        2. Logging
      4. License
        ID: t1x2r819sf