
ssh-mcp
io.github.gelsePublished by GitHub account gelsev0.3.0Updated Oct 24, 2026
MCP gateway for controlled SSH access with per-client auth, command policies, and audit logging.
Overview
A centralized MCP gateway that gives AI assistants controlled SSH access to remote servers, with per-client authorization, command policies, and audit logging.
- What you can do
- Exposes six MCP tools over Streamable HTTP: list configured SSH targets, list allowed commands for a target, execute a command on a remote server, test SSH connectivity, and download or upload a single file via SFTP. Authorization, rate limiting, connection pooling, and JSONL audit logging are handled centrally in the gateway rather than in each client. Configuration lives in JSON files with hot reload, and an optional web dashboard and REST API manage configuration.
- When to use it
- Use it when several AI agents or clients need SSH access to the same servers and you want one place to define which commands each client may run, to pool connections, and to keep an audit trail. It is a poor fit if you need an interactive shell, directory listing or recursive SFTP transfer, or network-level access control.
- Requirements
- Runs as a local process or Docker container (image ghcr.io/gelse/ssh-mcp, host port 9080 mapped to 8080). Needs a config directory (CONFIG_DIR) with ssh-mcp-config.json and secrets.json, an SSH target list with credentials or keys, and an API key hash for clients, passed via X-API-Key or Authorization: Bearer. Optional: CONFIG_API_ENABLED and CONFIG_API_TOKEN for the config API and dashboard, and LOG_DIR for audit logs.
Installation
In SourceWeft
- Open ssh-mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
ssh-mcp
A centralized MCP gateway that gives AI agents controlled SSH access over Streamable HTTP.
[License: MIT] [Docker] [MCP] [Security] [M8ven Live Monitored]
What problem does this solve?
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 need SSH access, each manages its own SSH keys and runs its own process. This creates:
- No centralized access control — every client decides what it can run
- No audit trail — commands are invisible to the ops team
- SSH key sprawl — keys scattered across every agent machine
- No rate limiting — a runaway agent can overwhelm a target
ssh-mcp solves this by deploying a single HTTP gateway. All clients connect to it; it connects to your SSH targets. Authorization, rate limiting, connection pooling, and audit logging happen in one place.
Quick Start
Using the pre-built image (recommended)
The image is published at ghcr.io/gelse/ssh-mcp:latest.
The compose file maps host port 9080 to container port 8080.
Verify the server is running:
Create a minimal config in config/ssh-mcp-config.json:
Generate an API key hash and add it to your config or
secrets.json (see Configuration).
Build locally instead
What you can do (tools)
Six MCP tools are available over Streamable HTTP:
Tool Naming Convention
All tools follow the pattern ssh_<verb>_<noun>:
ssh_list_servers— list resourcesssh_list_allowed_commands— list permissionsssh_execute_command— perform an actionssh_check_connection— verify connectivityssh_download_file/ssh_upload_file— file transfer
See examples/README.md for usage examples
including curl commands and Python client code.
What's configurable
ssh-mcp is configured via JSON files with hot-reload (15 s poll, 2 s debounce). Key areas:
Full reference: docs/CONFIGURATION.md
Why not just raw SSH / other MCP servers?
ssh-mcp adds a layered authorization chain (9 ordered layers) between every client request and every SSH command. Per-API-key and per-network rules let different agents get different permissions on different servers — without touching the underlying SSH accounts.
Additional protections:
- Circuit breakers isolate failing targets with exponential backoff
- Rate limiting prevents runaway agents from overwhelming hosts
- Structured audit logs trace every command, client, IP, and authorization decision
- Connection pooling reuses SSH sessions across requests
- Input sanitization and dangerous-pattern detection block shell injection attempts
Architecture: ARCHITECTURE.md
Security model: docs/SECURITY.md
What it is NOT
- Not an interactive shell — commands are executed individually with structured output
- Not a file manager — SFTP supports single-file download and upload only (no directory listing or recursive transfer)
- Not a firewall / network ACL — authorization is command-level, not network-level
- Does not reduce SSH account privileges — if a command is allowed, the SSH user executes it with whatever privileges that account has
Not yet / known gaps
Fixable with contribution:
- SFTP is single-file only — no directory listing or recursive transfer
- No TLS termination — run Traefik or nginx in front
- No OAuth or mTLS app-layer authentication
- Rate limiter settings are not hot-reloadable (set at boot)
Architectural:
- Config API dashboard login sessions are in-memory only — they don't survive restarts and the API is single-instance (config changes themselves persist to the config file normally)
- No tamper protection for audit logs
Observability
- Health:
GET /health— returns{"status": "ok"} - Metrics:
GET /metrics— Prometheus exposition format - Logging: Structured JSONL with request correlation
Full reference: docs/OBSERVABILITY.md
Config API & Dashboard
An optional web dashboard for managing configuration without
editing JSON files. Enable with CONFIG_API_ENABLED=true.
Full reference: docs/CONFIG-API.md
FAQ
Dashboard returns 401 over HTTP
The session cookie defaults to Secure (HTTPS only). For local
HTTP testing, set:
Then restart the container.
How do MCP clients connect?
Connect to http://host:9080/mcp using the Streamable HTTP
transport. Pass your API key via X-API-Key or
Authorization: Bearer header.
How do I generate an API key hash?
Or use the hash utility in the Config API dashboard.
How does hot reload work?
The config file is polled every 15 seconds with a 2-second debounce. Changes to targets, commands, and settings take effect without restart. Rate limiter and log target settings require a restart.
Why was my command denied?
Commands are evaluated through a 9-layer authorization chain.
The matched_via field in logs shows which layer denied.
See Security Model for the full chain.
How does rate limiting work?
Per-IP sliding window, default 60 requests per 60 seconds.
Exceeding the limit returns HTTP 503. Configure via
settings.rate_limit in the config file.
Where do logs go?
Logs are written to the /logs volume (mapped from ./logs).
The active log file is ssh-mcp.log in JSONL format with
optional gzip rotation.
Troubleshooting basics
Documentation
Development
See CONTRIBUTING.md for the full development
guide, coding conventions, and PR workflow.
Roadmap
No public roadmap. See Not yet / known gaps for current limitations and opportunities.
License
Source: README.md at commit ec87fab
Tools
0Version history
1- v0.3.0LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts