Aegis-SSH-MCP
About
Secure Zero-Trust SSH Gateway for AI Agents. A Go-based Model Context Protocol (MCP) server featuring runtime Regex Command Firewalls and multi-host isolation.
Details
- Author
- sparksbenjamin
- Categories
- Other, Security, Infrastructure
Jump to
Setup
Install Aegis-SSH-MCP in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/sparksbenjamin/Aegis-SSH-MCP
Follow the installation instructions in the repository README, then restart your MCP client.
Give AI agents safe, limited SSH access without handing them a shell.
Aegis-SSH-MCP is a small MCP-native bridge that lets an AI agent runapproved commandson Linux hosts over SSH.
It is built for people who want agentic infrastructure workflows, but donotwant to give an AI unrestricted terminal access.
Aegis sits between your MCP client and your servers. It checks every requested command against your rules, opens a short-lived SSH session only when the command is allowed, returns the result, and disconnects.
Aegis does not replace SSH, Linux permissions, sudo, or host hardening. It helps you keep those controls in charge while giving MCP clients a safer way to interact with real systems.
- Quick start
- How it works
- Core concepts
- Security model
- Client example: LibreChat
- Documentation
AI agents are useful when they can inspect logs, check services, look at containers, or run routine operational commands.
The dangerous version of that is simple:
Give the agent SSH access and hope it behaves.
Give the agent a narrow MCP tool that can only run commands you have approved.
That means an agent can do things like check Docker status, read logs, or run diagnostics without receiving a persistent shell, a pseudo-terminal, SSH agent forwarding, or hidden session state.
- connect an MCP client to Linux hosts over SSH
- let agents run a small set of operational commands
- keep command access host-scoped and rule-based
- audit what the agent tried to do
- preserve your existing SSH, Linux, sudo, and host security model
It is not a replacement for SSH, Linux permissions, sudo, IAM, RBAC, host hardening, or human judgment.
- give agents a persistent shell
- create hidden session state
- provide full OS-level sandboxing
- approve commands through a human workflow
- turn MCP into a full infrastructure automation platform
It gives an MCP client a controlled, auditable way to run approved SSH commands -- and leaves the rest of your security model intact.
The recommended way to run Aegis is with the includeddocker-compose.yml.
- Docker Compose
- an MCP client with SSE support
- a reachable Linux host
- an SSH key or password for a least-privileged remote user
By default, Aegis exposes MCP over SSE at:
Starter rule profiles are included inrules/. Keep or copy those profiles when deploying; the quick start only requires you to add host configs and SSH credentials.
Create these folders next todocker-compose.ymlif they do not already exist:
./configs ./keys ./certs # only needed if you enable HTTPS
The repository already includes./ruleswith starter rule profiles.
Place the SSH private key Aegis should use inkeys/.
Keep the key permissions strict and use a dedicated, least-privileged SSH user where possible.
{ "alias": "docker", "host_ip": "192.168.1.10", "ssh_port": 22, "ssh_user": "ops", "auth_method": "key", "key_path": "/keys/docker_ed25519", "rule_profile": "docker-readonly", "timeout_seconds": 30, "host_key_fingerprint": "SHA256:replace-this-with-your-real-host-key", "api_keys": [ "change-me-docker-key" ] }
- alias: the friendly name for this host
- ssh_user: the Linux user Aegis connects as
- key_path: the private key path inside the container
- rule_profile: the command rules this host uses
- host_key_fingerprint: pins the SSH host key
- api_keys: bearer tokens allowed to reach this host endpoint
docker compose pull docker compose up -d docker compose logs -f aegis-ssh-mcp
Send the bearer token configured inconfigs/docker.json:
Authorization: Bearer change-me-docker-key
curl -i -N \ -H "Authorization: Bearer change-me-docker-key" \ http://localhost:8443/mcp/docker/sse
A valid token should return200 OKand keep the SSE stream open.
git clone https://github.com/sparksbenjamin/Aegis-SSH-MCP.git cd Aegis-SSH-MCP go build -o aegis-ssh-mcp .
For each command request, Aegis follows the same basic flow:
- The MCP client asks Aegis to run a command.
- Aegis checks the bearer token for that host endpoint.
- Aegis parses the command.
- Aegis rejects unsafe shell behavior such as chaining, redirects, and command substitution.
- Aegis checks the command against the host's assigned rule profile.
- If the command is allowed, Aegis opens a fresh non-interactive SSH session.
- Aegis runs the command, captures the result, logs the attempt, and disconnects.
No persistent shell is handed to the agent.
+-------------------+ | MCP Client / LLM | | Claude / OpenAI | | LibreChat / SSE | +---------+---------+ | | MCP over HTTP/SSE or stdio | +---------v---------+ | Aegis-SSH-MCP | |-------------------| | Bearer Auth | | Rule Validation | | Audit Logging | | Host Isolation | | Ephemeral SSH | +---------+---------+ | | Standard SSH | +---------v---------+ | Remote Linux Host | |-------------------| | SSH Permissions | | sudo Policies | | auditd/journald | | Host Security | +-------------------+
Configs can be fixed hosts or dynamic profiles
Each JSON file inconfigs/describes either one fixed remote host or one dynamic SSH profile.
- one MCP endpoint
- one host-scoped SSH tool
- one assigned rule profile
- one bearer-token boundary for SSE
For example, a host with aliasdockerbecomes:
If one agent needs access to two hosts, add Aegis twice in the MCP client: one endpoint and one token per host alias.
A dynamic profile uses the same rule and SSH execution engine, but the MCP tool call supplies the host:
{ "config_type": "dynamic", "alias": "linux-dynamic", "ssh_user": "ops", "auth_method": "key", "key_path": "/keys/linux-dynamic.pem", "rule_profile": "readonly-safe", "api_keys": [ "change-me-linux-dynamic-key" ] }
That profile createsaegis_ssh_linux-dynamicwith two required arguments:
{ "host": "192.168.1.42", "command": "uptime" }
"rule_profile": "docker-readonly"
Rule profiles live inrules/and define which command shapes are allowed or blocked before SSH is attempted.
- readonly-safe
- debian-readonly
- debian-ops
- ubuntu-readonly
- ubuntu-ops
- rhel-readonly
- rhel-ops
- proxmox-readonly
- proxmox-ops
- docker-readonly
- docker-ops
- systemd-ops
- kubernetes-readonly
- network-diagnostics
- logs-readonly
- package-readonly
Aegis validates commands before it connects to the remote host.
- Parse the command into executable and arguments.
- Reject shell control features such as redirects, chaining, and command substitution.
- Allow only a limited set of safe pipeline filters.
- Apply executable, argument, and full-command blacklist checks.
- Apply executable, argument, and full-command whitelist checks.
- Attempt SSH only if the command passes validation.
Aegis uses defense in depth. It is not one magic security layer; it is several smaller boundaries working together.
- use dedicated least-privileged SSH users
- pin SSH host keys withhost_key_fingerprint
- use narrow rule profiles first
- enable TLS or run behind a trusted reverse proxy
- rotate bearer tokens regularly
- collect Aegis logs centrally
- keep sudo policy explicit and minimal
For the deeper threat model, seedocs/security.md.
- stealth_mode: returns a normal-looking fake response for blocked commands
- fake_response: custom response used whenstealth_modeis enabled
- redaction_enabled: masks matching output before results are returned
- redaction_patterns: regex patterns used for output redaction
- host_key_fingerprint: recommended SSH host key pinning
mcpSettings: allowedDomains: - "192.168.100.184" mcpServers: aegis-docker: type: sse url: "http://192.168.100.184:8443/mcp/docker/sse" headers: Authorization: "Bearer change-me-docker-key" timeout: 120000 initTimeout: 30000
The README is meant to help you understand and try Aegis quickly. The deeper docs are here:
- docs/security.md: threat model, validation logic, pipeline handling, container hardening, and SSH session behavior
- docs/config.md: host config fields, hot reload behavior, aliases, API keys, and key paths
- docs/rules.md: rule profile design, whitelists, blacklists, argument constraints, and starter profiles
- docs/FAQ.md: common questions and operational notes
- docs/tech-specs/aegis-ssh-mcp-tech-spec.md: deeper implementation details
- docs/readme-authoring.md: README authoring guidance for this repo
Aegis has an early-stage API and an operational runtime.
- MCP over HTTP/SSE
- MCP over stdio
- multi-host configuration
- rule-based command validation
- audit logging
- SSH key authentication
- password authentication
- host fingerprint pinning
- ephemeral per-request SSH execution
- hardened shell-less distroless container runtime
- optional output redaction
- hot reload for config and rule changes
For bugs, setup questions, or operational feedback, open an issue in this repository.
Contributions are welcome, especially around:
- MCP client interoperability
- rule validation improvements
- observability
- deployment hardening
- transport support
- testing and validation
Until a dedicated contributing guide lands, opening an issue before a large change is the best way to align on direction.
awaBerry Agentic allows for secure remote access to any terminal based device for workflows allowing any Agent and Large Language Model based routine to execute commands on your devices for getting access to required data - and to also write genrated data back.
DevOps MCP — Secure MCP Server for Linux Server Automation
A three-tier access control MCP server that allows AI assistants (Claude Code, Cursor, Windsurf) to safely scan, plan, and operate Linux servers via SSH without full write access. Includes an out-of-band human consent token gate, automated port-conflict scanning, and a completely read-only default safe mode to eliminate accidental destructive commands on production environments.
Give your AI agents access to production without the risks of sharing SSH keys.
A security-focused MCP server for performing safe operations on an Ubuntu system, featuring robust security controls and audit logging.
Secure every MCP server with one governed gateway. Give each AI agent its own scoped MCP access, contain credentials at the gateway, and audit every MCP tool call without wiring agents directly to each server.
Civilian situational awareness for AI deployments — real-time risk dashboards, multi-source threat correlation, anomaly detection, and automated alerting for critical infrastructure and enterprise AI systems.
MCP server to Automate Exposure Management
Security gateway for AI agents. Provides scoped tokens with automatic credential injection, human-in-the-loop approval for dangerous commands, SSH execution, vault management, organization skills, wiki, agent memories, and full audit logging. Self-hosted or cloud.
Monitor WAF events, analyze attacks, tune rules and whitelist IPs for OWASP ModSecurity CRS via Docker
A MCP server to allow your AI agent to manage your SikkerKey secrets vault.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



