Allows executing SSH commands on remote Git repositories, enabling operations like cloning, pushing, pulling, and managing remote Git repositories through secure SSH connections.
Provides SSH connectivity to remote Node.js servers, allowing for deployment, configuration, and management of Node.js applications on remote hosts.
MCP SSH Agent
A Model Context Protocol (MCP) server for managing and controlling SSH connections via STDIO interface. Uses native SSH commands for maximum reliability and compatibility.
Overview
This MCP server provides SSH operations through a clean, standardized interface that can be used by MCP-compatible language models. The server automatically discovers SSH hosts from your ~/.ssh/config
and ~/.ssh/known_hosts
files and executes commands using local ssh
and scp
tools.
Example Usage
The screenshot above shows the MCP SSH Agent in action, demonstrating how it integrates with MCP-compatible clients to provide seamless SSH operations.
Key Features
- Reliable SSH: Uses native
ssh
/scp
commands instead of JavaScript SSH libraries - Automatic Discovery: Finds hosts from SSH config and known_hosts files
- Full SSH Support: Works with SSH agents, keys, and all authentication methods
- File Operations: Upload and download files using
scp
- Batch Commands: Execute multiple commands in sequence
- Error Handling: Comprehensive error reporting with timeouts
Functions
The agent provides the following MCP tools:
- listKnownHosts() - Lists all known SSH hosts, prioritizing entries from ~/.ssh/config first, then additional hosts from ~/.ssh/known_hosts
- runRemoteCommand(hostAlias, command) - Executes a command on a remote host using
ssh
- getHostInfo(hostAlias) - Returns detailed configuration for a specific host
- checkConnectivity(hostAlias) - Tests SSH connectivity to a host
- uploadFile(hostAlias, localPath, remotePath) - Uploads a file to the remote host using
scp
- downloadFile(hostAlias, remotePath, localPath) - Downloads a file from the remote host using
scp
- runCommandBatch(hostAlias, commands) - Executes multiple commands sequentially
Installation
Usage
The agent runs as a Model Context Protocol server over STDIO:
The server will output initialization messages and then wait for MCP requests over STDIO.
Integration with MCP Clients
To use this agent with an MCP-compatible client:
Alternative (more verbose) configuration:
Project Structure
Requirements
- Node.js 18 or higher
- Existing SSH configuration with key-based authentication
- SSH keys must be properly configured (no interactive password prompts)
Security Notes
- Uses existing SSH keys and configurations
- Does not store or handle passwords
- Requires pre-configured SSH key authentication
- All operations use your existing SSH setup
Troubleshooting
- Server won't start: Check that all dependencies are installed with
npm install
- SSH operations fail: Verify your SSH configuration works with standard
ssh
commands - Host not found: Ensure hosts are properly configured in
~/.ssh/config
Development
The server is implemented in JavaScript using:
@modelcontextprotocol/sdk
for MCP protocol compliance- Native
ssh
andscp
commands for reliable SSH operations ssh-config
for parsing SSH configuration files- Node.js
child_process
for command execution
The implementation prioritizes reliability and simplicity by leveraging the existing SSH infrastructure rather than complex JavaScript SSH libraries.
This server cannot be installed
A server that enables secure interaction with remote SSH hosts through standardized MCP interface, providing functions like listing hosts, executing commands, and transferring files using native SSH tools.
Related MCP Servers
- AsecurityAlicenseAqualityA simple MCP server that facilitates website fetching through a configurable server platform using stdio or SSE transport, allowing integration with tools like Cursor for streamlined access.Last updated -223PythonMIT License
- -securityFlicense-qualityA simple MCP server that allows accessing and executing shell commands on a VM machine through a web-based terminal interface, with automatic tunneling to make the VM accessible from anywhere.Last updated -392JavaScript
- -securityAlicense-qualityAn MCP server that enables secure execution of shell commands across Windows, macOS, and Linux with built-in whitelisting and approval mechanisms for enhanced security.Last updated -13JavaScriptMIT License
- -security-license-qualityA secure server that implements the Model Context Protocol (MCP) to enable controlled execution of authorized shell commands with stdin support.Last updated -Python