SSH MCP Server
Click on "Deploy 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 Server Check disk usage on 192.168.1.100"
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.
๐ SSH MCP Server (Node.js)
A secure, high-performance Model Context Protocol (MCP) server that enables AI assistants like Claude Desktop to execute SSH commands on remote servers. Built with Node.js and the official MCP SDK for maximum compatibility and reliability.
๐ Version 2.1.0 - Token-Efficient File Operations: Complete rewrite in Node.js with official MCP SDK - eliminates all previous Go compatibility issues!
โจ Features
๐ Secure SSH: Private key authentication with multiple key format support
๐ค AI-Ready: Official MCP SDK integration for Claude Desktop and other AI tools
โก High Performance: Node.js async architecture for fast command execution
๐ฆ Zero Setup: One-command installation via NPX - no compilation required
๐ Universal: Pure JavaScript runs on Windows, macOS, and Linux
๐ก๏ธ Type Safe: Built with modern JavaScript and comprehensive error handling
๐ Standards Compliant: Uses official @modelcontextprotocol/sdk
Related MCP server: ssh-mcp-server
๐ Quick Start
Installation & Usage
# Use directly with NPX (recommended)
npx @idletoaster/ssh-mcp-server@latest
# Or install globally
npm install -g @idletoaster/ssh-mcp-serverClaude Desktop Configuration
Add to your Claude Desktop MCP configuration file:
{
"mcpServers": {
"ssh": {
"command": "npx",
"args": ["-y", "@idletoaster/ssh-mcp-server@latest"],
"env": {}
}
}
}That's it! Claude can now execute SSH commands on your remote servers.
๐ฌ Usage Examples
Once configured, Claude can help you with commands like:
"Check disk usage on my production server at 192.168.1.100"
"Restart the nginx service on server.example.com as user admin"
"Show running processes on my Ubuntu server using my SSH key"
Manual Tool Usage
{
"tool": "remote-ssh",
"arguments": {
"host": "192.168.1.100",
"user": "ubuntu",
"command": "df -h",
"privateKeyPath": "/home/user/.ssh/id_rsa"
}
}๐ง Configuration
SSH Key Authentication
The server supports multiple authentication methods:
1. Explicit Key Path
{
"privateKeyPath": "/path/to/your/private/key"
}2. Environment Variable
export SSH_PRIVATE_KEY="/home/user/.ssh/id_rsa"3. Auto-Discovery
Automatically searches for keys in:
~/.ssh/id_rsa~/.ssh/id_ed25519~/.ssh/id_ecdsa
Supported Key Formats
โ RSA keys (
id_rsa)โ ED25519 keys (
id_ed25519)โ ECDSA keys (
id_ecdsa)โ OpenSSH format
โ PEM format
๐ ๏ธ Development
Prerequisites
Node.js 18+ (check:
node --version)NPM 9+ (check:
npm --version)
Install Node.js
Windows:
Download from nodejs.org or use Chocolatey:
choco install nodejsLinux (Ubuntu/Debian):
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejsLinux (CentOS/RHEL):
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
sudo yum install -y nodejsmacOS:
brew install nodeBuild from Source
# Clone repository
git clone https://github.com/idletoaster/ssh-mcp-server.git
cd ssh-mcp-server
# Install dependencies
npm install
# Run locally
npm start
# Development with auto-reload
npm run dev๐๏ธ Architecture
ssh-mcp-server/
โโโ package.json # NPM configuration & dependencies
โโโ index.js # Main MCP server (Official SDK)
โโโ lib/
โ โโโ ssh-client.js # SSH connection management
โโโ README.md # Documentation
โโโ LICENSE # MIT license
โโโ .gitignore # Node.js gitignoreTechnology Stack
Runtime: Node.js 18+ with ES Modules
MCP SDK: @modelcontextprotocol/sdk (Official)
SSH: ssh2 library for Node.js
Distribution: NPM with direct NPX execution
๐ Security
Best Practices
โ Private key authentication only (no passwords)
โ Configurable SSH algorithms and timeouts
โ No persistent connections (session-based)
โ Input validation and sanitization
โ Comprehensive error handling
Security Guidelines
๐ Store private keys with restrictive permissions (
chmod 600)๐ Use SSH key passphrases when possible
๐ก๏ธ Restrict SSH keys to specific hosts in
~/.ssh/config๐ Monitor SSH access logs
๐ซ Never run as root unless absolutely necessary
Network Security
# Example SSH config for restricted access
Host production-server
HostName 192.168.1.100
User deploy
IdentityFile ~/.ssh/production_key
IdentitiesOnly yes
StrictHostKeyChecking yes๐งช Testing
Local Testing
# Test the MCP server
echo '{"host":"test.server.com","user":"testuser","command":"whoami"}' | npm startIntegration Testing
# Verify Node.js installation
node --version # Should be 18+
npm --version # Should be 9+
# Test NPX execution
npx @idletoaster/ssh-mcp-server@latest --help๐ Compatibility
Operating Systems
โ Windows 10/11 (x64, ARM64)
โ macOS 12+ (Intel & Apple Silicon)
โ Linux (x64, ARM64) - All major distributions
AI Platforms
๐ค Claude Desktop (Primary target)
๐ค Cursor IDE
๐ค Any MCP-compatible application
Node.js Compatibility
โ Node.js 18.x (LTS)
โ Node.js 20.x (LTS)
โ Node.js 22.x (Current)
๐ Migration from v1.x (Go)
Upgrading from the Go version? The Node.js version offers:
โ Improvements
Zero compilation - No more binary builds
Better compatibility - Official MCP SDK
Faster development - Direct code changes
Simpler deployment - Pure NPX distribution
No protocol issues - Official Anthropic SDK
๐ Migration Steps
Uninstall old version: Remove Go-based installation
Install new version:
npx @idletoaster/ssh-mcp-server@latestUpdate Claude config: Same configuration works!
Test connection: Verify SSH functionality
๐ค Contributing
Development Workflow
Fork the repository
Create a feature branch:
git checkout -b feature/amazing-featureMake your changes
Test thoroughly:
npm testSubmit a pull request
Code Style
Use ES6+ modern JavaScript
Follow Node.js best practices
Add JSDoc comments for functions
Validate with existing patterns
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
@modelcontextprotocol/sdk - Official MCP SDK
ssh2 - Node.js SSH client
Claude Desktop - Primary target platform
Model Context Protocol - Standard specification
๐ Support
๐ Issues: GitHub Issues
๐ฌ Discussions: GitHub Discussions
Built with โค๏ธ for the AI development community using Node.js and official MCP SDK
๐ NEW in v2.1.0: Token-Efficient File Operations
Enhanced with 4 powerful tools inspired by Desktop Commander for optimal token usage:
๐ฏ Token-Efficient Tools
ssh-edit-block - Edit specific text blocks (80-90% token reduction vs full rewrites)
ssh-read-lines - Read file sections by line numbers (massive savings for large files)
ssh-search-code - Pattern search without reading full files
ssh-write-chunk - Efficient content writing with append/rewrite modes
๐ก Benefits
80-90% fewer tokens for file operations
No more full file rewrites for small changes
Partial file reading for large codebases
Pattern searching without token overhead
๐ New Tool Usage
// Edit specific text blocks
{
"name": "ssh-edit-block",
"arguments": {
"host": "server.com",
"user": "username",
"filePath": "/path/to/file.js",
"oldText": "version: '2.0.0'",
"newText": "version: '2.1.0'"
}
}
// Read specific lines only
{
"name": "ssh-read-lines",
"arguments": {
"host": "server.com",
"user": "username",
"filePath": "/path/to/large-file.js",
"startLine": 100,
"endLine": 150
}
}
// Search patterns efficiently
{
"name": "ssh-search-code",
"arguments": {
"host": "server.com",
"user": "username",
"path": "/project",
"pattern": "function.*export",
"filePattern": "*.js"
}
}Available Tools
5 toolsremote-sshB
Execute SSH commands on remote servers with private key authentication
Inputs: host (required), user (required), command (required), privateKeyPath, +1 more.
ssh-edit-blockB
Edit specific text blocks in remote files (token-efficient alternative to full rewrites)
Inputs: host (required), user (required), filePath (required), oldText (required), +4 more.
ssh-read-linesA
Read specific lines from remote files (token-efficient for large files)
Inputs: host (required), user (required), filePath (required), startLine, +4 more.
ssh-search-codeA
Search for patterns in remote files without reading full content (token-efficient)
Inputs: host (required), user (required), path (required), pattern (required), +6 more.
ssh-write-chunkB
Write content to remote files with append/rewrite modes (token-efficient for large content)
Inputs: host (required), user (required), filePath (required), content (required), +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: remote-ssh for general command execution, and the four ssh-* tools for specific file operations (edit block, read lines, search code, write chunk). There is no overlap or ambiguity.
Four tools follow the consistent 'ssh-verb-noun' pattern (e.g., ssh-read-lines), but 'remote-ssh' breaks this pattern. Still, the naming is mostly consistent and predictable.
With 5 tools, the server is well-scoped for its purpose of SSH remote operations. It covers essential file manipulation and command execution without being too sparse or bloated.
The tool set covers command execution and core file operations (read, write, edit, search). However, it lacks file listing, deletion, or transfer capabilities, leaving minor gaps for a complete SSH toolkit.
Maintenance
Related MCP Connectors
Work on your own computers from Claude or ChatGPT: run commands, edit and search files.
Connect AI assistants to explicitly paired computers, servers, and VMs for permitted remote actions.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yoโฆ
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceProvides remote filesystem operations, git repository management, and process execution capabilities for AI agents through the Model Context Protocol.-
- AlicenseNot gradedqualityBmaintenanceEnables secure remote command execution and bidirectional file transfers on SSH servers through the Model Context Protocol. It features robust security controls including command whitelisting, credential isolation, and support for multiple SSH connection profiles.2,863 npm1,041ISC
- AlicenseBqualityDmaintenanceEnables AI assistants to manage SSH connections, execute commands, and transfer files via SFTP over the Model Context Protocol.2746 PyPI3MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to execute commands and transfer files on remote servers over SSH connections.1MIT