Remote Command MCP Server

MIT License
  • Linux

Integrations

  • Enables execution of Chocolatey commands for Windows package management through the remote command interface

  • Provides ability to execute Git commands remotely with support for repository operations like status checks and working directory specification

  • Supports execution of Linux-specific commands with automatic command normalization between Windows and Unix-like systems

원격 명령 MCP 서버

다양한 운영 체제에서 원격 명령 실행을 지원하는 모델 컨텍스트 프로토콜(MCP) 서버입니다. 이 서버는 셸 명령을 실행하기 위한 통합 인터페이스를 제공하여 Windows와 Unix 계열 시스템 간의 플랫폼별 차이점을 자동으로 처리합니다.

특징

  • 크로스 플랫폼 명령 실행
  • Windows와 Unix 간 자동 명령 정규화
  • 내장된 오류 처리 및 출력 스트리밍
  • 작업 디렉토리 사양 지원
  • 플랫폼별 셸 선택

설치

  1. 저장소를 복제합니다.

지엑스피1

  1. 종속성 설치:
npm install
  1. 서버를 빌드하세요:
npm run build
  1. 설정 파일에서 MCP 서버를 구성하세요.

VSCode Cline 확장 프로그램( cline_mcp_settings.json )의 경우:

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

용법

서버는 호스트 머신에서 모든 유효한 셸 명령을 실행할 수 있는 execute_remote_command 라는 단일 도구를 제공합니다. 여기에는 다음이 포함됩니다.

  • 시스템 명령
  • 패키지 관리자 명령어(apt, yum, chocolatey 등)
  • 개발 도구(git, npm, python 등)
  • 파일 작업
  • 네트워크 명령
  • 서비스 관리
  • 그리고 시스템에서 사용 가능한 다른 CLI 명령

도구: execute_remote_command

매개변수:

  • command (필수): 호스트 OS에서 실행할 수 있는 유효한 셸 명령
  • cwd (선택 사항): 명령 실행을 위한 작업 디렉토리

예시

  1. 시스템 정보:
<use_mcp_tool> <server_name>remote-command</server_name> <tool_name>execute_remote_command</tool_name> <arguments> { "command": "systeminfo" // Windows // or "uname -a" // Linux } </arguments> </use_mcp_tool>
  1. 패키지 관리:
<use_mcp_tool> <server_name>remote-command</server_name> <tool_name>execute_remote_command</tool_name> <arguments> { "command": "npm list -g --depth=0" // List global NPM packages } </arguments> </use_mcp_tool>
  1. 네트워크 운영:
<use_mcp_tool> <server_name>remote-command</server_name> <tool_name>execute_remote_command</tool_name> <arguments> { "command": "netstat -an" // Show all network connections } </arguments> </use_mcp_tool>
  1. Git 작업:
<use_mcp_tool> <server_name>remote-command</server_name> <tool_name>execute_remote_command</tool_name> <arguments> { "command": "git status", "cwd": "/path/to/repo" } </arguments> </use_mcp_tool>
  1. 파일 작업:
<use_mcp_tool> <server_name>remote-command</server_name> <tool_name>execute_remote_command</tool_name> <arguments> { "command": "ls -la", // List files with details "cwd": "/path/to/directory" } </arguments> </use_mcp_tool>
  1. 프로세스 관리:
<use_mcp_tool> <server_name>remote-command</server_name> <tool_name>execute_remote_command</tool_name> <arguments> { "command": "ps aux" // List all running processes (Unix) // or "tasklist" // Windows equivalent } </arguments> </use_mcp_tool>
  1. 서비스 제어:
<use_mcp_tool> <server_name>remote-command</server_name> <tool_name>execute_remote_command</tool_name> <arguments> { "command": "systemctl status nginx" // Check service status (Linux) // or "sc query nginx" // Windows equivalent } </arguments> </use_mcp_tool>

보안 고려 사항

이 서버는 모든 시스템 명령을 실행할 수 있으므로 다음 보안 관행을 고려해 주시기 바랍니다.

  1. 액세스 제어 : MCP 서버에 대한 액세스를 신뢰할 수 있는 사용자에게만 제한합니다.
  2. 명령 검증 : 애플리케이션 로직에서 실행하기 전에 명령을 검증합니다.
  3. 작업 디렉토리 : cwd 매개변수를 사용하여 명령 실행을 특정 디렉토리로 제한합니다.
  4. 환경 : 시스템 설정이나 중요한 파일을 수정하는 명령에는 주의하세요.
  5. 권한 : 적절한 사용자 권한으로 MCP 서버를 실행합니다.

크로스 플랫폼 명령 처리

서버는 플랫폼별 차이점을 자동으로 처리합니다.

  1. 명령어 번역:
    • lsdir (플랫폼에 따라 자동 변환)
    • 각 플랫폼에 적합한 파이프 연산자 형식
  2. 쉘 선택:
    • Windows: cmd.exe 사용
    • Unix/Linux: /bin/sh 사용

오류 처리

서버는 자세한 오류 메시지를 제공하고 응답에 stdout과 stderr를 모두 포함합니다. 명령이 실패하면 오류 원인에 대한 자세한 정보가 포함된 오류 메시지를 받게 됩니다.

오류 응답 예:

{ "content": [ { "type": "text", "text": "Command execution error: Command failed with exit code 1" } ], "isError": true }

개발

프로젝트 구조

remote-command-server/ ├── src/ │ └── index.ts # Main server implementation ├── package.json ├── tsconfig.json └── README.md

건물

npm run build

이렇게 하면 TypeScript 코드가 컴파일되고 build 디렉토리에 실행 파일이 생성됩니다.

기여하다

  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 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

-
security - not tested
A
license - permissive license
-
quality - not tested

다양한 운영체제에서 셸 명령을 원격으로 실행할 수 있는 모델 컨텍스트 프로토콜 서버로, Windows와 Unix 계열 시스템 간의 플랫폼별 차이점을 자동으로 처리합니다.

  1. Features
    1. Installation
      1. Usage
        1. Tool: execute_remote_command
        2. Examples
        3. Security Considerations
        4. Cross-Platform Command Handling
        5. Error Handling
      2. Development
        1. Project Structure
        2. Building
      3. Contributing
        1. License
          ID: mshw9wfbs6