Skip to main content
Glama
lazyst
by lazyst

agent-ssh

SSH 远程管理 CLI 工具,支持在远程服务器上执行命令和传输文件。可独立作为 CLI 使用,也可作为 MCP Server 运行。

安装

全局安装

npm install -g agent-ssh
agent-ssh --help

本地安装

npm install
npm run build
node dist/cli.js --help
npm link
agent-ssh --help

Related MCP server: SSH MCP Server

CLI 命令

命令

功能

exec <command>

远程执行命令

upload <local> <remote>

上传文件

download <remote> <local>

下载文件

upload-dir <local> <remote>

上传目录

download-dir <remote> <local>

下载目录

list-servers

列出已配置的服务器

--mcp

以 MCP Server 模式运行

使用示例

# 使用配置文件中的服务器
agent-ssh exec "df -h" -s production
agent-ssh upload ./file.txt /root/file.txt -s development
agent-ssh download /var/log/app.log ./logs/ -s production
agent-ssh list-servers

# 直接指定连接参数
agent-ssh exec "ls -la" -H 192.168.1.100 -u root -p password
agent-ssh upload ./deploy.sh /opt/deploy.sh -H 192.168.1.100 -u root --private-key ~/.ssh/id_rsa

# JSON 格式输出
agent-ssh exec "uname -a" -s production --json

配置文件

创建 .agent-ssh/config.json 在命令执行的目录下:

{
  "servers": {
    "production": {
      "host": "192.168.1.100",
      "port": 22,
      "username": "root",
      "password": "your_password",
      "timeout": 60000
    },
    "development": {
      "host": "192.168.1.50",
      "port": 2222,
      "username": "admin",
      "privateKey": "/path/to/id_rsa",
      "timeout": 30000
    }
  },
  "defaultServer": "development"
}

配置文件搜索顺序

  1. AGENTS_SSH_CLI_CONFIG 环境变量指定路径

  2. 当前目录下的 .agent-ssh/config.json

  3. 项目目录下的 ssh-cli.config.json

  4. 当前目录下的 ssh-cli.config.json

  5. 用户主目录下的 .ssh-cli-config.json

配置参数说明

参数

必填

默认值

说明

host

-

SSH 服务器地址

port

22

SSH 端口

username

-

用户名

password

-

密码(与 privateKey 二选一)

privateKey

-

私钥路径或内容(与 password 二选一)

timeout

30000

超时时间(毫秒)

认证方式

支持两种认证方式,passwordprivateKey 二选一即可:

密码认证:

agent-ssh exec "ls" -H 192.168.1.100 -u root -p mypassword

私钥认证:

agent-ssh exec "ls" -H 192.168.1.100 -u root -k ~/.ssh/id_rsa

MCP Server 模式

保留完整的 MCP 协议兼容性,可作为 Agent 的 MCP Server 使用。

agent-ssh --mcp

可用 MCP 工具

工具

说明

ssh_list_servers

列出所有已配置的服务器

ssh_execute_command

执行命令

ssh_upload_file

上传文件

ssh_download_file

下载文件

ssh_upload_directory

上传目录

ssh_download_directory

下载目录

MCP 客户端配置

{
  "mcpServers": {
    "agent-ssh": {
      "command": "agent-ssh",
      "args": ["--mcp"]
    }
  }
}
A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • -
    license
    -
    quality
    -
    maintenance
    Enables secure file transfer operations with remote Linux and Windows systems via SCP/SFTP protocols. Supports uploading, downloading, listing, and managing files on remote servers through SSH authentication.
    Last updated
  • A
    license
    A
    quality
    D
    maintenance
    Enables secure SSH connections to multiple remote servers with support for command execution, file transfers (SFTP), directory listing, and both password and key-based authentication.
    Last updated
    7
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables remote server management through SSH and SFTP, supporting command execution, file transfers, and interactive shell sessions. It allows for multiple concurrent connections using either password or SSH key authentication.
    Last updated
    11
    31
    2
    MIT
  • A
    license
    -
    quality
    C
    maintenance
    Enables executing commands and transferring files over SSH on multiple hosts concurrently, with auto-discovery from SSH config and support for various authentication methods.
    Last updated
    3
    MIT

View all related MCP servers

Related MCP Connectors

  • Operate your own Linux servers from your LLM. Requires the SentinelX agent installed per host.

  • Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.

  • Execute PowerShell commands securely with controlled timeouts and input validation. Retrieve syste…

View all MCP Connectors

Latest Blog Posts

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/lazyst/agent-ssh'

If you have feedback or need assistance with the MCP directory API, please join our Discord server