MCP SSH Session
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP SSH Sessionrun 'uptime' on staging server"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP SSH Session - Reloaded
An MCP (Model Context Protocol) server that enables AI agents to establish and manage persistent SSH sessions.
Features
Smart Command Execution - auto-transitions to async mode if timeout is reached
Persistent Sessions - SSH connections reused across commands
Async Commands - non-blocking execution for long-running tasks
SSH Config Support - reads
~/.ssh/configfor aliases, ports, keysMulti-host - manage connections to multiple hosts simultaneously
Network Devices - enable mode handling for Cisco, Juniper, MikroTik, etc.
Sudo Support - automatic password handling for Unix/Linux hosts
File Operations - read/write remote files via SFTP (sudo fallback)
Command Interruption - send Ctrl+C to stop running commands
Thread-safe - safe for concurrent operations
Async Native - built-in support for asynio.
Related MCP server: Simple SSH MCP Server
Quick Start
📦 Migrating from mcp-ssh-session
This project is a drop-in replacement for the original devnullvoid/mcp-ssh-session. To migrate:
Replace the package name -
mcp-ssh-session→mcp-ssh-reloadedEnvironment variables fully inherited - all
OVRD_*andMCP_SSH_*env vars work the sameThat's it - reconnect and you're done
{
"mcpServers": {
"ssh-session": {
"command": "uvx",
"args": ["mcp-ssh-session", "serve", "mcp"]
}
}
}{
"mcpServers": {
"ssh-session": {
"command": "uvx",
"args": ["mcp-ssh-reloaded", "serve", "mcp"]
}
}
}Install
uvx mcp-ssh-reloadedDevelopment
uv venv
source .venv/bin/activate
uv pip install -e .CLI
# MCP server (default)
mcp-ssh-reloaded serve mcp
# Direct execution (no MCP)
mcp-ssh-reloaded exec myserver "uname -a" -u admin
# List / close sessions
mcp-ssh-reloaded list
mcp-ssh-reloaded close-allMCP Client Config
Claude Code / Desktop (~/.claude.json or claude_desktop_config.json):
{
"mcpServers": {
"ssh-session": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-ssh-reloaded", "serve", "mcp"],
"env": {}
}
}
}Quick Examples
// SSH config alias
{ "host": "myserver", "command": "uptime" }
// Explicit params
{ "host": "example.com", "username": "user", "command": "ls -la", "port": 2222 }
// Network device (Cisco enable mode)
{ "host": "router", "username": "admin", "enable_password": "secret", "command": "show run" }
// Unix with sudo
{ "host": "server", "username": "ops", "sudo_password": "secret", "command": "systemctl restart nginx" }Full API reference: API-DOCS.md - all types, all methods, all MCP tools, error handling, server config tunables.
SSH Config
~/.ssh/config is read automatically:
Host myserver
HostName example.com
User myuser
Port 2222
IdentityFile ~/.ssh/id_rsaThen use "host": "myserver" - the rest is resolved for you.
Credential Hiding (OVRD_*)
For production environments, store real credentials in env vars so AI agents only see aliases:
Variable | Description |
| Real hostname or IP |
| SSH port |
| SSH username |
| SSH password |
| Path to SSH private key |
| Sudo password |
| Enable password |
Example config:
{
"mcpServers": {
"ssh-session": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-ssh-reloaded", "serve", "mcp"],
"env": {
"OVRD_prod_db_HOST": "192.168.1.100",
"OVRD_prod_db_USER": "admin",
"OVRD_prod_db_PASS": "secret123",
"OVRD_prod_db_SUDO_PASS": "sudopass"
}
}
}
}The agent uses "host": "prod_db" - never sees real IPs or passwords.
Configuration
Timeouts & server settings
All tunables live in ServerConfig. Values resolve in priority:
Constructor kwargs (highest)
MCP_SSH_*environment variablesDefaults (lowest)
Env Variable | Default | Description |
|
| Command timeout (seconds) |
|
| Hard cap on timeout |
|
| SSH connect timeout |
|
| Thread pool size |
|
| Max file read/write (2 MB) |
|
| Max command output (10 MB) |
|
| Enable PTY terminal emulation |
|
| Relax validation for PTY inspection |
|
| Auto-handle MikroTik pagers |
|
| PTY columns |
|
| PTY rows |
|
| Log directory |
|
| Background monitor max timeout |
|
| Normal idle timeout (seconds) |
|
| Package manager idle timeout |
|
| Async command default timeout |
Via CLI (serve modes)
mcp-ssh serve mcp --default-timeout 60 --max-workers 20
mcp-ssh serve http --port 8080 --interactive-mode false
mcp-ssh serve sse --port 9000 --connect-timeout 15Via API
from mcp_ssh_reloaded import SSHService, ServerConfig
svc = SSHService(config=ServerConfig(default_timeout=60, max_timeout=600))How It Works
Commands run inside persistent interactive shells:
Directory persists:
cd /tmpstays in/tmpfor the next commandEnv vars persist:
export FOO=baris visible across commandsPrompt detection: completion detected via captured prompt or idle timeout (2 s)
Session recovery: stuck shells auto-reset after repeated prompt-detection failures
Docs
Doc | Topic |
Full API reference - types, SSHService methods, MCP tools, error model | |
Agent prompt - patterns for correct tool usage, async handling | |
Smart execution & async command lifecycle | |
Terminal emulation, screen snapshots, key sending | |
Limits, timeouts, session recovery, error handling | |
Running via Docker |
License
MIT - see LICENSE.
Fork
Fork of devnullvoid/mcp-ssh-session with significant refactoring by AmritaConstant.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AmritaBot/mcp-ssh-reloaded'
If you have feedback or need assistance with the MCP directory API, please join our Discord server