Logo van ShellGuard

ShellGuard

Organisatie
fawdyinc

MCP server that gives LLM agents read-only shell access over SSH. Powers Fawdy (fawdy.com)

Uitgeverfawdyinc
Repositoryshellguard
TaalGo
Forks
4
Sterren
22
Beschikbare tools
0
Transporttypestdio
Categorieën
LicentieApache-2.0
Links
  • Koppel tools aan AI-workflows

    ShellGuard biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 0 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    22 sterren en 4 forks in de gekoppelde repository.

ShellGuard

Stop copy-pasting terminal output into your AI. Let your LLM SSH in and look around.

ShellGuard is an MCP server that gives LLM agents controlled bash access to remote servers over SSH. Connect your AI to production, staging, or dev servers and let it run diagnostics, inspect logs, query databases, and troubleshoot -- hands-free.


ShellGuard is the open-source security layer built by the team at Fawdy. It powers Fawdy's AI-powered Linux server investigation tool that delivers plain-English root cause analysis.

You can use ShellGuard standalone with any MCP-compatible AI agent, or try the full investigation experience with Fawdy.


Why ShellGuard?

AI agents are powerful, but giving them unrestricted shell access to production servers is risky. ShellGuard solves this by enforcing read-only access at the command level. Every command is parsed, validated against an allowlist, and reconstructed before execution. If an agent tries something destructive, ShellGuard blocks it and tells the agent what to do instead.

Commands are restricted to a curated set of observation and diagnostic tools. Destructive operations are blocked with actionable suggestions so the LLM can self-correct and keep investigating:

  • wget -r -> "Recursive downloading is not allowed"
  • tail -f -> "Follow mode hangs until timeout. Use tail -n 100 for recent lines."
  • sed -> "Stream editing can modify files -- read-only access only. Use grep for searching."
  • $HOME/file -> "Variable expansion will not expand. Use absolute paths."

Quick Start

Install

bash
brew install fawdyinc/tap/shellguard

Or download the latest binary:

bash
curl -fsSL https://raw.githubusercontent.com/fawdyinc/shellguard/main/install.sh | sh

Or with Go:

bash
go install github.com/fawdyinc/shellguard/cmd/shellguard@latest

Configure with an MCP Client

ShellGuard starts as a stdio MCP server -- no arguments needed. Add it to your MCP client of choice:

Go to: Settings -> Cursor Settings -> MCP -> Add new global MCP server

Or paste this into your ~/.cursor/mcp.json file. You can also install per-project by creating .cursor/mcp.json in your project folder. See Cursor MCP docs for more info.

json
{
  "mcpServers": {
    "shellguard": {
      "command": "shellguard"
    }
  }
}

Add the following to your Claude Desktop config file. See Claude Desktop MCP docs for more info.

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "shellguard": {
      "command": "shellguard"
    }
  }
}

Run this command. See Claude Code MCP docs for more info.

sh
claude mcp add shellguard -- shellguard

Add this to your OpenCode configuration file. See OpenCode MCP docs for more info.

json
{
  "mcp": {
    "shellguard": {
      "type": "local",
      "command": ["shellguard"],
      "enabled": true
    }
  }
}

Add the following to your VS Code settings.json or .vscode/mcp.json. See VS Code MCP docs for more info.

User settings (settings.json)

json
{
  "mcp": {
    "servers": {
      "shellguard": {
        "type": "stdio",
        "command": "shellguard"
      }
    }
  }
}

Workspace config (.vscode/mcp.json)

json
{
  "servers": {
    "shellguard": {
      "type": "stdio",
      "command": "shellguard"
    }
  }
}

Add the following to your Zed settings file (~/.config/zed/settings.json). See Zed MCP docs for more info.

json
{
  "context_servers": {
    "shellguard": {
      "command": {
        "path": "shellguard",
        "args": []
      }
    }
  }
}

Go to: Roo Code Settings -> MCP Servers -> Edit MCP Settings

Or add the following to your Roo Code MCP settings file. See Roo Code MCP docs for more info.

json
{
  "mcpServers": {
    "shellguard": {
      "command": "shellguard"
    }
  }
}

What It Does

ShellGuard exposes 6 tools to the LLM:

