# ssh MCP server

> Allows AI assistants to remotely execute SSH commands, manage files, and handle background tasks through a standardized protocol.

- Repository: https://github.com/classfang/ssh-mcp-server
- Page: https://hostedmcp.org/servers/classfang/ssh-mcp-server
- Transport: stdio
- Stars: 1045
- License: ISC

## Install

### Claude Code

```sh
claude mcp add ssh-mcp-server -- npx -y @fangjunjie/ssh-mcp-server
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "ssh-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "ssh-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"ssh-mcp-server","type":"stdio","command":"npx","args":["-y","@fangjunjie/ssh-mcp-server"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "ssh-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add ssh-mcp-server -- npx -y @fangjunjie/ssh-mcp-server
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.ssh-mcp-server]
command = "npx"
args = ["-y", "@fangjunjie/ssh-mcp-server"]
```

### Gemini CLI

```sh
gemini mcp add -s user ssh-mcp-server npx -- -y @fangjunjie/ssh-mcp-server
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "ssh-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@fangjunjie/ssh-mcp-server"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `SSH_MCP_HTTP_TOKEN` | no | no |  |

## FAQ

### How can I securely control which commands the AI can run?

You can use the --whitelist and --blacklist flags to define allowed or forbidden command ranges using regular expressions.

### How does the server handle multi-factor authentication (2FA)?

By enabling the --try-keyboard flag, the server can handle 2FA prompts using the SSH_MCP_2FA_CODE environment variable.
