sshmng

by jim58246

Not rated
GitHub

About

MCP-based SSH session manager for Linux backend teams

Details

Author
jim58246
Categories
Developer Tools, Infrastructure, Other

Setup

Install sshmng in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/jim58246/sshmng

Follow the installation instructions in the repository README, then restart your MCP client.

sshmng is aunified SSH managercoveringevery connection shape— direct,ssh -Jtransparent jumps, interactive bastions, transport proxies — in onezero-depbinary that supportsauto-update. It runs as anMCP server for AI agents(Claude Code / Hermes / etc.) and asshmng sshCLI for humans, both backed by thesame config. When something breaks, the Agent reads the failure trace, patches the config, and retries —closed-loop self-healing,no human in the middle.

- Interactive bastions that actually work: most SSH tools give up on menu-driven bastions. sshmng'sLoginFlowdecision tree (send + expect, glob orre:regex) drives the menu to log into the target — and when the menu text changes, the failure trace goes back to the Agent so it can patch the pattern and retry
- Self-healing config loop: the Agent readserror/login_trace, callsupdate_to patch the broken LoginFlow pattern, retrieslogin— closes the diagnostic loop without human hand-holding
- One-command setup wizard:sshmng installcreates the config directory + template, auto-detects installed AI Agents (Claude Code / Hermes / OpenCode) and injects itself into their configs with timestamped backups;sshmng doctorverifies everything is wired up
- One config, two interfaces: MCP server for AI agents (Claude Code / Hermes / OpenCode / Claude Desktop / Cursor),sshmng sshCLI for humans. Sameconfig.json, same direct / Pattern A (ssh -J) / Pattern B (bastion) patterns — set up a server once, use it from either side
- Explicit session management:loginrun_in_sessionclose_sessiontrio; consecutive commands share cwd / env / background jobs, unlike one-shotssh host cmd
- sftp file transfer:upload/downloadsingle files over a dedicated sftp channel, separate from the PTY command channel; graceful degradation when unavailable.upload_dir/download_dirrecursively transfer directory trees, concurrent (default 4), conflict policy overwrite / skip / rename.relay_transferstreams a file from one session to N others via sshmng (no local disk, 1:N fanout, source read once)
- Command diagnostics:run_in_sessiontimeout auto Ctrl-C + drain, returnstimed_out/ctrl_c_sent;get_traceretrieves command history (including raw_output, ctrl_c_sent)
- TOFU host key: first connection records the public key toknown_hosts; changes are rejected ("host key changed, possible MITM")
- Config CRUD:list_
/get_/update_tool families manage SSHServer / Jumphost / Proxy, with RFC 7396 JSON Merge Patch semantics

sshmng is a single binary with no runtime dependencies. Pick one:

# Option 0: one-click install — downloads release, places on PATH # macOS / Linux: curl -fsSL https://raw.githubusercontent.com/jim58246/sshmng/main/install.sh | bash # Windows (PowerShell): irm https://raw.githubusercontent.com/jim58246/sshmng/main/install.ps1 | iex # Option 1: download release binary (recommended, no Go required) # From https://github.com/jim58246/sshmng/releases, pick the binary for your OS/Arch chmod +x sshmng # Option 2: go install (requires Go 1.25+) go install github.com/jim58246/sshmng/cmd/sshmng@latest # Option 3: clone and build locally git clone https://github.com/jim58246/sshmng.git cd sshmng && go build -o sshmng ./cmd/sshmng

Or let your AI Agent install it for you: copy the prompt indocs/agent-install-prompt.mdand paste it into Claude Code / Cursor / Hermes / OpenCode — the Agent will download the binary, place it onPATH, and runsshmng installfor you.

macOS: browser-downloaded binaries carry a Gatekeeper quarantine attribute — runxattr -d com.apple.quarantine sshmngbefore first use.go install/go buildbinaries don't need this (local compilation). Auto-updated binaries also don't need this (seedocs/auto-update.md).

After getting the binary, runsshmng installto create~/.sshmng/and inject into installed AI Agents (Claude Code / Hermes / OpenCode, etc.). SeeQuick Start.

Recommended: before runninginstall, move the binary to a stable location on yourPATH(e.g.mv sshmng /usr/local/bin/, or rely on~/go/bin/if you usedgo install).sshmng installrecords the absolute binary path into Agent configs, andsshmng doctorverifies it matches the running executable — picking a stable location up front avoids re-running install after a later move.

# Plain build (version.Version is "dev", self-update is disabled) go build -o sshmng ./cmd/sshmng # Inject version via ldflags (self-update needs a real version number) go build -ldflags="-X github.com/jim58246/sshmng/internal/version.Version=v1.2.3" -o sshmng ./cmd/sshmng

Without ldflags,version.Versiondefaults to"dev", in which case bothsshmng updateand themcpstartup auto-update goroutine are skipped.