ToolDescription
connectEstablish an SSH connection to a remote host
executeRun a validated shell command on the remote host
disconnectClose SSH connection(s)
sleepWait between diagnostic checks (max 15s)
provisionDeploy diagnostic tools (rg, jq, yq) to the remote host
download_fileDownload a file from the remote host via SFTP (50MB limit)

provision, download_file, and sleep can be disabled via the disabled_tools config option or SHELLGUARD_DISABLED_TOOLS environment variable.

The LLM connects to a server, runs commands, and reads the output -- the same workflow you'd do manually, but without the context-switching.

How It Works

Every command goes through a pipeline before reaching the remote host:

  1. Parse -- bash is parsed into an AST. Shell tricks (semicolons, redirections, command substitution, etc.) are rejected at the syntax level.
  2. Validate -- commands, flags, and arguments are checked against a curated allowlist of commands (with an explicit denylist). Default-deny.
  3. Reconstruct -- arguments are re-quoted to prevent injection.
  4. Execute -- the command runs over SSH with per-command timeouts and output truncation.

For full details, see ARCHITECTURE.md.

SSH Configuration

Authentication

ShellGuard tries authentication methods in this order, stopping at the first success:

PriorityMethodSourceOn failure
1Explicit keyidentity_file parameter in connectFatal -- connection fails immediately
2ssh-agentSSH_AUTH_SOCK unix socketSilent -- skipped
3Default keys~/.ssh/id_ed25519, id_ecdsa, id_rsaSilent -- skipped

Passphrase-protected keys are silently skipped during default key discovery. If you specify a passphrase-protected key via identity_file, the connection will fail. Add the key to your agent first: ssh-add ~/.ssh/my_key.

SSH Modes

ShellGuard supports two SSH modes:

ModeDescription
native(Default) Uses Go's built-in SSH library. Reads ~/.ssh/config for HostName, User, Port, and IdentityFile. Lightweight, no external dependencies.
systemUses the local ssh binary. Full ~/.ssh/config support including ProxyJump, ProxyCommand, Match blocks, and all other OpenSSH features. Requires ssh to be installed.

If you connect through bastion hosts, use ProxyJump, or rely on Match blocks in your SSH config, enable system mode:

yaml
ssh:
  mode: system
bash
export SHELLGUARD_SSH_MODE=system

If mode is set to system but the ssh binary is not found, ShellGuard logs a warning and falls back to native mode.

Native mode limitations: Match directives, ProxyJump, ProxyCommand, and ForwardAgent are not supported. Use system mode if your infrastructure requires these features.

System mode notes:

  • Host key verification is handled entirely by OpenSSH. The host_key_checking and known_hosts_file settings only apply in native mode.
  • Connections are multiplexed using OpenSSH ControlMaster, so only the first connection per host pays the SSH handshake cost.

Host Key Verification

ShellGuard verifies SSH host keys using ~/.ssh/known_hosts. Three modes are available:

ModeBehavior
accept-new(Default) Trust-on-first-use. Unknown hosts are accepted and written to known_hosts. Key changes are rejected.
strictRequire the host key to already exist in known_hosts. Unknown hosts are rejected.
offDisable host key verification entirely.

If a host key has changed, remove the old entry from your known_hosts file.

Configuration

Settings can be specified in a YAML config file or via environment variables. Environment variables take precedence.

Config file location: $XDG_CONFIG_HOME/shellguard/config.yaml (default: ~/.config/shellguard/config.yaml)

yaml
ssh:
  mode: "native"                   # native | system
  connect_timeout: "10s"           # default 10s
  retries: 2                       # default 2
  retry_backoff: "250ms"           # default 250ms
  host_key_checking: "accept-new"  # accept-new | strict | off (native mode only)
  known_hosts_file: "~/.ssh/known_hosts"  # native mode only
YAML fieldEnvironment variableDefaultDescription
ssh.modeSHELLGUARD_SSH_MODEnativeSSH mode: native (built-in) or system (uses local ssh binary)
ssh.connect_timeoutSHELLGUARD_SSH_CONNECT_TIMEOUT10sTCP + SSH handshake timeout
ssh.retriesSHELLGUARD_SSH_RETRIES2Connection/execution retry attempts
ssh.retry_backoffSHELLGUARD_SSH_RETRY_BACKOFF250msBase backoff (exponential: backoff * 2^attempt)
ssh.host_key_checkingSHELLGUARD_SSH_HOST_KEY_CHECKINGaccept-newHost key verification mode (native mode only)
ssh.known_hosts_fileSHELLGUARD_SSH_KNOWN_HOSTS_FILE~/.ssh/known_hostsPath to known_hosts file (native mode only)

