Skip to main content
Glama

πŸ›‘οΈ SSH Remote MCP β€” Matlock Edition

"Never trust raw command piping. Verify state forensically. Contain the blast radius."
An enterprise-grade Model Context Protocol (MCP) server engineered with Grab's Matlock Agent Mindset for safe, deterministic, and audited remote infrastructure management.


⚑ The Problem with Commodity SSH MCPs

Traditional SSH MCPs treat the remote server like a dumb stdin/stdout pipe:

  1. Blind Execution / Command Injection: Raw multiline scripts and unescaped quotes corrupt remote configuration files or cause hanging heredocs.

  2. Zero Blast-Radius Control: A hallucinated rm -rf / or recursive permission change runs unconditionally, permanently bricking nodes.

  3. No Forensic Verification: Commands returning exit code 0 are assumed successful, even when background services fail to bind ports or immediately enter crash loops.

  4. Dangerous Remote File Mutations: Overwriting remote files without backup snapshots or unified diff inspection leads to silent data loss.

  5. Session Hanging on Long Tasks: Builds, container pulls, or migrations cause client stdio timeouts.


Related MCP server: ssh-pro-mcp

πŸ›οΈ The Matlock Architecture

                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚           AI Agent / Client            β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                           β”‚ JSON-RPC (MCP)
                                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                 SSH REMOTE MCP                                         β”‚
β”‚                                                                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ 3-Tier Blast Radius   β”‚  β”‚   Forensic Assertion    β”‚  β”‚   Safe SFTP Engine      β”‚  β”‚
β”‚  β”‚     Containment       β”‚  β”‚         Engine          β”‚  β”‚  (Atomic + Diff + Roll) β”‚  β”‚
β”‚  β”‚                       β”‚  β”‚                         β”‚  β”‚                         β”‚  β”‚
β”‚  β”‚ β€’ Tier 1: Safe Read   β”‚  β”‚ β€’ Port Listening Verify β”‚  β”‚ β€’ Auto .matlock.bak     β”‚  β”‚
β”‚  β”‚ β€’ Tier 2: Mutating    β”‚  β”‚ β€’ Process Liveness Checkβ”‚  β”‚ β€’ Base64 Safe Transfer  β”‚  β”‚
β”‚  β”‚ β€’ Tier 3: Block/Gate  β”‚  β”‚ β€’ File State Check      β”‚  β”‚ β€’ Unified Git Diffs     β”‚  β”‚
β”‚  β”‚   (Safety Bypass Tkn) β”‚  β”‚ β€’ HTTP Health Probe     β”‚  β”‚ β€’ 1-Click Rollback      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚   Background Task Envelope       β”‚  β”‚     Multiplexed Session & Profile Store β”‚     β”‚
β”‚  β”‚   (Detached + Poll + Kill)       β”‚  β”‚     (~/.matlock/profiles.json)          β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                           β”‚ SSH2 / SFTP Keepalive Pool
                                           β–Ό
                                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                 β”‚    Remote Host    β”‚
                                 β”‚ (Homelab / Cloud) β”‚
                                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧰 Available Tools (10 Primitives)

1. Command Execution & Telemetry

Tool

Description

Matlock Feature

ssh_exec

Executes shell commands on remote target.

3-Tier classification (TIER_1_SAFE, TIER_2_MUTATING, TIER_3_DESTRUCTIVE), post-flight assertions, exit-code validation.

ssh_host_diagnose

Gathers a full forensic host telemetry snapshot.

OS, kernel, uptime, load avg, memory (MB), disk usage, Docker containers, listening ports, top processes in 1 roundtrip.

2. Long-Running Task Envelope

Tool

Description

Matlock Feature

ssh_exec_background

Detaches long tasks into background runner subshells.

Generates task ID, runner script, captures exit codes to disk without hanging MCP stdio.

ssh_task_poll

Polls background task status.

Process liveness check, exit code inspection, and real-time log tailing.

ssh_task_kill

Signals or terminates background task.

Supports SIGTERM / SIGKILL cleanly.

3. Safe Atomic SFTP Primitives

Tool

Description

Matlock Feature

sftp_read_file

Reads file content with line slicing.

Line range parameters (startLine, endLine), SHA-256 integrity hash.

sftp_write_safe

Atomic file write with automatic backup.

Creates .matlock.bak.<timestamp>, base64 transfer, atomic swap, and returns a Unified Diff (diff -u).

sftp_rollback_file

Restores modified file from backup.

Atomic restoration from .matlock.bak.latest or specific backup.

sftp_list_dir

Structured directory file explorer.

Parsed permissions, owner, size, and modification timestamps.

4. Profile, Key Bootstrap & Credential Isolation

Tool

Description

Matlock Feature

ssh_profile_manage

Manages saved hosts in ~/.matlock/profiles.json.

Zero raw private key transmission across MCP parameters; references credentials securely by profile name.

ssh_key_bootstrap

1-Click Password to Key Setup.

Tα»± tαΊ‘o SSH key, kαΊΏt nα»‘i bαΊ±ng password, inject vΓ o authorized_keys, xΓ‘c minh vΓ  lΖ°u profile khΓ΄ng cαΊ§n gΓ΅ pass nα»―a.

mcp_auto_install

Universal Agent IDE Installer.

CΓ i Δ‘αΊ·t tα»± Δ‘α»™ng ssh-remote-mcp vΓ o mọi IDE (Claude, VS Code, Cursor, Windsurf...).


πŸ”’ 3-Tier Blast Radius Containment

  • Tier 1 (Safe / Telemetry): Read-only inspection (ls, cat, df, free, ps, docker ps, ss). Automatically executed.

  • Tier 2 (Mutating): System mutations (mkdir, systemctl restart, docker compose up -d, apt install). Executed with pre/post flight forensic assertions.

  • Tier 3 (Destructive): High-risk operations (rm -rf /, mkfs, dd to /dev/sd*, shutdown, reboot, iptables -F, kill -9 1). Interpreted and BLOCKED before transmission unless explicit confirmDangerToken: true is supplied.


πŸš€ 1-Click Universal Auto-Installer (CΓ i tα»± Δ‘α»™ng cho mọi Agent IDE)

ssh-remote-mcp tΓ­ch hợp sαΊ΅n bα»™ Auto-Installer thΓ΄ng minh, tα»± Δ‘α»™ng quΓ©t vΓ  cΓ i Δ‘αΊ·t vΓ o mọi Agent IDE cΓ³ trΓͺn mΓ‘y tΓ­nh cα»§a bαΊ‘n (Claude Desktop, VS Code Native MCP, Antigravity, Cursor, Windsurf, Cline, Roo Code, Continue, Zed):

# 1-Click CΓ i Δ‘αΊ·t tα»± Δ‘α»™ng qua NPX (tα»± Δ‘α»™ng nhαΊ­n diện IDE vΓ  cαΊ₯u hΓ¬nh an toΓ n):
npx github:nguyenquocanhz/ssh-remote-mcp install

# HoαΊ·c cΓ i tα»« local repo:
node dist/index.js install

# Xem danh sΓ‘ch cΓ‘c IDE được phΓ‘t hiện trΓͺn mΓ‘y:
npx github:nguyenquocanhz/ssh-remote-mcp list

# CΓ i Δ‘αΊ·t Γ©p buα»™c cho tαΊ₯t cαΊ£ IDE (kể cαΊ£ chΖ°a khởi tαΊ‘o config):
npx github:nguyenquocanhz/ssh-remote-mcp install --all

✨ TΓ­nh nΔƒng an toΓ n cα»§a Auto-Installer:

  • KhΓ΄ng ghi Δ‘Γ¨ dα»― liệu cΕ©: Giα»― nguyΓͺn 100% cΓ‘c MCP server Δ‘ang cΓ³ (zmp-mcp, unityMCP,...).

  • Tα»± Δ‘α»™ng sao lΖ°u: TαΊ‘o file snapshot .matlock.bak.<timestamp> trΖ°α»›c khi chỉnh sα»­a.

  • Hα»— trợ Δ‘a nền tαΊ£ng: Windows, macOS, Linux.


βš™οΈ CαΊ₯u hΓ¬nh thα»§ cΓ΄ng (Manual Configuration)

NαΊΏu bαΊ‘n muα»‘n cαΊ₯u hΓ¬nh thα»§ cΓ΄ng vΓ o file config cα»§a IDE:

CΓ‘ch 1: ChαΊ‘y trα»±c tiαΊΏp qua NPX tα»« GitHub:

{
  "mcpServers": {
    "ssh-remote-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "github:nguyenquocanhz/ssh-remote-mcp"
      ]
    }
  }
}

CΓ‘ch 2: ChαΊ‘y tα»« source code cα»₯c bα»™:

cd D:\ssh-remote-mcp
npm install
npm run build

CαΊ₯u hΓ¬nh trong mcp_config.json:

{
  "mcpServers": {
    "ssh-remote-mcp": {
      "command": "node",
      "args": [
        "D:\\ssh-remote-mcp\\dist\\index.js"
      ]
    }
  }
}

πŸ§ͺ Verification & Evidence

Run the integrated automated forensic test suite:

node test-matlock.js

Verified against Homelab Node (192.168.100.169):

  • βœ… ssh_host_diagnose: OS Ubuntu 24.04.5 LTS, 15 Docker containers detected (zaloapp-backend healthy on port 8088).

  • βœ… ssh_exec: Post-flight assertions verified Port 8088 listening and cloudflared active.

  • βœ… Blast-Radius: Destructive rm -rf / blocked by Matlock guardrails.

  • βœ… Safe SFTP: Atomic backup created, unified diff generated, rolled back cleanly.

  • βœ… Background Envelope: Detached runner script executed for loop, polled output, and returned exit code 0.

Available Tools

12 tools
mcp_auto_installB

Automatically detect and install/configure ssh-remote-mcp (or any MCP server) into all Agent IDEs on this computer (Claude Desktop, VS Code, Cursor, Windsurf, Antigravity, Cline, Roo Code, Zed, Continue).

Inputs: mode, dryRun, forceAll, targetIdeIds.

sftp_list_dirB

List remote directory entries with structured file metadata (type, permissions, owner, size, modified date).

Inputs: dirPath (required), target.

sftp_read_fileB

Safely read remote file with line range slicing (startLine/endLine) and SHA-256 integrity checksum.

Inputs: filePath (required), target, endLine, maxBytes, +1 more.

sftp_rollback_fileC

Instantly rollback a modified remote file to its previous .matlock.bak snapshot.

Inputs: filePath (required), target, backupPath.

sftp_write_safeA

Safe atomic remote file write: creates automated remote backup (.matlock.bak.), writes atomically, and returns a unified diff patch and SHA-256 hashes.

Inputs: content (required), filePath (required), target, createBackup.

ssh_execB

Execute shell command on remote host with Matlock 3-Tier blast-radius containment and post-flight state assertions (verifies listening ports, process liveness, file existence). Blocks destructive operations unless confirmed.

Inputs: command (required), env, target, timeoutMs, +3 more.

ssh_exec_backgroundA

Launch long-running command in a detached background subshell (avoids client timeout). Returns a taskId to poll logs and status.

Inputs: command (required), target, taskTag, workingDir.

ssh_host_diagnoseB

Comprehensive host telemetry snapshot in a single round-trip: OS, Kernel, Uptime, Load Avg, RAM, Disk, Docker containers, Listening Ports, and Top Processes.

Inputs: target.

ssh_key_bootstrapA

1-Click SSH Key Bootstrap: If you only have a VPS password, this tool automatically generates a local SSH key pair, connects via password, securely installs the public key into ~/.ssh/authorized_keys, verifies key-based login, and saves a named profile so you never need to use passwords again.

Inputs: host (required), password (required), port, keyName, +2 more.

ssh_profile_manageB

List, save, or remove saved SSH host profiles in ~/.matlock/profiles.json.

Inputs: action (required), profile, profileName.

ssh_task_killC

Terminate or signal a running background task by taskId.

Inputs: taskId (required), signal, target.

ssh_task_pollA

Check status, exit code, and inspect log tail of a background task launched via ssh_exec_background.

Inputs: taskId (required), target, tailLines.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 12 tool updatesv1.0.0
    • First observedmcp_auto_install
    • First observedsftp_list_dir
    • First observedsftp_read_file
    • First observedsftp_rollback_file
    • First observedsftp_write_safe
    • First observedssh_exec
    • First observedssh_exec_background
    • First observedssh_host_diagnose
    • First observedssh_key_bootstrap
    • First observedssh_profile_manage
    • First observedssh_task_kill
    • First observedssh_task_poll

TDQS

A3.5/5.0

Scored across 12 tools

Disambiguation4/5

Tools are largely distinct by resource and action: foreground vs background execution, task lifecycle, SFTP file operations, diagnostics, profiles, and setup. Minor overlap exists between ssh_profile_manage and ssh_key_bootstrap (both can save profiles), and mcp_auto_install is tangential to remote SSH operations but clearly described.

Naming Consistency4/5

All names use snake_case with consistent resource prefixes (ssh_, sftp_, mcp_). However action ordering varies (ssh_exec vs ssh_task_poll) and mcp_auto_install breaks the prefix-based pattern, so it is not perfectly uniform.

Tool Count5/5

12 tools is well within the ideal range for an SSH remote management server, covering execution, background tasks, file transfer, diagnostics, profile management, and setup without bloat.

Completeness4/5

Core workflows are covered: command exec, background task lifecycle, file read/write/list/rollback, host diagnostics, profile management, key bootstrap, and installer. Missing explicit remote file delete/mkdir/chmod or connection tunneling, but those can be achieved via ssh_exec.

Maintenance

ActivitySlowing
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to securely execute commands on remote hosts via SSH and SFTP, with persistent shells, file transfers, screenshots, and an audit log.
    5
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to manage remote servers via SSH, including command execution, multi-host batch operations, SFTP file transfer, background job handling, DevOps diagnostics, port tunneling, and safety guardrails like high-risk command blocking and read-only mode.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to remotely execute shell commands and transfer files on SSH hosts, including jump-host tunneling, background tasks, resumable transfers, and optional approval of destructive commands, while SSH credentials remain in the local process. It runs over stdio or a streamable HTTP daemon and supports auditing, allow/deny lists, and multiple authentication methods.
    ISC
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to run shell and sudo commands on remote machines through profile-driven SSH sessions, with explicit target guards that prevent commands from hitting the wrong host. It offers bucketed inventory lookup, connectivity diagnostics, keepalive-based connection resilience, and credential-safe configuration management.
    16,179 npm
    MIT