SuperAPIAI Directory

mcp-remote-ssh

github.com · AI developer platforms

SSH access with persistent sessions, SFTP and port forwarding, with secrets injected via stdin and redacted from output before reaching the LLM.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

Purpose

mcp-remote-ssh is a server based on the MCP protocol that provides AI agents with full remote SSH operation capabilities. It fills in the common feature gaps of other SSH MCP servers (such as lack of password authentication support, no persistent sessions, no SFTP, no port forwarding, no structured exit codes), and provides the currently unique MCP-level key management mechanism to prevent AI agents from directly touching user credentials.

Main Capabilities

  • Persistent Sessions: Supports long-term maintenance of SSH sessions for continuous interaction.
  • Structured Command Output: ssh_execute uses exec_command() to obtain clear output and real exit codes.
  • SFTP File Transfer: Built-in SFTP support for file transfer.
  • Port Forwarding: Supports SSH port forwarding.
  • Session Recording: Optional session recording feature, disabled by default, enabled per session, used to audit the commands actually run by the agent, suitable for defect reproduction and testing activities. Execution/sudo output and the I/O sent/read by the shell are key-redacted before recording, and in-memory records are discarded when the session is closed (ssh_save_transcript or ssh_get_transcript must be used first to save them).
  • Secure Environment Variable Injection for Keys: Reads keys from a local file via ssh_load_env_file, injects them into the remote SSH session, and automatically redacts them in all tool responses (ssh_execute, ssh_shell_send, ssh_shell_read, ssh_read_remote_file), ensuring keys do not reach the LLM context. Uses longest-first matching to prevent corruption from partial matches. Keys are injected via shell built-in commands (read -r VAR <<< 'value' && export VAR) or stdin, avoiding appearing in the process tree or /proc/*/cmdline.

Usage

  • Built on Paramiko (SSH) and FastMCP (MCP protocol).
  • ssh_execute uses exec_command(), and when a key is loaded, provides the export to the bash wrapper via stdin, then execs the actual command, ensuring the key does not appear in the process tree.
  • ssh_shell_* uses invoke_shell() to maintain a persistent interactive session; all blocking Paramiko calls run in run_in_executor to remain asynchronous, and the shell retains a 500KB scroll buffer for shell_read polling.
  • Environment variable files use the standard .env format; the file is located on the local machine and is not uploaded to the remote host.

Security Properties

  • Host Key Policy: Uses Paramiko's AutoAddPolicy; unknown host keys are automatically accepted without prompting. This is designed for QE/experimental environments (such as Beaker, cloud instances, CI machines), with the tradeoff that the first connection to an unknown host may be vulnerable to man-in-the-middle attacks. If operating on an untrusted network, it is recommended to use a VPN or SSH bastion host and pre-distribute host keys. Future versions may add a host_key_policy parameter.
  • Key Management: Keys are read from a local file, injected via shell built-in commands or stdin, automatically redacted across all output paths, and replaced using longest-first matching.

Applicable Scenarios

Suitable for automation tasks that require AI agents to operate remote servers via SSH, especially in temporary, experimental environments (such as QE testing, CI machines, cloud instances), and in scenarios with high requirements for key security.

Limitations

  • Currently uses AutoAddPolicy, so there is a MITM risk on the first connection to an unknown host.
  • Session recording is disabled by default and stored in memory; closing the session discards it.
  • Only .env format environment variable file support is provided.
  • Other feature details, installation commands, pricing information, etc. are not yet provided.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools