Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSH Manager Plugin for opencode

Manage SSH server connections directly within opencode. Connect to remote servers, and all commands automatically target the remote environment.

Commands

Command Description
/ssh List saved servers and connect to one
/ssh-disconnect Disconnect from the current SSH server
/ssh-add Add a new SSH server configuration
/ssh-edit Edit or delete SSH server configurations

Installation

  1. Copy this plugin directory into your project
  2. Ensure opencode.json references the plugin:
    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["./ssh-plugin.ts"]
    }
  3. Restart opencode

Quick Start

# Add a server
/ssh-add

# Connect to a server
/ssh

# Work normally - commands target the remote server

# Disconnect when done
/ssh-disconnect

How It Works

Adding a Server (/ssh-add)

The AI will ask for:

  • Server name - unique identifier
  • Hostname/IP - server address
  • Username - SSH login user
  • Auth - password, key file path, or SSH agent
  • Port - default 22
  • Remote folder - working directory on the server
  • Environment - OS, runtime versions, etc.
  • Description - optional notes

Connecting (/ssh)

Select a server from the list. The plugin:

  1. Tests the SSH connection
  2. Sets the active connection in ssh.json
  3. Injects connection context into the AI's system prompt

Once connected, the AI knows it's working on a remote server and will execute commands via SSH automatically.

Context Injection

When connected, the following information is injected at the end of the system prompt (preserving max prefix cache):

  • Server name, host, username, port
  • Remote folder path
  • Environment details
  • SSH/SCP/rsync command templates

Editing (/ssh-edit)

  • Edit - modify any field of an existing server
  • Delete - remove a server (with confirmation)
  • View - display all server configurations

Data File (ssh.json)

{
  "servers": [
    {
      "name": "production",
      "host": "192.168.1.100",
      "username": "deploy",
      "port": 22,
      "remoteFolder": "/var/www/app",
      "environment": "Ubuntu 22.04, Node.js 18, Docker 24",
      "description": "Production web server"
    },
    {
      "name": "dev-vm",
      "host": "192.168.1.50",
      "username": "dev",
      "keyFile": "~/.ssh/id_rsa",
      "port": 22,
      "remoteFolder": "/home/dev/project",
      "environment": "Ubuntu 24.04, Python 3.12",
      "description": "Development VM"
    }
  ],
  "activeConnection": {
    "serverName": "production",
    "connectedAt": "2025-01-15T10:30:00.000Z"
  }
}

Security Notes

  • ssh.json may contain passwords in plain text. Prefer SSH key authentication.
  • ssh.json is included in .gitignore by default.
  • For production, use SSH key files or SSH agent instead of passwords.

File Structure

opencode-ssh/
├── opencode.json       # Plugin configuration
├── ssh-plugin.ts       # Plugin source
├── ssh.json            # Server data (auto-managed)
├── ssh.example.json    # Example configuration
├── package.json        # Dependencies
├── .gitignore          # Ignore sensitive files
└── README.md           # This file

Requirements

  • opencode with plugin support
  • SSH client installed locally
  • Network access to target servers

About

SSH server manager plugin for opencode

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages