Skip to main content
Glama
RinardNick

MCP Terminal Server

by RinardNick

MCP 터미널 서버

모델 컨텍스트 프로토콜(MCP)을 구현하는 보안 터미널 실행 서버입니다. 이 서버는 보안 기능 및 리소스 제한을 갖춘 제어된 명령 실행 기능을 제공합니다.

특징

  • 명령 실행 : 출력 캡처 및 오류 처리를 통해 셸 명령을 실행합니다.

  • 보안 제어 : 허용된 명령을 제한하고 명령 주입을 방지합니다.

  • 리소스 제어 :

    • 명령 시간 초과

    • 최대 출력 크기 제한

  • MCP 프로토콜 지원 :

    • 표준 MCP 메시지 형식

    • 역량 광고

    • 스트리밍 출력 지원

Related MCP server: MCP Terminal

개발

로컬 설정

지엑스피1

PyPI에 게시

# Build the package
uv pip install build
python -m build

# Upload to PyPI
uv pip install twine
python -m twine upload dist/*

MCP Inspector로 테스트

MCP Inspector 도구를 사용하면 서버 구현을 테스트할 수 있습니다.

# Install inspector
npm install -g @modelcontextprotocol/inspector

# Test server
npx @modelcontextprotocol/inspector python3 src/mcp_terminal/server.py --allowed-commands "python,pip,git,ls,cd"

테스트 실행

# Run all tests
pytest tests/

# Run specific test file
pytest tests/test_terminal.py

# Run with coverage
pytest --cov=mcp_terminal tests/

Claude Desktop과 함께 사용

패키지가 PyPI에 게시되면:

  1. UV를 설치하세요 (아직 설치되지 않았다면):

    pip install uv
  2. UV를 사용하여 패키지 설치 :

    uv pip install mcp-terminal
  3. Claude Desktop 구성 : Claude Desktop 구성 파일을 편집합니다(일반적으로 macOS에서는 ~/Library/Application Support/Claude/claude_desktop_config.json 에 있음):

    {
      "mcpServers": {
        "terminal": {
          "command": "uv",
          "args": [
            "pip",
            "run",
            "mcp-terminal",
            "--allowed-commands",
            "python,pip,git,ls,cd",
            "--timeout-ms",
            "30000",
            "--max-output-size",
            "1048576"
          ]
        }
      }
    }

프로토콜 구현

서버는 다음 기능을 갖춘 MCP(모델 컨텍스트 프로토콜)를 구현합니다.

기능 광고

{
  "protocol": "1.0.0",
  "name": "terminal",
  "version": "1.1.0",
  "capabilities": {
    "execute": {
      "description": "Execute a terminal command",
      "parameters": {
        "command": {
          "type": "string",
          "description": "The command to execute"
        }
      },
      "returns": {
        "type": "object",
        "properties": {
          "exitCode": { "type": "number" },
          "stdout": { "type": "string" },
          "stderr": { "type": "string" },
          "startTime": { "type": "string" },
          "endTime": { "type": "string" }
        }
      }
    }
  }
}

메시지 형식

요구 :

{
  "type": "execute",
  "data": {
    "command": "echo 'hello world'"
  }
}

응답 :

{
  "type": "result",
  "data": {
    "command": "echo 'hello world'",
    "exitCode": 0,
    "stdout": "hello world\n",
    "stderr": "",
    "startTime": "2024-01-20T12:34:56.789Z",
    "endTime": "2024-01-20T12:34:56.790Z"
  }
}

오류 :

{
  "type": "error",
  "data": {
    "message": "command not allowed"
  }
}

보안 고려 사항

  1. 명령 검증 :

    • 허용된 명령만 실행할 수 있습니다.

    • Shell 운영자는 차단되었습니다.

    • 명령 주입 시도가 방지됩니다.

  2. 자원 보호 :

    • 명령 시간 초과로 인해 중단이 방지됩니다.

    • 출력 크기 제한으로 메모리 고갈 방지

    • 모든 실패 사례에 대한 오류 처리

  3. 모범 사례 :

    • 프로덕션에서는 항상 allowed-commands 설정하세요.

    • 보수적인 시간 제한 및 크기 제한을 사용하세요

    • 명령 실행 로그 모니터링

기여하다

  1. 저장소를 포크하세요

  2. 기능 브랜치를 생성합니다( git checkout -b feature/amazing-feature )

  3. 변경 사항을 커밋하세요( git commit -m 'Add some amazing feature' )

  4. 브랜치에 푸시( git push origin feature/amazing-feature )

  5. 풀 리퀘스트 열기

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

Available Tools

1 tool
run_commandC

Run a terminal command with security controls.

ParametersJSON Schema
NameRequiredDescriptionDefault
allowedCommandsNoOptional list of allowed command executables
commandYesThe command to execute
maxOutputSizeNoMaximum output size in bytes (default: 1MB)
timeoutMsNoMaximum execution time in milliseconds (default: 30 seconds)

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. While it mentions 'security controls' which suggests safety features, it doesn't specify what those controls are, what permissions are required, whether commands run in a sandbox, what happens on failure, or any rate limits. The description provides minimal behavioral context beyond the basic purpose.

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 extremely concise - a single sentence that communicates the core purpose and a key characteristic ('with security controls'). Every word earns its place, and there's no unnecessary verbiage or repetition. It's front-loaded with the essential information.

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?

For a command execution tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (success/failure indicators, output format, error handling), doesn't detail the security controls mentioned, and provides minimal behavioral context. Given the potential complexity and risks of command execution, more completeness 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?

The schema has 100% description coverage, so all parameters are documented in the structured schema. The description adds no additional parameter information beyond what's already in the schema descriptions. The baseline score of 3 is appropriate when the schema does the heavy lifting for parameter documentation.

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 verb ('Run') and resource ('a terminal command'), specifying it's for executing commands in a terminal environment. It adds the qualifier 'with security controls' which provides important context about the tool's nature. However, without sibling tools, it cannot demonstrate differentiation from alternatives.

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 other approaches or alternatives. It doesn't mention prerequisites, typical use cases, or scenarios where this tool would be preferred over direct terminal access or other execution methods. The 'security controls' mention hints at a context but doesn't provide explicit usage rules.

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 observedrun_command

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 as running terminal commands with security controls, making it distinct by default.

Naming Consistency5/5

The single tool follows a clear verb_noun pattern (run_command), which is consistent and predictable. Since there are no other tools to compare against, it inherently maintains perfect naming consistency.

Tool Count2/5

A single tool for a terminal server is too few for the apparent scope, as terminal operations typically involve multiple actions (e.g., list files, navigate directories, monitor processes). This minimal set feels thin and incomplete for the domain.

Completeness2/5

The tool surface is severely incomplete for a terminal server domain. While run_command covers command execution, there are obvious gaps such as listing files, checking system status, or managing processes, which will likely cause agent failures in typical terminal workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    A 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.
    1
    198
    MIT
  • A
    license
    C
    quality
    C
    maintenance
    A server that enables AI assistants to execute terminal commands and retrieve outputs via the Model Context Protocol (MCP).
    3
    26
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    A secure Model Context Protocol server that allows AI assistants to execute terminal commands with controlled directory access and command permissions. It features a robust security architecture including whitelisting, session IDs, and categorized command levels to ensure safe system interaction.
    8
    MIT