Ssh Fleet Mcp Server

io.github.jordanburke由 GitHub 账号 jordanburke 发布v0.2.1更新于 Nov 6, 2026

MCP server that manages a fleet of SSH hosts via pooled connections.

概览

AI 生成的概览

本地 MCP 服务器,通过连接池管理多台 SSH 主机,让助手在远端执行 shell 命令并操作 tmux 会话。

可以做什么
  • 列出已配置的主机及其实时连接状态
  • 查看配置状态:配置文件路径、各主机连接状态与最近错误、CA 公钥及后续步骤
  • 在指定主机上通过 SSH 执行一次性 shell 命令
  • 列出主机上的 tmux 会话、向会话输入文本、读取最近的窗格输出、发送控制键或特殊键
  • 返回服务器自身的名称、版本、构建提交与运行时信息
适用场景
适合需要让助手在一处操作多台远程机器的场景,例如批量执行命令、检查连通性,或在 tmux 中驱动远程编码代理等长时间运行的交互式进程。
运行要求
以本地 Node.js 进程运行(README 称需 Node 22 以上),通常通过 npx 启动。需要一份 TOML 集群配置,列出主机与 SSH 凭据(密码、密钥文件、环境变量中的密钥或 ssh-agent 套接字),并能访问这些主机。使用 tmux 工具的主机需安装 tmux。
安装前请注意
它把远程主机的 shell 权限交给助手,命令可能修改或删除数据;README 建议审计命令、限制目标账户权限并考虑使用跳板机。凭据可能以密码参数、密钥路径或环境变量名形式传入,不应提交到版本控制。tmux_send 会向活动会话输入文本,必要时还会创建会话。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Ssh Fleet Mcp Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

SSH Client MCP Server

[License] [NPM Version] [CI]

SSH Client MCP Server is a local Model Context Protocol (MCP) server that lets LLMs and other MCP clients execute shell commands on remote hosts over SSH. It runs from Linux, macOS, or Windows and targets any reachable SSH server (Linux, macOS, Windows with OpenSSH, etc.).

Built on somamcp — a functional MCP framework on the MCP TypeScript SDK 2.x, with telemetry and introspection.

Contents

Monorepo

This repository is a pnpm monorepo with three packages:

Packagenpm nameRole
packages/core@ssh-mcp/core (private)Shared SSH pool, tmux command builders, and auth resolution. Bundled into the other packages; not published separately.
packages/connectorssh-client-mcp-serverSingle-host MCP server (the original package). exec + tmux_* tools for one configured SSH host.
packages/orchestratorssh-fleet-mcp-serverMulti-host fleet MCP server. Host-routed exec + tmux_* tools driven by a TOML fleet config.

For the fleet server, start with its README: first run, fleet_setup, audit log, policy, CA mode, and running on several machines (where to register it, installing on a hub, per-hub keys versus CA mode, macOS hosts).

Run the full validation suite across all packages:

bash
pnpm -r validate

Quick Start

  1. Configure your MCP client (Claude Desktop, Cursor, Cline, etc.) to launch this server via npx — see Client Setup.
  2. Ask your LLM to run shell commands on the target host.

No global install required — npx fetches and runs the latest published version.

Features

  • Single exec tool — runs a shell command on the remote host. A non-zero exit is the failure; a command that exits 0 succeeds even if it wrote to stderr, and its stderr follows stdout under a [stderr] marker. A failure reads exit <code>: then stderr, then stdout under [stdout]; a command a signal ended reads exit 137 (signal KILL).
  • Four auth modes — password, key file, key from environment variable (e.g. injected by envpkt, Vault, Doppler), or SSH_AUTH_SOCK (system ssh-agent, 1Password, Bitwarden Desktop, KeePassXC).
  • Smart path expansion — --key supports ~, $VAR, ${VAR}, and relative paths via functype-os. Unresolved variables fail fast with a typed error.
  • OS-user fallback — --user defaults to the current OS username when omitted.
  • Fail-fast auth — the SSH key is loaded and validated at server startup, not on the first exec call.
  • Introspection out-of-the-box — an info tool, auto-registered by somamcp, reports the server's name, version, runtime, and tool counts.
  • Cross-platform — runs on Linux, macOS, Windows (anywhere Node 22+ runs).

Tools

ToolDescription
execExecute a shell command on the remote SSH server and return its output.
infoServer name, version, runtime, and registered tool counts.

Persistent sessions (tmux)

For driving long-running interactive processes (e.g. a remote coding agent) across calls, the server exposes tmux-backed tools. tmux must be installed on the remote host.

  • tmux_list — list live tmux sessions.
  • tmux_send({ session?, input, submit? }) — type input into session (created if absent); presses Enter unless submit: false.
  • tmux_read({ session?, lines? }) — return the recent pane transcript (lines default 200, max 2000).
  • tmux_keys({ session?, keys }) — send control/special keys, e.g. { keys: ["C-c"] }.

session defaults to --tmux-session (default agent). Tip: run agents in a line-oriented mode (not a full-screen TUI) so tmux_read returns a clean transcript.

