ssh-mcp
Provides persistent SSH access to servers using OpenSSH ControlMaster multiplexing, allowing AI agents to run commands on registered hosts by name without re-entering credentials.
README
ssh-mcp
A small, reliable MCP server that gives an AI agent (Claude Code, etc.) persistent SSH access to your servers — register a host once, then run commands by name.
Why
Stock SSH MCP servers reimplement the SSH transport in-process: they drop connections, lose credentials between sessions, and force the agent to fall back to raw ssh -i key user@host shell-outs (which leak creds into command history and break on reconnect).
This server does not reimplement SSH. It wraps the system ssh/scp binaries with OpenSSH ControlMaster multiplexing:
- A background control socket (
ControlPersist=10m) keeps one authenticated connection warm — reconnects are instant and survive MCP restarts. - Credentials live in a registry file (
~/.ssh/ssh_mcp_hosts.json), set once, reused by host name. - The agent calls
ssh_exec(host="myserver", command=...)— no keys or IPs in every call.
Tools
| Tool | Purpose |
|---|---|
host_add |
Register/overwrite a named host (name, host, user, port?, key?, note?) |
host_list |
List registered hosts |
host_remove |
Remove a host by name |
ssh_exec |
Run one non-interactive command on a host (one-shot) |
sftp_put |
Upload a local file via scp |
sftp_get |
Download a remote file via scp |
Execution model — one-shot
Each ssh_exec is an independent command. State does not persist between calls:
cwddoes not persist → use absolute paths orcd /path && cmd.- env does not persist → set inline (
VAR=x cmd). - No interactive TUI (
vim,top,less) and no prompts → pass-y/--yes. - Long jobs:
nohup cmd >/tmp/x.log 2>&1 &, then tail the log in a later call.
Requirements
- Node.js 23.6+ (runs TypeScript directly via type-stripping — no build step)
- OpenSSH client (
ssh,scp) on PATH
Install
pnpm install
Register with your MCP client (e.g. Claude Code ~/.claude.json):
{
"mcpServers": {
"ssh": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/ssh_mcp/src/index.ts"]
}
}
}
Restart the client, then add a host:
host_add(name="myserver", host="1.2.3.4", user="root", key="~/.ssh/id_ed25519")
ssh_exec(host="myserver", command="uname -a")
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.