Toolkit Provisioning

Remote servers don't always have the tools you want. On connect, ShellGuard probes for rg, jq, and yq. If any are missing, the LLM can call provision to deploy them:

ToolVersionArchitectures
rg (ripgrep)14.1.1x86_64, aarch64
jq1.7.1x86_64, aarch64
yq4.52.2x86_64, aarch64

Binaries are downloaded from GitHub Releases with SHA-256 verification, cached locally, and deployed to ~/.shellguard/bin/ on the remote host.

Library Usage

ShellGuard can be used as a Go library:

go
package main

import (
    "context"
    "log/slog"
    "os"

    "github.com/fawdyinc/shellguard"
)

func main() {
    ctx := context.Background()
    logger := slog.New(slog.NewTextHandler(os.Stderr, nil))

    err := shellguard.RunStdio(ctx, shellguard.Config{Logger: logger})
    if err != nil {
        os.Exit(1)
    }
}

See the Custom Configuration and Custom Executor sections below for advanced usage.

Custom Configuration

go
import (
    "github.com/fawdyinc/shellguard"
    "github.com/fawdyinc/shellguard/manifest"
    "github.com/fawdyinc/shellguard/server"
)

manifests, _ := manifest.LoadEmbedded()
// Add or remove commands as needed

core, err := shellguard.New(shellguard.Config{
    Manifests: manifests,         // Custom registry (nil = embedded defaults)
    Executor:  myCustomExecutor,  // Custom backend (nil = SSH)
    Name:      "my-server",       // MCP server name
    Version:   "1.0.0",          // MCP server version
})

Custom Executor Backend

Implement the server.Executor interface to use non-SSH backends:

go
type Executor interface {
    Connect(ctx context.Context, params ssh.ConnectionParams) error
    Execute(ctx context.Context, host, command string, timeout time.Duration) (ssh.ExecResult, error)
    ExecuteRaw(ctx context.Context, host, command string, timeout time.Duration) (ssh.ExecResult, error)
    SFTPSession(host string) (ssh.SFTPClient, error)
    Disconnect(host string) error
}

Testing

bash
make test          # Run all tests
make test-race     # Run with race detector
make lint          # Run go vet

Project Structure

shellguard/
  shellguard.go          # Top-level constructor (New, RunStdio)
  cmd/shellguard/        # CLI entrypoint
  server/                # MCP server core, tool registration, Executor interface
  parser/                # Shell AST parser (mvdan.cc/sh/v3)
  validator/             # Command/flag/SQL validation engine
  manifest/              # YAML command registry (embed.FS)
    manifests/           # allowed command manifests
    manifests/denied/    # denied command manifests
  ssh/                   # SSH manager, ShellQuote, ReconstructCommand
  output/                # Output truncation (64KB cap)
  toolkit/               # Diagnostic tool provisioning (rg, jq, yq)

Try the Full Experience

ShellGuard is great on its own, but if you want automated incident investigation with plain-English root cause reports, check out Fawdy. It connects to your Linux servers via ShellGuard and investigates incidents automatically. 10-minute setup.

License

Apache License 2.0. See LICENSE for details.

Installatie

TypingMind
Vereisten:

Node.js 18+

{
  "mcpServers": {
    "fawdyinc-shellguard": {
      "command": "",
      "args": []
    }
  }
}

Gebruik ShellGuard MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra ShellGuard is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg ShellGuard toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van ShellGuard.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "fawdyinc-shellguard": {
      "command": "npx",
      "args": [
        "-y",
        "shellguard"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van ShellGuard in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van ShellGuard in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je ShellGuard gebruiken om me hiermee te helpen?
ShellGuard
Zeker. Ik heb het gelezen.
Dit vond ik met ShellGuard.

Veelgestelde vragen

Waarvoor wordt de MCP-server ShellGuard gebruikt?

ShellGuard is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik ShellGuard MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je ShellGuard gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom ShellGuard MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als ShellGuard verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik ShellGuard MCP met TypingMind?

ShellGuard werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt ShellGuard MCP in TypingMind?

ShellGuard biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om ShellGuard MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als ShellGuard authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