Installation

Run via npx (recommended)

No install step — your MCP client launches it on demand. See Client Setup.

Global install

bash
npm install -g ssh-client-mcp-server# then:ssh-client-mcp-server --host=1.2.3.4 --user=root --password=pass

From source (for contributors)

bash
git clone https://github.com/jordanburke/ssh-client-mcp-server.gitcd ssh-client-mcp-serverpnpm installpnpm build

Configuration

The server reads SSH connection info from CLI flags:

FlagRequiredDefaultDescription
--hostyes—Hostname or IP of the remote SSH server.
--usernoOS usernameSSH username. Falls back to the local OS user (whoami) when omitted.
--portno22SSH port.
--passwordno*—SSH password.
--keyno*—Path to a private SSH key. Supports ~, $VAR, ${VAR}, and relative paths.
--key-envno*—Name of an env var holding the private key PEM (e.g. injected by envpkt, Vault, Doppler).
--agentno*—Set to true to use SSH_AUTH_SOCK (system ssh-agent, 1Password, Bitwarden Desktop, KeePassXC).

*Auth precedence is --password → --key → --key-env → --agent. If none are set the server starts but ssh2 will fail to authenticate on first exec.

Pulling keys from a password manager (Bitwarden / 1Password / KeePassXC)

Each of these can expose your SSH keys via SSH_AUTH_SOCK. Unlock the vault, confirm the agent is enabled, then run with --agent=true — the server never sees the private key.

bash
# verify the agent is reachablessh-add -l
# launch the MCP server through itssh-client-mcp-server --host=1.2.3.4 --user=root --agent=true

For Bitwarden Desktop ≥ 2024.12: enable Settings → SSH agent, then on macOS confirm launchctl getenv SSH_AUTH_SOCK points at Bitwarden's socket.

Pulling keys from envpkt (or any tool that injects env vars)

Store the PEM as a sealed value in envpkt.toml, then launch via envpkt exec:

bash
envpkt exec -- ssh-client-mcp-server --host=1.2.3.4 --user=root --key-env=MY_SSH_KEY

Same pattern works for HashiCorp Vault, Doppler, Infisical, AWS Secrets Manager, or any wrapper that lands the key in process.env.

Client Setup

Claude Desktop (claude_desktop_config.json)

json
{  "mcpServers": {    "ssh-client-mcp-server": {      "command": "npx",      "args": ["-y", "ssh-client-mcp-server", "--host=1.2.3.4", "--user=root", "--key=~/.ssh/id_ed25519"]    }  }}

Password auth

Replace the --key arg with --password=hunter2. Avoid checking this into version control.

Using the current OS user

Omit --user entirely — the server defaults to your local username.

Other MCP clients

Any client that speaks the stdio MCP transport works. Same command / args shape.

Testing

Against a published build

bash
npx @modelcontextprotocol/inspector npx ssh-client-mcp-server --host=1.2.3.4 --user=root --key=~/.ssh/id_ed25519

Against a local build (after pnpm build)

bash
pnpm inspect

This builds and launches the MCP Inspector pointed at dist/index.js.

Development

All tooling is delegated to ts-builds:

bash
pnpm validate      # format → lint → typecheck → test → buildpnpm test          # vitest runpnpm test:watch    # vitest watch modepnpm build         # production build to dist/pnpm dev           # tsdown watch mode to lib/pnpm inspect       # build + launch MCP Inspector

Pure helpers (parseArgv, validateConfig, resolveAuth, effectiveUser) live in src/config.ts and are covered by test/config.spec.ts (18 cases, including tempfile-backed key reads and env-var expansion).

Disclaimer

Provided under the MIT License. Use at your own risk. Not affiliated with or endorsed by any SSH vendor or MCP provider. Be careful granting LLMs shell access — audit commands, restrict target-account privileges, and consider a jump box.

Contributing

Issues and PRs welcome at jordanburke/ssh-client-mcp-server. Please run pnpm validate before submitting.

来源:README.md,提交 934c335

工具

8

info

Returns identity and build information for this server (name, version, build commit, runtime, capability counts)

无需输入参数。

hosts_list

List configured fleet hosts and their live connection status. If a host you expect is missing, call fleet_setup: the config may have changed since the server started.

无需输入参数。

fleet_setup

Show setup state: config path, each host's connection state and last error, each CA's public key and the line to add on hosts, and what to do next. Read-only.

无需输入参数。

exec

Run a one-shot shell command on a fleet host over SSH.

输入参数host必填command必填timeout_ms

tmux_list

List tmux sessions on a fleet host. Returns a JSON array of session names.

输入参数host必填

tmux_send

Type text into a persistent tmux session on a fleet host (creates it if absent).

输入参数host必填input必填submitsession

tmux_read

Capture the recent pane transcript of a tmux session on a fleet host.

输入参数host必填linessession

tmux_keys

Send control/special keys (e.g. C-c) to a tmux session on a fleet host.

输入参数host必填keys必填session

版本历史

1
  1. v0.2.1最新Nov 6, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分