mcp-ssh
# mcp-ssh
MCP сервер для подключения по SSH и выполнения команд на удалённом сервере.
## Быстрый старт
1) Установите зависимости:
- npm install
2) Создайте .env на основе .env.example и задайте параметры подключения.
3) Запустите в режиме разработки:
- npm run dev
Или соберите и запустите:
- npm run build
- npm start
## Запуск через docker-compose
1) Создайте .env на основе .env.example.
2) Запустите сервис:
- docker compose up -d
Сервис работает по stdio (MCP), проброс портов не требуется.
## Доступные инструменты MCP
### ssh_connect
Создаёт SSH сессию.
Параметры:
- host (string, optional)
- port (number, optional)
- username (string, optional)
- privateKey (string, optional)
- privateKeyPath (string, optional)
- password (string, optional)
- connectTimeoutMs (number, optional)
Возвращает: sessionId, host, port, username.
### ssh_exec
Выполняет команду в существующей сессии.
Параметры:
- sessionId (string)
- command (string)
- cwd (string, optional)
- timeoutMs (number, optional)
Возвращает: stdout, stderr, exitCode, exitSignal.
### ssh_disconnect
Закрывает сессию.
Параметры:
- sessionId (string)
Возвращает: disconnected.
### ssh_list_sessions
Возвращает список активных сессий.
## Ограничение хостов
Если задан MCP_SSH_ALLOWED_HOSTS, подключение разрешено только к хостам из списка.
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose with no overlap: ssh_connect establishes sessions, ssh_disconnect terminates them, ssh_exec runs commands, and ssh_list_sessions enumerates active sessions. The descriptions reinforce these boundaries, making misselection unlikely.
All tool names follow a consistent 'ssh_verb' pattern with snake_case, using clear action verbs like connect, disconnect, exec, and list_sessions. This predictability aids agent understanding and tool selection.
With 4 tools, the server is well-scoped for SSH management, covering core operations: establishing, managing, using, and monitoring sessions. Each tool earns its place without bloat or thinness for the domain.
The tool set provides complete lifecycle coverage for SSH sessions: connect, disconnect, execute commands, and list sessions. There are no obvious gaps, as all essential operations for remote command execution and session management are included.