Skip to main content
Glama
bhayanak

Simple SSH MCP Server

by bhayanak

CI npm License: MIT

一个 MCP 服务器,为 AI 助手提供完整的 SSH/SFTP 远程操作功能——包括会话管理、命令执行、交互式 Shell、文件传输、端口转发和系统诊断。

适用于 Claude Desktop、VS Code + GitHub Copilot 以及任何兼容 MCP 的客户端。

软件包

软件包

描述

ssh-mcp-server

MCP 服务器(49 个工具)——独立 CLI 和 npm 包

ssh-mcp-vscode

VS Code 扩展——自动向 GitHub Copilot 注册服务器

Related MCP server: ssh-mcp

功能特性

  • 会话管理 — 通过密码或密钥认证进行连接/断开连接/ping 操作

  • 命令执行 — 执行命令并捕获 stdout/stderr、超时设置和退出代码

  • Sudo 执行 — 通过 stdin 注入密码(从不记录日志)执行提权命令

  • 后台作业 — 支持轮询和取消的长时运行命令

  • 交互式 Shell — 支持读/写/调整大小的 PTY Shell

  • SFTP 操作 — 上传、下载、读取、写入、删除、列出、查看状态

  • 端口转发 — 本地 (-L) 和远程 (-R) SSH 隧道

  • 系统诊断 — 操作系统、CPU、内存、磁盘、网络、负载、进程信息

  • 文件搜索与分析 — 查找文件、grep 内容、diff、tail、校验和

  • 服务器管理 — 服务、进程、cron、网络诊断、用户管理

  • 多主机工作流 — 广播命令、主机间文件传输、跳板机/堡垒机连接、脚本执行

  • 会话智能 — 系统快照、快照差异对比、连接书签

  • 容器感知 — Docker/Podman 容器的列表、日志、exec 操作

  • 审计日志 — 带有过滤功能的 NDJSON 结构化日志

快速入门

独立运行 (npm)

npm install -g simple-ssh-mcp-server

Claude Desktop

添加到 claude_desktop_config.json

{
  "mcpServers": {
    "ssh": {
      "command": "npx",
      "args": ["ssh-mcp-server"],
      "env": {
        "SSH_MCP_MAX_CONNECTIONS": "10",
        "SSH_MCP_HOST_KEY_MODE": "accept"
      }
    }
  }
}

VS Code + GitHub Copilot

安装 SSH MCP VS Code 扩展 —— 服务器会在 VS Code 启动时自动运行。需要 VS Code 1.99+ 和 GitHub Copilot。

工具 (49)

类别

工具

会话

ssh_connect, ssh_disconnect, ssh_list_sessions, ssh_session_ping

执行

ssh_exec, ssh_sudo_exec

后台

ssh_exec_background, ssh_exec_poll, ssh_exec_poll_list, ssh_exec_cancel

Shell

ssh_shell_open, ssh_shell_write, ssh_shell_read, ssh_shell_resize, ssh_shell_close, ssh_shell_list

SFTP

ssh_sftp_list, ssh_sftp_upload, ssh_sftp_download, ssh_sftp_read, ssh_sftp_write, ssh_sftp_delete, ssh_sftp_stat

端口转发

ssh_port_forward_local, ssh_port_forward_remote, ssh_port_forward_list, ssh_port_forward_remove

文件搜索

ssh_find, ssh_grep, ssh_diff, ssh_tail, ssh_checksum

服务器管理

ssh_service, ssh_process, ssh_cron, ssh_network, ssh_user

多主机

ssh_broadcast, ssh_transfer, ssh_jump_connect, ssh_script

会话智能

ssh_snapshot, ssh_snapshot_diff, ssh_bookmark

容器

ssh_container_list, ssh_container_logs, ssh_container_exec

诊断

ssh_system_info, ssh_get_logs

配置

所有设置均通过环境变量进行:

变量

默认值

描述

SSH_MCP_MAX_CONNECTIONS

10

最大并发 SSH 会话数

SSH_MCP_LOG_DIR

~/.ssh-mcp/logs

审计日志目录

SSH_MCP_DEFAULT_TERM

xterm-256color

PTY Shell 的默认 TERM

SSH_MCP_DEFAULT_COLS

220

终端宽度

SSH_MCP_DEFAULT_ROWS

50

终端高度

SSH_MCP_EXEC_TIMEOUT_MS

30000

命令超时时间 (ms)

SSH_MCP_HOST_KEY_MODE

accept

主机密钥模式:accept, strict, ask

SSH_MCP_ENV

development

production 模式默认使用 strict 主机密钥

请参阅 服务器 README 获取完整的配置参考。

安全性

  • Sudo 密码通过 stdin 注入,从不记录日志

  • 从输出中剥离 ANSI 转义序列

  • 输出截断防止内存溢出

  • SSH keepalive 检测死连接

  • CI 中集成了 ESLint 安全插件 + Gitleaks + CodeQL + Trivy

许可证

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    MCP server giving AI agents full SSH access with persistent sessions, structured command output, SFTP file transfer, and port forwarding.
    18
    10
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server that gives AI agents SSH access to remote machines through your local OpenSSH client, enabling remote command execution, file transfer, persistent shell sessions, and port forwarding.
    17
    16
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    MCP server enabling AI assistants to securely operate remote servers via persistent SSH sessions, with tools for command execution, file transfer, directory listing, and system monitoring.
    4
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    An open MCP server that gives any AI agent SSH access to remote Linux/Unix machines — shell commands, file read/write, and SFTP transfers.
    11
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bhayanak/ssh-server-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server