Agentic SSH

io.github.sandbanks由 GitHub 账号 sandbanks 发布v0.6.1更新于 Nov 6, 2026

High-performance (Rust), token-efficient, and asynchronous SSH orchestrations for AI agents.

发布方自己的服务:agentic.no

概览

AI 生成的概览

基于 Rust 的 SSH 连接池与 MCP 服务器,让 AI 助手以白名单方式、低 token 消耗地远程执行命令。

可以做什么
  • 发现 SSH 配置中已授权的主机别名与多主机分组
  • 在多台主机上并发执行命令,支持同步或后台分离模式
  • 查看远程系统状态:CPU、内存、磁盘、监听端口、进程与网络连接
  • 读取日志:系统日志、Docker 容器日志、syslog 与 journalctl 匹配
  • 检查服务与容器:systemd 状态、Docker 守护进程健康、待更新软件包
  • 维护主机:拉取远程 Git 仓库、查找大文件、列出 cron 任务
适用场景
适合需要让助手通过 SSH 排查、审计或运维多台远程机器的场景,并希望有严格的主机白名单和精简的结构化输出,而不是原始终端刷屏。适用于家庭实验室、开发服务器与集群。
运行要求
作为本地进程运行,可通过 Homebrew、cargo-binstall 或 Nix 安装;使用现有的 SSH 配置与密钥,可选配置文件用于设置 allow_hosts、ignore_hosts 和主机分组。远程目标需提供 POSIX 兼容的 sh 或 bash,可选 setsid。未声明任何环境变量或请求头。
安装前请注意
助手可在所有白名单主机上执行任意命令,包括后台任务和会改变远程状态的 git 拉取;若未设置 allow_hosts,默认屏蔽所有主机,请保持白名单尽量窄。超时命令会按进程组被终止,输出会写入本机用户目录下的会话日志。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Agentic SSH,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[Release] [Sponsor] [MCP Toplist] [agentic_ssh MCP server] [Crates.io] [Homebrew]

agentic_ssh 🛰️🛡️

Stop your AI agent from nosing around your SSH connections without permission.

A secure-by-default SSH connection pool & MCP server for AI coding assistants (Claude Code, Cursor, Gemini, Antigravity, Copilot, Cline).

agentic_ssh gives your AI assistant fast, token-efficient, and asynchronous SSH access to your homelab, dev servers, and clusters—with strict zero-trust host guardrails so it can never touch unauthorized infrastructure.

[AI Agent Multi-Host Interrogation & Security Guardrail]

📊 Token & Quota Impact: Raw SSH vs. agentic_ssh

Metric / ScenarioRaw SSH in Agent PromptWith agentic_ssh MCPThe Difference
Security & Blast RadiusFull access to every host in ~/.ssh/configStrict Whitelist Guardrail (allow_hosts)Unauthorized hosts blocked 🛡️
Context Window Consumption15,000+ tokens (raw stdout dump)185 tokens (structured JSON telemetry)98.8% token savings 📉
API Cost per Query~$0.05 – $0.15~$0.0004Fraction of a cent 💰
Connection Latency800ms – 1.5s reconnect handshake0ms (pooled Keepalive socket)Instant response ⚡️
Long-Running BuildsBlocks agent reasoning / silent dropoutDetached async (background: true)Parallel workflows 🚀

💡 Why I Built This

I built agentic_ssh after watching my AI coding agent do remote server triage across my own fleet of machines.

I asked it to investigate an anomaly. I sat there watching as it opened the same SSH connection time after time to talk to the same remote server, checking one small thing at a time. When querying multiple nodes, it would ask the exact same question of each server individually, running fresh TCP/SSH handshakes for every single command.

Worse, every single docker logs or system check dumped hundreds—sometimes thousands—of tokens of raw terminal noise and ANSI escape codes straight into the context window, chewing through my API budget in minutes. And whenever an idle SSH connection dropped mid-query, the agent would lose its place and spin in retry loops.

I realised that could be dramatically streamlined with a dedicated, connection-pooled, security-first MCP server.


🛑 Why Giving AI Agents Raw SSH Is a Bad Idea

