Skip to main content
Glama

Remote Demo MCP

rsync를 사용하여 미리 빌드된 정적 디렉토리를 원격 호스트에 배포하는 로컬 MCP 서버입니다.

기능

  • MCP 설정의 고정된 deployUser 사용

  • localDir의 기본 이름에서 project 추출

  • localDir 콘텐츠를 다음 경로로 업로드:

    • /var/www/html/demo-remote/{user}/{project}/

  • 로컬 rsync 명령 사용

  • rsync 세션을 /dev/tty에 연결하여 OTP/대화형 SSH 흐름 지원

  • 실패 시 사용자가 취소할 때까지 재시도 여부 확인

Related MCP server: nomad

설치

npm install
npm run build

설정

기본 설정 경로:

  • ~/.config/remote-demo-mcp/config.json

경로 재정의:

  • REMOTE_DEMO_MCP_CONFIG=/abs/path/config.json

예시:

{
  "deployUser": "demo_user-01",
  "publicBaseUrl": "https://example.com",
  "sessionLog": {
    "enabled": false,
    "path": "/tmp/remote-demo-mcp-session.log",
    "logInputValue": false
  },
  "ssh": {
    "host": "xxx.xxx.xxx.xxx",
    "port": 2222,
    "username": "alice123#ec2-user#52.76.147.44",
    "interactiveAuth": true,
    "password": "",
    "hostKeyPolicy": "accept-new",
    "autoFillPassword": true
  },
  "rsyncOptions": ["-az", "--delete"]
}

서버는 다음 옵션을 추가하여 재개 가능한 업로드를 자동으로 활성화합니다:

  • --partial

  • --checksum

  • --progress (rsyncOptions에 이미 --progress 또는 --info=...가 포함된 경우는 제외)

