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!
- π 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
# Use directly with NPX (recommended)
npx @idletoaster/ssh-mcp-server@latest
# Or install globally
npm install -g @idletoaster/ssh-mcp-serverAdd 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.
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"
{
"tool": "remote-ssh",
"arguments": {
"host": "192.168.1.100",
"user": "ubuntu",
"command": "df -h",
"privateKeyPath": "/home/user/.ssh/id_rsa"
}
}The server supports multiple authentication methods:
{
"privateKeyPath": "/path/to/your/private/key"
}export SSH_PRIVATE_KEY="/home/user/.ssh/id_rsa"Automatically searches for keys in:
~/.ssh/id_rsa~/.ssh/id_ed25519~/.ssh/id_ecdsa
- β
RSA keys (
id_rsa) - β
ED25519 keys (
id_ed25519) - β
ECDSA keys (
id_ecdsa) - β OpenSSH format
- β PEM format
- Node.js 18+ (check:
node --version) - NPM 9+ (check:
npm --version)
Download from nodejs.org or use Chocolatey:
choco install nodejscurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejscurl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
sudo yum install -y nodejsbrew install node# 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 devssh-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 gitignore
- Runtime: Node.js 18+ with ES Modules
- MCP SDK: @modelcontextprotocol/sdk (Official)
- SSH: ssh2 library for Node.js
- Distribution: NPM with direct NPX execution
- β Private key authentication only (no passwords)
- β Configurable SSH algorithms and timeouts
- β No persistent connections (session-based)
- β Input validation and sanitization
- β Comprehensive error handling
- π 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
# Example SSH config for restricted access
Host production-server
HostName 192.168.1.100
User deploy
IdentityFile ~/.ssh/production_key
IdentitiesOnly yes
StrictHostKeyChecking yes# Test the MCP server
echo '{"host":"test.server.com","user":"testuser","command":"whoami"}' | npm start# Verify Node.js installation
node --version # Should be 18+
npm --version # Should be 9+
# Test NPX execution
npx @idletoaster/ssh-mcp-server@latest --help- β Windows 10/11 (x64, ARM64)
- β macOS 12+ (Intel & Apple Silicon)
- β Linux (x64, ARM64) - All major distributions
- π€ Claude Desktop (Primary target)
- π€ Cursor IDE
- π€ Any MCP-compatible application
- β Node.js 18.x (LTS)
- β Node.js 20.x (LTS)
- β Node.js 22.x (Current)
Upgrading from the Go version? The Node.js version offers:
- 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
- Uninstall old version: Remove Go-based installation
- Install new version:
npx @idletoaster/ssh-mcp-server@latest - Update Claude config: Same configuration works!
- Test connection: Verify SSH functionality
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Test thoroughly:
npm test - Submit a pull request
- Use ES6+ modern JavaScript
- Follow Node.js best practices
- Add JSDoc comments for functions
- Validate with existing patterns
MIT License - see LICENSE file for details.
- @modelcontextprotocol/sdk - Official MCP SDK
- ssh2 - Node.js SSH client
- Claude Desktop - Primary target platform
- Model Context Protocol - Standard specification
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
Built with β€οΈ for the AI development community using Node.js and official MCP SDK
Enhanced with 4 powerful tools inspired by Desktop Commander for optimal token usage:
- 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
- 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
// 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"
}
}