Aegis-SSH-MCP
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.
Aegis-SSH-MCP
A thin MCP-native SSH bridge for AI agents.
Aegis lets AI agents run approved commands on Linux hosts over SSH without giving them unrestricted shell access.
Aegis exposes host-scoped MCP tools backed by SSH, with rule-based validation, ephemeral per-request execution, and audit logging. It is designed to work with existing Linux permissions, sudo policy, and host security rather than replace them.
Quick links:
Quick start
The checked-in docker-compose.yml is the recommended deployment path. It runs Aegis over SSE on http://localhost:8443 by default and ships with starter rule profiles in rules/.
- Create or populate these folders next to
docker-compose.yml:
./configs
./rules
./keys
./certs # only if you want HTTPS
-
Put an SSH private key in
keys/and keep its permissions strict. -
Add a host config in
configs/docker.json:
{
"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"
]
}
- Start the service:
docker compose pull
docker compose up -d
docker compose logs -f aegis-ssh-mcp
- Connect your MCP client to:
http://localhost:8443/mcp/docker/sse
Authorization: Bearer change-me-docker-key
If you want HTTPS, uncomment the TLS lines in docker-compose.yml and set AEGIS_SSE_BASE_URL to your real external address.
Build from source
git clone https://github.com/sparksbenjamin/Aegis-SSH-MCP.git
cd Aegis-SSH-MCP
go build -o aegis-ssh-mcp .
Why it exists
Most AI infrastructure tooling tends toward one of two extremes:
- raw shell access with very little control
- a heavy replacement platform for existing SSH and Linux workflows
Aegis is the middle path:
Keep SSH authoritative. Keep Linux authoritative. Keep infrastructure ownership where it already belongs.
It gives MCP clients a controlled way to reach real hosts without turning Aegis into a replacement for your existing security model.
What it does
- Creates one host-scoped MCP endpoint per host config
- Exposes one host-scoped SSH tool plus
aegis_statusfor that endpoint - Validates commands against rule profiles before SSH is attempted
- Opens a fresh SSH session for every request
- Supports both
sseandstdiotransport - Logs command attempts for audit visibility
- Supports host key pinning, bearer tokens, and optional output redaction
- Hot-reloads config and rule changes from disk
What it does not do
- Replace SSH, Linux permissions, or sudo policy
- Provide OS-level sandboxing or full IAM-style RBAC
- Keep persistent remote shells, PTYs, or hidden session state
- Support SSH agent forwarding or
~/.ssh/config - Pause commands for human approval
- Act as a full autonomous infrastructure platform
How it works
For each allowed request, Aegis parses the command, validates it against the assigned rule profile, opens a new non-interactive SSH session, runs the command, returns the output, and disconnects immediately.
Architecture view
+-------------------+
| MCP Client / LLM |
| Claude / OpenAI |
| LibreChat / SSE |
+---------+---------+
|
| MCP (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 |
+-------------------+
Configuration
Host configs
One JSON file in configs/ equals one remote host.
- One host config = one MCP endpoint
- One host config = one host-scoped SSH tool
- One host config = one assigned rule profile
- One host config = one bearer-token boundary for SSE
Use simple aliases such as web-01 or docker. The alias becomes part of the endpoint path and tool name.
Optional host fields
stealth_mode: returns a fake normal-looking response for blocked commandsfake_response: custom fake response whenstealth_modeis onredaction_enabled: applies regex-based output masking before results are returnedredaction_patterns: regex list used for output redactionhost_key_fingerprint: strongly recommended host key pinning
Rule profiles
Each host config points to one rule profile with:
"rule_profile": "docker-readonly"
Rule profiles live in rules/ and decide which command shapes are allowed or blocked before SSH is attempted.
Shipped starter profiles
readonly-safedebian-readonlydebian-opsubuntu-readonlyubuntu-opsrhel-readonlyrhel-opsproxmox-readonlyproxmox-opsdocker-readonlydocker-opssystemd-opskubernetes-readonlynetwork-diagnosticslogs-readonlypackage-readonly
Rule validation model
Aegis validates commands in this order:
- Parse the command into executable plus 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 all checks pass
Connect a client
Each host config becomes its own host-scoped SSE endpoint:
http://YOUR_AEGIS_HOST:8443/mcp/<alias>/sse
Clients must send the configured bearer token:
Authorization: Bearer YOUR_TOKEN
Quick reachability check:
curl -i -N \
-H "Authorization: Bearer change-me-docker-key" \
http://YOUR_AEGIS_HOST:8443/mcp/docker/sse
If the token is valid, Aegis should return 200 OK and keep the SSE stream open.
If one agent needs access to two different hosts, add Aegis twice in the client with one endpoint URL and one bearer token per host alias.
LibreChat example
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
Security model
Aegis is a controlled SSH execution bridge, not a full security platform.
Security boundaries come from the combination of:
- SSH authentication
- Linux user permissions
- sudo configuration
- host isolation
- command validation rules
- bearer-authenticated MCP access
- audit logging
- ephemeral execution isolation
Operators still own:
- credential management
- host hardening
- least-privilege remote accounts
- network security
- audit retention
- infrastructure segmentation
Docs
The README stays focused on deployment and first-use. The deeper docs below are still in the repo, but their core purpose is summarized here first.
Authoring rule for this README: docs/readme-authoring.md
Config guide
Full guide: docs/config.md
Highlights:
- one config file equals one host
- config changes are hot-reloaded
- aliases become endpoint paths and tool names
api_keysare optional forstdioand effectively required forsse- key paths must be container-visible paths such as
/keys/my-server.pem
Rule guide
Full guide: docs/rules.md
Highlights:
- use a tight executable whitelist first
- constrain arguments and full command shapes second
- layer blacklists on top for shell escape paths
- starter profiles for Docker, Debian, Ubuntu, RHEL, Proxmox, Kubernetes, logs, and diagnostics are already included
FAQ
Full guide: docs/FAQ.md
Highlights:
- no persistent SSH shell is handed to the agent
- Aegis reduces abuse risk, but it is not a remote sandbox
- audit logs are structured and useful for investigation
- output redaction helps, but it is not full data-loss prevention
Technical spec
Full spec: docs/tech-specs/aegis-ssh-mcp-tech-spec.md
Use the tech spec when you want the deeper implementation model, transport details, and runtime behavior.
Screenshots
Open screenshots
Status
Aegis is early-stage but operational.
Current capabilities
Current capabilities include:
- MCP over HTTP/SSE
- MCP over stdio
- multi-host configuration
- rule-based validation
- audit logging
- SSH key authentication
- password authentication
- host fingerprint pinning
- ephemeral per-request SSH execution
Support
For bugs, setup questions, or operational feedback, open an issue in this repository.
Primary maintainer: @sparksbenjamin
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.
License
MIT License
เซิร์ฟเวอร์ที่เกี่ยวข้อง
iPayX FX Audit
Forensic FX audit MCP. Detects hidden bank markups on cross-border payments. FINTRAC MSB registered.
Pinterest Ads MCP
Connect Pinterest Ads to Claude or ChatGPT via Two Minute Reports MCP to get clear insights into Pin clicks, outbound clicks, engagement rate and conversions.
MCP Dev Brasil
37 MCP servers for agentic commerce — Stripe ACP, x402, AP2, Google UCP, plus 14 Brazilian payment rails. ~480 tools.
MCP Minecraft Remote
Remotely control a Minecraft Java Edition server using the Model Context Protocol (MCP).
Etsy
A TypeScript-based MCP server for interacting with the Etsy API, featuring a simple notes system.
SectorHQ
Real-time AI company intelligence — track which AI companies are actually shipping vs just announcing, with live rankings, hype/reality gaps, and momentum signals.
Image Reader
A server for extracting and understanding content from images.
tip.md x402 + CDP
An MCP server for the tip.md platform that enables AI agents to facilitate crypto tipping using x402 payment collection and CDP automatic disbursement.
AILibrary MCP Server
API for AI agents to search, license, and download b-roll video clips and voiceovers. Pay-per-request, no human interaction required.
Launch Engine
Agentic pipeline that transforms ideas to revenue — for solo founders and bootstrappers.