호환성 참고:

  • 대화형 세션 모드는 node-pty를 사용합니다. macOS/Linux에서 posix_spawnp failed 오류가 발생하면, 이는 종종 실행 불가능한 node-pty 헬퍼(.../node-pty/prebuilds/*/spawn-helper) 때문입니다. 이 서버는 이제 세션 시작 시 헬퍼 실행 권한을 확인하고 자동으로 수정합니다.

원격 대상 기본 경로는 하드코딩되어 있으며 재정의할 수 없습니다:

  • /var/www/html/demo-remote

도구

deploy_static

키워드:

  • EN: deploy to remote, deploy demo, publish demo, upload static site

  • 中文: 部署到远程, 部署demo, 部署 demo, 发布demo, 上传静态网页

user 규칙:

  • deployUser는 SSH username이 아닌 원격 경로에 대한 앱 사용자 ID입니다.

  • 허용된 문자: A-Z a-z 0-9 _ -

  • 허용되지 않는 문자: ., .., 공백, /, \ 및 기타 특수 문자

입력:

{
  "localDir": "/abs/path/to/dist",
  "clientCwd": "/abs/path/on-mcp-client",
  "dryRun": false
}

localDir 경로 확인:

  • 절대 경로: 그대로 사용

  • 상대 경로: 제공된 경우 clientCwd를 기준으로 확인

  • 상대 경로 대체: 설정된 경우 CODEX_START_DIR, 그렇지 않으면 process.cwd() (서버 시작 디렉토리)

프로젝트 이름 확인:

  • clientCwd가 제공되면 프로젝트 이름은 clientCwd의 마지막 경로 세그먼트를 사용합니다.

  • 그렇지 않으면 프로젝트 이름은 확인된 localDir의 마지막 경로 세그먼트를 사용합니다.

동작 참고:

  • ssh.interactiveAuth=true이고 dryRun=false인 경우, deploy_static은 설계상 즉시 실패합니다.

  • OTP/비밀번호 대화형 배포의 경우 다음을 사용하세요:

    1. start_deploy_session

    2. poll_deploy_session

    3. nextAction=submit_input일 때 submit_deploy_input 호출

  • 호스트 키 확인(yes/no) 및 비밀번호 프롬프트는 세션 모드에서 자동으로 처리됩니다.

  • OTP는 여전히 수동입니다: nextAction=submit_input일 때 submit_deploy_input을 호출하세요.

출력 (structuredContent):

{
  "ok": true,
  "attempts": 1,
  "user": "alice",
  "project": "my-site",
  "remotePath": "/var/www/html/demo-remote/alice/my-site/",
  "publicUrl": "https://example.com/alice/my-site/index.html",
  "message": "Deploy succeeded after 1 attempt(s)."
}

verify_deploy

입력:

{
  "url": "https://example.com/alice/my-site/index.html",
  "timeoutMs": 8000
}

대화형 OTP 세션 도구

비 TTY 호스트에서 배포 중 OTP/비밀번호를 입력해야 할 때 다음을 사용하세요:

  1. start_deploy_session

  2. poll_deploy_session (출력 및 진행 상황 읽기; state=waiting_input이면 코드 제출)

  3. submit_deploy_input (OTP/비밀번호 전송)

  4. statesucceeded 또는 failed가 될 때까지 2단계 반복

  5. 선택 사항: cancel_deploy_session

poll_deploy_sessioncursor를 통한 증분 출력을 지원하며 nextCursor를 반환합니다.

세션 도구는 오케스트레이션을 결정론적으로 만들기 위해 nextAction을 반환합니다:

  • submit_input: submit_deploy_input 호출

  • poll: poll_deploy_session 호출

  • done: 워크플로우 완료 (succeeded / failed / cancelled)

세션 로깅:

  • MCP 설정 파일의 sessionLog 아래에서 구성합니다.

  • sessionLog.enabled 기본값은 false입니다.

  • sessionLog.path 기본값은 /tmp/remote-demo-mcp-session.log입니다.

  • sessionLog.logInputValue 기본값은 false입니다 (입력 길이만 기록).

  • 대화형 세션 도구는 PTY에서 rsync를 실행하므로 poll_deploy_session을 통해 비밀번호/OTP 프롬프트를 감지할 수 있습니다.

SSH 호스트 키 정책:

  • accept-new (기본값): 처음 접속하는 호스트 키는 자동으로 수락되며, 변경된 키는 거부됩니다.

  • strict: 알 수 없는 호스트 키를 절대 자동 수락하지 않습니다.

  • insecure: 호스트 키 유효성 검사를 비활성화합니다 (위험도가 높음; 임시/디버그 용도로만 사용).

Codex CLI 대화형 흐름:

  1. start_deploy_session 호출

  2. poll_deploy_session 루프

  3. needsInput=true 또는 nextAction=submit_input이면, OTP/비밀번호와 함께 submit_deploy_input을 호출합니다. 사용자에게 표시되는 팁은 "Please Enter MFA Code." 또는 "Please Enter Password."입니다.

  4. nextAction=done이 될 때까지 계속 폴링

에이전트 프로토콜 계약 (Codex와 같은 MCP 클라이언트용):

  1. start_deploy_session을 한 번 호출합니다.

  2. 응답에서 nextAction을 읽습니다.

  3. nextAction=submit_input이면 submit_deploy_input을 호출합니다.

  4. nextAction=poll이면 poll_deploy_session을 호출합니다.

  5. nextAction=done이 될 때까지 2-4단계를 반복합니다.

  6. OTP 흐름에 대해 deploy_static을 절대 호출하지 마세요. 세션 도구만 사용하세요.

  7. 폴링하는 동안 output의 전송 진행 상황을 최종 사용자에게 지속적으로 전달하세요.

출력 (structuredContent):

{
  "ok": true,
  "url": "https://example.com/alice/my-site/index.html",
  "status": 200,
  "statusText": "OK",
  "responseTimeMs": 123,
  "message": "URL is reachable: HTTP 200 in 123ms"
}

실행

npm run dev
# or
npm run build && npm start

설정 파일 초기화:

remote-demo-mcp init

다음이 생성됩니다:

  • ~/.config/remote-demo-mcp/config.json

  • 대화형 모드에서는 편집을 위해 각 현재 필드 값을 보여줍니다.

  • 입력 없이 Enter를 누르면 현재 값을 변경하지 않고 유지합니다.

  • 설정이 이미 존재하는 경우, init은 수정 여부를 묻고 덮어쓰기 전에 최종 확인을 요청합니다.

codex 사용

설치 npm 패키지

npm install -g    @jake.e-com365/remote-demo-mcp

codex mcp 추가

codex mcp add remote-demo-mcp remote-demo-mcp  

remote-demo-mcp 설정

remote-demo-mcp init
vi ~/.config/remote-demo-mcp/config.json
{
  "deployUser": "jake",
  "publicBaseUrl": "https://demo-remote.e-com365.com/",
  "ssh": {
    "host": "xxx.xxx.xxx.xxx",
    "username": "alice123#ec2-user#18.140.183.126",
    "interactiveAuth": true,
    "port": 2222,
    "password": "xxx",
    "hostKeyPolicy": "accept-new",
    "autoFillPassword": true
  },
  "rsyncOptions": ["-az", "--delete"]
}

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    A local MCP server for agentic remote development that enables code sync via rsync, SSH command execution, and long-running task management in remote tmux sessions.
    15
    2
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    SSH-based MCP server that enables remote execution of SSH commands, file transfers, and secure server management via the MCP protocol.
    ISC