npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

terminal-ssh-mcp

v0.1.7

Published

SSH MCP Server for AI Agents - Execute commands on remote servers via SSH with persistent shell sessions

Downloads

848

Readme

Terminal SSH MCP Server (v2)

基于 Rust 的 SSH MCP Server,为 Agent 提供稳定的远程 SSH 执行能力。

v2 目标

  • 双轨执行模型:
    • ssh_exec:一次性命令执行
    • ssh_shell_open/write/read/exec:流式 shell + 精确退出码
  • 结构化返回:统一 okerror.codeerror.message
  • Host Key 策略:insecure / strict / accept_new
  • 会话可观测:connectedshell_openstatelast_activity_at

工具列表

  1. ssh_connect
  2. ssh_exec
  3. ssh_shell_open
  4. ssh_shell_write
  5. ssh_shell_read
  6. ssh_shell_exec
  7. ssh_shell_resize
  8. ssh_shell_close
  9. ssh_list_sessions
  10. ssh_disconnect

推荐调用流程

一次性命令

  1. ssh_connect
  2. ssh_exec
  3. ssh_disconnect

持久 shell

  1. ssh_connect
  2. ssh_shell_open
  3. ssh_shell_write + ssh_shell_read(流式)
  4. ssh_shell_exec(单条命令+退出码)
  5. ssh_shell_close
  6. ssh_disconnect

连接参数(ssh_connect

  • host / port / username
  • auth_method
    • {"type":"password","password":"..."}
    • {"type":"public_key","key_path":"~/.ssh/id_rsa","passphrase":null}
    • {"type":"agent"}
  • host_key_policy(可选,默认 insecure
    • insecure
    • strict
    • accept_new
  • known_hosts_path(可选)
  • connect_timeout_ms(可选)
  • keepalive_interval_secs(可选)

ssh_shell_exec 说明

ssh_shell_exec 内部使用哨兵协议提取退出码,返回:

  • output
  • stdout
  • stderr
  • exit_code
  • duration_ms
  • timed_out
  • truncated
  • command_id

当传入 split_streams=true 时,stdout/stderr 会按流分离;否则 stderr 为空,output/stdout 为合并输出。

错误返回语义

失败时统一返回:

  • ok: false
  • error.code
  • error.message
  • error.category (auth / usage / timeout / transport / internal)
  • error.retriable (布尔值,建议 agent 用于自动重试决策)

开发与测试

cargo clippy
cargo test

集成测试(需 SSH 容器环境):

cargo test --test integration_ssh -- --ignored --nocapture

CI 中会覆盖:

  • 密码认证端到端
  • HostKey 策略(strict / accept_new
  • SSH Agent 认证端到端