MCP SSH 서버
모델 컨텍스트 프로토콜(MCP)을 위한 강력한 SSH 서버 구현입니다. 이 서버는 SSH 프로토콜을 통해 안전한 원격 명령 실행 및 파일 작업을 지원하며, 비밀번호 및 키 기반 인증을 모두 지원합니다.
특징
- ✨ 안전한 SSH 연결 관리
- 🔑 비밀번호 및 키 기반 인증
- 💻 원격 명령 실행
- 📁 파일 작업(업로드/다운로드)
- 📊 파일 전송 진행 상황 추적
- 🔐 권한 관리
- 📂 디렉토리 작업
- 🚀 대량 파일 전송
- 📝 자세한 로깅
설치
- 패키지를 설치하세요:
지엑스피1
- Claude 데스크톱 구성(
claude_desktop_config.json
)에 다음을 추가합니다.
{
"mcpServers": {
"ssh": {
"command": "node",
"args": ["%APPDATA%/npm/node_modules/mcp-ssh/dist/server.js"],
"env": {
"SSH_PORT": "8889",
"SSH_LOG_LEVEL": "info"
}
}
}
}
용법
비밀번호 인증
$body = @{
id = "test"
host = "example.com"
port = 22
username = "user"
password = "pass123"
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:8889/connect" -Method Post -Body $body -ContentType "application/json"
키 인증
$body = @{
id = "test"
host = "example.com"
port = 22
username = "user"
privateKey = Get-Content ~/.ssh/id_rsa | Out-String
passphrase = "optional-key-passphrase" # if your key is protected
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:8889/connect" -Method Post -Body $body -ContentType "application/json"
명령 실행
$execBody = @{
id = "test"
command = "ls -la"
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:8889/exec" -Method Post -Body $execBody -ContentType "application/json"
파일 작업
# Upload file
$uploadForm = @{
file = Get-Item -Path "localfile.txt"
remotePath = "/remote/path/file.txt"
}
Invoke-RestMethod -Uri "http://localhost:8889/upload/test" -Method Post -Form $uploadForm
# Download file
Invoke-RestMethod -Uri "http://localhost:8889/download/test?remotePath=/remote/path/file.txt" -Method Get -OutFile "downloaded.txt"
디렉토리 작업
# List directory
Invoke-RestMethod -Uri "http://localhost:8889/ls/test?path=/remote/path" -Method Get
# Get connection status
Invoke-RestMethod -Uri "http://localhost:8889/status/test" -Method Get
개발
- 저장소를 복제합니다.
git clone https://github.com/shaike1/mcp-server-ssh.git
cd mcp-server-ssh
- 종속성 설치:
- 짓다:
- 서버 시작:
환경 변수
SSH_PORT
: 서버 포트(기본값: 8889)SSH_LOG_LEVEL
: 로깅 레벨(기본값: info)
기여하다
- 저장소를 포크하세요
- 기능 브랜치를 생성합니다(
git checkout -b feature/amazing-feature
) - 변경 사항을 커밋하세요(
git commit -m 'Add some amazing feature'
) - 브랜치에 푸시(
git push origin feature/amazing-feature
) - 풀 리퀘스트 열기
특허
MIT