ssh-client-mcp-server
A local MCP server that enables LLMs to execute shell commands on remote hosts over SSH with multiple authentication methods.
README
SSH Client MCP Server
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 over FastMCP with telemetry, introspection, and backend abstraction.
Contents
Quick Start
- Configure your MCP client (Claude Desktop, Cursor, Cline, etc.) to launch this server via
npx— see Client Setup. - 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
exectool — runs a shell command on the remote host, returns stdout. stderr surfaces as a structured error. - 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 —
--keysupports~,$VAR,${VAR}, and relative paths viafunctype-os. Unresolved variables fail fast with a typed error. - OS-user fallback —
--userdefaults to the current OS username when omitted. - Fail-fast auth — the SSH key is loaded and validated at server startup, not on the first
execcall. - Introspection out-of-the-box —
soma_health,soma_capabilities,soma_connectionsauto-registered by somamcp. - Cross-platform — runs on Linux, macOS, Windows (anywhere Node 22+ runs).
Tools
| Tool | Description |
|---|---|
exec |
Execute a shell command on the remote SSH server and return stdout. |
soma_health |
Server uptime, status, active session count. |
soma_capabilities |
Enumerate registered tools, resources, and prompts. |
soma_connections |
Gateway connection status (unused here). |
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? })— typeinputintosession(created if absent); presses Enter unlesssubmit: false.tmux_read({ session?, lines? })— return the recent pane transcript (linesdefault 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
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)
git clone https://github.com/jordanburke/ssh-client-mcp-server.git
cd ssh-client-mcp-server
pnpm install
pnpm build
Configuration
The server reads SSH connection info from CLI flags:
| Flag | Required | Default | Description |
|---|---|---|---|
--host |
yes | — | Hostname or IP of the remote SSH server. |
--user |
no | OS username | SSH username. Falls back to the local OS user (whoami) when omitted. |
--port |
no | 22 |
SSH port. |
--password |
no* | — | SSH password. |
--key |
no* | — | Path to a private SSH key. Supports ~, $VAR, ${VAR}, and relative paths. |
--key-env |
no* | — | Name of an env var holding the private key PEM (e.g. injected by envpkt, Vault, Doppler). |
--agent |
no* | — | 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.
# verify the agent is reachable
ssh-add -l
# launch the MCP server through it
ssh-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:
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)
{
"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
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)
pnpm inspect
This builds and launches the MCP Inspector pointed at dist/index.js.
Development
All tooling is delegated to ts-builds:
pnpm validate # format → lint → typecheck → test → build
pnpm test # vitest run
pnpm test:watch # vitest watch mode
pnpm 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。