{"_id":"@alolite/ssh-mcp","_rev":"4-a54eefe83ad489c038c98d3384d78b6b","name":"@alolite/ssh-mcp","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.1":{"name":"@alolite/ssh-mcp","version":"1.0.1","keywords":["mcp","ssh","remote","server","model-context-protocol"],"author":"","license":"MIT","_id":"@alolite/ssh-mcp@1.0.1","maintainers":[{"name":"jppradhan","email":"er.jppradhan@gmail.com"}],"homepage":"https://github.com/jppradhan/ssh-mcp#readme","bugs":{"url":"https://github.com/jppradhan/ssh-mcp/issues"},"bin":{"ssh-mcp":"build/index.js"},"dist":{"shasum":"cc3253ee73cc1eea3bab00776f93627e0434c7bd","tarball":"https://registry.npmjs.org/@alolite/ssh-mcp/-/ssh-mcp-1.0.1.tgz","fileCount":6,"integrity":"sha512-VRMqBlWMGaIO4pGSDnly3WWsOFGtw0XZ5zf588hqk8Zi54wP87pCW3Fb7NeWi4wL04K8q/6xbH8D3U3Oe8gIiw==","signatures":[{"sig":"MEUCIHcBzkIGlbEOegw6j5y+gWJGtKtVjFB5VSSeIHkSt+hvAiEAso9tZn7+IA8sT11kirb7fXEJu7CDDEzzwlxn7BerkLI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34142},"main":"build/index.js","type":"module","types":"./build/index.d.ts","gitHead":"9f9c131f2337a4d47ff095d18d96b4f1dade879a","scripts":{"dev":"tsx src/index.ts","build":"tsc && chmod +x build/index.js","start":"node build/index.js"},"_npmUser":{"name":"jppradhan","email":"er.jppradhan@gmail.com"},"repository":{"url":"git+https://github.com/jppradhan/ssh-mcp.git","type":"git"},"_npmVersion":"10.8.2","description":"MCP server for SSH remote command execution","directories":{},"_nodeVersion":"18.20.8","dependencies":{"zod":"^3.22.4","ssh2":"^1.15.0","@modelcontextprotocol/sdk":"^1.0.2"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.6.0","typescript":"^5.3.0","@types/node":"^20.0.0","@types/ssh2":"^1.15.0"},"_npmOperationalInternal":{"tmp":"tmp/ssh-mcp_1.0.1_1758352554450_0.6051954299231865","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@alolite/ssh-mcp","version":"1.0.2","keywords":["mcp","ssh","remote","server","model-context-protocol"],"author":"","license":"MIT","_id":"@alolite/ssh-mcp@1.0.2","maintainers":[{"name":"jppradhan","email":"er.jppradhan@gmail.com"}],"homepage":"https://github.com/jppradhan/ssh-mcp#readme","bugs":{"url":"https://github.com/jppradhan/ssh-mcp/issues"},"bin":{"ssh-mcp":"build/index.js"},"dist":{"shasum":"f996206f12d59f2107a8bd973924dadd19550f0b","tarball":"https://registry.npmjs.org/@alolite/ssh-mcp/-/ssh-mcp-1.0.2.tgz","fileCount":6,"integrity":"sha512-Ky6mPyfAmyxFiBydUGvdtzQnFrZJHv8murirKt27PTuSPyEKB3n/h9i+wZuDHJMVpKWzE5MVjdohDwr/PmJPzA==","signatures":[{"sig":"MEYCIQDGB9pC8YPeqchyVvdGhEyjAgG9P2YiPiPRgcuOECyDyAIhAL/9oVTVvHnKAScZQ6hcZxclly+Z6uIK3R36ZzCVzbzN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34168},"main":"build/index.js","type":"module","types":"./build/index.d.ts","gitHead":"55d1b9449250ae0d67688c640ec992fa244c09f2","scripts":{"dev":"tsx src/index.ts","build":"tsc && chmod +x build/index.js","start":"node build/index.js"},"_npmUser":{"name":"jppradhan","email":"er.jppradhan@gmail.com"},"repository":{"url":"git+https://github.com/jppradhan/ssh-mcp.git","type":"git"},"_npmVersion":"10.8.2","description":"MCP server for SSH remote command execution","directories":{},"_nodeVersion":"18.20.8","dependencies":{"zod":"^3.22.4","ssh2":"^1.15.0","@modelcontextprotocol/sdk":"^1.0.2"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.6.0","typescript":"^5.3.0","@types/node":"^20.0.0","@types/ssh2":"^1.15.0"},"_npmOperationalInternal":{"tmp":"tmp/ssh-mcp_1.0.2_1758353590287_0.21034465695391735","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@alolite/ssh-mcp","version":"1.0.3","keywords":["mcp","ssh","remote","server","model-context-protocol"],"author":"","license":"MIT","_id":"@alolite/ssh-mcp@1.0.3","maintainers":[{"name":"jppradhan","email":"er.jppradhan@gmail.com"}],"homepage":"https://github.com/jppradhan/ssh-mcp#readme","bugs":{"url":"https://github.com/jppradhan/ssh-mcp/issues"},"bin":{"alolite-ssh-mcp":"build/index.js"},"dist":{"shasum":"744912a95b5a60af0846a90721241ced0ff3671f","tarball":"https://registry.npmjs.org/@alolite/ssh-mcp/-/ssh-mcp-1.0.3.tgz","fileCount":6,"integrity":"sha512-JOz1n/NS5yLaZC9wPn9LFjy8TpWYtgHDtCxaGRqBjvsH1H62jbx5vHxXdcxwDPDPHCLZIhSdq8Z2SFcsLDuVLA==","signatures":[{"sig":"MEYCIQCrduOBz1vIYey0Z0o2mVwuS/gW+e4sHciHJ5G77CQuyAIhAL8V+uqZ146oQAGIL69zns/dbnf0Haqqv8FIuKEcJQMi","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34166},"main":"build/index.js","type":"module","types":"./build/index.d.ts","gitHead":"249a5e7af01f52f2d13a989b03cf1a915acd6de6","scripts":{"dev":"tsx src/index.ts","build":"tsc && chmod +x build/index.js","start":"node build/index.js"},"_npmUser":{"name":"jppradhan","email":"er.jppradhan@gmail.com"},"repository":{"url":"git+https://github.com/jppradhan/ssh-mcp.git","type":"git"},"_npmVersion":"10.8.2","description":"MCP server for SSH remote command execution","directories":{},"_nodeVersion":"18.20.8","dependencies":{"zod":"^3.22.4","ssh2":"^1.15.0","@modelcontextprotocol/sdk":"^1.0.2"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.6.0","typescript":"^5.3.0","@types/node":"^20.0.0","@types/ssh2":"^1.15.0"},"_npmOperationalInternal":{"tmp":"tmp/ssh-mcp_1.0.3_1758354330116_0.10684832634862351","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@alolite/ssh-mcp","version":"1.0.4","description":"MCP server for SSH remote command execution","type":"module","main":"build/index.js","bin":{"alolite-ssh-mcp":"build/index.js"},"scripts":{"build":"tsc && chmod +x build/index.js","dev":"tsx src/index.ts","start":"node build/index.js"},"dependencies":{"@modelcontextprotocol/sdk":"^1.0.2","ssh2":"^1.15.0","zod":"^3.22.4"},"devDependencies":{"@types/node":"^20.0.0","@types/ssh2":"^1.15.0","tsx":"^4.6.0","typescript":"^5.3.0"},"keywords":["mcp","ssh","remote","server","model-context-protocol"],"author":"","license":"MIT","repository":{"type":"git","url":"git+https://github.com/jppradhan/ssh-mcp.git"},"homepage":"https://github.com/jppradhan/ssh-mcp#readme","bugs":{"url":"https://github.com/jppradhan/ssh-mcp/issues"},"_id":"@alolite/ssh-mcp@1.0.4","gitHead":"4fd49f59e37359a47d3a1a7d2940ddbc3ff7389f","types":"./build/index.d.ts","_nodeVersion":"18.20.8","_npmVersion":"10.8.2","dist":{"integrity":"sha512-EGnTQR7kPK0UfUyPVkJtBNY5S/FEH8qTWzR4JDHJ0PDA9kW/+JXZQiI80rdGoHCO0BSAbPbx28epXj/OSc0+Qw==","shasum":"2174f0765019a28ccc7706acd09842220a4accd6","tarball":"https://registry.npmjs.org/@alolite/ssh-mcp/-/ssh-mcp-1.0.4.tgz","fileCount":6,"unpackedSize":32787,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFKfGYgXqMR44NlKB+Kl+4ANG3QI68x6qK1na1dcWLSUAiBtiq73kRKUmdBcfiTU2r2MRcBmwEtxDw6opsS+S3Gf6Q=="}]},"_npmUser":{"name":"jppradhan","email":"er.jppradhan@gmail.com"},"directories":{},"maintainers":[{"name":"jppradhan","email":"er.jppradhan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ssh-mcp_1.0.4_1758358572226_0.6127462856781198"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-20T07:15:54.297Z","modified":"2025-09-20T08:56:12.637Z","1.0.1":"2025-09-20T07:15:54.665Z","1.0.2":"2025-09-20T07:33:10.477Z","1.0.3":"2025-09-20T07:45:30.346Z","1.0.4":"2025-09-20T08:56:12.414Z"},"bugs":{"url":"https://github.com/jppradhan/ssh-mcp/issues"},"license":"MIT","homepage":"https://github.com/jppradhan/ssh-mcp#readme","keywords":["mcp","ssh","remote","server","model-context-protocol"],"repository":{"type":"git","url":"git+https://github.com/jppradhan/ssh-mcp.git"},"description":"MCP server for SSH remote command execution","maintainers":[{"name":"jppradhan","email":"er.jppradhan@gmail.com"}],"readme":"# Alolite SSH MCP Server\n\nA Model Context Protocol (MCP) server that enables SSH remote command execution on remote machines with **persistent connections**. This server provides a secure way to connect to remote servers, execute commands, and retrieve output through the MCP protocol while maintaining long-lived SSH sessions for improved performance.\n\n## Features\n\n- **Persistent SSH connections** - Maintains long-lived SSH sessions for better performance\n- **Automatic connection management** - Reuses connections, automatically reconnects if lost\n- **Connection pooling** - Manages multiple SSH connections efficiently\n- Execute commands on remote servers via SSH\n- **Automatic SSH key discovery** - Works like standard `ssh` command, automatically finds keys in `~/.ssh/`\n- Support for both SSH key and password authentication\n- SSH agent forwarding support\n- Configurable connection timeouts\n- Detailed command execution results including stdout, stderr, and exit codes\n- **Connection monitoring** - Track active connections, idle times, and connection status\n- **Graceful cleanup** - Automatic cleanup of stale connections and graceful shutdown\n- Error handling and reporting\n\n## Installation\n\n### From npm (Recommended)\n\n```bash\nnpm install -g @alolite/ssh-mcp\n```\n\n### From source\n\n1. Clone the repository:\n```bash\ngit clone <repository-url>\ncd ssh-mcp\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Build the project:\n```bash\nnpm run build\n```\n\n## Usage\n\nThe server exposes two main tools: `ssh_execute` and `ssh_connections`\n\n### ssh_execute\n\nExecute a command on a remote server via SSH with persistent connections, just like using `ssh -A username@hostname`.\n\n**Key Benefits of Persistent Connections:**\n- First command to a server establishes the connection\n- Subsequent commands reuse the existing connection (much faster)\n- Connections are automatically maintained and monitored\n- Automatic reconnection if connection is lost\n- Connection cleanup after 30 minutes of inactivity\n\n**Parameters:**\n- `host` (string): SSH server hostname or IP address (e.g., 'dev234', '192.168.1.100')\n- `username` (string): SSH username (e.g., 'username')\n- `command` (string): Command to execute on the remote server\n- `port` (number, optional): SSH server port (default: 22)\n- `privateKeyPath` (string, optional): Path to SSH private key file (default: auto-discovered from ~/.ssh/)\n- `passphrase` (string, optional): Passphrase for the private key (if required)\n- `password` (string, optional): SSH password (only if not using SSH keys)\n- `timeout` (number, optional): Connection timeout in milliseconds (default: 10000)\n- `agentForward` (boolean, optional): Enable SSH agent forwarding (default: true)\n\n### ssh_connections\n\nManage and monitor SSH connections in the connection pool.\n\n**Parameters:**\n- `action` (string): Action to perform:\n  - `\"list\"`: List all active connections with status\n  - `\"close\"`: Close a specific connection\n  - `\"close_all\"`: Close all connections\n- `connectionKey` (string, optional): Connection identifier (username@host:port) - required for \"close\" action\n\n**Usage Examples:**\n```javascript\n// List all active connections\n{\n  \"action\": \"list\"\n}\n\n// Close a specific connection\n{\n  \"action\": \"close\",\n  \"connectionKey\": \"username@host:22\"\n}\n\n// Close all connections\n{\n  \"action\": \"close_all\"\n}\n```\n\n**Authentication Priority:**\n1. If `password` is provided, use password authentication\n2. Otherwise, use SSH key authentication (default behavior):\n   - If `privateKeyPath` is specified, use that key\n   - If not specified, automatically discover keys from `~/.ssh/` directory\n   - Tries common key names: `id_rsa`, `id_ed25519`, `id_ecdsa`, `id_dsa`\n\n**Simple Usage Examples for ssh_execute:**\n```javascript\n// Basic command execution (like: ssh username@host 'ls -la')\n// First run establishes connection, subsequent runs reuse it\n{\n  \"host\": \"host\",\n  \"username\": \"username\", \n  \"command\": \"ls -la\"\n}\n\n// Second command on same server (reuses connection - much faster!)\n{\n  \"host\": \"host\",\n  \"username\": \"username\", \n  \"command\": \"pwd\"\n}\n\n// Check disk space on production server\n{\n  \"host\": \"prod-web-01.company.com\",\n  \"username\": \"deploy\",\n  \"command\": \"df -h\"\n}\n\n// Run a command with specific SSH key\n{\n  \"host\": \"staging-db\",\n  \"username\": \"dbadmin\",\n  \"privateKeyPath\": \"/home/user/.ssh/staging_rsa\",\n  \"command\": \"systemctl status postgresql\"\n}\n```\n\n### Example Configuration for Claude Desktop\n\nAdd this to your VSCode configuration:\n\n```json\n{\n  \"servers\": {\n    \"alolite-ssh-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"alolite-ssh-mcp\", \"@alolite/ssh-mcp\"]\n    }\n  }\n}\n```\n\n## Security Considerations\n\n- **Credentials**: This server requires SSH credentials to function. Be cautious about how credentials are provided and stored.\n- **Command Execution**: The server can execute arbitrary commands on remote systems. Ensure proper access controls.\n- **Network Security**: SSH connections are encrypted, but ensure you're connecting to trusted hosts.\n- **Logging**: Sensitive information like passwords are not logged, but command output may contain sensitive data.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}