MCP SSH Gateway¶
This guide enables SSH Gateway integration through the local Dockerized
mcp-ssh-gateway server registered in .mcp.json.
Scope¶
Current implementation in this repository provides:
- Docker-only MCP transport
- Pinned immutable runtime image digest
- Pinned upstream source commit checkout
- Bitwarden-managed SSH identity for remote command execution
- Local static connection declarations in
.data/mcp-ssh-gateway/config/connections.json
Runtime image: docker.io/python:3.12-slim
Source pin: olilanz/mcp-ssh-gateway@1303f538fb36ab45b8f2a685a30de9ff4cf7cc73
1. Initialize local SSH Gateway paths¶
Create a starter connection config:
This creates:
.data/mcp-ssh-gateway/config/connections.json.data/mcp-ssh-gateway/keys/
2. Generate and stash a shared SSH identity¶
Generate a local Ed25519 keypair:
Push the private and public keys into Bitwarden item SSH Gateway Identity:
Install the printed public key onto remote hosts in the target user
authorized_keys.
For another workstation, hydrate the same identity back from Bitwarden:
3. Define target connections¶
Edit .data/mcp-ssh-gateway/config/connections.json with one object per host.
Example:
[
{
"name": "prod-edge-1",
"mode": "direct",
"user": "ops",
"host": "10.10.10.21",
"port": 22,
"id_file": "/data/keys/id_ed25519"
}
]
Use mode: "tunnel" with loopback host and reverse tunnel port when the remote
initiates ssh -R to your agent host.
4. Validate MCP wiring¶
Run from the hermetic Nix shell:
Expected summary includes:
ssh-gateway MCP docker image: docker.io/python@sha256:<digest>
5. Example prompts¶
In your MCP-capable client, run prompts similar to:
Troubleshooting¶
Missing /data/config/connections.json: runjust mcp-ssh-gateway-init.Missing /data/keys/id_ed25519: runjust bw-ssh-gateway-key-pullorjust bw-ssh-gateway-key-generatethenjust bw-ssh-gateway-key-push.- SSH auth failures: verify the public key from
.data/mcp-ssh-gateway/keys/id_ed25519.pubis installed in the correct remote userauthorized_keys. - Connection failures: verify
host,port, and network reachability from the Docker runtime.