MCP SSH MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add mcp-ssh -- docker compose up -d
README.md

Connect via SSH and execute commands on a remote server.

mcp-ssh

MCP сервер для подключения по SSH и выполнения команд на удалённом сервере.

Быстрый старт

  1. Установите зависимости:
  • npm install
  1. Создайте .env на основе .env.example и задайте параметры подключения.

  2. Запустите в режиме разработки:

  • 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, подключение разрешено только к хостам из списка.

Tools (4)

ssh_connectCreates an SSH session.
ssh_execExecutes a command in an existing session.
ssh_disconnectCloses an SSH session.
ssh_list_sessionsReturns a list of active sessions.

Environment Variables

MCP_SSH_ALLOWED_HOSTSOptional list of allowed hosts for security access control.

Configuration

claude_desktop_config.json
{"mcpServers": {"mcp-ssh": {"command": "node", "args": ["/path/to/mcp-ssh/build/index.js"]}}}

Try it

Connect to my production server at 192.168.1.10 using my private key and list the files in the /var/www directory.
Execute 'uptime' on my existing SSH session and report the system load.
Check which SSH sessions are currently active.
Disconnect the SSH session with ID 'session-123'.

Frequently Asked Questions

What are the key features of MCP SSH?

Secure SSH connection management. Remote shell command execution. Support for password and private key authentication. Host-based access control via allowlist. Active session tracking and management.

What can I use MCP SSH for?

Automating remote server maintenance tasks via Claude. Running diagnostic commands on remote infrastructure. Managing multiple remote server sessions from a single interface. Executing deployment scripts on remote machines.

How do I install MCP SSH?

Install MCP SSH by running: npm install && npm run build

What MCP clients work with MCP SSH?

MCP SSH works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP SSH docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare