FS

fryjustinc/ssh-mcp-sessions

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

18 stars 7 forks 품질 70 트렌드 22MIT

An MCP tool to manage persistent ssh connections to a collection of hosts enabling remote development, deployment, and information gathering.

개요

A Model Context Protocol (MCP) server that gives LLM clients safe, persistent SSH access to remote machines. ssh-mcp lets MCP-compatible clients (such as Claude Code, Cursor, or custom MCP inspectors) control remote machines through SSH. Once hosts are registered, the server maintains persistent shell sessions that retain environment state between commands—ideal for multi-step workflows, long-running processes, or interactive diagnostics. The server is implemented in TypeScript on top of the official @modelcontextprotocol/sdk. - exposes functionality through standard MCP tool definitions. - keep shell sessions alive, preserving working directory, environment variables, and process state across multiple commands. - manage SSH targets through durable JSON configuration (~/.ssh-mcp/hosts.json). - supports passwords, private keys, and SSH agent forwarding (fallback). - sessions auto-close after prolonged inactivity; commands are marked and monitored for completion.

README

원문 README의 일부입니다. 원문 보기.

SSH MCP Server

A Model Context Protocol (MCP) server that gives LLM clients safe, persistent SSH access to remote machines.


Table of Contents

  1. Overview
  2. Key Features
  3. Architecture
  4. Installation
  5. Running the Server
  6. Client Integrations
  7. Host Configuration
  8. Session Management
  9. Authentication Modes
  10. Timeouts & Inactivity Handling
  11. Directory Structure
  12. Using the MCP Tools
  13. Testing
  14. Troubleshooting
  15. Security Considerations
  16. Contributing
  17. License

Overview

ssh-mcp lets MCP-compatible clients (such as Claude Code, Cursor, or custom MCP inspectors) control remote machines through SSH. Once hosts are registered, the server maintains persistent shell sessions that retain environment state between commands—ideal for multi-step workflows, long-running processes, or interactive diagnostics.

The server is implemented in TypeScript on top of the official @modelcontextprotocol/sdk.


Key Features

  • MCP-compliant: exposes functionality through standard MCP tool definitions.
  • Persistent sessions: keep shell sessions alive, preserving working directory, environment variables, and process state across multiple commands.
  • Stored host profiles: manage SSH targets through durable JSON configuration (~/.ssh-mcp/hosts.json).
  • Flexible authentication: supports passwords, private keys, and SSH agent forwarding (fallback).
  • Timeout & cleanup safeguards: sessions auto-close after prolonged inactivity; commands are marked and monitored for completion.
  • Structured listings: query active sessions and saved hosts directly from the MCP client.

Architecture

MCP Client ─┬─> add-host / edit-host / remove-host
            │
            ├─> list-hosts
            │
            ├─> start-session ─┬─> PersistentSession (ssh2 shell)
            │                  ├─> exec (reuses shell, captures stdout/stderr)
            │                  └─> close-session / auto-timeout
            │
            └─> list-sessions

Persistent configuration → ~/.ssh-mcp/hosts.json
GitHub에서 전체 README 보기

설치

npx ssh-mcp-sessions
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "ssh-mcp": { "command": "npx", "args": [ "ssh-mcp-sessions" ] } } }