SSH, policy-gated remote access

Security

Policy-gated, audited SSH for Linux and Windows hosts: roles, approvals, and an audit log.

Your AI app calls the SSH, policy-gated remote access MCP server, which does the work through tools like run-command and destructive-command and sends the result back to the chat.

About SSH, policy-gated remote access

SSH, policy-gated remote access is a community MCP server from tufantunc, filed in our directory under security. Policy-gated, audited SSH for Linux and Windows hosts: roles, approvals, and an audit log.

SSH, policy-gated remote access runs on your own machine: your AI app starts it with the command npx -y ssh-mcp@2.30.0 and talks to it over standard input and output.

The README for SSH, policy-gated remote access lists tools such as run-command and destructive-command, which your AI app can call once the server is connected.

SSH, policy-gated remote access is listed in the official MCP registry as io.github.tufantunc/ssh-mcp, version 2.30.0.

At a glance

Publisher
tufantunc (community)
Runs
Locally on your machine
Install from
Node.js package on npm: ssh-mcp
Written in
TypeScript
License
MIT
GitHub stars
922
Official MCP registry
io.github.tufantunc/ssh-mcp

Tools SSH, policy-gated remote access gives your AI app

  • run-commandKeeps running read-only and safe commands. A destructive or privileged.
  • destructive-command, privileged-command, an interactive open-session, and.

Tool names as the SSH, policy-gated remote access README lists them. Your AI app shows the live list once SSH, policy-gated remote access is connected.

How to set up SSH, policy-gated remote access

  1. Install Node.js on the machine that runs your AI app, because SSH, policy-gated remote access starts with npx and downloads its package on first run.
  2. Check the SSH, policy-gated remote access README for keys or settings; the registry lists none that SSH, policy-gated remote access requires.
  3. Add SSH, policy-gated remote access to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the SSH, policy-gated remote access tools to confirm the connection.
  5. Run one read-only task with SSH, policy-gated remote access first, such as a call to run-command, before you allow anything that writes or sends.

SSH, policy-gated remote access compared with similar servers

  • Ida MCP Rs by blacktop has fewer GitHub stars than SSH, policy-gated remote access (917 against 922); both are community servers, and both run locally.
  • Safe Anything by erkamyaman has more GitHub stars than SSH, policy-gated remote access (971 against 922); both are community servers, and both run locally.
  • Kali by Wh0am123 has fewer GitHub stars than SSH, policy-gated remote access (889 against 922); both are community servers, and both run locally.

Before you connect SSH, policy-gated remote access

  • Give SSH, policy-gated remote access its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each SSH, policy-gated remote access tool call until you trust what it does with them.
  • Treat text that SSH, policy-gated remote access fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for SSH, policy-gated remote access on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for SSH, policy-gated remote access

How marketing and sales teams put SSH, policy-gated remote access to work, by company size. Pick the size closest to yours and start SSH, policy-gated remote access on one use case.

Small business

  • A small business can use SSH, policy-gated remote access to check its domains, logins and site for common gaps before they cost a customer's trust.
  • Owners can ask SSH, policy-gated remote access whether a tool or vendor has known issues before connecting it to customer data.
  • SSH, policy-gated remote access runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing ops can use SSH, policy-gated remote access to review what each connected app can access and remove keys nobody uses.
  • Security and web teams can connect SSH, policy-gated remote access to scan campaign sites and forms before launch, not after an incident.
  • Start with run-command and destructive-command, the tools SSH, policy-gated remote access lists first, and add more once the team trusts the results.

Enterprise

  • Enterprises can run SSH, policy-gated remote access in the security team's tooling, so marketing's agents and apps are reviewed like any other system.
  • Large orgs can use SSH, policy-gated remote access to keep evidence for audits, showing which agents reached which data and when.
  • SSH, policy-gated remote access is a community server, so have security review the code and pin a version before SSH, policy-gated remote access touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

SSH, policy-gated remote access README

From tufantunc/ssh-mcp on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

SSH MCP Server v2

SSH MCP Server is a security-first Model Context Protocol server that gives LLM agents controlled SSH access to remote hosts, with command classification, policy-based authorization, human-in-the-loop approval, and full audit logging.

The risk this server exists to manage. Giving an LLM shell access on a remote host puts private data, untrusted input and network egress in one place, Simon Willison's "lethal trifecta". Prompt injection has no general fix, so ssh-mcp assumes any command may be attacker-influenced: it classifies before executing, authorizes against a role × host-group matrix, gates destructive work behind approval, and records the decision either way. That narrows the blast radius; it does not remove the risk. Two things stay yours: never point it at a root account, and never set auto approval on a production profile. SECURITY.md has the full threat model.

Quick Start

1. Install
npm install -g ssh-mcp
2. Configure

Without a config the server still starts, so a client or directory can complete the MCP handshake and read tools/list, but every tool call is refused until you configure it, with a message naming the path below. Nothing runs on a host until this step is done. The one exception is reload-config: write the file, then call it with action: "reload" (or restart the server) to configure a server that is already running, see Reloading.

Create the config file at the path for your platform:

Platform Path
Linux ~/.config/ssh-mcp/config.toml (or $XDG_CONFIG_HOME/ssh-mcp/config.toml)
macOS ~/Library/Application Support/ssh-mcp/config.toml
Windows %APPDATA%\ssh-mcp\config.toml
[defaults]
defaultProfile = "dev"
approvalMode = "ask-destructive"

[[profiles]]
name = "dev"
host = "192.168.1.100"
port = 22
user = "deploy"           # NOT root!
auth = "key"
keyRef = "~/.ssh/id_ed25519"
role = "admin"
approvalPolicy = "auto"    # dev is permissive
chmod 700 ~/.config/ssh-mcp && chmod 600 ~/.config/ssh-mcp/config.toml

The config decides which hosts, roles and policy rules this server honours, so it checks that nobody but you can read it, and treats the two platforms differently, because the question has a much clearer answer on one of them.

Linux and macOS: enforced. The mode check above, on the file and the directory, which is why chmod 700 is in that command, since mkdir -p under the default umask leaves the directory 0755. The server refuses to start otherwise. "Only the owner" is unambiguous here and chmod is a one-line fix.

Windows: split by what the ACL actually allows. There are no mode bits, so the ACL is read instead, and read exposure and write exposure are not treated alike, because Windows is much clearer about one of them than the other.

The ACL lets another account… Default
only read the config reported, and the server starts
change the config refused
nothing (no ACL at all) refused, that is full control for everyone
…and if the ACL could not be read refused, except when icacls is absent or the check timed out

A config under %APPDATA% inherits access for you, SYSTEM and Administrators and needs nothing done to it. One created elsewhere does not: a file under C:\ inherits read for every local account and modify for every authenticated one. The message names the two icacls commands that fix it either way.

Read exposure is reported rather than refused because that is where Windows is genuinely muddier than POSIX, and refusing over it blocked a config at the documented location (#138). Write exposure is refused because it is not muddy at all: another account being able to rewrite the file that decides which hosts, roles and approval policy this server honours is an authorization bypass, not a disclosure.

Two flags move the whole thing: --strictConfigAcl refuses everything the check objects to, read-only grants included; --allowUncheckedConfigAcl reports everything and refuses nothing. Neither combination leaves you without an exit, which is the lesson of #138.

Exit statuses
Status Meaning
0 Clean shutdown
1 A defect in the server, printed with a stack trace; please report it
2 How it was invoked or configured, printed as a message, no stack

A supervisor that treats any non-zero status as a failure needs no change. One that matched on 1 to detect a startup problem should match on 2 as well.

Starting with nothing configured is not an exit-2 condition, as of the release that added introspection without a config: the server starts so it can be described, and refuses each tool call instead, except reload-config. A supervisor that used a non-zero exit to catch an unconfigured deployment should watch for starting unconfigured on stderr, or read configured from GET /health when running the HTTP transport.

3. Set credentials via environment variables
export SSH_MCP_PASSWORD="your-password"        # if using auth=password
# OR use SSH agent (recommended):
export SSH_AUTH_SOCK="$SSH_AUTH_SOCK"           # already set if agent running
4. Connect from your MCP client

Claude Code:

claude mcp add --transport stdio ssh-mcp -- ssh-mcp

Claude Desktop / Cursor / Windsurf:

{
  "mcpServers": {
    "ssh-mcp": {
      "command": "ssh-mcp",
      "env": {
        "SSH_MCP_PASSWORD": "your-password"
      }
    }
  }
}

Never pass passwords as CLI arguments, they're visible via ps aux. Use env vars, config files, SSH agent, or OS keychain.

Tools (16)

Tool Purpose readOnly destructive
list-connections Discover available hosts and connection status ✅ ,
list-sessions List active sessions per host ✅ ,
open-session Create a named interactive (stateful) or background session (ttlMs sets that session's idle timeout: it may shorten the profile's, and lengthen it only up to sessionBackgroundMaxMs for a background session (the profile's own when that is 0); 0 = never idle-expire is the profile's to set, not the call's) , ,
close-session Close a session. A background session's command is signalled (INT/TERM/KILL) before its channel is dropped , ✅
read-session-output Read output from background sessions (e.g., tail -f) ✅ ,
read-command Execute allowlisted read-only commands (ls, cat, grep, ...) ✅ ,
run-command Execute arbitrary commands (destructive/privileged need approval, unless approvalPolicy = "auto") , ,
destructive-command Runs a shell command on a profile with approvalPolicy = "client-tool", where the call is the approval; refused on any other profile (see Approval Modes) , ✅
privileged-command Execute with sudo (needs approval, unless approvalPolicy = "auto") , ✅
sftp-upload Upload a file via SFTP (replaces the destination unconditionally) , ✅
sftp-download Download a file via SFTP ✅ ,
sftp-list List a remote directory, bounded in entries and bytes ✅ ,
sftp-upload-file Stream a local file to the remote host, never through model context , ✅
sftp-download-file Stream a remote file to local disk, never through model context , ✅
signal-process Send INT/TERM/KILL to a remote PID , ✅
reload-config Show the config file's status, or re-read and apply it without a restart (see Reloading) , ✅
Streaming file transfer

sftp-upload/sftp-download move file contents through the model's context: the text is an argument on the way out and a response on the way back. That is what you want for a config snippet and exactly what you do not want for a 200 MB tarball or anything binary.

The two also differ on what they do to an existing destination, and the approved string now says which is which. sftp-upload replaces unconditionally and spells --overwrite every time, because that is what it always does; sftp-upload-file refuses unless you pass overwrite: true, and only then carries the flag. Since sftp-upload takes its content as an argument rather than naming a local file, its string also carries --bytes=<n> --sha256=<32 hex>, without that, two uploads to the same path are the same string, which means one approval covers both and an auditor cannot tell which set of bytes landed. The digest is 128 bits rather than a short prefix because that claim has to hold against a caller who picks both payloads, not only against an accidental repeat.

[policy].denylist patterns are tested against that whole string and, for every SFTP tool, against the remote path on its own, as given, lexically normalized, and read the way Windows reads it (see "Policy Engine"). A rule written for the path, such as authorized_keys$, therefore does not depend on where the string puts it or on how the file is spelled. A rule anchored on the whole string (^sftp:upload /root/.*$) still does: that layout is ours to change, so anchor on the path instead.

sftp-upload-file and sftp-download-file stream between the remote host and local disk instead. Neither the bytes nor a base64 encoding of them ever reaches the model, the response is a byte count and two paths.

The two transfer tools are off until you configure defaults.transferRoot, and refuse with an explanation until then. (sftp-list has no local side and needs none of this.) That directory is the whole of their local reach:

[defaults]
transferRoot = "/srv/ssh-mcp-transfers"
transferMaxBytes = 268435456        # 256MB per transfer
transferTimeoutMs = 300000          # 5min with no bytes moving

Checked on every call, and refused rather than degraded if any of it fails: the directory must be 0700 and owned by the account running this server, with no group- or world-writable parent, and must not overlap the ssh-mcp installation, the config directory, the audit log directory, or ~/.ssh. It must also be separate from every ssh config file read, from the file [defaults] sshConfigPath names and from every sshConfigIncludeRoots directory, even before a profile sets sshConfigHost (a reload updates that list). Caller paths are confined to it, symlinks are refused rather than followed, and a download is staged as a sibling .part file and published atomically, so a failed transfer never leaves a half-written file at the destination.

transferTimeoutMs is an idle budget, not a total one: it bounds one metadata round-trip, or one stretch of the copy with no bytes moving, and is re-armed on progress. A slow but live transfer of a large file survives it; a stalled channel still fails within one window. That is why the byte cap above does not have to be divided by it, a total budget would have made a 256MB cap mean "only if the link sustains 900 KB/s".

Not available on Windows, where the transfer root cannot yet be verified private; the two transfer tools refuse there rather than writing into a directory other accounts may be able to read.

sftp-upload-file takes an optional mode (1–511; setuid, setgid and the sticky bit are refused). Omitted, a new remote file is published 0600; an overwritten one inherits the replaced file's permission bits, its permission bits only, not its setuid or setgid.

What a transfer is authorized for includes these arguments: the string the policy engine classifies, the approval prompt a human reads, and the audit record all name --overwrite and --mode when they are given. So approving one upload to a path does not approve a different one to the same path, and an approval grant (approvalGrantTtlMs) cannot be replayed with a different mode.

Interactive Sessions

Sessions maintain state (CWD, environment variables) between commands:

Agent: open-session(name="deploy", type="interactive")
Agent: run-command(session="deploy", command="cd /opt/myapp")
Agent: run-command(session="deploy", command="git pull")    # runs in /opt/myapp
Agent: run-command(session="deploy", command="npm ci")      # CWD persists
Agent: close-session(name="deploy")
Background Sessions

Long-running processes (logs, builds):

Agent: open-session(name="logs", type="background", command="tail -f /var/log/syslog")
Agent: read-session-output(name="logs", lines=20)   # poll
Agent: close-session(name="logs")
Remote host support

Tested against Linux (Debian/bash, Alpine/busybox ash), Dropbear, and Windows OpenSSH on Windows 11.

Linux / BSD / macOS Windows OpenSSH
read-command, run-command, destructive-command, privileged-command, signal-process ✅ ✅
sftp-upload, sftp-download ✅ ✅
sftp-list ✅ ✅
sftp-upload-file, sftp-download-file ✅ ❌ (local side unverifiable)
Background sessions ✅ ✅
Interactive sessions ✅ ❌

Interactive sessions require a POSIX shell (sh, bash, ash, zsh). They work by bracketing each command with printf markers and reading $? and $PWD from a trailer, none of which exist in cmd.exe, the default shell for Windows OpenSSH. Opening one against such a host fails immediately with an explicit error rather than timing out; everything else works normally.

Setting PowerShell as the OpenSSH DefaultShell does not help: the protocol is POSIX-specific, not merely non-cmd.

Configuration

Profile options
[defaults]
defaultProfile = "dev"
sessionMaxPerConnection = 5
sessionIdleTimeoutMs = 600000       # 10min; 0 = never idle-expire (and the connection is then never idle-reaped)
sessionBackgroundMaxMs = 3600000    # 1hr absolute cap; 0 = no cap
commandTimeoutMs = 60000
commandMaxChars = 5000              # 0 = unlimited, the config spelling of --maxChars=none
commandMaxOutputBytes = 1048576     # 1MB
commandOutputTruncation = "head"    # head | tail; see below
connectionIdleReapMs = 900000       # 15min
commandQuotaPerDay = 0              # 0 = unlimited; circuit breaker for runaway agents
approvalGrantTtlMs = 0              # 0 = always prompt; see "Approval Grants"
approvalMode = "ask-destructive"    # auto | ask-destructive | ask-all | deny | client-tool
# transferRoot = "/srv/ssh-mcp-transfers"   # enables the streaming file tools; see above
transferMaxBytes = 268435456        # 256MB per streaming transfer
transferTimeoutMs = 300000          # 5min with no bytes moving (idle, not total)

[[profiles]]
name = "prod-web-1"
host = "10.0.1.50"
port = 22
user = "deploy"
auth = "agent"                      # agent | key | password | keychain
keyRef = "~/.ssh/id_ed25519"        # for auth=key
keychainEntry = "ssh-mcp/prod"      # for auth=keychain (requires @napi-rs/keyring)
via = "bastion"                     # ProxyJump, route through bastion profile
group = "prod"                      # Policy tier: prod | staging | dev, or your own (see [policy])
workdir = "/var/www"
trustedHostKey = "SHA256:..."       # Pin host key (optional)
tty = false
role = "operator"                   # viewer | operator | admin
readOnly = false
approvalPolicy = "ask-all"
cert = false                        # SSH CA cert auth, auto-detects keyRef-cert.pub
announceAgent = true                # Send AI_AGENT=ssh-mcp to this host (see below); clear it for a host you do not control
keyboardInteractive = "off"         # "empty": answer keyboard-interactive rounds with '' (Dell iDRAC7/8); "password": also answer one hidden Password prompt with the password (VMware ESXi with PasswordAuthentication no)
connectTimeoutMs = 20000            # ceiling on connecting and logging in, 1000 to 600000; raise it for a host with a slow login
sessionMaxPerConnection = 3         # per-profile override
sessionIdleTimeoutMs = 300000       # stricter for prod
commandQuotaPerDay = 200            # per-profile override
maxChars = 2000                     # per-profile override; stricter for prod
outputTruncation = "tail"           # per-profile override
transferMaxBytes = 16777216         # per-profile override; transferRoot is not per-profile
transferTimeoutMs = 60000           # per-profile override

# Optional. Merged over the built-in role matrix; see "Policy Engine" below.
# roleBindings is keyed by role and then by tier, so the block below changes
# operator on prod and leaves operator's other tiers, and viewer and admin,
# on their defaults.
[policy]
denylist = ["^terraform\\s+destroy", "\\.ssh/authorized_keys$"]

[policy.roleBindings.operator]
prod = ["read-only", "safe", "destructive"]

commandOutputTruncation chooses which end of a command's output survives commandMaxOutputBytes (counted in characters, as that cap always has been). The default, "head", keeps the start, unchanged behaviour, which can run past the cap by the last chunk read. Set it to "tail" when the recent end is the part worth keeping: grep pattern /var/log/big.log, a log window, or any command whose answer is "what happened last". In head mode an over-cap grep returns the oldest matches and silently drops the rest, which can read as "nothing recent happened"; tail mode drops from the front instead and returns at most the cap, starting at the first whole line, so redaction does not see a line whose name was cut off (only output with no line break inside the cap is cut mid-line). While the command runs, tail mode holds a few times the cap per stream. Per-profile override: outputTruncation.

Unknown sections and keys are a startup error, not a warning, so a typo cannot leave you running defaults you thought you had overridden. That extends to role and tier names: every one you write under [policy.roleBindings] has to be reachable by some profile, and every profile's role and tier has to resolve to real bindings. Both directions are checked at startup and on every reload.

Every profile needs a name of its own. Two profiles with the same name are a startup error, and a reload refuses them too; the error names the two entries by index (profiles[2].name repeats profiles[0].name), not by the name. Before this release such a config started, and the first of the two was used.

Host-side identification

Every command this server runs announces itself to the host as the environment variable AI_AGENT=ssh-mcp, so an operator can tell an agent's session from a person's from anything on the host that reads the session environment, a /etc/profile snippet or a ForceCommand wrapper, for instance. It covers all three channels a command can run on: one-shot commands, background sessions and interactive sessions. SFTP transfers do not carry it, because the SSH library this server uses offers no way to send an environment request on a subsystem channel.

The variable only lands in the session if the host opts in with AcceptEnv AI_AGENT in sshd_config. Without that line sshd ignores it and the session environment is unchanged, measured against Dropbear, which has no AcceptEnv mechanism at all, and against Windows OpenSSH on a default configuration: the command runs, the exit code is unchanged, the variable is simply absent.

The request is nevertheless sent to every host, opted in or not. AcceptEnv is the server's policy about what it stores; it is not a gate on what this client transmits. A host that has not opted in, including one that is hostile, can still see on the wire that an agent rather than a person is driving the session. That is why announceAgent = false exists on the profile: set it for any host you do not control and nothing is sent to it. It is on by default, because the operators who benefit are the ones running the hosts you do control.

No version is sent, deliberately. A version would narrow a hostile host to one specific build; the tool's name alone does not. (The SSH transport already discloses the library version in its identification string, which is one library's version across every program that uses it.)

Treat the variable as a courtesy label, not an attestation. Any SSH client can set it and any agent can omit it, so it is useful for attributing sessions you already trust and must not be used as an authorization or intrusion-detection input. Authoritative attribution belongs to the key or principal that authenticated.

ProxyJump (Bastion)

Reach internal hosts behind a bastion/jump server. The via field specifies a profile name to tunnel through:

[[profiles]]
name = "bastion"
host = "bastion.example.com"
user = "deploy"
auth = "agent"

[[profiles]]
name = "internal-db"
host = "10.0.1.50"                 # private IP, not directly reachable
user = "dbadmin"
auth = "key"
keyRef = "~/.ssh/db_key"
via = "bastion"                     # tunnel through bastion

No agent forwarding, only a TCP tunnel via forwardOut. The bastion stays connected and reusable for multiple internal hosts.

Using ~/.ssh/config

A profile can take its host, port, user, key, connect timeout and jump host from ~/.ssh/config by naming an alias:

[defaults]
# Optional. Defaults to ~/.ssh/config, and is read only if a profile sets sshConfigHost.
sshConfigPath = "~/.ssh/config"
# Optional. Directories an Include may read from besides ~/.ssh.
sshConfigIncludeRoots = ["~/.orbstack/ssh"]

[[profiles]]
name = "web1"
sshConfigHost = "web1"      # alias in ~/.ssh/config
group = "prod"
role = "operator"

[[profiles]]
name = "bastion"
sshConfigHost = "jump"
group = "prod"

Only profiles that name an alias are resolved; no other host in the file becomes reachable. group, role, policy and every other ssh-mcp setting stay in config.toml.

The file is read as data. Nothing in it is ever executed, and ssh -G is not used.

Precedence, per field: a value written in config.toml wins, even when it equals the default (port = 22 beats Port 2200). Otherwise the ssh config's value is used, otherwise ssh-mcp's default. As in OpenSSH, with no HostName the host is the alias itself, and with no User it is your local user name.

Directives
Read HostName (%h, %%), Port, User (%%), IdentityFile, CertificateFile, ConnectTimeout, ProxyJump, Include, and the Host and Match blocks that select them
Refused (loading the config fails with an error naming the profile) when they apply to that alias: ProxyCommand other than none, LocalCommand, RemoteCommand, KnownHostsCommand, ProxyUseFdpass yes, PermitLocalCommand yes, CanonicalizeHostname other than no, a multi-hop ProxyJump (when via is not set in config.toml), Match exec and Match canonical; and Match … final anywhere in the file
Ignored everything else, including StrictHostKeyChecking, UserKnownHostsFile, HostKeyAlias, ForwardAgent, port forwards, IdentityAgent, IdentitiesOnly and the algorithm lists. Host-key trust stays with --hostKeyMode and trustedHostKey

Lines are split as OpenSSH splits them: the keyword is separated from its value by spaces, tabs or one =, and may be wrapped in double quotes ("Host" web1). An unterminated quote, any other quote or a backslash in a keyword, or a keyword that is not plain letters and digits fails the load, as OpenSSH fails on it too. HostName, User, Port, ConnectTimeout, ProxyJump, IdentityFile and CertificateFile with no value, an empty "" or a second value fail the load where they apply. OpenSSH reads ProxyJump as written, up to a #, without removing quotes or escapes, so a quoted or escaped ProxyJump, or one with a # inside it, fails the load too.

Errors name the profile, the alias, the directive, and the file and line, never the directive's value. A resolution failure fails the whole config load: startup exits, and a reload is refused and the previous config stays live. A missing ssh config file fails the load too, once a profile sets sshConfigHost. sshConfigPath expands ~ and ~/ only, and a relative path resolves against the server's working directory.

Matching. Host patterns are case-sensitive, as in OpenSSH. Match supports all, host, originalhost, user and localuser, also written key=value, and Match all cannot be combined or negated. A Match line's criteria are evaluated left to right and evaluation stops at the first one that does not match; a criterion after it is not looked at, so any other criterion fails the load only when evaluation reaches it. Match host and originalhost compare case-insensitively, while Host, user and localuser are case-sensitive. Match exec and Match canonical refuse the profile when evaluation reaches them. As with ssh -o, a host or user written in config.toml is what Match host and Match user compare against. An alias that only Host *, Match all or a non-host Match criterion matches is "alias not found", not a host named like the alias, because that is almost always a typo. The first value found wins, except IdentityFile and CertificateFile, which accumulate.

Keys. IdentityFile and CertificateFile must be absolute or start with ~/ once ~, %%, %d, %h, %p, %r, %u and %n are expanded; any other % token or ${ fails the load. In HostName only %h and %% are expanded, and in User only %%; any other % token fails. Port must be 1–65535 and ConnectTimeout a whole number of seconds from 1 to 600, or loading fails. ConnectTimeout becomes the profile's connectTimeoutMs, which bounds the whole login (connection, key exchange and authentication), not only the TCP connect. IdentityFile is consulted only when config.toml sets no keyRef and its auth is absent or "key": under "agent", "password" or "keychain" it is not read. Then the first IdentityFile that exists as a regular file wins and sets keyRef; auth is not changed, so with auth absent the key is used alongside the SSH agent, as ssh does. Under auth = "agent", which is what an absent auth means, a key that is encrypted while no passphrase is set (SSH_MCP_PASSPHRASE or SSH_MCP_<NAME>_PASSPHRASE) is skipped when SSH_AUTH_SOCK names an agent, and the agent alone is used; with no agent, or under an explicit auth = "key", the key is always offered. IdentityFile none is skipped, and so is any path ending in .pub, as agent and 1Password setups point IdentityFile at a public key. If every applicable IdentityFile is a .pub, no keyRef is set and the profile uses the agent alone. If a non-.pub IdentityFile applies but none of those is an existing regular file, loading fails. A CertificateFile is honoured only when the profile has a keyRef and it is that key's own -cert.pub (cert = true); any other path fails the load, and without a keyRef it is ignored.

ProxyJump. none means no jump host. One hop, [user@]host[:port], must name another profile, by its sshConfigHost first and then by its name; that profile becomes via and keeps its own policy. A user@ or :port that disagrees with that profile fails the load, and so does a hop host that matches more than one profile, an IPv6 hop host, more than one hop (chain via in config.toml instead), or a cycle between derived vias. ProxyCommand is allowed only as none: a ProxyCommand none obtained before ProxyJump disables the jump, and any other ProxyCommand that applies fails the load, even where OpenSSH would ignore it after a ProxyJump. via written in config.toml wins and ProxyJump is then not consulted.

Include. Relative paths resolve against ~/.ssh, ~ and ~/ expand to your home, and a ~user path fails the load. * and ? are allowed in the last path segment only (config.d/*); as in OpenSSH they do not match a leading ., so config.d/* skips config.d/.old unless the pattern itself starts with .. A [ anywhere in an Include argument fails the load, since OpenSSH would read it as a bracket class. The real path of every included file, after symlinks, must stay under ~/.ssh or under a directory listed in [defaults] sshConfigIncludeRoots. Nesting is limited to 16 levels and 256 files in all, and missing targets are skipped. As in OpenSSH, a target or wildcard match that is a dangling symlink, that runs through a regular file, or that sits in a directory that cannot be searched is skipped too, while a symlink that leads through one of those, or any other target that cannot be read (a symlink loop, say), fails the load. Non-regular files are refused. An Include inside a Host block applies only when that block matches.

If your ~/.ssh/config includes a file outside ~/.ssh, such as OrbStack's Include ~/.orbstack/ssh/config or a Colima config, list its directory in sshConfigIncludeRoots (["~/.orbstack/ssh"]); without that, the config fails to load as soon as any profile sets sshConfigHost. Each entry must be absolute or start with ~/, an entry that does not exist is ignored, and a filesystem root (/, C:\) fails the load. Files under these directories pass the same permission, size and symlink checks as those under ~/.ssh. The top-level file named by sshConfigPath may live anywhere.

Permissions. Every ssh config file must be at most 1 MiB, not group- or world-writable (0644 is fine: it holds no secrets), and owned by you or root. On Windows the config ACL check applies.

sshConfigHost is a connection field for reloading. reload-config re-reads ~/.ssh/config and closes only the connections whose resolved values changed, and its status lists each ssh config file read (including Included ones) with its sha256. The file read is [defaults] sshConfigPath, default ~/.ssh/config.

SSH CA Certificates

For enterprise setups with a central SSH Certificate Authority:

[[profiles]]
name = "prod-db"
host = "db.internal"
user = "admin"
auth = "key"
keyRef = "~/.ssh/id_ed25519"
cert = true                         # enable CA cert auth

The certificate file is auto-detected using OpenSSH convention (keyRef + -cert.pub, e.g. ~/.ssh/id_ed25519-cert.pub). You can override the path with SSH_MCP_<NAME>_CERT env var. The cert is concatenated with the private key per ssh2 convention.

Credential Resolution Order
  1. SSH agent (SSH_AUTH_SOCK), no key material in process memory
  2. OS keychain (macOS Keychain / Windows Credential Manager / Linux Secret Service), requires auth = "keychain" and @napi-rs/keyring
  3. Environment variables, SSH_MCP_PASSWORD, SSH_MCP_KEY, SSH_MCP_SUDO_PASSWORD, or profile-specific SSH_MCP_<NAME>_PASSWORD
  4. Key file, keyRef path or SSH_MCP_KEY env var

For a profile with sshConfigHost, the first existing IdentityFile fills keyRef only when the profile has none and its auth is absent or "key" (see Using ~/.ssh/config).

Never CLI arguments. v2 removes --password, --sudoPassword, --suPassword entirely.

Read the rest of the SSH, policy-gated remote access README on GitHub

Questions about SSH, policy-gated remote access

What is the SSH, policy-gated remote access MCP server?

Policy-gated, audited SSH for Linux and Windows hosts: roles, approvals, and an audit log. SSH, policy-gated remote access is maintained by tufantunc on GitHub at tufantunc/ssh-mcp, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the SSH, policy-gated remote access MCP server?

Add SSH, policy-gated remote access to your AI app's MCP config with the command npx -y ssh-mcp@2.30.0. In Claude Code, run claude mcp add --transport stdio ssh -- npx -y ssh-mcp@2.30.0. To run SSH, policy-gated remote access this way you need Node.js installed.

Does SSH, policy-gated remote access need an API key?

The registry lists no required keys for SSH, policy-gated remote access. Check the SSH, policy-gated remote access README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is SSH, policy-gated remote access an official MCP server?

No. SSH, policy-gated remote access is a community server maintained by tufantunc. Community servers can be excellent; read the code and the open issues before you give SSH, policy-gated remote access access to company data.

What license is SSH, policy-gated remote access under?

SSH, policy-gated remote access is released under the MIT license, according to its GitHub repository. The license covers the code of SSH, policy-gated remote access; the service it connects to has its own terms.