MCP Directory

How to add SSH MCP Server to Cursor

Execute shell commands on remote Linux and Windows servers over SSH via MCP. Paste the config into ~/.cursor/mcp.json and restart Cursor.

Last updated June 14, 2026 · 504 · stdio · no auth

Cursor config for SSH MCP Server

npx -y ssh-mcp
{
  "mcpServers": {
    "ssh-mcp-server": {
      "command": "npx",
      "args": [
        "ssh-mcp",
        "-y",
        "--",
        "--host=1.2.3.4",
        "--port=22",
        "--user=root",
        "--password=pass",
        "--key=path/to/key",
        "--timeout=30000",
        "--maxChars=none"
      ]
    }
  }
}

Setup steps

  1. 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
  2. 2Paste the SSH MCP Server config below into the "mcpServers" object.
  3. 3Fill in placeholder secrets, then save.
  4. 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
  5. 5Ask Cursor to use one of SSH MCP Server's tools to confirm it's connected.

Before you start

  • Node.js (per package engines)
  • A reachable SSH server (Linux or Windows) with host, username, and password or SSH private key
  • An MCP client such as Claude Desktop, Claude Code, Cursor, or Windsurf

What SSH MCP Server can do in Cursor

exec

Execute a shell command on the remote SSH server. Parameters: command (required) — shell command to execute; description (optional) — note appended as a comment. Subject to the configurable --timeout (default 60000ms) and --maxChars limit (default 1000, disable with none or 0).

sudo-exec

Execute a shell command with sudo elevation as root. Parameters: command (required); description (optional). Requires --sudoPassword for password-protected sudo (or use --suPassword for a persistent root shell). Subject to the same --timeout and --maxChars settings. Not available when the server is started with --disableSudo.

Security

Grants an MCP client the ability to run arbitrary shell commands on a remote server over SSH, including optional sudo/su root elevation. Credentials (password, SSH key path, sudo/su passwords) are passed as command-line arguments in the client config. Use a least-privilege SSH account, prefer key-based auth, and pass `--disableSudo` when root access is not needed. Provided under the MIT License; use at your own risk.

SSH MCP Server + Cursor FAQ

Where is the Cursor config file?

Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the SSH MCP Server config there under the "mcpServers" key and restart the client.

Is SSH MCP Server safe to use with Cursor?

Grants an MCP client the ability to run arbitrary shell commands on a remote server over SSH, including optional sudo/su root elevation. Credentials (password, SSH key path, sudo/su passwords) are passed as command-line arguments in the client config. Use a least-privilege SSH account, prefer key-based auth, and pass `--disableSudo` when root access is not needed. Provided under the MIT License; use at your own risk.

Which authentication methods are supported?

Password authentication via --password, or SSH key-based authentication via --key (path to a private SSH key). Optional --sudoPassword and --suPassword enable privileged operations.

How do I add it to Claude Code?

Use the claude mcp add command, e.g. `claude mcp add --transport stdio ssh-mcp -- npx -y ssh-mcp -- --host=YOUR_HOST --user=YOUR_USER --password=YOUR_PASSWORD`. Scopes can be set with --scope local|project|user.

Can I disable sudo access?

Yes. Pass the --disableSudo flag at startup and the sudo-exec tool will not be registered at all, which is useful when sudo access is not needed or not available.

View repo Full SSH MCP Server page