mcpHydroSSH

mcpHydroSSH

An SSH MCP server that enables users to connect to and manage remote servers directly from Claude Code. It provides tools to execute commands, monitor connection status, and dynamically manage server configurations through natural language.

Category
访问服务器

README

mcp-hydrocoder-ssh

中文 | English | Configuration Guide | 配置指南

MCP server that provides SSH remote connection capabilities for Claude Code. Connect to remote servers, execute commands, and automate deployments without needing a separate SSH terminal.

npm version License: MIT


Part 1: Features

What is this?

mcp-hydrocoder-ssh is an MCP (Model Context Protocol) server that enables Claude Code to:

  • 🔌 Connect to remote SSH servers directly (persistent background connections)
  • ⚡ Execute commands and get complete output
  • 🔄 Maintain connection state for multi-step operations
  • 🚀 Run deployment scripts (git pull, npm install, systemctl restart, etc.)

Key Benefits

Benefit Description
No window switching Complete all remote operations within Claude Code conversation
Smart deployment Claude can auto-determine next steps based on command output
Multi-server management Manage multiple server configs, switch quickly
Secure authentication Support SSH agent, key files
Connection pooling Maintain persistent connections, avoid re-authentication overhead

Available Tools

SSH Connection Tools (5):

  • ssh_list_servers - List all configured servers
  • ssh_connect - Connect to a server
  • ssh_exec - Execute commands (with working directory support)
  • ssh_get_status - Get connection status
  • ssh_disconnect - Disconnect from server

Configuration Management Tools (5):

  • ssh_add_server - Add new server configuration
  • ssh_remove_server - Remove server configuration
  • ssh_update_server - Update server configuration
  • ssh_view_config - View config (filters sensitive info)
  • ssh_help - Show help information

Part 2: Installation

One-Line Installation (Easiest, Recommended)

claude mcp add hydrossh npx mcp-hydrocoder-ssh@latest

Restart Claude Code and you're done!

Option 2: Global Installation

npm install -g mcp-hydrocoder-ssh
claude mcp add hydrossh mcp-hydrocoder-ssh

Option 3: Manual JSON Configuration

Edit ~/.claude.json:

Windows path: C:\Users\<YourUsername>\.claude.json macOS/Linux path: ~/.claude.json

{
  "mcpServers": {
    "hydrossh": {
      "command": "npx",
      "args": ["-y", "mcp-hydrocoder-ssh@latest"]
    }
  }
}

Note:

  • hydrossh is the server identifier, can be changed to any name you prefer.
  • -y flag lets npx auto-confirm installation, avoiding interactive prompts.

Verify Installation

In Claude Code, enter:

List available SSH servers

If you see a server list (empty list means no servers configured yet), the installation was successful.


Part 3: Using from Source Code

1. Clone Repository

git clone https://github.com/hydroCoderClaud/mcpHydroSSH.git
cd mcpHydroSSH

2. Install Dependencies

npm install

3. Build

npm run build

Build output goes to dist/ directory:

  • dist/index.js - MCP server entry point
  • dist/ssh-manager.js - SSH connection management
  • dist/config.js - Configuration management

4. Configure Claude Code

Edit ~/.claude.json:

{
  "mcpServers": {
    "hydrossh": {
      "command": "node",
      "args": ["<absolute-path>/dist/index.js"]
    }
  }
}

Note: Replace <absolute-path> with your actual source directory absolute path.

5. Restart Claude Code

Close and reopen Claude Code.

6. Development Mode (Optional)

For hot-reload development:

npm run dev

Then configure Claude Code with:

{
  "mcpServers": {
    "hydrossh": {
      "command": "npx",
      "args": ["tsx", "<absolute-path>/src/index.ts"]
    }
  }
}

Appendix A: SSH Configuration

Configuration file location: ~/.hydrossh/config.json

Auto-created on first run: The ~/.hydrossh/ directory and config file are automatically created when the MCP server first starts.

Quick Add via Claude Code

After installation, you can add server configs using natural language commands.

Configuration Example

{
  "servers": [
    {
      "id": "prod-server",
      "name": "Production Server",
      "host": "example.com",
      "port": 22,
      "username": "deploy",
      "authMethod": "agent"
    },
    {
      "id": "test-server",
      "name": "Test Server",
      "host": "test.example.com",
      "username": "ubuntu",
      "authMethod": "key",
      "privateKeyPath": "~/.ssh/id_rsa"
    }
  ],
  "settings": {
    "defaultConnectTimeout": 30000,
    "defaultKeepaliveInterval": 60000,
    "commandTimeout": 60000,
    "maxConnections": 5,
    "logCommands": true
  }
}

Authentication Methods

Method Configuration Description
SSH Agent "authMethod": "agent" Recommended, uses system SSH agent
Key File "authMethod": "key", "privateKeyPath": "~/.ssh/id_rsa" Default, reads private key file
Password "authMethod": "password", "password": "xxx" Not recommended, password stored in plaintext

See CONFIG-GUIDE_EN.md for details.


Appendix B: Usage Examples

Basic Usage

User: List available servers
Claude: Found 2 configured servers: prod-server, test-server

User: Connect to prod-server
Claude: [ssh_connect] Connected! connectionId: xxx

User: Execute command: uptime
Claude: [ssh_exec] Returns: up 30 days, 2 users, load average: 0.1, 0.2, 0.5

User: Disconnect
Claude: [ssh_disconnect] Disconnected

Automated Deployment

User: Deploy latest code to production server
Claude: Okay, I'll execute the deployment flow...
1. Connect to prod-server
2. cd /opt/myapp && git pull
3. npm ci --production
4. sudo systemctl restart myapp
5. Check service status
6. Disconnect
Deployment complete!

Appendix C: Security Notes

  • 🔒 SSH Agent Recommended - Prefer authMethod: "agent"
  • 🔒 Config File Permissions - Ensure ~/.hydrossh/config.json is readable only by you
  • 🔒 Config Viewing - ssh_view_config tool automatically filters passwords and key paths

Appendix D: Troubleshooting

Issue Solution
SSH Agent not running Windows: Start "OpenSSH Authentication Agent" service
Connection timeout Check server address, port, network connectivity
Command not found Verify npm global install or check PATH environment variable
Config not loaded Check if ~/.claude.json format is correct
Config file not found Auto-created on first run, or manually create ~/.hydrossh/config.json

Appendix E: Command Reference

Development Commands

npm run build        # Build TypeScript
npm run dev          # Development mode (hot reload)
npm test             # Run tests
npm run lint         # Code linting
npm run format       # Code formatting

MCP Tool Parameters

Tool Parameters Description
ssh_list_servers none List all configured servers
ssh_connect serverId, timeout? Connect to server
ssh_exec command, connectionId?, timeout?, cwd? Execute command
ssh_get_status connectionId? Get connection status (all if not specified)
ssh_disconnect connectionId? Disconnect (most recent if not specified)
ssh_add_server id, name, host, username, port?, authMethod?, privateKeyPath?, password? Add server config
ssh_remove_server serverId Remove server config
ssh_update_server serverId, name?, host?, port?, username?, authMethod?, privateKeyPath?, password? Update server config
ssh_view_config none View config (filters sensitive info)
ssh_help topic? Show help information

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选