npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@john050605/ssh-mcp-server-npx

v1.0.8

Published

SSH MCP Server

Readme

SSH MCP Server

채팅에서 PEM 키와 연결 정보를 받아 SSH 서버에 접속할 수 있는 MCP(Model Context Protocol) 서버입니다.

주요 기능

  • 📋 채팅에서 PEM 키 입력: 채팅 창에서 직접 PEM 키 내용을 복사/붙여넣기
  • 🔐 다양한 인증 방식: PEM 키, 비밀번호, 키 파일 경로 지원
  • 💾 연결 정보 저장: 자주 사용하는 SSH 연결 정보를 저장하고 재사용
  • 🚀 명령 실행: SSH를 통해 원격 서버에서 명령어 실행
  • 📁 파일 전송: SCP 또는 rsync를 사용한 파일 업로드/다운로드
  • 🧹 자동 정리: 임시 키 파일 자동 생성 및 정리

설치 및 실행

# 의존성 설치
npm install

# 빌드
npm run build

# 실행
npm start

사용 가능한 도구

1. SSH PEM 키로 연결 (ssh_connect_with_pem)

채팅에서 제공된 PEM 키를 사용하여 SSH 서버에 연결합니다.

필수 파라미터:

  • host: SSH 서버 주소
  • username: SSH 사용자명
  • pemKeyContent: PEM 키 내용 (-----BEGIN ... -----END 포함)

선택 파라미터:

  • port: SSH 포트 (기본값: 22)
  • connectionName: 연결에 이름을 지정하여 저장

사용 예시:

호스트: my-server.com
사용자: ubuntu
PEM 키:
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA...
-----END RSA PRIVATE KEY-----

2. SSH 비밀번호로 연결 (ssh_connect_with_password)

사용자명과 비밀번호를 사용하여 SSH 서버에 연결합니다.

필수 파라미터:

  • host: SSH 서버 주소
  • username: SSH 사용자명
  • password: SSH 비밀번호

3. SSH 명령 실행 (ssh_exec)

저장된 연결 또는 직접 제공된 연결 정보를 사용하여 SSH 명령을 실행합니다.

필수 파라미터:

  • command: 실행할 명령어

선택 파라미터 (저장된 연결 사용시):

  • connectionName: 저장된 연결 이름

선택 파라미터 (직접 연결시):

  • host, username, pemKeyContent 또는 password, port

4. 연결 정보 저장 (add_credential)

SSH 연결 정보를 저장하여 나중에 재사용할 수 있습니다.

5. 저장된 연결 목록 (list_credentials)

저장된 모든 SSH 연결 정보를 확인합니다.

6. 연결 삭제 (remove_credential)

저장된 SSH 연결 정보를 삭제합니다.

7. 파일 전송 (ssh_file_transfer)

SCP 또는 rsync를 사용하여 파일을 업로드/다운로드합니다.

8. 연결 정리 (ssh_disconnect)

임시 SSH 키 파일을 정리합니다.

보안 기능

  • 🔒 임시 키 저장: PEM 키는 ~/.ssh-mcp-temp-keys/ 디렉토리에 임시로 저장
  • 🗑️ 자동 정리: 사용 후 임시 키 파일 자동 삭제
  • 🔐 권한 설정: 키 파일은 600 권한으로 생성
  • 🚫 민감정보 보호: 저장된 연결 목록에서 비밀번호/키 내용 숨김

사용 시나리오

시나리오 1: 빠른 서버 접속

사용자: "다음 PEM 키로 my-server.com에 ubuntu 계정으로 접속해줘"
[PEM 키 내용 붙여넣기]

시나리오 2: 연결 저장 후 재사용

사용자: "위 연결을 'production'이라는 이름으로 저장해줘"
사용자: "production 서버에서 'ls -la' 명령어 실행해줘"

시나리오 3: 파일 전송

사용자: "production 서버에 로컬의 app.js 파일을 /home/ubuntu/로 업로드해줘"

필요 시스템 도구

SSH 연결을 위해 다음 도구들이 시스템에 설치되어 있어야 합니다:

  • ssh: SSH 클라이언트
  • scp: 파일 복사 (SSH 패키지에 포함)
  • rsync: 파일 동기화 (선택사항)
  • sshpass: 비밀번호 인증용 (비밀번호 사용시 필요)

macOS 설치:

brew install sshpass rsync

Ubuntu/Debian 설치:

sudo apt-get install sshpass rsync

데이터베이스

연결 정보는 ~/ssh.db SQLite 데이터베이스에 저장됩니다.

문제 해결

연결 실패

  1. SSH 서버가 실행 중인지 확인
  2. 방화벽/보안 그룹 설정 확인
  3. PEM 키 형식이 올바른지 확인
  4. 호스트명/IP 주소가 정확한지 확인

권한 오류

  1. PEM 키 파일 권한이 너무 개방적일 때 발생
  2. MCP 서버가 자동으로 600 권한으로 설정

파일 전송 실패

  1. 대상 디렉토리가 존재하는지 확인
  2. 충분한 디스크 공간이 있는지 확인
  3. 파일 경로에 특수 문자가 있는지 확인