
SSH MCP Server
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.
README
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:
git clone <repository-url>
cd ssh_mcp
- Install dependencies:
uv sync
- Test the installation:
uv run python main.py
Claude Desktop Configuration
1. Locate Claude Desktop Config File
Windows:
%APPDATA%\Claude\claude_desktop_config.json
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Linux:
~/.config/Claude/claude_desktop_config.json
2. Add MCP Server Configuration
Add the following configuration to your claude_desktop_config.json
:
{
"mcpServers": {
"ssh-session-manager": {
"command": "uv",
"args": [
"--directory",
"path/to/ssh_mcp",
"run",
"python",
"main.py"
],
"env": {
"PYTHONPATH": "path/to/ssh_mcp"
}
}
}
}
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:
Connect to my server using ssh_connect with host="192.168.1.100", username="admin", password="mypassword"
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:
Execute "ls -la" command in session "ssh_12345678"
ssh_list_sessions
List all active SSH sessions.
Example:
Show me all active SSH sessions
ssh_session_info
Get detailed information about a specific SSH session.
Parameters:
session_id
(string): ID of the SSH session
Example:
Get information about session "ssh_12345678"
ssh_close_session
Close a specific SSH session.
Parameters:
session_id
(string): ID of the SSH session to close
Example:
Close SSH session "ssh_12345678"
ssh_close_all_sessions
Close all active SSH sessions.
Example:
Close all SSH sessions
Configuration Options
Session Manager Settings
You can modify the session manager settings in main.py
:
ssh_manager = SSHSessionManager(
max_sessions=5, # Maximum number of concurrent sessions
session_timeout=600 # Session timeout in seconds (10 minutes)
)
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
Connect to server 192.168.1.100 with username "admin" and password "mypass"
Execute Multiple Commands
1. Connect to my server at example.com with username "user" and password "pass"
2. Execute "whoami" command
3. Execute "df -h" command
4. Show session information
Session Management
1. List all active sessions
2. Close session with oldest connection
3. Show remaining sessions
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
ssh_mcp/
├── main.py # Main MCP server implementation
├── pyproject.toml # Project configuration and dependencies
├── uv.lock # Dependency lock file
├── README.md # This file
└── run_mcp.bat # Windows batch script for easy execution
Running in Development Mode
# Run the MCP server directly
uv run python main.py
# Or use the batch script (Windows)
run_mcp.bat
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
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。