MCP server for remote SSH access

MCP server for remote SSH access

mcp-remote-ssh•byfaizbawa

An MCP server that lets AI agents connect to and operate remote SSH hosts with persistent sessions, command execution, SFTP transfer, port forwarding, and secret-safe environment variables.

License: MIT•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Opens SSH sessions using password, key, or agent authentication and returns a session identifier.
  • •Runs commands remotely and returns structured stdout, stderr, and exit codes.
  • •Provides an interactive persistent shell that preserves working directory, environment, and processes.
  • •Loads secrets from a local environment file and automatically redacts their values from tool output.

BEST FOR

  • •AI agents that need to administer or troubleshoot remote Linux servers.
  • •Workflows where an agent must use API tokens or passwords without exposing them in the LLM context.
  • •Recording an audit log of what an agent actually ran over SSH.

ABOUT MCP-REMOTE-SSH

MCP server for remote SSH access is cataloged as an MCP server attributed to faizbawa. An MCP server that lets AI agents connect to and operate remote SSH hosts with persistent sessions, command execution, SFTP transfer, port forwarding, and secret-safe environment variables. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server for remote SSH access are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How does the server keep secrets out of the LLM context?

It reads secrets from a local env file, injects them into the remote session, and registers them so every tool response is scrubbed before reaching the LLM.

Does the server redact transformed or encoded versions of a secret?

No; only literal matches are redacted, so encoded or transformed secrets are not detected.

Is session recording enabled by default?

No, recording is off by default and must be enabled per session.

上游原版 README

在 GitHub 查看同一版本原文

README.md · b175efa17142 · 采集于 2026-11-13 12:30:35 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

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, session transcript recording, 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

Session transcripts

Recording is off by default. Enable it per session when you need an audit log of what the agent actually ran — useful for bug reproductions and test campaigns.

# Start recording on connect
ssh_connect(host="lab.example.com", username="root", password="...", record=True)

# Or toggle later
ssh_start_recording(session_id="a1b2c3d4")
ssh_execute(session_id="a1b2c3d4", command="uname -a")
ssh_get_transcript(session_id="a1b2c3d4")
→ {"recording": true, "total_entries": 2, "transcript": "[12:01:02] --- connect: lab.example.com ---\n[12:01:05] $ uname -a\nLinux ...\n[exit 0]"}

ssh_save_transcript(session_id="a1b2c3d4", path="/tmp/lab-session.log")
ssh_stop_recording(session_id="a1b2c3d4")
  • Execute/sudo output and shell send/read I/O are secret-redacted before they are recorded
  • Closing the session discards the in-memory transcript — ssh_save_transcript or ssh_get_transcript first

Installation

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

Configuration

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

Tools (24)

Connection

ToolDescription
ssh_connectConnect with password, key, or agent auth. Optional record=True to start a transcript immediately. 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)

Transcripts

ToolDescription
ssh_start_recordingStart recording execute/sudo/shell I/O for this session
ssh_stop_recordingStop recording; transcript stays available until the session is closed
ssh_get_transcriptReturn the transcript as text or JSONL (last_n optional)
ssh_save_transcriptWrite the transcript to a local file on the MCP host

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", record=True)
→ {"session_id": "a1b2c3d4", "connected": true, "recording": 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
  • Session transcripts are in-memory, off by default, and discarded when the session is closed

License

MIT

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server for remote SSH access from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-remote-ssh)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools