Skip to content

Comments

feat: add passphrase support for encrypted SSH keys#35

Open
mikusnuz wants to merge 2 commits intotufantunc:mainfrom
mikusnuz:main
Open

feat: add passphrase support for encrypted SSH keys#35
mikusnuz wants to merge 2 commits intotufantunc:mainfrom
mikusnuz:main

Conversation

@mikusnuz
Copy link

@mikusnuz mikusnuz commented Feb 6, 2026

Summary

  • Add --passphrase CLI argument for encrypted private SSH keys
  • Pass passphrase to ssh2 connection config when using key-based auth
  • Update SSHConfig interface to include passphrase field

Motivation

Currently, ssh-mcp only supports unencrypted private keys. Many users have passphrase-protected SSH keys for security reasons, and the ssh2 library already supports passphrases natively. This PR enables that functionality.

Usage

npx ssh-mcp -- --host=example.com --user=root --key=/path/to/encrypted/key --passphrase=your_key_passphrase

Changes

  • src/index.ts: Added PASSPHRASE constant and passphrase field to SSHConfig interface
  • README.md: Documented the new --passphrase option

Test

Tested with encrypted ed25519 and RSA keys with passphrases.


🤖 Generated with Claude Code

- Add --passphrase CLI argument for encrypted private keys
- Pass passphrase to ssh2 connection config when using key-based auth
- Update SSHConfig interface to include passphrase field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant