Skip to main content
Glama
simon-ami

Windows CLI MCP Server

Windows CLI MCP 서버

NPM 다운로드 NPM 버전 대장간 배지

Windows 시스템에서 안전한 명령줄 상호작용을 위한 MCP 서버로 , SSH를 통해 PowerShell, CMD, Git Bash 셸 및 원격 시스템에 대한 제어된 액세스를 지원합니다. MCP 클라이언트(예: Claude Desktop )가 Open Interpreter 와 유사하게 시스템에서 작업을 수행할 수 있도록 지원합니다.

[!중요] 이 MCP 서버는 SSH를 통해 시스템의 명령줄 인터페이스와 원격 시스템에 직접 액세스할 수 있도록 합니다. 활성화하면 파일, 환경 변수, 명령 실행 기능 및 원격 서버 관리에 액세스할 수 있습니다.

  • 허용된 경로 및 SSH 연결을 검토하고 제한합니다.

  • 디렉토리 제한 활성화

  • 명령 블록 구성

  • 보안 영향을 고려하세요

자세한 내용은 구성을 참조하세요.

특징

  • 멀티 셸 지원 : PowerShell, 명령 프롬프트(CMD), Git Bash에서 명령 실행

  • SSH 지원 : SSH를 통해 원격 시스템에서 명령 실행

  • 리소스 노출 : SSH 연결, 현재 디렉토리 및 구성을 MCP 리소스로 보기

  • 보안 제어 :

    • 명령어 및 SSH 명령어 차단(전체 경로, 대소문자 변형)

    • 작업 디렉토리 검증

    • 최대 명령 길이 제한

    • 명령 로깅 및 기록 추적

    • 스마트한 인수 검증

  • 구성 가능 :

    • 사용자 정의 보안 규칙

    • 셸별 설정

    • SSH 연결 프로필

    • 경로 제한

    • 차단된 명령 목록

MCP 클라이언트에 서버가 제공하는 도구와 리소스에 대한 자세한 내용은 API 섹션을 참조하세요.

참고 : 서버는 구성된 디렉토리 내에서 허용된 명령을 사용하고 구성된 SSH 연결을 통해서만 작업을 허용합니다.

Related MCP server: Calculator MCP Server

Claude Desktop과 함께 사용

claude_desktop_config.json 에 다음을 추가하세요:

지엑스피1

특정 구성 파일과 함께 사용하려면 --config 플래그를 추가하세요.

{
  "mcpServers": {
    "windows-cli": {
      "command": "npx",
      "args": [
        "-y",
        "@simonb97/server-win-cli",
        "--config",
        "path/to/your/config.json"
      ]
    }
  }
}

구성 후 다음을 수행할 수 있습니다.

  • 사용 가능한 도구를 사용하여 명령을 직접 실행합니다.

  • 리소스 섹션에서 구성된 SSH 연결 및 서버 구성을 확인하세요.

  • 제공된 도구를 통해 SSH 연결을 관리합니다.

구성

서버는 JSON 구성 파일을 사용하여 동작을 사용자 지정합니다. 보안 제어, 셸 구성 및 SSH 연결에 대한 설정을 지정할 수 있습니다.

  1. 기본 구성 파일을 만들려면 다음 중 하나를 수행하세요.

a) config.json.example config.json 에 복사하거나

b) 실행:

npx @simonb97/server-win-cli --init-config ./config.json
  1. 그런 다음 Claude Desktop 사용 섹션에 설명된 대로 --config 플래그를 설정하여 구성 파일을 가리키도록 합니다.

구성 위치

서버는 다음 위치에서 구성을 찾습니다(순서대로).

  1. --config 플래그로 지정된 경로

  2. 현재 디렉토리의 ./config.json

  3. 사용자 홈 디렉토리의 ~/.win-cli-mcp/config.json

구성 파일을 찾을 수 없는 경우 서버는 기본(제한된) 구성을 사용합니다.

기본 구성

참고 : 기본 구성은 제한적이고 안전하게 설계되었습니다. 각 설정에 대한 자세한 내용은 구성 설정 섹션에서 확인하세요.

