MCP gateway for controlled SSH access with per-client auth, command policies, and audit logging.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
A centralized MCP gateway that gives AI agents controlled access to SSH infrastructure over Streamable HTTP.
ssh-mcp runs as a single HTTP service. Multiple AI clients β agents, CI pipelines, dashboards β connect to one gateway. SSH credentials stay on the gateway. Authorization policies, audit logging, and rate limiting are applied centrally before any SSH command executes.
Each agent runs its own process. SSH credentials live on every machine. No centralized control.
A single deployment serves all clients. Credentials, policies, and logs live in one place.
Different agents need different permissions. ssh-mcp enforces this at the gateway:
A minimal config demonstrating this setup:
Most MCP SSH servers run as local stdio processes β one per client, with no shared state, no centralized authorization, and no audit trail. When multiple AI agents, CI pipelines, or dashboards need SSH access, each one independently manages its own SSH keys and runs its own MCP process. This creates:
ssh-mcp solves this by deploying a single MCP server as an HTTP gateway. All clients connect to it; it connects to your SSH targets. Authorization, authentication, rate limiting, connection pooling, and audit logging happen in one place.
Run a team of AI agents with different access levels. The deployment agent can systemctl restart nginx on web servers; the monitoring agent can journalctl everywhere; the database agent can only run psql on the DB server. Each agent authenticates with its own API key; each key has its own permission set.
Point your CI pipeline at ssh-mcp instead of managing SSH keys on every runner. A single API key per pipeline, network-based rules for your CI subnet, and command allowlists ensure your deployment scripts run exactly what they should β nothing more.
Use ssh_download_file to pull logs, config files, or database dumps from remote servers without leaving your MCP client. The 8-layer path validation and sandbox root settings ensure file transfers stay within safe boundaries.
Build an MCP-powered dashboard that queries uptime, free, df, and ps across your fleet. The connection pool reuses SSH sessions, the circuit breaker isolates failing targets, and Prometheus metrics at /metrics feed your existing monitoring stack.
Every command is logged with structured JSONL: who ran what, on which server, from which IP, whether it was allowed, and how long it took. The matched_via field traces exactly which authorization layer made the decision. Config changes are logged separately with before/after state.
ssh-mcp applies defense-in-depth at every layer. The full security model is documented in docs/SECURITY.md.
Security boundary: ssh-mcp adds an authorization, authentication, and auditing layer in front of SSH. It does not replace the permissions of the underlying SSH accounts. If a command is allowed, the SSH user executes it with whatever privileges that account has. The gateway itself should be protected with TLS and network access controls. Logs may contain command output and should be treated accordingly.
Commands are evaluated through an ordered, layered chain. If any layer denies, the request stops there:
| Layer | What it checks |
|---|---|
| 1. Target validation | Is the server name known? |
2. block_patterns | Does the command match a blocked regex? |
| 3. Dangerous patterns | Does it contain $(), backticks, or newlines? |
| 4. Redirection guard | Do shell redirects target /dev/, /proc/, /sys/? |
| 5. Segmentation | After stripping redirects and splitting on &&, ` |
6. default rules | All-client allow/deny rules |
7. api_keys rules | Per-key allow/deny rules |
8. networks rules | Per-CIDR allow/deny rules |
| 9. Deny | Implicit fallback |
API keys are sent via X-API-Key or Authorization: Bearer headers. Keys are hashed with PBKDF2-HMAC-SHA256 (100,000 iterations, random 16-byte salt) and verified with constant-time comparison. Raw keys are never stored.
Commands, target names, and log strings are sanitized before processing: null bytes stripped, control characters removed, NFKC-normalized, and run through ReDoS protection for block_patterns.
SFTP transfers go through 8-layer path validation including null-byte checks, control-character stripping, dot-segment normalization, symlink resolution, and sandbox-root enforcement.
Sliding-window rate limiter per client IP (60 requests / 60 seconds, /health exempt). Violations return HTTP 429 with Retry-After.
Rate limiting is configurable under settings.rate_limit:
Note: the rate limiter is built once at container startup from the initial config and is not rebuilt on config hot-reload. To disable rate limiting you must set
settings.rate_limit.enabledtofalsein the config present at boot (e.g.config/ssh-mcp-config.jsonin the mounted volume). This is useful for high-volume clients or test suites that issue many requests from a single IP.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/ssh-mcp)<a href="https://allmcps.com/mcp/ssh-mcp"><img src="https://allmcps.com/api/badge/ssh-mcp?style=directory" alt="Ssh MCP on AllMCPs" /></a>