faizbawa/mcp-remote-ssh

πŸ–₯️ Command Line🟒 Verified Active
0 Views
0 Installs

🐍 🏠 🍎 πŸͺŸ 🐧 - Full SSH access for AI agents with secret-safe environment injection and automatic output redaction. Persistent sessions, structured execution, SFTP, port forwarding β€” secrets are fed via stdin (invisible to ps) and scrubbed from all tool responses before reaching the LLM. uvx mcp-remote-ssh

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "faizbawa-mcp-remote-ssh": {
      "command": "npx",
      "args": [
        "-y",
        "faizbawa-mcp-remote-ssh"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

mcp-remote-ssh

PyPI Python License: MIT

MCP server giving AI agents full SSH access -- persistent sessions, structured command output, SFTP file transfer, port forwarding, and secret-safe environment variable injection with automatic output redaction.

Why this exists

Every other SSH MCP server is missing something: no password auth, no persistent sessions, no SFTP, no port forwarding, or no structured exit codes. This one has all of them -- plus the only MCP-level secret management that prevents AI agents from ever seeing your credentials.

Secret-Safe Environment Variables

The problem: When an AI agent needs to use API tokens, passwords, or keys on a remote server, the standard approach exposes secrets in the LLM's context window. The agent either reads the secret file (now it's in the conversation) or runs echo $TOKEN and sees the value in the output.

The solution: ssh_load_env_file reads secrets from a local file on your machine, injects them into the remote SSH session, and registers them for automatic output redaction. The AI agent can use the variables freely -- every tool response is scrubbed before it reaches the LLM.

# Agent calls this -- file is read from YOUR machine, not the remote host
ssh_load_env_file(session_id="abc", file_path="~/.secrets/prod.env")
β†’ "Loaded 3 variables from local:~/.secrets/prod.env: API_TOKEN, DB_PASS, SECRET_KEY"

# Agent tries to echo the value -- redacted automatically
ssh_execute(session_id="abc", command="echo $API_TOKEN")
β†’ {"stdout": "***\n", "exit_code": 0}

# Agent dumps the environment -- all secret values scrubbed
ssh_execute(session_id="abc", command="env | grep API_TOKEN")
β†’ {"stdout": "API_TOKEN=***\n", "exit_code": 0}

# Agent reads a file containing a secret -- also redacted
ssh_read_remote_file(session_id="abc", remote_path="/etc/app/config")
β†’ "db_password=***\ndb_host=localhost\n"

# Normal commands work perfectly -- no over-redaction
ssh_execute(session_id="abc", command="uname -a")
β†’ {"stdout": "Linux server 6.1.0 ...", "exit_code": 0}

How it works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   LLM   β”‚ ←─JSON─ β”‚   MCP Server (your machine)  β”‚ ──SSH─→ β”‚ Remote Host β”‚
β”‚ (Agent) β”‚         β”‚                              β”‚         β”‚             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚  1. Reads ~/.secrets/prod.envβ”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚  2. Parses KEY=VALUE pairs   β”‚
                    β”‚  3. Stores values in memory  β”‚
                    β”‚  4. Injects into SSH session β”‚
                    β”‚  5. Redacts ALL tool output  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. Local file read -- the env file lives on your machine, never on the remote host
  2. Shell injection via builtins -- uses read -r VAR <<< 'value' && export VAR (no process tree exposure)
  3. Stdin-based exec injection -- ssh_execute feeds secrets via stdin to a bash wrapper, so they never appear in /proc/*/cmdline
  4. Automatic redaction -- every tool response (ssh_execute, ssh_shell_send, ssh_shell_read, ssh_read_remote_file) is scrubbed before reaching the LLM
  5. Longest-first matching -- prevents partial-match corruption (e.g., abc123 is replaced before abc)

Security properties

ThreatMitigated?How
Secret in LLM context windowYesOutput redaction replaces values with ***
Secret in remote process tree (shell)YesShell builtins (read/export) don't fork
Secret in remote process tree (exec)YesSecrets fed via stdin, never in /proc/*/cmdline
LLM tries cat on the env fileN/AFile is local-only, doesn't exist on remote
LLM tries echo $VARYesOutput is redacted
Encoded/transformed secret (base64)NoOnly literal matches are redacted
MITM on first SSH connectionAcceptedAutoAddPolicy used β€” see note below

Host key policy

This server uses Paramiko's AutoAddPolicy β€” unknown host keys are accepted without prompting. This is intentional for QE/lab environments where hosts are ephemeral (Beaker, cloud instances, CI machines). The trade-off:

  • Pro: Zero-friction connections to newly provisioned machines
  • Con: Vulnerable to MITM on the very first connection to an unknown host

If you operate on untrusted networks, consider wrapping connections through a VPN or SSH bastion with pre-distributed host keys. A host_key_policy parameter may be added in a future release for strict environments.

Env file format

Standard .env format:

# Comments are ignored
API_TOKEN=your-secret-token
DB_PASSWORD="quoted values work"
SECRET_KEY='single quotes too'
export ALSO_WORKS=yes

Installation

uvx mcp-remote-ssh        # or: pip install mcp-remote-ssh

Configuration

{
  "mcpServers": {
    "remote-ssh": {
      "command": "uvx",
      "args": ["mcp-remote-ssh"]
    }
  }
}

Tools (20)

Connection

ToolDescription
ssh_connectConnect with password, key, or agent auth. Returns session_id
ssh_list_sessionsList active sessions
ssh_close_sessionClose a session and release resources

Execution

ToolDescription
ssh_executeRun a command, returns {stdout, stderr, exit_code}
ssh_sudo_executeRun with sudo elevation

Interactive Shell

ToolDescription
ssh_shell_openOpen persistent shell (preserves cwd, env, processes)
ssh_shell_sendSend text (with optional Enter)
ssh_shell_readRead current output buffer
ssh_shell_send_controlSend Ctrl+C, Ctrl+D, etc.
ssh_shell_waitWait for a pattern or output to stabilize

Secrets Management

ToolDescription
ssh_load_env_fileLoad secrets from a local env file; values never returned to the LLM
ssh_clear_secretsClear redaction registry (values become visible again)

SFTP

ToolDescription
ssh_upload_fileUpload local file to remote host
ssh_download_fileDownload remote file to local machine
ssh_read_remote_fileRead a remote text file
ssh_write_remote_fileWrite/append to a remote file
ssh_list_remote_dirList directory with metadata

Port Forwarding

ToolDescription
ssh_forward_portCreate SSH tunnel (local -> remote)
ssh_list_forwardsList active tunnels
ssh_close_forwardClose a tunnel

Quick start

ssh_connect(host="server.example.com", username="admin", password="secret")
β†’ {"session_id": "a1b2c3d4", "connected": true}

ssh_load_env_file(session_id="a1b2c3d4", file_path="~/.secrets/prod.env")
β†’ "Loaded 2 variables: API_TOKEN, DB_PASS"

ssh_execute(session_id="a1b2c3d4", command="curl -H \"Authorization: Bearer $API_TOKEN\" https://api.example.com")
β†’ {"stdout": "{\"status\": \"ok\"}", "exit_code": 0}  # token used but never visible

ssh_shell_open(session_id="a1b2c3d4")
ssh_shell_send(session_id="a1b2c3d4", data="cd /opt && make -j$(nproc)")
ssh_shell_wait(session_id="a1b2c3d4", pattern="$ ", timeout=600)

ssh_upload_file(session_id="a1b2c3d4", local_path="config.yaml", remote_path="/etc/app/config.yaml")
ssh_forward_port(session_id="a1b2c3d4", remote_port=5432, local_port=15432)

Design

Built on Paramiko (SSH) + FastMCP (MCP protocol).

  • ssh_execute uses exec_command() for clean structured output with real exit codes
  • When secrets are loaded, ssh_execute feeds exports via stdin to a bash wrapper, then execs the actual command -- secrets never appear in the process tree
  • ssh_shell_* uses invoke_shell() for persistent interactive sessions
  • All blocking Paramiko calls run in run_in_executor to stay async
  • Shell keeps a 500KB rolling buffer for shell_read polling
  • Secret redaction uses longest-first string replacement across all output paths

License

MIT

Related MCP Servers

blinkingbit-oss/execkit

πŸ¦€ 🏠 🍎 🐧 - Stateful, structured, auditable shell sessions for AI agents over local, SSH, and Docker. Secret redaction, output budgeting, SSH host-key verification, and a loopback read-only browser viewer that streams the live transcript.

πŸ–₯️ Command Line0 views
bvisible/mcp-ssh-manager

πŸ“‡ 🏠 🍎 πŸͺŸ 🐧 - Manage multiple SSH servers from one MCP: command execution, file transfer/rsync, database dump/import/query (MySQL/PostgreSQL/MongoDB), backups & restore, health monitoring, persistent sessions, tunnels, ProxyJump/bastion, and opt-in per-server security modes (readonly/restricted) with audit log. Linux, macOS & Windows OpenSSH.

πŸ–₯️ Command Line0 views
capsulerun/bash

πŸ“‡ 🏠 🍎 πŸͺŸ 🐧 - Sandboxed bash for agents. Run untrusted commands in WebAssembly sandboxes with no setup required.

πŸ–₯️ Command Line0 views
cygnussystems/cygnus-ssh-mcp

🐍 🏠 🍎 πŸͺŸ 🐧 - MCP server for SSH-based control of remote Linux, macOS, and Windows servers with 46 purpose-built tools instead of one generic command-runner: line-level file editing (no download/edit/upload round-trip), background task launch/monitor/kill, real sudo support, host aliases, recursive directory ops, archive create/extract, and full Unicode via SFTP (avoids PowerShell OEM code page corruption on Windows targets). pip install cygnus-ssh-mcp or uvx cygnus-ssh-mcp.

πŸ–₯️ Command Line0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Active

Recent health check succeeded.

Last checked: 7/29/2026, 4:31:04 AM

Unclaimed listing (imported or pending owner verification). Claim it β†’
β˜… Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.