{
  "security": {
    "maxCommandLength": 2000,
    "blockedCommands": [
      "rm",
      "del",
      "rmdir",
      "format",
      "shutdown",
      "restart",
      "reg",
      "regedit",
      "net",
      "netsh",
      "takeown",
      "icacls"
    ],
    "blockedArguments": [
      "--exec",
      "-e",
      "/c",
      "-enc",
      "-encodedcommand",
      "-command",
      "--interactive",
      "-i",
      "--login",
      "--system"
    ],
    "allowedPaths": ["User's home directory", "Current working directory"],
    "restrictWorkingDirectory": true,
    "logCommands": true,
    "maxHistorySize": 1000,
    "commandTimeout": 30,
    "enableInjectionProtection": true
  },
  "shells": {
    "powershell": {
      "enabled": true,
      "command": "powershell.exe",
      "args": ["-NoProfile", "-NonInteractive", "-Command"],
      "blockedOperators": ["&", "|", ";", "`"]
    },
    "cmd": {
      "enabled": true,
      "command": "cmd.exe",
      "args": ["/c"],
      "blockedOperators": ["&", "|", ";", "`"]
    },
    "gitbash": {
      "enabled": true,
      "command": "C:\\Program Files\\Git\\bin\\bash.exe",
      "args": ["-c"],
      "blockedOperators": ["&", "|", ";", "`"]
    }
  },
  "ssh": {
    "enabled": false,
    "defaultTimeout": 30,
    "maxConcurrentSessions": 5,
    "keepaliveInterval": 10000,
    "keepaliveCountMax": 3,
    "readyTimeout": 20000,
    "connections": {}
  }
}

구성 설정

구성 파일은 security , shells , ssh 세 가지 주요 섹션으로 나뉩니다.

보안 설정

{
  "security": {
    // Maximum allowed length for any command
    "maxCommandLength": 1000,

    // Commands to block - blocks both direct use and full paths
    // Example: "rm" blocks both "rm" and "C:\\Windows\\System32\\rm.exe"
    // Case-insensitive: "del" blocks "DEL.EXE", "del.cmd", etc.
    "blockedCommands": [
      "rm", // Delete files
      "del", // Delete files
      "rmdir", // Delete directories
      "format", // Format disks
      "shutdown", // Shutdown system
      "restart", // Restart system
      "reg", // Registry editor
      "regedit", // Registry editor
      "net", // Network commands
      "netsh", // Network commands
      "takeown", // Take ownership of files
      "icacls" // Change file permissions
    ],

    // Arguments that will be blocked when used with any command
    // Note: Checks each argument independently - "cd warm_dir" won't be blocked just because "rm" is in blockedCommands
    "blockedArguments": [
      "--exec", // Execution flags
      "-e", // Short execution flags
      "/c", // Command execution in some shells
      "-enc", // PowerShell encoded commands
      "-encodedcommand", // PowerShell encoded commands
      "-command", // Direct PowerShell command execution
      "--interactive", // Interactive mode which might bypass restrictions
      "-i", // Short form of interactive
      "--login", // Login shells might have different permissions
      "--system" // System level operations
    ],

    // List of directories where commands can be executed
    "allowedPaths": ["C:\\Users\\YourUsername", "C:\\Projects"],

    // If true, commands can only run in allowedPaths
    "restrictWorkingDirectory": true,

    // If true, saves command history
    "logCommands": true,

    // Maximum number of commands to keep in history
    "maxHistorySize": 1000,

    // Timeout for command execution in seconds (default: 30)
    "commandTimeout": 30,

    // Enable or disable protection against command injection (covers ;, &, |, \`)
    "enableInjectionProtection": true
  }
}

셸 구성

{
  "shells": {
    "powershell": {
      // Enable/disable this shell
      "enabled": true,
      // Path to shell executable
      "command": "powershell.exe",
      // Default arguments for the shell
      "args": ["-NoProfile", "-NonInteractive", "-Command"],
      // Optional: Specify which command operators to block
      "blockedOperators": ["&", "|", ";", "`"]  // Block all command chaining
    },
    "cmd": {
      "enabled": true,
      "command": "cmd.exe",
      "args": ["/c"],
      "blockedOperators": ["&", "|", ";", "`"]  // Block all command chaining
    },
    "gitbash": {
      "enabled": true,
      "command": "C:\\Program Files\\Git\\bin\\bash.exe",
      "args": ["-c"],
      "blockedOperators": ["&", "|", ";", "`"]  // Block all command chaining
    }
  }
}