./sshmng # Print help ./sshmng mcp # Start MCP server (what Agent configs use) ./sshmng install # First-time setup wizard ./sshmng doctor # Verify setup ./sshmng version # Print version / commit / date ./sshmng version --check # Check latest version against source ./sshmng update # Self-update to latest release ./sshmng mcp --config /path/to/config.json # MCP server with custom config SSHMNG_HOME=/custom/dir ./sshmng mcp # MCP server with custom home ./sshmng server list [keywords...] # List SSH servers (AND match on name/addr/tags) ./sshmng server get <name> # Show SSH server details (full auth) ./sshmng jumphost list|get ... # Same for jumphosts ./sshmng proxy list|get ... # Same for proxies ./sshmng ssh <name> [command] # Interactive SSH login; with command, non-interactive ./sshmng file upload <name> <local> <remote> # File transfer via sftp (also: download, upload-dir, download-dir, relay) ./sshmng file relay <src-name> <src-path> <dst-path> --to <dst1,dst2> # 1:N fanout to multiple servers
# 1. Build go build -o sshmng ./cmd/sshmng # 2. First-time install (creates ~/.sshmng/ + injects into installed AI Agents) ./sshmng install # 3. Verify config ./sshmng doctor # 4. Restart your Agent, have it call sshmng: # "list_ssh_servers" → should return an empty array # "add an SSH server named prod-web-01 at 10.0.0.1:22 with password ..." # "login to prod-web-01 and run df -h"
./sshmng install --yes --agents claude-code,hermes

For manual config fallback and per-Agent integration steps, seedocs/agents.md.

Nosend_input/send_specialprovided: MCP clients serialize tool calls, so duringrun_in_sessionexecution these two tools can't be invoked; after the command ends (normal exit or timeout Ctrl-C), the session is already idle or closed, and calling them also errors. Interactive commands (sudo/read/cat>file) rely onrun_in_session's own timeout +get_tracefor raw_output diagnostics, not on send_input feeding.

- Plaintext storage: v1 stores password / passphrase in plaintext inconfig.json, documented explicitly; if unacceptable, encrypt the wholeconfig.jsonwithage/gpgyourself, decrypt before use
- TOFU host key: enabled by default; first connection records public key to~/.sshmng/known_hosts, changes rejected ("host key changed, possible MITM"). Can be disabled per-entity viahost_key_verify: false(completely skips known_hosts read/write, loses MITM protection — only for trusted intranet bastions, etc.); deleting a recorded key still requires manually editing~/.sshmng/known_hosts, no tool support
- Trace contains sensitive data:Send(LoginFlow stage),Output(PTY raw stream) may contain passwords; trace is in-memory only, retained for 10 minutes afterclose_sessionthen auto-cleaned, never persisted to disk
- stdout must never log: JSON-RPC is dedicated to stdout; operation logs go to the rotating file specified byconfig.log_path(10MB / 5 files, 0600 perms), or no logging if unconfigured; bootstrap errors go to stderr
- Auth scope (v1): only Password + PrivateKey supported; no keyboard-interactive / SSH agent / SSH certificate / 2FA (if your environment requires these, v2 extension or hardcoded interaction in LoginFlow)

sshmng silently checks for updates in a background goroutine onmcpstartup (writeslog_pathlog only, never stdout). Disable via{"auto_update_enabled": false}. Manual update:sshmng update. Rate-limited by GitHub? Download the asset with your browser and runsshmng update --file <path>(bypasses the API quota; accepts.tar.gz,.tar, or an extracted directory). Version check:sshmng version --check. Custom source: setupdate_url(seedocs/auto-update.mdfor self-hosted source layout, macOS notes,--filemode, and release flow).

# Run all tests (with race detector) go test -race ./...

For test coverage and development details, seedocs/development.md(Chinese only — translations welcome).

- Configuration reference— full config.json field reference, Pattern A/B shape constraints, examples
-
Agent integration guide— Claude Code / Hermes Agent / OpenCode / Claude Desktop detailed config, MCP Inspector debugging, first-time setup flow, typical call flow
-
Agent install prompt— copy-paste prompt to have your AI Agent install sshmng end-to-end
-
Auto-update— self-hosted HTTP source layout, macOS notes, release flow
-
Architecture & development— package structure, key designs, subcommand dispatch, test coverage (Chinese only — translations welcome)
-
Design doc— full design spec (PTY sentinel, LoginFlow, session state machine, etc.) (Chinese only — translations welcome)
-
Implementation plan— v1 implementation progress (Chinese only — translations welcome)

v1 stage: client runs standalone, stdio single-process, config stored locally. Design doc:docs/ssh-session-manager-design.md(Chinese only — translations welcome).

Feel free to openissuesfor bugs and feature requests.

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Production-ready MCP server for AI-driven console automation and monitoring. 40+ tools for session management, SSH, testing, and background jobs.

Hetzner Cloud MCP Server — (Cloud API + SSH)

Hetzner Cloud MCP Server — two management layers (Cloud API + SSH) with 60 tools. Manage server power, snapshots, firewalls, DNS, plus SSH into servers for service control, log viewing, Nginx management, MySQL queries, and system monitoring. Self-hosted PHP, MIT licensed.

Provides remote machine control capabilities, eliminating SSH overhead for token-efficient system operations.

Orchestrates remote server tasks via SSH and SFTP with a persistent queue. Ideal for DevOps and AI agents.

Securely execute remote commands and perform file operations over SSH, with support for both password and key-based authentication.

MCP server that exposes an SSH server list from a TOML config file

Execute commands on local or remote hosts via SSH. Supports session persistence and environment variables.

Connect to, configure, and monitor Cisco network devices like routers and switches via SSH.

Rent a real Linux VPS as an AI agent — pay USDC (x402 on Base) or card, SSH in under 60s, no signup; provision, exec, firewall, and storage.

A comprehensive MCP server for configuring and managing Cisco ACI (Application Centric Infrastructure) fabrics through the APIC REST API.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.