If you've ever let an autonomous agent run raw terminal ssh, you're exposing your machines to huge risks:

  • 🚨 Unrestricted Fleet Access ("Nosing Around"): Standard agent bash tools have full, unchecked access to your ~/.ssh/config. If you ask an agent to inspect a local dev box, nothing stops it from querying your production database, jumping through client bastions, or running rogue commands where it shouldn't.
  • 💥 The Context Avalanche: The agent runs apt upgrade or cargo build, and 15,000 lines of compiler noise dump straight into your context window—wiping out memory, blowing up rate limits, and wasting money.
  • 👻 Silent Death by Dropout: Cloud NATs and Tailscale love to silently drop idle SSH sockets during a 10-minute compile. The agent hangs forever waiting for output that will never arrive.
  • 😵‍💫 Nested Escaping Hell: Asking an LLM to quote bash inside an SSH string inside an MCP JSON payload (ssh host "bash -c \"echo 'hello'\"") invariably leads to broken quotes and syntax errors.

🪄 How agentic_ssh Fixes This

The Dangeragentic_ssh Zero-Trust Solution
Unchecked Server AccessStrict Host Whitelist (allow_hosts): If allow_hosts is not configured, all hosts are blocked by default. Your agent can only touch machines you have explicitly approved.
Bloated Context WindowsAutomatically summarizes verbose outputs and redirects large streams to isolated local session logs (~/.agentic_ssh/sessions/).
Dropped Sockets & LagRust-native connection pooling (russh) with automatic 30s keepalives and zero-latency session reuse.
Broken QuotingArguments are structured and escaped natively behind the scenes—zero escaping headaches for the model.
Blocking Long TasksSupports background: true—fires long builds or migrations into detached threads so the agent can keep working.

⚡️ Quick Start (30 Seconds)

1. Install

bash
# macOS & Linux (Homebrew)brew install sandbanks/tap/agentic_ssh
# Or with cargo-binstall (pre-compiled binary)cargo binstall agentic_ssh
# Or run instantly with Nix (zero compile)nix run github:sandbanks/agentic_ssh -- doctor

2. Auto-Register with Your AI Agents

One command detects your installed AI tools and registers the MCP server automatically:

bash
agentic_ssh install

(Supports Claude Code / Desktop, Cursor, Gemini, Antigravity, Copilot, Zed, Cline, and Roo-Code).

3. Verify Health

bash
agentic_ssh doctor

🤖 Prompt Recipes: What Your AI Agent Can Do

Once installed, just talk to your agent naturally. Here are real-world prompts you can copy & paste:

🔍 1. Cluster Health & Resource Audit

"Check the CPU load, RAM usage, and available disk space across stan, cartman, and aruba. Report any bottlenecks."

⚡️ Agent calls get_system_stats concurrently across all 3 nodes and gives you a structured comparison table in 2 seconds.

🛡️ 2. Security & Port Exposure Check

"Inspect all active listening TCP and UDP ports on our staging server. Flag anything open on 0.0.0.0 that shouldn't be."

⚡️ Agent calls list_ports with process attribution (PID + binary name) for instant auditing.

🐳 3. Container Status & Error Log Tailing

"Check if any Docker containers crashed on cartman, and tail the last 50 lines of the auth-service logs."

⚡️ Agent calls check_docker_status and tail_container_logs without flooding your context window.

⏳ 4. Detached Background Jobs

"Deploy the latest git commit on stan in the background and notify me when it finishes."

⚡️ Agent runs run_command with background: true, frees up your chat immediately, and tracks the output in a local session log.


🖥️ CLI Superpowers for Humans (Built-in Terminal Tools)

agentic_ssh isn't just an MCP server for AI—it includes powerful CLI tools for human developers too:

💡 Tip: Add alias ash="agentic_ssh" to your ~/.zshrc or ~/.bashrc to save keystrokes!

agentic_ssh watch: Multi-Host Live Streaming TUI

Watch commands run concurrently across multiple servers with live streaming panes and post-run log inspection:

[Multi-Host Command Watcher TUI]

bash
# Watch a command on multiple hosts concurrentlyagentic_ssh watch stan,cartman,aruba "pnpm --version"
# Watch an entire host group defined in your configagentic_ssh watch web-fleet "docker compose ps"