SSH 구성

{
  "ssh": {
    // Enable/disable SSH functionality
    "enabled": false,

    // Default timeout for SSH commands in seconds
    "defaultTimeout": 30,

    // Maximum number of concurrent SSH sessions
    "maxConcurrentSessions": 5,

    // Interval for sending keepalive packets (in milliseconds)
    "keepaliveInterval": 10000,

    // Maximum number of failed keepalive attempts before disconnecting
    "keepaliveCountMax": 3,

    // Timeout for establishing SSH connections (in milliseconds)
    "readyTimeout": 20000,

    // SSH connection profiles
    "connections": {
      // NOTE: these examples are not set in the default config!
      // Example: Local Raspberry Pi
      "raspberry-pi": {
        "host": "raspberrypi.local", // Hostname or IP address
        "port": 22, // SSH port
        "username": "pi", // SSH username
        "password": "raspberry", // Password authentication (if not using key)
        "keepaliveInterval": 10000, // Override global keepaliveInterval
        "keepaliveCountMax": 3, // Override global keepaliveCountMax
        "readyTimeout": 20000 // Override global readyTimeout
      },
      // Example: Remote server with key authentication
      "dev-server": {
        "host": "dev.example.com",
        "port": 22,
        "username": "admin",
        "privateKeyPath": "C:\\Users\\YourUsername\\.ssh\\id_rsa", // Path to private key
        "keepaliveInterval": 10000,
        "keepaliveCountMax": 3,
        "readyTimeout": 20000
      }
    }
  }
}

API

도구

  • 실행 명령

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

    • 입력:

      • shell (문자열): 사용할 셸("powershell", "cmd" 또는 "gitbash")

      • command (문자열): 실행할 명령

      • workingDir (선택적 문자열): 작업 디렉토리

    • 실행에 실패하면 명령 출력을 텍스트로 반환하거나 오류 메시지를 반환합니다.

  • 명령 기록 가져오기

    • 실행된 명령의 기록을 가져옵니다

    • 입력: limit (선택적 숫자)

    • 출력과 함께 타임스탬프가 지정된 명령 기록을 반환합니다.

  • ssh_execute

    • SSH를 통해 원격 시스템에서 명령 실행

    • 입력:

      • connectionId (문자열): 사용할 SSH 연결의 ID

      • command (문자열): 실행할 명령

    • 실행에 실패하면 명령 출력을 텍스트로 반환하거나 오류 메시지를 반환합니다.

  • ssh_disconnect

    • SSH 서버에서 연결 해제

    • 입력:

      • connectionId (문자열): 연결을 끊을 SSH 연결의 ID

    • 확인 메시지를 반환합니다.

  • ssh_연결 생성

    • 새로운 SSH 연결을 만듭니다

    • 입력:

      • connectionId (문자열): 새 SSH 연결에 대한 ID

      • connectionConfig (객체): 호스트, 포트, 사용자 이름, 비밀번호 또는 privateKeyPath를 포함한 연결 구성 세부 정보

    • 확인 메시지를 반환합니다.

  • ssh_연결 읽기

    • 구성된 모든 SSH 연결을 읽습니다.

    • 구성에서 모든 SSH 연결 목록을 반환합니다.

  • 업데이트_ssh_연결

    • 기존 SSH 연결 업데이트

    • 입력:

      • connectionId (문자열): 업데이트할 SSH 연결의 ID

      • connectionConfig (객체): 새로운 연결 구성 세부 정보

    • 확인 메시지를 반환합니다.

  • ssh_연결 삭제

    • SSH 연결 삭제

    • 입력:

      • connectionId (문자열): 삭제할 SSH 연결의 ID

    • 확인 메시지를 반환합니다.

  • get_current_directory

    • 서버의 현재 작업 디렉토리를 가져옵니다

    • 현재 작업 디렉토리 경로를 반환합니다.

