mcp-ssh-tool
mcp-ssh-tool
운영자, 개발자 및 AI 클라이언트를 위한 프로덕션급 MCP SSH 자동화 도구입니다. mcp-ssh-tool은 지속적인 SSH 세션을 열고 명령 실행, 파일 작업, 전송, 터널링, 패키지/서비스 관리, 메트릭, 리소스 및 가이드 프롬프트를 위한 안전하고 구조화된 도구를 제공합니다.
v2는 기본적으로 보안이 강화되었습니다: 엄격한 호스트 키 검증이 활성화되어 있고, 루트 로그인이 차단되며, 원시 sudo는 정책에 의해 제어됩니다. 파괴적인 명령 및 파일 시스템 변경은 정책이 허용하지 않는 한 거부되며, 원격 HTTP는 베어러 인증 및 허용된 오리진이 구성되지 않은 경우 루프백에서만 시작됩니다.
이 서버를 사용하는 이유
신뢰성: 중앙 정책 엔진, 구조화된 감사 이벤트, 로그 마스킹, 엄격한 호스트 키 및 기계 판독 가능한 오류.
MCP 품질: 로컬 클라이언트를 위한 stdio, 원격 클라이언트를 위한 Streamable HTTP, 명시적 호환성 플래그 뒤에만 존재하는 레거시 SSE.
AI 친화적 도구: 안정적인 출력 스키마,
structuredContent, 읽기 전용/파괴적/멱등성 동작에 대한 주석, 리소스 및 큐레이팅된 프롬프트.운영: 세션 TTL/퇴거, 명령 시간 초과, 전송 체크섬 검증, 실제 SSH 포워딩, Prometheus 메트릭 및 OpenTelemetry 훅.
이식성: SFTP 우선, 기본 파일 작업을 위한 POSIX/BusyBox 인식 셸 폴백 및 명시적 지원 범위.
빠른 시작
설치 없이 실행:
npx -y mcp-ssh-tool --version또는 전역 설치:
npm install -g mcp-ssh-tool클라이언트에 stdio MCP 서버 추가:
{
"servers": {
"ssh-mcp": {
"type": "stdio",
"command": "mcp-ssh-tool",
"args": []
}
}
}MCP 클라이언트에서 사용:
Open a safe SSH session to prod-1 as deploy, inspect host capabilities, then show disk usage.요구 사항
Node.js
22.22.2+또는24.14.1+(LTS 전용)대상 호스트에 대한 SSH 액세스
엄격한 호스트 검증을 위한 채워진
known_hosts파일 또는 세션별 명시적 호스트 키 정책
전송 방식
모드 | 명령 | 사용 시기 |
stdio |
| ChatGPT, Claude Desktop, VS Code, Cursor 또는 Codex와 같은 로컬 데스크톱 클라이언트. |
Streamable HTTP |
| 원격 MCP 클라이언트, 리버스 프록시 또는 Inspector 세션. |
레거시 SSE |
| 일시적인 v1 호환성 전용. Streamable HTTP 사용 권장. |
루프백이 아닌 HTTP 시작은 --bearer-token-file과 허용된 오리진이 모두 구성되지 않은 경우 거부됩니다.
보안 기본값
영역 | v2 기본값 |
호스트 키 |
|
루트 SSH 로그인 | 거부됨 |
원시 |
|
파괴적인 명령 |
|
파괴적인 파일 시스템 작업 | 정책 접두사 내에서만 허용, 그 외에는 거부됨 |
HTTP 바인딩 |
|
레거시 SSE | 비활성화됨 |
파일 읽기 |
|
세션별 policyMode: "explain"은 실행 없이 계획/판단을 반환합니다. AI 클라이언트가 위험을 요약해야 할 때 변경 작업 전에 사용하십시오.
정책 예시
SSH_MCP_POLICY_FILE=/etc/mcp-ssh-tool/policy.json 설정:
{
"mode": "enforce",
"allowRootLogin": false,
"allowRawSudo": false,
"allowDestructiveCommands": false,
"allowDestructiveFs": false,
"allowedHosts": ["^prod-[0-9]+\\.example\\.com$"],
"commandAllow": ["^(uname|df|uptime|systemctl status)\\b"],
"commandDeny": ["rm\\s+-rf\\s+/", "shutdown", "reboot"],
"pathAllowPrefixes": ["/tmp", "/var/tmp", "/home/deploy"],
"pathDenyPrefixes": ["/etc/shadow", "/etc/sudoers", "/boot", "/dev", "/proc"]
}간단한 배포는 SSH_MCP_ALLOW_RAW_SUDO=true, SSH_MCP_ALLOWED_HOSTS=prod-1.example.com 또는 SSH_MCP_PATH_ALLOW_PREFIXES=/tmp,/home/deploy와 같은 환경 변수 재정의를 사용할 수 있습니다.
핵심 도구
ssh_open_session,ssh_close_session,ssh_list_sessions,ssh_ping,ssh_list_configured_hosts,ssh_resolve_hostproc_exec,proc_sudo,proc_exec_streamfs_read,fs_write,fs_list,fs_stat,fs_mkdirp,fs_rmrf,fs_renamefile_upload,file_downloadensure_package,ensure_service,ensure_lines_in_file,patch_applyos_detect,get_metricstunnel_local_forward,tunnel_remote_forward,tunnel_list,tunnel_close
모든 도구는 텍스트와 안정적인 structuredContent를 반환합니다. 도구 메타데이터에는 읽기 전용, 파괴적, 멱등성 및 외부 부작용 동작을 공개하는 제목, 출력 스키마 및 주석이 포함됩니다.
리소스 및 프롬프트
리소스:
mcp-ssh-tool://sessions/activemcp-ssh-tool://metrics/jsonmcp-ssh-tool://metrics/prometheusmcp-ssh-tool://ssh-config/hostsmcp-ssh-tool://policy/effectivemcp-ssh-tool://audit/recentmcp-ssh-tool://capabilities/support-matrix
프롬프트:
safe-connectinspect-host-capabilitiesplan-mutationmanaged-config-change
지원 매트릭스
대상 | 상태 |
Linux | 전체 지원. |
macOS/BSD | 세션, 프로세스, 파일 시스템 및 전송 지원; 패키지/서비스 도우미는 테스트된 경우에만 지원. |
BusyBox/dropbear | 세션, 프로세스 및 기본 파일 시스템 폴백에 대해 실험적 지원. |
Windows SSH 대상 | 세션, 프로세스, 파일 시스템 및 전송에 대해 실험적 지원; |
클라이언트 예시
ChatGPT 또는 Claude Desktop:
{
"mcpServers": {
"ssh-mcp": {
"command": "npx",
"args": ["-y", "mcp-ssh-tool"]
}
}
}VS Code 또는 Cursor:
{
"servers": {
"ssh-mcp": {
"type": "stdio",
"command": "mcp-ssh-tool"
}
}
}HTTP를 통한 MCP Inspector:
printf '%s' 'super-secret-token' > .mcp-token
mcp-ssh-tool --transport=http --host 127.0.0.1 --port 3000 --bearer-token-file .mcp-token구성
주요 환경 변수:
변수 | 기본값 | 목적 |
| 설정 안 됨 | 표준 JSON 정책 소스. |
|
|
|
|
| 엄격한 검증을 위한 known-hosts 파일. |
|
|
|
|
| 기본 명령 시간 초과. |
|
| Streamable HTTP 바인딩 호스트. |
|
| Streamable HTTP 포트. |
| 설정 안 됨 | 루프백이 아닌 HTTP에 필요. |
| 루프백 오리진 | 쉼표로 구분된 허용된 오리진. |
더 이상 사용되지 않는 별칭 STRICT_HOST_KEY_CHECKING 및 SSH_MCP_STRICT_HOST_KEY는 v2 호환성 주기를 위해 여전히 허용됩니다. SSH_MCP_HOST_KEY_POLICY 사용을 권장합니다.
개발
.nvmrc / .node-version의 정확한 로컬 런타임을 사용한 후 다음을 실행하십시오:
npm ci
npm run check라이브 SSH 제품군은 선택 사항입니다:
RUN_SSH_INTEGRATION=1 npm run test:integration
RUN_SSH_E2E=1 npm run test:e2e로컬 품질 게이트는 계층화되어 있습니다:
pre-commit: 스테이징된 파일 포맷팅 및 스테이징된 TypeScript 린트pre-push:npm run check:push실행task hooks:pre-commit이 설치된 경우 추적된 npm 훅과.pre-commit-config.yaml훅 실행수동/전체 패리티:
task ci또는npm run check
CI/CD 소유권
개인 저장소 https://github.com/oaslananka/mcp-ssh-tool이 표준 소스 저장소입니다. 자동 CI/CD, 공급망 보안 검사, 신뢰할 수 있는 npm 게시 및 MCP Registry 게시는 https://github.com/oaslananka-lab/mcp-ssh-tool에서만 실행됩니다. 조직 저장소는 표준 소스에서 가져오며, 개인 저장소의 푸시 및 게시 워크플로는 비활성화되어 있습니다.
npm 패키지 repository.url은 의도적으로 조직 저장소를 가리키므로 npm 출처를 통해 게시된 아티팩트가 이를 빌드한 GitHub Actions 저장소에서 왔음을 확인할 수 있습니다.
조직 동기화, 릴리스 흐름 및 수동 폴백 지침은 docs/ci-cd-topology.md를 참조하십시오.
문서
라이선스
MIT 라이선스. LICENSE를 참조하십시오.
Available Tools
33 toolsconnector_statusConnector StatusARead-onlyIdempotent
Use this when ChatGPT or Claude needs to understand the remote connector profile, authentication mode, and credential broker readiness without exposing secrets.
Inputs: no named parameters. Returns: Remote connector readiness without secrets
ensure_lines_in_fileEnsure Lines In FileADestructiveIdempotent
Ensures specific lines are present or absent in a file
Inputs: sessionId (required), path (required), lines (required), state, +1 more. Returns: Line management result
ensure_packageEnsure Package StateCDestructiveIdempotent
Ensures a package is installed or removed
Inputs: sessionId (required), name (required), state. Returns: Package state result
ensure_serviceEnsure Service StateBDestructiveIdempotent
Ensures a service is in the desired state
Inputs: sessionId (required), name (required), state (required). Returns: Service state result
file_downloadDownload FileARead-only
Downloads a remote file to the local machine over SFTP
Inputs: sessionId (required), remotePath (required), localPath (required). Returns: Download result with integrity details
file_uploadUpload FileBDestructive
Uploads a local file to the remote host over SFTP
Inputs: sessionId (required), localPath (required), remotePath (required). Returns: Upload result with integrity details
fs_listList Remote DirectoryCRead-onlyIdempotent
Lists directory contents
Inputs: sessionId (required), path (required), page, limit. Returns: Remote directory entries
fs_mkdirpCreate Remote DirectoriesAIdempotent
Creates directories recursively
Inputs: sessionId (required), path (required). Returns: Directory creation result
fs_readRead Remote FileBRead-onlyIdempotent
Reads a file from the remote system
Inputs: sessionId (required), path (required), encoding, maxBytes. Returns: Remote file content wrapped as structured content
fs_renameRename Remote PathBDestructive
Renames or moves a file/directory
Inputs: sessionId (required), from (required), to (required). Returns: Rename result
fs_rmrfRemove Remote Path RecursivelyADestructive
Removes files or directories recursively
Inputs: sessionId (required), path (required). Returns: Recursive remove result
fs_statStat Remote PathARead-onlyIdempotent
Gets file or directory statistics
Inputs: sessionId (required), path (required). Returns: Remote path stat result
fs_writeWrite Remote FileBDestructive
Writes data to a file on the remote system
Inputs: sessionId (required), path (required), data (required), mode. Returns: File write result
get_metricsGet Runtime MetricsARead-onlyIdempotent
Returns server metrics including session counts, command statistics, and uptime
Inputs: format. Returns: Runtime metrics
os_detectDetect Remote OSARead-onlyIdempotent
Detects operating system and environment information
Inputs: sessionId (required). Returns: Remote operating system information
patch_applyApply PatchBDestructive
Applies a patch to a file
Inputs: sessionId (required), path (required), diff (required). Returns: Patch application result
proc_execExecute Remote CommandA
Executes a non-interactive command on the remote system after policy and safety checks
Inputs: sessionId (required), command (required), cwd, env, +1 more. Returns: Remote command result
proc_exec_streamExecute Streaming CommandA
Executes a command and returns streaming output chunks
Inputs: sessionId (required), command (required), cwd, env, +1 more. Returns: Streaming command result with output chunks
proc_sudoExecute Sudo CommandADestructive
Executes a command with sudo privileges only when allowRawSudo policy permits it
Inputs: sessionId (required), command (required), cwd, timeoutMs. Returns: Remote sudo command result
ssh_close_sessionClose SSH SessionBIdempotent
Closes an SSH session
Inputs: sessionId (required). Returns: Boolean close result wrapped as structured content
ssh_host_inspectInspect SSH HostARead-only
Use this when ChatGPT or Claude needs read-only host inspection through the server-side credential broker. The user supplies only a configured host alias and selected checks; no secret material or login details are accepted.
Inputs: hostAlias (required), checks. Returns: Read-only host inspection result
ssh_hosts_listList Safe SSH Host AliasesARead-onlyIdempotent
Use this when ChatGPT or Claude needs a safe list of SSH host aliases that may be inspected through the remote connector. Sensitive login material is omitted.
Inputs: no named parameters. Returns: Redacted SSH host aliases allowed by policy
ssh_list_configured_hostsList Configured HostsARead-onlyIdempotent
Lists all hosts configured in ~/.ssh/config
Inputs: no named parameters. Returns: Configured SSH host aliases
ssh_list_sessionsList SSH SessionsARead-onlyIdempotent
Lists all active SSH sessions with their details
Inputs: no named parameters. Returns: Active SSH sessions
ssh_mutation_planPlan SSH MutationARead-onlyIdempotent
Use this when ChatGPT or Claude needs a non-executing plan for a remote SSH change. It never runs commands, writes files, uploads data, starts tunnels, or escalates privileges.
Inputs: hostAlias (required), goal (required), category. Returns: Non-executing remote mutation plan
ssh_open_sessionOpen SSH SessionB
Opens a new SSH session with authentication
Inputs: host (required), username (required), port, auth, +12 more. Returns: Session creation result or explain-mode connection plan
ssh_pingPing SSH SessionARead-onlyIdempotent
Checks if an SSH session is still alive and responsive
Inputs: sessionId (required). Returns: Session health check result
ssh_policy_explainExplain SSH PolicyARead-onlyIdempotent
Use this when ChatGPT or Claude needs to explain whether a requested SSH inspection or mutation would be allowed. This is explain-only and does not execute commands or open tunnels.
Inputs: hostAlias, action, command, path. Returns: Explain-only policy decision
ssh_resolve_hostResolve SSH HostARead-onlyIdempotent
Resolves a host alias from ~/.ssh/config to connection parameters
Inputs: hostAlias (required). Returns: Resolved SSH connection parameters
tunnel_closeClose SSH TunnelBIdempotent
Closes an active tunnel
Inputs: tunnelId (required). Returns: Tunnel close result
tunnel_listList SSH TunnelsARead-onlyIdempotent
Lists active tunnels, optionally filtered by session
Inputs: sessionId. Returns: Active tunnels
tunnel_local_forwardCreate Local SSH TunnelC
Creates a local SSH port forward
Inputs: sessionId (required), localPort (required), remoteHost (required), remotePort (required). Returns: Local tunnel information
tunnel_remote_forwardCreate Remote SSH TunnelC
Creates a remote SSH port forward
Inputs: sessionId (required), remotePort (required), localHost (required), localPort (required). Returns: Remote tunnel information
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 33 tools
Each tool targets a distinct operation or resource type (file, command, session, tunnel, package, service, inspection). There is no significant overlap; even similar tools like proc_exec and proc_exec_stream are differentiated by execution mode.
Tools are grouped by domain (fs_, proc_, tunnel_, ssh_, ensure_) with consistent patterns within groups. However, the overall naming convention mixes prefixes (fs_list vs file_download) and some tools use long phrasal names (ensure_lines_in_file).
At 33 tools, the server is heavily featured. While most tools serve a clear purpose, the count is above the typical sweet spot and includes several niche utilities (get_metrics, os_detect, ssh_mutation_plan) that could be consolidated.
The tool surface covers the full lifecycle of SSH interactions: session management, file operations, command execution, package/service management, tunneling, and safety/planning. No obvious gaps exist for a generic SSH administration server.
Maintenance
Related MCP Connectors
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Termalin's hosted MCP server. Claude, ChatGPT or any MCP client runs commands, moves files over SFTP, queries databases and reads server metrics and monitoring alerts on your servers, keylessly through Termalin Connectors: no SSH key is handed over and no inbound port is opened. Per-host command policy and an audit log. Needs a termal.in Pro or Team account (new accounts start with a 14-day Pro trial).
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.