Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-server-ssh

MCP.Pizza Chef: shaike1

The mcp-server-ssh is a robust SSH server implementation designed for the Model Context Protocol (MCP). It facilitates secure remote command execution and comprehensive file operations over SSH, supporting both password and key-based authentication methods. Key features include secure connection management, permission controls, directory and bulk file operations, progress tracking for transfers, and detailed logging. This server is ideal for integrating secure, remote system interactions within MCP-enabled environments, enhancing automation and remote management capabilities.

Use This MCP server To

Execute remote commands securely over SSH Perform file uploads and downloads remotely Manage directories and permissions via SSH Track progress of large file transfers Enable bulk file transfers in MCP workflows Log detailed SSH session activities

README

MCP SSH Server

A powerful SSH server implementation for Model Context Protocol (MCP). This server enables secure remote command execution and file operations through SSH protocol, supporting both password and key-based authentication.

Features

  • ✨ Secure SSH connection management
  • 🔑 Password and key-based authentication
  • 💻 Remote command execution
  • 📁 File operations (upload/download)
  • 📊 Progress tracking for file transfers
  • 🔐 Permission management
  • 📂 Directory operations
  • 🚀 Bulk file transfers
  • 📝 Detailed logging

Installation

  1. Install the package:
npm install mcp-ssh
  1. Add to your Claude desktop config (claude_desktop_config.json):
{
  "mcpServers": {
    "ssh": {
      "command": "node",
      "args": ["%APPDATA%/npm/node_modules/mcp-ssh/dist/server.js"],
      "env": {
        "SSH_PORT": "8889",
        "SSH_LOG_LEVEL": "info"
      }
    }
  }
}

Usage

Password Authentication

$body = @{
    id = "test"
    host = "example.com"
    port = 22
    username = "user"
    password = "pass123"
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:8889/connect" -Method Post -Body $body -ContentType "application/json"

Key Authentication

$body = @{
    id = "test"
    host = "example.com"
    port = 22
    username = "user"
    privateKey = Get-Content ~/.ssh/id_rsa | Out-String
    passphrase = "optional-key-passphrase"  # if your key is protected
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:8889/connect" -Method Post -Body $body -ContentType "application/json"

Execute Commands

$execBody = @{
    id = "test"
    command = "ls -la"
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:8889/exec" -Method Post -Body $execBody -ContentType "application/json"

File Operations

# Upload file
$uploadForm = @{
    file = Get-Item -Path "localfile.txt"
    remotePath = "/remote/path/file.txt"
}
Invoke-RestMethod -Uri "http://localhost:8889/upload/test" -Method Post -Form $uploadForm

# Download file
Invoke-RestMethod -Uri "http://localhost:8889/download/test?remotePath=/remote/path/file.txt" -Method Get -OutFile "downloaded.txt"

Directory Operations

# List directory
Invoke-RestMethod -Uri "http://localhost:8889/ls/test?path=/remote/path" -Method Get

# Get connection status
Invoke-RestMethod -Uri "http://localhost:8889/status/test" -Method Get

Development

  1. Clone the repository:
git clone https://github.com/shaike1/mcp-server-ssh.git
cd mcp-server-ssh
  1. Install dependencies:
npm install
  1. Build:
npm run build
  1. Start server:
npm start

Environment Variables

  • SSH_PORT: Server port (default: 8889)
  • SSH_LOG_LEVEL: Logging level (default: info)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT

mcp-server-ssh FAQ

How do I install the mcp-server-ssh?
Install via npm using 'npm install mcp-ssh' and configure it in your MCP host's config file.
What authentication methods does mcp-server-ssh support?
It supports both password and key-based SSH authentication for secure access.
Can mcp-server-ssh handle bulk file transfers?
Yes, it supports bulk file transfers with progress tracking for efficient operations.
How is logging handled in mcp-server-ssh?
The server provides detailed logging of SSH sessions, configurable via environment variables.
How do I configure the SSH port for mcp-server-ssh?
Set the SSH_PORT environment variable in the server's environment configuration.
Is permission management supported?
Yes, mcp-server-ssh includes permission management for secure file and directory operations.
Can I use mcp-server-ssh with different LLM providers?
Yes, it integrates with MCP clients that can use models from OpenAI, Claude, Gemini, and others.
What platforms is mcp-server-ssh compatible with?
It runs on any platform supporting Node.js, making it versatile for various MCP host environments.