SSH MCP Server
SSH MCP Server provides SSH remote command execution and file transfer using managed credentials.
Execute remote shell commands with
ssh_execusing host, username, command, and private key path.Add named SSH credentials with
add_credential(host, username, private key path).List stored credentials with
list_credentials.Remove stored credentials by name with
remove_credential.Copy files/directories to or from a remote host with
rsync_copyusing a stored credential and direction.The README also documents extra features not present in this schema, including raw argv exec, SCP, interactive sessions, port-forwarding tunnels, host-key pinning, and a connection-caching CLI.
Manages SSH credentials storage through a SQLite database, enabling persistence of connection details for remote command execution.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SSH MCP Server list all my saved SSH credentials"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SSH MCP Server
A Model Context Protocol (MCP) server implementation that provides SSH capabilities. This server allows for secure remote access and execution through the MCP protocol.
Features
SSH server implementation using MCP protocol
SQLite database integration for data persistence
TypeScript implementation for type safety and better development experience
Related MCP server: Remote Command MCP Server
Prerequisites
Node.js 18 or higher
npm or yarn package manager
TypeScript knowledge for development
Installation
Installing via Smithery
To install SSH Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @KinoThe-Kafkaesque/ssh-mcp-server --client claudeManual Installation
Clone the repository:
git clone <repository-url>
cd ssh-serverInstall dependencies:
npm installBuild the project:
npm run buildUsage
Configuration
The server uses a SQLite database (ssh.db) to store SSH credentials. The
database file will be created automatically when the server starts.
Tools
The server stores named credentials, then every remote action refers to a
credentialName. privateKeyPath must point to an existing private key
(~/ expands to your home directory).
Host keys are verified: the first time a credential connects, the server's
host key fingerprint is pinned in ~/ssh.db. Later connections that present a
different key are refused with HOST_KEY_MISMATCH. To pin a known key up
front, pass hostKeyFingerprint (the SHA256:... value printed by
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub on the server). After a
legitimate key change, remove the credential and add it again.
add_credential: save{ "name", "host", "username", "privateKeyPath", "hostKeyFingerprint"? }.list_credentials: list stored credential records.remove_credential: delete{ "name" }.ssh_exec: run a shell command with{ "credentialName", "command", "timeout" }.ssh_exec_raw: run an argv-style command array, for example{ "credentialName": "prod", "command": ["grep", "-E", "foo|bar", "/var/log/app.log"] }.scp_copy: copy one file over SFTP with{ "credentialName", "localPath", "remotePath", "direction" }.rsync_copy: copy directories or larger trees with rsync and the same transfer shape.ssh_session_start,ssh_session_send,ssh_session_read,ssh_session_end,ssh_session_list: manage interactive SSH sessions.ssh_tunnel_start,ssh_tunnel_list,ssh_tunnel_stop: manage local or remote port-forwarding tunnels.
Example:
{
"tool_name": "ssh_exec",
"arguments": {
"credentialName": "prod",
"command": "uptime",
"timeout": 120000
}
}Starting the server
npm startThe server will start running on the configured port (default settings can be modified in the source code).
CLI Usage
The CLI shares the MCP server's ~/ssh.db credential store. For remote work it
uses an OpenSSH multiplexed connection, so separate CLI invocations for the
same host, username, and key reuse one authenticated transport. Build first,
then run with npm run cli -- or via the sshcli bin after npm link:
npm run build && npm run cli -- <command>
# or, after linking:
npx sshcli <command>Commands:
sshcli creds add prod --host 1.2.3.4 --user ubuntu --key ~/.ssh/id_rsa
sshcli creds list
sshcli creds rm prod
sshcli exec prod uptime
sshcli exec prod --timeout 30000 -- df -h /
sshcli exec --raw prod grep -E 'foo|bar' /var/log/app.log
sshcli scp prod ./file.txt /tmp/file.txt toRemote
sshcli rsync prod ./dir/ /tmp/dir/ fromRemote
sshcli session prod # live interactive shell; Ctrl+D or exit to close
sshcli tunnel prod --type local --local-port 8080 --remote-host localhost --remote-port 80
sshcli cache status prod
sshcli cache close prodNotes:
For
exec, the variadic<command...>is greedy, so put options like--timeoutand--rawbefore the command tokens.exec,scp,rsync,session, andtunnelall reuse the same connection. Idle connections remain cached for 30 minutes by default.The first connection attempt for an endpoint is serialized across CLI processes. A failed attempt creates a 15-second exponential reconnect backoff (up to 5 minutes), preventing repeated calls from hammering a rate-limited host.
sessionandtunnelare foreground commands that block until the shell closes or you press Ctrl+C, respectively; exiting them does not close the shared transport.The CLI intentionally omits session send/read/end/list and tunnel list/stop commands: their in-memory state does not persist across one-shot CLI invocations. Use the foreground
sessionandtunnelcommands instead.The cache lives under
$XDG_RUNTIME_DIR/sshcli/connections(or a private per-user temporary directory). Tune it withSSHCLI_CONTROL_PERSIST_SECONDS,SSHCLI_RECONNECT_BACKOFF_MS,SSHCLI_RECONNECT_BACKOFF_MAX_MS, orSSHCLI_CACHE_DIR.OpenSSH, scp, and rsync must be available in
PATHfor their corresponding CLI commands.
Project Structure
src/- Source code directorybuild/- Compiled JavaScript outputnode_modules/- Project dependencies
Dependencies
@modelcontextprotocol/sdk: MCP protocol implementationsqlite3: SQLite database drivertypescript: Development dependency for TypeScript support
Development
To make changes to the project:
Make your changes in the
src/directoryRebuild the project:
npm run buildStart the server to test your changes:
npm startLicense
MIT
Contributing
Fork the repository
Create your feature branch
Commit your changes
Push to the branch
Create a new Pull Request
Available Tools
5 toolsadd_credentialC
Add a new SSH credential with private key file path
Inputs: host (required), name (required), privateKeyPath (required), username (required).
list_credentialsB
List all stored SSH credentials
Inputs: no named parameters.
remove_credentialC
Remove a stored SSH credential
Inputs: name (required).
rsync_copyC
Copy files/directories between local and remote server via rsync
Inputs: credentialName (required), direction (required), localPath (required), remotePath (required).
ssh_execC
Execute command over SSH using private key file path
Inputs: command (required), host (required), privateKeyPath (required), username (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: credential management (add, list, remove) is separate from remote operations (rsync, ssh_exec). The descriptions clearly differentiate between managing stored credentials and performing remote actions, eliminating any potential for misselection.
All tools follow a consistent verb_noun pattern with snake_case: add_credential, list_credentials, remove_credential, rsync_copy, ssh_exec. The naming is predictable and readable throughout, with no deviations or mixed conventions.
With 5 tools, this server is well-scoped for SSH operations. Each tool earns its place by covering essential functions: credential management (3 tools) and remote execution/copy (2 tools). This count is appropriate for the domain without being too thin or heavy.
The tool surface covers core SSH workflows: credential lifecycle (add, list, remove) and remote operations (execute, copy). A minor gap exists in credential updates (e.g., update_credential), but agents can work around this by removing and re-adding. Overall, the set provides good coverage for the stated purpose.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Model Context Protocol server for Studex tools, notifications, and profile integrations
Model Context Protocol server for todo.vu task management and time tracking.
A Model Context Protocol server for Wix AI tools
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA secure SSH server implementation for Model Context Protocol that enables remote command execution and file operations, supporting both password and key-based authentication.58MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables remote execution of shell commands across different operating systems, automatically handling platform-specific differences between Windows and Unix-like systems.1MIT
- AlicenseBqualityDmaintenanceA server that enables remote command execution over SSH through the Model Context Protocol (MCP), supporting both password and private key authentication.110 npm2MIT
- FlicenseAqualityDmaintenanceA local Model Context Protocol server that allows LLMs to securely execute shell commands on remote Linux and Windows systems via SSH connections.610 npm2-