Skip to main content
Glama
mkusaka
by mkusaka

MCP 셸 서버

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

특징

  • 셸 명령 실행(단일 줄 및 다중 줄 지원)

  • 다양한 셸(bash, zsh, fish, powershell, cmd 등) 지원

  • 자세한 오류 처리 및 로깅

  • MCP Inspector 호환

Related MCP server: Command Executor MCP Server

설치

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"]
    }
  }
}

클라인 통합

Cline은 Claude AI와 함께 MCP 서버를 사용할 수 있도록 해주는 VS Code 확장 프로그램입니다. Cline을 사용하여 이 MCP 셸 서버를 설정하려면 다음 단계를 따르세요.

  1. Cline MCP 설정 파일을 엽니다.

    • macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

    • Windows: %APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

    • 리눅스: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

  2. 셸 서버 MCP 구성을 추가합니다.

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

    또는 로컬에 설치된 패키지를 사용하려면 다음을 수행합니다.

    {
      "mcpServers": {
        "shell": {
          "command": "node",
          "args": ["/path/to/mcp-shell-server/dist/index.js"],
          "disabled": false,
          "autoApprove": []
        }
      }
    }

규칙 구성

AI 비서의 규칙이나 프롬프트에 다음을 추가하세요.

You have MCP Shell tools at your disposal. Follow these rules regarding Shell tool usage:
1. ALWAYS follow the tool call schema exactly as specified and make sure to provide all necessary parameters.
2. **NEVER refer to tool names when speaking to me.** For example, instead of saying 'I need to use the shell_exec tool to run this command', just say 'I'll run that command for you'.
3. Only use Shell tools when they are necessary. If my task is general or you already know the answer, just respond without calling tools.
4. When I ask you to execute shell commands, use the appropriate tool to:
   - Run single-line commands
   - Run multi-line commands (using heredoc syntax when appropriate)
   - Execute file operations, git commands, or system utilities
   - Provide system information when relevant
5. Always be careful with shell commands that might modify the system, and explain what the command will do before executing it.
6. If a shell command produces an error, explain what went wrong in simple terms and suggest ways to fix 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
-w, --working-dir <directory>  Specify the working directory for command execution
-h, --help           Display help message
-V, --version        Display version information

도구 참조

shell_exec

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

매개변수:

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

  • workingDir (문자열, 선택 사항): 명령을 실행할 작업 디렉토리입니다. $HOME 아래에 있어야 합니다.

리소스 참조

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

호스트 이름

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

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

Available Tools

1 tool
shell_execC

Executes commands in the specified shell with detailed error handling and output capture

ParametersJSON Schema
NameRequiredDescriptionDefault
commandYesThe shell command to execute in the configured shell environment
workingDirNoOptional working directory to execute the command in (must be under $HOME for security)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'detailed error handling and output capture' which adds some context beyond basic execution, but fails to address critical aspects like security implications, permission requirements, rate limits, or what happens when commands fail. For a shell execution tool with zero annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Executes commands in the specified shell') and adds value with secondary capabilities ('with detailed error handling and output capture'). Every word earns its place with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of shell execution (security risks, variable outputs) and the absence of both annotations and an output schema, the description is insufficient. It doesn't explain return values, error formats, or security constraints beyond the schema's workingDir note. For a potentially dangerous tool with no structured safety indicators, more descriptive context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., no examples of command syntax, working directory constraints beyond security). The baseline score of 3 reflects adequate schema coverage without description enhancement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Executes commands in the specified shell' with additional capabilities for 'detailed error handling and output capture'. It uses specific verbs ('executes', 'capture') and identifies the resource ('shell commands'). However, there are no sibling tools mentioned, so differentiation from alternatives cannot be evaluated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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 security considerations. It mentions 'detailed error handling and output capture' which implies some context, but offers no explicit when/when-not instructions or named alternatives.

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. 1 tool updatev1.0.0
    • First observedshell_exec

TDQS

B3.1/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool's purpose is clearly defined and distinct by default.

Naming Consistency5/5

A single tool inherently has perfect naming consistency, as there are no other tools to compare against. The name 'shell_exec' follows a clear verb_noun pattern.

Tool Count2/5

A single tool is generally too few for a server's purpose, as it limits functionality and may indicate an incomplete surface. However, for a simple shell execution server, it could be minimally viable but lacks breadth.

Completeness2/5

The tool provides basic shell command execution, but there are obvious gaps such as no tools for listing available commands, managing shell sessions, or handling file operations, making the surface severely incomplete for typical shell-related tasks.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers