MCP SSH Gateway logo

MCP SSH Gateway

Runs stateful SSH shells for AI agents with command status, interactive input, paging, signals, and remote file operations.

Install MCP SSH Gateway

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "mcp-ssh-gateway": {
      "command": "uvx",
      "args": [
        "mcp-ssh-gateway"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

uvx mcp-ssh-gateway

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

MCP SSH Gateway MCP server connects AI agents to configured SSH hosts through stateful shell sessions. It reports exit codes, distinguishes completed, running, waiting, interrupted, and timed-out commands, and exposes output paging for long responses. Use it when an agent needs repeatable terminal access to Linux hosts or supported router CLIs without a separate daemon or cloud service.

Use cases

  • Run commands on configured Linux hosts
  • Continue work in stateful remote shells
  • Inspect and edit remote files over SSH
  • Handle interactive prompts and long-running commands
  • Operate supported Keenetic router CLIs

Key features

  • Stateful SSH shell sessions
  • Immediate command exit codes
  • Paged output with offsets and tails
  • Interactive input and Ctrl+C signals
  • SFTP or shell-based remote file operations
  • Keenetic router CLI support

Tools7

What MCP SSH Gateway lets your agent do. Expand a tool for its parameters.

Self-reported~197 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

12/12 checks healthy over the last 42d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 12d ago via OSV.dev · mcp-ssh-gateway (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars3Stargazers on the source repository.
Last commit2mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed7Callable tools this server registers over MCP.
Directory activity4 viewsConfig copies, upvotes, and views on AllMCPs.

How MCP SSH Gateway works

What MCP SSH Gateway MCP server does

MCP SSH Gateway MCP server gives an MCP client access to remote machines over SSH. Each session is a real shell, so directory changes, environment variables, and virtual environments remain available for later commands in that session. Starting run without a session ID creates a new shell; passing the returned ID continues the existing one.

The gateway can work with configured Linux hosts and supports a Keenetic router CLI or router Linux shell through the same interface. It uses Paramiko as its direct dependency and runs locally as an MCP process rather than requiring a daemon or hosted service.

How it works

The gateway reports when a command has actually finished instead of inferring completion from a quiet terminal. Completed commands include an exit code, including non-zero codes for ordinary command failures. A command that exceeds the wait period returns a running status, after which the agent can call read to collect more output.

Interactive programs are represented as waiting_input when they request input, encounter a password prompt, or leave an unclosed quote. The agent can provide text with signal or interrupt the process with Ctrl+C. Long output is returned in pages, with fields indicating remaining lines and allowing the agent to read from an offset or request the tail. The session retains up to the documented buffer limit; output beyond that limit can be reported as dropped.

Setup and configuration

MCP SSH Gateway MCP server requires Python 3.11 or later, or installation through uvx, and SSH access to a host under the operator’s control. With an existing SSH configuration, start it using uvx mcp-ssh-gateway --import-ssh-config; hosts in the SSH config become available to the gateway. The package can also be installed with pip install mcp-ssh-gateway and launched as mcp-ssh-gateway.

For explicit definitions, provide a servers.json file containing server names, host addresses, users, and either key or password authentication. Use --servers-config with an absolute path to that file. Configuration values can reference environment variables, which must be supplied through the MCP client’s environment block.

The documented client configurations include Claude Desktop, Cursor, Claude Code, VS Code, and Codex. The server uses stdio transport in those examples. A first uvx launch may download the package, and the Codex example sets a startup timeout for that case.

Tools and capabilities

  • server_list returns configured servers and their open sessions.
  • run executes a command, creates a shell when no session ID is supplied, and accepts controls for waiting, timeouts, shell selection, and output lines.
  • read retrieves unread output from a session, waits for running commands, or reads by tail and offset.
  • signal sends standard input, Ctrl+C, or Ctrl+D.
  • session_close closes a shell. Each server permits a limited number of sessions, with a default maximum of eight.
  • file lists, reads, writes, and edits remote files over SFTP or through the shell when SFTP is unavailable. Reads support filtering, and edits can verify expected file content with a SHA-256 value.
  • server_add can add a server to servers.json only when the gateway is started with --allow-add-server.

Limitations and notes

A new run call without a session ID does not share state with earlier shells. Agents should retain and reuse the returned session ID, then close sessions when finished. The gateway has a small fixed tool surface, and it does not provide a cwd argument; commands that need a particular directory should change directory within the shell command.

Non-zero command exit codes are returned as command results rather than MCP tool failures. Long-running commands require follow-up reads, while interactive commands require a signal response or interruption. Passwords and other referenced configuration variables must be provided by the client environment, and the SSH host must be reachable with valid credentials.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP SSH Gateway

MCP SSH Gateway is an MCP server that connects AI agents to configured SSH hosts, including Linux systems and Keenetic routers, through stateful shell sessions. Its main tools are server_list, run, read, signal, session_close, and file; server_add is available when explicitly enabled.

Install it with uvx or pip. Use `uvx mcp-ssh-gateway --import-ssh-config` with Python 3.11+ and SSH access, or run `pip install mcp-ssh-gateway` and launch `mcp-ssh-gateway` directly.

Yes, MCP SSH Gateway works with Cursor through a stdio configuration in `~/.cursor/mcp.json`. Configure `uvx` with `mcp-ssh-gateway` and either `--import-ssh-config` or `--servers-config` followed by an absolute configuration path.

Reuse the `session_id` returned by `run`. The associated real shell preserves changes such as `cd`, variables, and virtual environments; calling `run` without a session ID always opens a new shell.

Call `read` after `run` returns `running`, and use `signal` when the session returns `waiting_input`. `signal` can send text to standard input, issue Ctrl+C, or send Ctrl+D.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP SSH Gateway AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mcp-ssh-gateway?style=directory)](https://allmcps.com/mcp/mcp-ssh-gateway)
HTML Embed
<a href="https://allmcps.com/mcp/mcp-ssh-gateway"><img src="https://allmcps.com/api/badge/mcp-ssh-gateway?style=directory" alt="MCP SSH Gateway on AllMCPs" /></a>