SSH MCP Server
Advanced SSH Session Manager for Model Context Protocol (MCP) with multi-session support and connection monitoring.
Features
- Multi-Session Management: Create and manage multiple SSH connections simultaneously
- Session Monitoring: Automatic connection health checks and timeout management
- Command Execution: Execute commands on remote servers with timeout control
- Session Persistence: Maintain long-running SSH sessions with metadata tracking
- Automatic Cleanup: Intelligent session cleanup based on usage and timeouts
Installation
Prerequisites
- Python 3.11+
- UV package manager
- Claude Desktop
Setup with UV
- Clone or download this project:
- Install dependencies:
- Test the installation:
Claude Desktop Configuration
1. Locate Claude Desktop Config File
Windows:
macOS:
Linux:
2. Add MCP Server Configuration
Add the following configuration to your claude_desktop_config.json
:
Note: Replace path/to/ssh_mcp
with the actual path to your project directory.
3. Restart Claude Desktop
After saving the configuration, restart Claude Desktop to load the MCP server.
Available Tools
ssh_connect
Create a new SSH connection session.
Parameters:
host
(string): SSH server hostname or IP addressusername
(string): SSH usernamepassword
(string): SSH passwordport
(int, optional): SSH port (default: 22)session_name
(string, optional): Custom session name
Example:
ssh_execute
Execute a command in an existing SSH session.
Parameters:
session_id
(string): ID of the SSH sessioncommand
(string): Command to executetimeout
(int, optional): Command timeout in seconds (default: 30)
Example:
ssh_list_sessions
List all active SSH sessions.
Example:
ssh_session_info
Get detailed information about a specific SSH session.
Parameters:
session_id
(string): ID of the SSH session
Example:
ssh_close_session
Close a specific SSH session.
Parameters:
session_id
(string): ID of the SSH session to close
Example:
ssh_close_all_sessions
Close all active SSH sessions.
Example:
Configuration Options
Session Manager Settings
You can modify the session manager settings in main.py
:
Security Considerations
- Host Key Verification: Currently disabled for development. Enable proper host key verification for production use.
- Password Storage: Passwords are not stored persistently but remain in memory during the session.
- Network Security: Use this tool only on trusted networks.
Usage Examples
Basic SSH Connection
Execute Multiple Commands
Session Management
Dependencies
asyncssh>=2.21.0
: Asynchronous SSH client librarymcp[cli]>=1.9.2
: Model Context Protocol frameworkparamiko>=3.5.1
: SSH client library (backup/compatibility)
Development
Project Structure
Running in Development Mode
Adding New Features
- Modify the
SSHSessionManager
class inmain.py
- Add new MCP tools using the
@mcp.tool()
decorator - Update this README with new tool documentation
Troubleshooting
Connection Issues
- Verify SSH server is accessible and credentials are correct
- Check firewall settings and network connectivity
- Ensure SSH service is running on the target server
Claude Desktop Integration
- Confirm UV is installed and accessible from system PATH
- Verify the project path in the configuration is correct
- Check Claude Desktop logs for error messages
- Restart Claude Desktop after configuration changes
Session Timeouts
- Increase
session_timeout
value in the session manager - Check network stability for long-running sessions
- Monitor session activity with
ssh_list_sessions
License
This project is open source. Please refer to the license file for more information.
Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
Changelog
v0.1.0
- Initial release
- Multi-session SSH management
- Basic command execution
- Session monitoring and cleanup
- Claude Desktop integration
This server cannot be installed
An advanced SSH session manager that allows Claude to establish and manage multiple SSH connections, execute remote commands, and monitor connection health through the Model Context Protocol.
Related MCP Servers
- AsecurityFlicenseAqualityProvides sophisticated context management for Claude, enabling persistent context across sessions, project-specific organization, and conversation continuity.Last updated -41JavaScript
- -securityFlicense-qualityA Model Context Protocol server for Claude Desktop that provides structured memory management across chat sessions, allowing Claude to maintain context and build a knowledge base within project directories.Last updated -TypeScript
- -securityAlicense-qualityA Model Context Protocol server that enables Claude to interact with the ConnectWise Manage API to perform operations like retrieving, creating, updating, and deleting tickets, companies, contacts, and other entities.Last updated -JavaScriptMIT License
- AsecurityAlicenseAqualityA collection of Model Context Protocol servers that enable Claude Desktop to provide development assistance capabilities with filesystem, Git, shell command, and web search functionality without incurring API usage costs.Last updated -214TypeScriptMIT License