SafeGrd MCP server
2026년 11월 8일 커밋S3-compatible Object Lock를 사용하여 데이터베이스, 디렉토리 트리, IMAP 메일함의 암호화 백업 및 무결성 테스트를 자동화합니다.
다른 이름 safegrd/cli, cli
- 스타
- 0
- Tools
- —
- 다운로드, 30일
- —
- 최신 버전
- 0.0.29
- 마지막 커밋
- 2026년 11월 8일
- 라이선스
- —
SafeGrd MCP란?
SafeGrd은(는) MCP server입니다. S3-compatible Object Lock를 사용하여 데이터베이스, 디렉토리 트리, IMAP 메일함의 암호화 백업 및 무결성 테스트를 자동화합니다.
프로젝트 README에서 생성된 요약
SafeGrd MCP server 정보
SafeGrd는 다양한 데이터 소스에 대해 암호화 백업을 생성하고 무결성 테스트를 수행하는 자동화 시스템을 제공합니다. PostgreSQL, MySQL, MariaDB, MongoDB, SQLite 데이터베이스뿐만 아니라 디렉토리 트리와 IMAP 메일함을 지원합니다. 이 도구는 데이터를 zstd로 압축하고 호스트에서 age를 사용하여 직접 암호화한 다음, Object Lock이 활성화된 S3-compatible 스토리지로 전송합니다. 이를 통해 승인되지 않은 에이전트에 의한 데이터 삭제나 수정을 방지할 수 있습니다.
사용자는 CLI 또는 데몬을 통해 이러한 작업을 관리할 수 있습니다. 시스템은 유연한 키 관리를 지원하며, 암호화 키를 로컬에 보관하거나 등록된 호스트를 위해 원격 서버가 봉인된 상태로 키를 보유하도록 선택할 수 있습니다. 검증을 위한 Fire Drill 기능은 백업을 임시 환경에 복구하여 모든 테이블, 행, 파일이 온전한지 확인합니다. 이 설정은 프로덕션 환경을 위해 신뢰할 수 있고 검증 가능한 데이터 보호가 필요한 개발자와 시스템 관리자를 위해 설계되었습니다.
활용 사례
- 1백업 무결성 검증Fire Drill을 실행하여 백업을 임시 데이터베이스에 복구하고 모든 행과 테이블이 올바른지 확인합니다.
- 2파괴적인 명령으로부터 보호잠금 상태의 스냅샷이 성공적으로 생성된 후에만 위험한 명령을 실행합니다.
- 3증분 파일 백업 수행최초 월간 실행 이후 변경된 청크만 업로드하는 디렉토리 트리 백업을 수행합니다.
- 4특정 파일 복구전체 데이터셋을 복구하지 않고 이전 스냅샷에서 특정 파일의 단일 버전을 가져옵니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
SafeGrd MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 SafeGrd MCP 설치
$ claude mcp add cli -- docker run -i --rm ghcr.io/safegrd/cli:0.0.29Cursor에 SafeGrd MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"cli": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/safegrd/cli:0.0.29"
]
}
}
}VS Code에 SafeGrd MCP 설치
.vscode/mcp.json
{
"servers": {
"cli": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/safegrd/cli:0.0.29"
]
}
}
}VS Code CLI에 SafeGrd MCP 설치
$ code --add-mcp '{"name":"cli","type":"stdio","command":"docker","args":["run","-i","--rm","ghcr.io/safegrd/cli:0.0.29"]}'Claude Desktop에 SafeGrd MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"cli": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/safegrd/cli:0.0.29"
]
}
}
}Codex에 SafeGrd MCP 설치
$ codex mcp add cli -- docker run -i --rm ghcr.io/safegrd/cli:0.0.29Codex config.toml에 SafeGrd MCP 설치
~/.codex/config.toml
[mcp_servers.cli] command = "docker" args = ["run", "-i", "--rm", "ghcr.io/safegrd/cli:0.0.29"]
Gemini CLI에 SafeGrd MCP 설치
$ gemini mcp add -s user cli docker -- run -i --rm ghcr.io/safegrd/cli:0.0.29Gemini settings.json에 SafeGrd MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"cli": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/safegrd/cli:0.0.29"
]
}
}
}자동 검사
2026년 11월 14일에 실행됨전체 보고서 →아직 인증되지 않았습니다. 서버는 80점 이상의 점수, 심각한 결함 없음, 그리고 검사에 충분한 데이터를 갖추어야 합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능safegrd/cli is public and reachablegithub.com/safegrd/cli ↗통과
- 패키지가 이 저장소를 소스로 명시검사되지 않음
- 빌드 출처(Sigstore 증명)검사되지 않음
- 오픈 소스 라이선스 (OSI)No license결함 발견
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-11-08github.com/safegrd/cli ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음검사되지 않음
- 패키지 및 해당 종속성에 중요한 보안 권고 없음검사되지 않음
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답HTTPS endpoint answered 401 (sign-in required)통과
README
GitHub에서 보기SafeGrd CLI (safegrd)
safegrd backs up PostgreSQL, MySQL, MariaDB, MongoDB and SQLite databases, directory trees
and IMAP mailboxes. Each backup is compressed with zstd and encrypted with age on the host that
takes it, then written to S3-compatible storage under Object Lock. It is restored on a schedule
to check that every table, row and file came back.
It is the CLI and daemon of SafeGrd. Documentation is at safegrd.dev/docs, and every command and flag is in the command reference.
- Backups go from your host straight to storage. The remote server receives a record of each backup (when it ran, its size, its digest and the date its lock ends) and the signed result of each restore test. The data never passes through it.
- You choose who holds the key. By default the remote server keeps your key sealed and
releases it only to your enrolled hosts, so you can restore even after losing a host. With
enroll --key-custody local, only you can decrypt these backups. - Restores are tested. A Fire Drill restores the newest backup into a throwaway database or directory, compares its tables, rows and digests with what was backed up, and signs the result.
- An agent cannot remove a backup.
safegrd guardtakes a locked snapshot before a destructive command runs, and a personal access token cannot delete a backup or shorten its lock.
Installation
Install script (Linux and macOS)
curl -fsSL https://safegrd.dev/install.sh | sh
It detects your OS and architecture, downloads the matching release archive, checks
it against the release's checksums.txt, and installs safegrd to /usr/local/bin
(or ~/.local/bin when it cannot use sudo). The script is install.sh
in this repository; https://raw.githubusercontent.com/safegrd/cli/main/install.sh
serves the same file.
When it runs in a terminal, it then offers to connect the machine to a remote server:
a browser login, a question about who holds the encryption key, then safegrd enroll.
The login prints a URL and a code that you can open in a browser on any device, so
it works the same on a server you reached over SSH or PuTTY. Without a terminal (CI,
cloud-init, cron) it installs and stops.
Options are environment variables, and they go on the sh after the pipe. Written
before curl they apply to curl, and the script never sees them:
curl -fsSL https://safegrd.dev/install.sh | VERSION=v0.0.3 sh # pin a release
curl -fsSL https://safegrd.dev/install.sh | SAFEGRD_INSTALL_DIR=~/.local/bin sh # no sudo
curl -fsSL https://safegrd.dev/install.sh | SAFEGRD_NO_SETUP=1 sh # install only
| Variable | Effect |
|---|---|
VERSION |
Release tag to install. Default: the latest release. |
SAFEGRD_INSTALL_DIR |
Where the binary goes. |
SAFEGRD_NO_SETUP=1 |
Install only; do not offer to log in and enroll. |
SAFEGRD_FORCE_INSTALL=1 |
Download and install even when the release asked for is already installed. |
SAFEGRD_PROJECT |
Project ID or slug to enroll this machine into. |
SAFEGRD_STORAGE |
hosted or local: where backups go when the project has no bucket. |
SAFEGRD_CLAIM |
The claim code the console shows for this machine. It carries the project, where backups go and the surfaces to protect, so enrollment writes them into the config and asks nothing. Needs a release whose enroll has --claim; an older one stops and says so. |
SAFEGRD_NODE_NAME |
Name the machine is shown under. |
SAFEGRD_KEY_CUSTODY |
local keeps this host's key on the host. Without it the remote server keeps the key sealed and releases it only to your enrolled hosts. |
SAFEGRD_SERVER_URL |
Remote server to log in and enroll with. Default: https://safegrd.dev. |
Homebrew (macOS and Linux)
brew install safegrd/tap/safegrd
The formula installs the same release archives as the script.
Go
go install github.com/safegrd/cli/cmd/safegrd@latest
Container image
ghcr.io/safegrd/cli runs on linux/amd64 and linux/arm64 and carries pg_dump, mysqldump
and mongodump, and a PostgreSQL 18 server so a drill can restore a database into a
throwaway cluster on the volume. The tag names the Postgres client: <version>-pg18 reads
Postgres 18 and every older server. Releases are signed with cosign (keyless, from this repository's release
workflow):
cosign verify ghcr.io/safegrd/cli:<version>-pg18 \
--certificate-identity-regexp 'https://github.com/safegrd/cli/.github/workflows/release.yml@.*' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
packaging/compose runs the daemon beside a database,
packaging/kubernetes runs daemon run --once as a
CronJob, and packaging/helm/safegrd runs the daemon as a
Deployment.
Each names the release it was cut with, such as ghcr.io/safegrd/cli:0.0.10; change
the tag to upgrade.
Release archives, or from source
Static binaries for Linux and macOS (amd64, arm64) and their SHA-256 checksums are
on the releases page. To build:
git clone https://github.com/safegrd/cli.git && cd cli
make build
Try it before you sign up
With no account, one command backs up a database and restores it to check:
safegrd try postgres://app:secret@db.example.com/app # or env:DATABASE_URL, a MySQL, MongoDB or SQLite URL, or a directory
safegrd signup # keep it: the host, its backup and a daily schedule
The backup is encrypted on this host, stored on the remote server's storage for 24 hours, and restored in memory from there. Details are in the install guide.
Quickstart
1. Create a config and a key
Skip this if you let the install script connect the machine: it already wrote the
keypair and ~/.safegrd/config.yaml, and init refuses to overwrite them.
# writes an age X25519 keypair and ~/.safegrd/config.yaml
safegrd init \
--database-url "postgres://postgres:password@localhost:5432/myapp_prod" \
--storage local \
--local-path ./backups \
--retention-days 14
2. Connect to a remote server (optional)
# Prints a URL and a code: open it in a browser on any device, including over SSH
safegrd login
# Register this machine, generating its encryption key if it has none.
# --key-custody decides whether the server keeps a copy (safegrd) or not (local)
safegrd enroll --key-custody local
# A host that should encrypt but never decrypt: make the key pair on your laptop,
# then put only the printed public key in the host's encryption.public_key
safegrd keygen --out ~/.safegrd/keys/prod.key
# Headless / CI: a Personal Access Token instead of the browser
safegrd enroll --token "sg_pat_..."
# Or with the claim code the console's setup shows: the project, where backups go and
# the surfaces are written into ~/.safegrd/config.yaml, and the key stays on this machine
safegrd enroll --claim <code>
safegrd doctor # every surface opens from this host; the console shows the result
safegrd daemon run --once
# Later, on an enrolled host: add the surfaces named for it in the console
# (Add surface on its row). Only adds; the old config is kept as config.yaml.bak
safegrd claim
safegrd daemon restart
# Verify the active session
safegrd whoami
3. Back up
# dumps, compresses, encrypts with age on this host, and writes to locked storage
safegrd backup
4. Run a Fire Drill
# restores into an empty database and checks every table's row count
safegrd verify \
--snapshot snap-20260919-01 \
--sandbox-target "postgres://postgres:password@localhost:5432/ephemeral_test_db"
5. Restore
safegrd restore \
--snapshot snap-20260919-01 \
--target "postgres://postgres:password@localhost:5432/myapp_recovered"
6. Protect several things on one host, unattended
Each entry under surfaces: in ~/.safegrd/config.yaml is one protected thing, and
safegrd daemon install runs them on their schedules. A surface's credential block says
where its secret comes from; the config never holds it:
surfaces:
- id: app-primary
type: postgres
schedule: "@daily"
credential:
from: env # or: command (with run), file (with path),
name: APP_DATABASE_URL # or safegrd: the remote server holds it for this host
- id: user-uploads
type: files
schedule: "6h"
roots: ["/var/www/uploads"]
safegrd.example.yaml is the annotated version. The daemon reads its
config when it starts, so run safegrd daemon restart after changing it.
7. Take a locked snapshot before a destructive command
safegrd guard backs up one surface, waits until the snapshot is uploaded and locked, and
then runs the command. If the backup fails or the snapshot is not locked, the command does
not run and guard exits 3.
safegrd guard --surface app-primary -- psql "$APP_DATABASE_URL" -c 'DROP TABLE sessions'
safegrd guard -- terraform destroy
# The commands a hook treats as destructive, and a check that takes no backup
safegrd guard --list
safegrd guard --matches "npx prisma migrate reset" # exit 0: it matches
Storage on the host's own disk, or a bucket with worm_mode: NONE, cannot lock a snapshot,
so guard refuses there unless you pass --allow-unlocked.
A locked snapshot of the surface younger than --max-age stands in for a new backup, so an
agent running several destructive commands in a row backs up once. --check-only takes no
backup at all and refuses the command unless such a snapshot exists:
safegrd guard --max-age 30m -- psql "$APP_DATABASE_URL" -c 'TRUNCATE sessions'
safegrd guard --max-age 1h --check-only -- terraform destroy
safegrd list --json prints every snapshot with its lock date, for scripts.
8. Back up a directory tree, and get one file back
File backups are incremental: the first run of each month uploads every file, and every run after it uploads only the chunks that changed. Every kept version of every file is searchable, and one file restores on its own.
safegrd backup --files /srv/app --exclude '*.tmp,node_modules/*'
# every kept version of a file, numbered from the oldest
safegrd find etc/nginx/nginx.conf
# one version of one file, or a directory as it was in one snapshot
safegrd restore --path etc/nginx/nginx.conf --version 2 --target-dir ./out
safegrd restore --snapshot snap-20260919-01 --path 'var/www/**' --target-dir ./out
# every pack present and every listing consistent, without restoring anything
safegrd check --all
# a bucket over the S3 API (Supabase Storage, or any S3-compatible store)
safegrd backup --files s3://avatars --source-endpoint https://PROJECT.storage.supabase.co/storage/v1/s3 \
--source-region eu-central-1 --source-access-key env:S3_KEY --source-secret-key env:S3_SECRET
# and back into the bucket, each object with the content type it had
safegrd restore --snapshot snap-20261012-01 --target s3://avatars --source-endpoint https://PROJECT.storage.supabase.co/storage/v1/s3 \
--source-region eu-central-1 --source-access-key env:S3_KEY --source-secret-key env:S3_SECRET
--format tar keeps one archive per backup instead. What is locked, for how long, and
what a restore brings back: safegrd.dev/docs/surfaces/files.
AI agents (MCP)
safegrd has two MCP servers. Neither has a tool that deletes a backup, changes where
backups go, or takes a private key.
The local server, safegrd mcp, runs on a host over stdio and uses that host's config
and key. Its tools are status, list, doctor, backup, verify, restore and
export, each running the command of the same name. restore writes only into a new or
empty directory or an empty database.
claude mcp add safegrd-local -- safegrd mcp
# a host that runs the container image: mount the volume it enrolled with
claude mcp add safegrd-local -- docker run -i --rm \
-v safegrd:/home/safegrd/.safegrd ghcr.io/safegrd/cli mcp
The remote server, https://safegrd.dev/mcp, reads every host's backups and Fire Drills
and asks for a backup or a drill now, on every plan. Add it with no header, then run /mcp
in Claude Code and choose Authenticate: you sign in to SafeGrd in the browser and approve.
claude mcp add --transport http safegrd https://safegrd.dev/mcp
The Claude Code plugin in safegrd/agent-plugins adds the same server, signed in the same way, with skills that back up and run a Fire Drill before a risky change:
/plugin marketplace add safegrd/agent-plugins
/plugin install safegrd@safegrd
A client that cannot sign in, such as CI, sends a personal access token from the console's
Tokens page as Authorization: Bearer sg_pat_....
Both servers are listed in the MCP Registry
as dev.safegrd/safegrd, and the remote one on Smithery.
Cursor and VS Code configs, and every tool's arguments: safegrd.dev/docs/mcp.
What it backs up
- PostgreSQL, incrementally: the schema comes from
pg_dumpand the rows stream over binaryCOPYfrom the same snapshot, so arrays, enums, foreign keys, views, triggers and sequence positions all come back. Each run uploads only the chunks of each table that changed,restore --tableloads chosen tables into a running database, and--change-logskips reading tables nothing wrote since the last run.--format tarkeeps one archive per backup. Needs apg_dumpat least as new as the server on the host. - SQLite, incrementally: copied through SQLite's online backup in one read transaction, so transactions still in the WAL are in it and writers carry on. The copy keeps the database's pages in place, so each run uploads only the chunks whose pages changed.
--format tarkeeps one archive per backup. Needs nothing installed on the host. - MySQL and MariaDB through
mysqldump --single-transaction, and MongoDB throughmongodump --archive, one archive per backup. - Directory trees, incrementally: each run uploads only the chunks that changed, every object is locked once when it is written, and
safegrd findlists every kept version of a file forrestore --path --version. - IMAP mailboxes, every message as RFC 5322 mail, checked by SHA-256 on every drill.
- Locked storage: S3 Object Lock in compliance mode, or governance mode where a lock may need lifting. Storage on the host's own disk, and a bucket with
worm_mode: NONE, keep backups without a lock. - Fire Drills: restore backups on a schedule, count what came back, and sign a record of each test.
Development
Go 1.25 or newer. make with no target lists everything.
make build # compile bin/safegrd
make test # unit and integration tests, race detector
make ci # the exact gate CI runs: gofmt check, tidy check, vet, race tests
make dist # cross-compile release archives + checksums into dist/
make fmt tidy # the developer-facing fixers (these rewrite files; `ci` never does)
CI runs make ci on every push and pull request, so a green local run means a
green pipeline. Tagging v* runs make dist VERSION=<tag without v> and
publishes the archives and checksums.txt as a GitHub Release.
License
Business Source License 1.1, with an Additional Use Grant. See LICENSE.
In short: read, modify and build it freely, and use it for evaluation anywhere. Production use is included with a SafeGrd account on any plan, the free one too. Listing, verifying, restoring and exporting your backups is always permitted, with or without an account. Each version becomes GPL-3.0-or-later four years after it is published. For a commercial license, contact support@safegrd.dev.
SafeGrd MCP 질문
SafeGrd MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add cli -- docker run -i --rm ghcr.io/safegrd/cli:0.0.29를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
SafeGrd MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
에이전트가 백업을 삭제할 수 있나요?
아니요. 에이전트나 개인 액세스 토큰이 백업을 삭제하거나 잠금 기간을 단축할 수 없도록 설계되었습니다.
백업은 어떻게 보호되나요?
백업은 호스트에서 zstd로 압축되고 age로 암호화된 후, Object Lock이 활성화된 S3-compatible 스토리지에 저장됩니다.
Fire Drill이란 무엇인가요?
Fire Drill은 최신 백업을 임시 환경에 복구하여 모든 테이블, 행, 파일이 온전한지 확인하는 복구 테스트입니다.
원격 서버가 제 데이터를 볼 수 있나요?
아니요. 데이터는 호스트에서 암호화되어 스토리지로 직접 전송되며, 원격 서버는 메타데이터와 복구 테스트 결과만 수신합니다.