agentic_ssh json: Instant Multi-Host Scripting

Call any built-in MCP diagnostic tool directly from your terminal and get clean, parseable JSON:

bash
# Get structured system stats across hostsagentic_ssh json get_system_stats stan,cartman
# Query listening portsagentic_ssh json list_ports '{"hosts": ["stan", "aruba"]}'

agentic_ssh tui: Live Connection Pool Dashboard

Inspect active SSH sockets, heartbeat metrics, connection lifetimes, and live running commands (with remote PID/PGID and timeout countdowns) inline under each host:

bash
agentic_ssh tui

🧰 Built-in Tool Catalog

MCP ToolDescription
list_hostsDiscovers and returns all authorized SSH host aliases from ~/.ssh/config.
list_groupsReturns defined multi-host server groups (e.g., web-fleet, db-cluster).
run_commandExecutes commands concurrently across hosts (supports sync or detached async background mode).
get_system_statsFetches CPU load, RAM utilization, and disk partition stats.
list_portsScans active listening TCP/UDP sockets with process & PID attribution.
search_processesEvaluates and filters running processes with regex matching.
tail_logSafely tails standard system log files without loading multi-gigabyte files.
tail_container_logsFetches real-time log frames from Docker containers.
check_docker_statusReturns Docker daemon health, running containers, and image counts.
check_service_statusQueries systemd / systemctl service states.
list_upgradableLists pending OS package updates across remote machines.
git_pullSafely fetches and updates a remote Git repository.
find_large_filesScans for disk-hogging files exceeding a size threshold.
grep_syslogSearches remote syslog / journalctl streams for specific error patterns.
list_cron_jobsInspects system and user crontabs.
list_network_connectionsLists active network connections and remote endpoints.

⚙️ Configuration (~/.config/agentic_ssh/config.toml)

You can define host groups and security boundaries in an optional configuration file:

toml
# Security boundaries: Only allow safe hostsallow_hosts = ["stan", "cartman", "kyle", "*.local"]ignore_hosts = ["prod-db-primary", "secure-vault"]
# Multi-host groups for easy targeting[groups]fleet = ["stan", "cartman", "aruba", "kyle"]pis = ["stan", "cartman", "kyle"]web = ["aruba", "stan"]
# Custom parameterized agent tools[tools.deploy_stack]description = "Pulls latest compose repo and updates stack containers."command = ["docker", "compose", "-f", "/opt/app/docker-compose.yml", "up", "-d"]allow_hosts = ["stan", "cartman"]

Remote Shell Requirements & Timeout Process Cleanup

agentic_ssh tracks every active remote command in an in-memory registry and automatically kills timed-out commands (and their spawned child processes) using their remote Process Group ID (PGID).

  • POSIX Shell Requirement: Remote targets are assumed to provide a POSIX-compliant sh or bash (and optionally setsid for isolated process groups).
  • Graceful Fallback: If a target uses a non-POSIX login shell where the PID sentinel cannot be detected, agentic_ssh logs a warning and falls back to best-effort channel closure without failing the command.

🤝 Acknowledgments

  • Standing on the shoulders of giants:
    • Russh: High-performance pure Rust SSH client.
    • Ratatui: Gorgeous terminal user interfaces.
    • Enzo: MCP installer inspiration from tokensave.

💖 Sponsoring Sandbanks

agentic_ssh is built and maintained as independent, sovereign open-source software.

If agentic_ssh saves your token budget, secures your infrastructure, or makes your AI pair-programming workflow faster:

👉 Sponsor @sandbanks on GitHub Sponsors

  • Sponsoring unlocks the GitHub Sponsor badge, access to the private sandbanks/vip discussions and early RFCs, and priority issue triage.

📄 License

Dual-licensed under MIT and Apache 2.0.


MCP Server Identifier: mcp-name: io.github.sandbanks/agentic_ssh

来源:README.md,提交 5394b02

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

4
  1. v0.6.1最新Nov 6, 2026
  2. v0.6.0Oct 20, 2026
  3. v0.5.4Oct 11, 2026
  4. v0.5.3Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Agentic 集成