자원

  • SSH 연결

    • URI 형식: ssh://{connectionId}

    • 민감한 정보가 가려진 연결 세부 정보가 포함되어 있습니다.

    • 구성된 각 SSH 연결에 대한 하나의 리소스

    • 예: ssh://raspberry-pi "raspberry-pi" 연결에 대한 구성을 보여줍니다.

  • SSH 구성

    • URI: ssh://config

    • 전체 SSH 구성 및 모든 연결(암호는 마스크됨)이 포함되어 있습니다.

    • defaultTimeout, maxConcurrentSessions 및 연결 목록과 같은 설정을 표시합니다.

  • 현재 디렉토리

    • URI: cli://currentdir

    • CLI 서버의 현재 작업 디렉토리를 포함합니다.

    • 기본적으로 명령이 실행되는 경로를 표시합니다.

  • CLI 구성

    • URI: cli://config

    • CLI 서버 구성(민감한 데이터 제외)이 포함되어 있습니다.

    • 보안 설정, 셸 구성 및 SSH 설정을 표시합니다.

보안 고려 사항

내장 보안 기능(항상 활성화)

다음 보안 기능은 서버에 하드코딩되어 있어 비활성화할 수 없습니다.

  • 대소문자 구분 없이 명령 차단 : 모든 명령 차단은 대소문자를 구분하지 않습니다(예: "del"이 blockedCommands에 있으면 "DEL.EXE", "del.cmd" 등이 모두 차단됨)

  • 스마트 경로 구문 분석 : 서버는 우회 시도를 방지하기 위해 전체 명령 경로를 구문 분석합니다("rm"이 차단된 경우 "C:\Windows\System32\rm.exe" 차단).

  • 명령어 구문 분석 인텔리전스 : 거짓 양성 반응이 방지됩니다(예: "rm"이 blockedCommands에 있다는 이유만으로 "warm_dir"이 차단되지 않음)

  • 입력 검증 : 모든 사용자 입력은 실행 전에 검증됩니다.

  • Shell 프로세스 관리 : 실행 또는 시간 초과 후 프로세스가 정상적으로 종료됩니다.

  • 민감한 데이터 마스킹 : 비밀번호는 리소스에서 자동으로 마스킹됩니다(********로 대체됨)

구성 가능한 보안 기능(기본적으로 활성화됨)

이러한 보안 기능은 config.json 파일을 통해 구성할 수 있습니다.

  • 명령 차단 : blockedCommands 배열에 지정된 명령이 차단됩니다(기본값에는 rm, del, format과 같은 위험한 명령이 포함됩니다)

  • 인수 차단 : blockedArguments 배열에 지정된 인수가 차단됩니다(기본값에는 잠재적으로 위험한 플래그가 포함됨)

  • 명령 주입 보호 : 명령 체이닝을 방지합니다(기본적으로 enableInjectionProtection: true 통해 활성화됨)

  • 작업 디렉토리 제한 : 명령 실행을 지정된 디렉토리로 제한합니다(기본적으로 restrictWorkingDirectory: true 를 통해 활성화됨)

  • 명령 길이 제한 : 최대 명령 길이를 제한합니다(기본값: 2000자)

  • 명령 시간 초과 : 너무 오래 실행되는 명령을 종료합니다(기본값: 30초)

  • 명령 로깅 : 명령 기록을 기록합니다(기본적으로 logCommands: true 를 통해 활성화됨)

중요 보안 경고

이는 기능이 아니지만 알아두어야 할 중요한 보안 고려 사항입니다.

  • 환경 액세스 : 명령은 민감한 정보를 포함할 수 있는 환경 변수에 액세스할 수 있습니다.

  • 파일 시스템 액세스 : 명령은 허용된 경로 내에서 파일을 읽고 쓸 수 있습니다. 민감한 데이터에 대한 액세스를 방지하려면 allowedPaths 신중하게 구성하세요.

특허

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/simon-ami/win-cli-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server