Skip to main content
Glama
marttinm

windows-terminal-mcp

by marttinm

windows-terminal-mcp

모든 LLM이 Windows 터미널에서 명령을 실행할 수 있게 해주는 MCP (Model Context Protocol) 서버입니다(로컬 셸 및 원격 SSH 연결 포함).

기능

  • cmd, powershell 또는 bash(Git Bash)를 통해 명령 실행

  • 키 기반 인증을 사용하여 SSH를 통해 원격 명령 실행

  • 3단계 보안 모델 (안전 / 확인 / 차단)

  • 명령별 타임아웃 설정 가능

  • Claude Desktop 및 모든 MCP 호환 클라이언트와 작동

Related MCP server: Windows CLI MCP Server

설치

git clone https://github.com/marttinm/windows-terminal-mcp.git
cd windows-terminal-mcp
pip install -e .

Windows에서 Python 3.11+가 필요합니다.

구성

Claude Desktop 구성 파일(%APPDATA%\Claude\claude_desktop_config.json)에 서버를 추가하세요:

{
  "mcpServers": {
    "windows-terminal": {
      "command": "cmd",
      "args": ["/c", "python", "-m", "windows_terminal_mcp.server"]
    }
  }
}

또는 스크립트를 직접 지정하세요:

{
  "mcpServers": {
    "windows-terminal": {
      "command": "cmd",
      "args": ["/c", "python", "C:/path/to/windows-terminal-mcp/src/windows_terminal_mcp/server.py"]
    }
  }
}

도구: execute_command

매개변수

매개변수

유형

기본값

설명

command

string

필수

실행할 명령. SSH의 경우: user@host command

shell

string

cmd

셸: cmd, powershell, bash, ssh

working_dir

string

—

작업 디렉터리 (로컬 명령만 해당)

timeout_ms

integer

120000

밀리초 단위 타임아웃

ssh_key

string

—

SSH 개인 키 경로 (예: ~/.ssh/id_rsa)

응답

{
  "stdout": "...",
  "stderr": "...",
  "exit_code": 0,
  "execution_time": 0.42
}

사용 예시

로컬 명령

Run: dir C:\Users
Shell: cmd

Run: Get-Process | Select-Object -First 5
Shell: powershell

Run: git status
Shell: bash

SSH 명령

Run: ubuntu@192.168.1.10 "df -h && uptime"
Shell: ssh
SSH key: ~/.ssh/id_rsa
Run: ubuntu@192.168.1.10 "docker ps"
Shell: ssh
SSH key: ~/.ssh/my_key
Timeout: 30000

보안

명령은 세 가지 수준으로 분류됩니다:

안전(Safe) — 직접 실행됨 echo, dir, type, git, npm, node, python, pip, curl 및 대부분의 읽기 전용 명령.

위험(Dangerous) — Claude가 실행 전 경고함 del, rmdir, rm, taskkill, net stop, net start, sc delete, reg add 등.

차단(Blocked) — 항상 거부됨 format, del /s /q, rd /s /q, reg delete, regedit, shutdown, net user, rm -rf, mkfs, fdisk 및 이와 유사한 파괴적인 작업.

개발

프로젝트 구조

windows-terminal-mcp/
├── src/windows_terminal_mcp/
│   ├── __init__.py
│   ├── server.py      # MCP server (main entry point)
│   ├── executor.py    # subprocess execution
│   ├── main.py        # simple stdin/stdout handler
│   └── security.py    # command safety checks
├── tests/
│   └── test_windows_terminal_mcp.py
├── pyproject.toml
├── LICENSE
└── README.md

테스트 실행

pip install pytest
pytest tests/ -v

Python 모듈로 사용

from windows_terminal_mcp.server import execute_command

result = execute_command("echo hello", shell="cmd")
print(result)
# {'stdout': 'hello\n', 'stderr': '', 'exit_code': 0, 'execution_time': 0.02}

result = execute_command(
    "ubuntu@192.168.1.10 uptime",
    shell="ssh",
    ssh_key="~/.ssh/id_rsa",
    timeout_ms=10000,
)
print(result)

변경 로그

v0.2.0

  • 키 기반 인증을 통한 SSH 지원 추가

  • SSH 명령 구성 수정 (호스트와 원격 명령을 별도의 인수로 전달)

  • Windows에서 SSH 키 경로의 ~ 확장 문제 수정

  • MCP 서버 프로세스 내에서 SSH가 중단되는 원인이었던 stdin 상속 문제 수정

v0.1.0

  • cmd, powershell, bash를 통한 기본 명령 실행

  • stdout/stderr/exit_code 캡처

  • 3단계 보안 모델

  • 단위 테스트

라이선스

MIT — LICENSE 참조

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    F
    maintenance
    A Model Context Protocol server that provides secure command-line access to Windows systems, allowing MCP clients like Claude Desktop to safely execute commands in PowerShell, CMD, and Git Bash shells with configurable security controls.
    9
    959 npm
    268
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    A local Model Context Protocol server that allows LLMs to securely execute shell commands on remote Linux and Windows systems via SSH connections.
    6
    6 npm
    2
    -
  • A
    license
    B
    quality
    A
    maintenance
    A secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.
    13
    264 npm
    6
    MIT