ssh-mcp-server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ssh-mcp-serverRundf -hon the production server"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server SSH
Servidor Model Context Protocol que permite ao opencode conectar-se a uma VPS via SSH (usuário e senha ou chave privada) e executar operações remotas: comandos, sessões interativas persistentes e transferência de arquivos via SFTP.
Tools
Tool | Descrição |
| Testa a conexão e retorna informações do servidor (hostname, SO, uptime, carga). |
| Executa um ou mais comandos na VPS e retorna stdout/stderr/código de saída. |
| Abre uma sessão interativa persistente (shell com estado). Retorna um |
| Envia um comando para uma sessão aberta. O estado do shell (cwd, vars) é preservado. |
| Fecha uma sessão interativa. |
| Envia um arquivo local para a VPS via SFTP. |
| Baixa um arquivo da VPS para a máquina local via SFTP. |
Related MCP server: MCP SSH Server
Credenciais
As credenciais são lidas de variáveis de ambiente do servidor MCP e podem ser
sobrescritas por chamada nas tools (host, port, username):
Variável | Obrigatória | Descrição |
| sim | IP ou hostname da VPS |
| sim | Usuário do SSH |
| sim* | Senha do SSH (*ou |
| não | Porta SSH (padrão |
| não | Caminho de uma chave privada (alternativa à senha) |
| não | Passphrase da chave privada |
Build
npm install
npm run typecheck # verificação de tipos (tsc --noEmit)
npm run build # compila para dist/
npm start # roda npx dist/index.jsSmoke test rápido
Sem precisar de uma VPS, dá para validar o servidor via stdio (lista as 7 tools):
printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"smoke","version":"0.0.0"}}}\n{"jsonrpc":"2.0","method":"notifications/initialized"}\n{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}\n' | node dist/index.jsEstrutura do código
src/
index.ts # entrada do servidor MCP (stdio) + encerramento limpo (SIGINT/SIGTERM)
config.ts # leitura/validação das credenciais (SSH_*) e overrides por chamada
sshManager.ts # ciclo de vida da conexão: client reutilizável, SFTP cacheado, sessões
exec.ts # execução one-shot e por sessão (marcador de fim de comando, truncagem)
tools/
shared.ts # schemas zod e helpers comuns (formatação, execução, erro)
exec.ts # tools ssh_exec e ssh_test
session.ts # tools ssh_session_open / send / close
transfer.ts # tools ssh_upload e ssh_download (SFTP)Notas de implementação
Sessões interativas: ao abrir, o eco do terminal é desativado (
stty -echo) e o prompt limpo, para que a captura de saída seja confiável. Cada comando é delimitado por um marcador único (; echo "exit=$?"; echo "__SSH_MARKER_*__") e a saída é lida até o marcador aparecer, com timeout padrão de 60s.Truncagem: a saída de cada comando fica limitada a 200 KB por bytes (não corta caracteres UTF-8 multibyte no meio).
Reutilização de conexão: uma única conexão SSH é mantida entre chamadas e só é reaberta se host/porta/usuário/credencial mudarem. O SFTP segue o mesmo princípio.
Configuração no opencode
Adicione o servidor em opencode.json (projeto) ou
~/.config/opencode/opencode.json (global):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"ssh": {
"type": "local",
"command": ["node", "S:/workspace/mcp/ssh/dist/index.js"],
"enabled": true,
"env": {
"SSH_HOST": "SEU_IP_OU_HOSTNAME",
"SSH_USER": "root",
"SSH_PASSWORD": "SUA_SENHA",
"SSH_PORT": "22"
}
}
}
}Requer Node.js >= 20 na máquina.
Depois de salvar, reinicie o opencode para que o servidor MCP seja carregado.
Segurança
A senha fica armazenada no
opencode.json. Proteja o arquivo (ex.:chmod 600) ou use apenasSSH_HOST/SSH_USERno config e passe a senha por chamada quando necessário.Prefira
SSH_PRIVATE_KEYcom passphrase quando possível.As tools seguem o princípio do menor privilégio: certifique-se de que a conta configurada tem apenas as permissões necessárias na VPS.
This server cannot be installed
Maintenance
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
- FlicenseBqualityDmaintenanceEnables SSH operations including connecting to remote servers, executing commands, and transferring files between local and remote systems. Supports multiple SSH connections with both password and private key authentication methods.18
- FlicenseBqualityDmaintenanceEnables seamless SSH operations including secure connections, file transfers, interactive shell sessions, and Docker container management on remote servers. Supports both password and SSH key authentication with credential management and connection pooling.18
- AlicenseAqualityDmaintenanceEnables secure SSH connections to multiple remote servers with support for command execution, file transfers (SFTP), directory listing, and both password and key-based authentication.7MIT
- AlicenseAqualityDmaintenanceEnables 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.11143MIT
Related MCP Connectors
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Issue, rotate and revoke scoped API-key passes for 25+ providers — the agent never sees a real key
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/herloncosta/ssh-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server