Skip to main content
Glama

guardian-mcp

CI

AI 코딩 에이전트(Claude Code, Claude Desktop, Cursor 등)가 목표를 달성하려다 저지르는 파괴적인 실수를 막는 MCP 서버예요.

"컴퓨터 용량 좀 줄여줘" → 에이전트가 시스템 드라이브를 지워버리는 사고, 권한이 있어도 일어날 수 있습니다. guardian-mcp는 삭제/덮어쓰기 같은 되돌리기 힘든 작업을 실행하기 직전에 가로채서 검사해줘요.

무엇을 막아주나요?

세 가지 계층으로 위험한 작업을 판단해요.

  1. 경로 가드 (pathGuard)/, /System, C:\Windows, 드라이브 루트(D:\), 마운트된 볼륨 전체(/Volumes/MyDrive), 사용자의 홈 디렉토리 자체처럼 시스템 치명적인 경로는 무조건 차단해요. GUARDIAN_PROTECTED_PATHS 환경변수로 내가 지정한 폴더도 추가로 보호할 수 있어요.

  2. 패턴 가드 (patternGuard) — 대상이 어디든 상관없이 rm -rf, DROP DATABASE, mkfs, diskutil eraseDisk, WHERE절 없는 DELETE FROM, 포크 폭탄 같은 알려진 파괴적 명령 시그니처 자체를 차단해요.

  3. 블래스트 레디어스 가드 (blastRadius) — 삭제 대상의 파일 개수/용량이 임계치(기본 100개 / 1GB)를 넘으면 자동 실행을 멈추고 확인을 요구해요.

삭제는 실제 unlink가 아니라 ~/.guardian-mcp/trash로 이동시키는 방식으로 구현되어 있어, 승인된 삭제라도 복구할 수 있어요. 덮어쓰기도 이전 버전을 같은 방식으로 백업해요.

⚠️ 이 도구는 안전망이지 샌드박스가 아니에요. 진짜 효과를 보려면 아래 "왜 클라이언트 설정이 꼭 필요한가" 항목을 반드시 함께 적용하세요.

Related MCP server: Agent File Guardian

설치

별도 설치 없이 npx로 바로 실행할 수 있어요.

npx -y guardian-mcp

사용 방법

Claude Code / Claude Desktop에 등록하기

.mcp.json (프로젝트) 또는 claude_desktop_config.json (전역)에 추가하세요.

{
  "mcpServers": {
    "guardian": {
      "command": "npx",
      "args": ["-y", "guardian-mcp"],
      "env": {
        "GUARDIAN_PROTECTED_PATHS": "/Users/me/Documents/important-project,/Users/me/Desktop",
        "GUARDIAN_MAX_FILES": "100",
        "GUARDIAN_MAX_BYTES": "1000000000"
      }
    }
  }
}

환경변수

기본값

설명

GUARDIAN_PROTECTED_PATHS

(없음)

콤마로 구분한 절대경로 목록. 이 경로들과 그 하위는 항상 삭제/덮어쓰기 차단

GUARDIAN_MAX_FILES

100

삭제 대상 파일 개수가 이 값을 넘으면 확인 요구

GUARDIAN_MAX_BYTES

1000000000 (~1GB)

삭제 대상 총 용량이 이 값을 넘으면 확인 요구

제공하는 도구

  • safe_delete({ path, confirm? }) — 검사 통과 시 대상을 삭제하는 대신 quarantine 폴더로 이동

  • safe_write({ path, content, overwrite? }) — 기존 파일이 있으면 overwrite:true 필요, 자동 백업

  • safe_execute({ command }) — 위험 패턴이 없는 명령만 실행

왜 클라이언트 설정이 꼭 필요한가?

MCP 서버는 새 도구를 추가할 뿐, 클라이언트에 이미 있는 Bash 같은 원본 도구를 막지는 못해요. 즉 guardian-mcp만 설치해도 에이전트가 원래 Bash 도구로 rm -rf를 직접 실행할 길은 여전히 열려 있어요.

실질적인 보호를 위해 클라이언트의 권한 설정에서 원본 파괴적 명령을 deny하고, 이 서버가 제공하는 safe_* 도구만 쓰도록 유도하세요. 예를 들어 Claude Code의 settings.json:

{
  "permissions": {
    "deny": [
      "Bash(rm -rf:*)",
      "Bash(rm -fr:*)",
      "Bash(diskutil eraseDisk:*)",
      "Bash(mkfs*:*)"
    ]
  }
}

개발

npm install
npm run build   # TypeScript 컴파일
npm test        # vitest — 실제 파일시스템은 격리된 임시 폴더에서만 건드립니다
npm run dev     # tsx로 바로 실행 (stdio)

테스트 전략

실제 드라이브 삭제를 재현해서 테스트하지 않아요. 대신:

  • pathGuard / patternGuardclassify*() 함수는 실제 파일 I/O가 전혀 없는 순수 함수라, 위험한 명령/경로 fixture 목록을 그대로 유닛 테스트에 넣어도 안전해요.

  • blastRadius, safeDelete, safeWrite는 매 테스트마다 fs.mkdtempSync로 새로 만든 격리된 임시 폴더 안에서만 동작을 검증하고, 끝나면 정리해요.

  • CI(GitHub Actions)는 매번 새로 뜨는 일회용 러너이므로 통합 테스트를 안전하게 반복 실행할 수 있어요.

로드맵

  • DB 가드 (SQL 파싱 기반 DROP/DELETE 차단, 커넥션 후킹)

  • 클라우드 리소스 가드 (S3 버킷 삭제, 프로덕션 인스턴스 종료 등)

  • 실제 OS 휴지통 연동 옵션

라이선스

MIT

Available Tools

3 tools
safe_deleteA

Delete a file or directory, but only after checking it against system-critical paths, user-protected paths, and blast-radius limits. Deletes are recoverable: the target is moved to a quarantine folder (~/.guardian-mcp/trash) instead of being unlinked. If the target is large, call again with confirm:true after reviewing the size warning.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to delete
confirmNo

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so well: it discloses that paths are validated against system-critical and user-protected lists, that blast-radius limits apply, that deletion is actually a move to a quarantine folder (~/.guardian-mcp/trash), and that large targets require a two-step confirm. It omits error/refusal behavior and the quarantine retention lifecycle, keeping it short of a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, each earning its place: safety checks first, then the recoverability guarantee, then the confirm workflow. Front-loaded with the most decision-relevant information and free of filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive-operation tool with no annotations and no output schema, the description covers action, safety gating, storage semantics, and the multi-step flow. Minor gaps remain around what an agent sees on a refusal or how the quarantine is eventually emptied.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 50% – 'path' is documented but 'confirm' is not. The description compensates by explaining confirm's purpose (second call after a size warning) rather than just restating the type, which is meaningful semantics beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb (delete) and resource (file or directory) and immediately scopes it with the safety checks it performs. An agent can distinguish it from safe_write and safe_execute purely on the resource/action pairing without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit conditional usage for the two-phase flow: 'If the target is large, call again with confirm:true after reviewing the size warning.' That is actionable guidance, though it never names when to prefer a sibling tool or what conditions make deletion inadvisable beyond the built-in checks.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

safe_executeA

Run a shell command after screening it for known-catastrophic patterns (rm -rf, DROP DATABASE, disk format, fork bombs, etc.), regardless of what path or table it targets. This is a pattern-based safety net, not a sandbox.

ParametersJSON Schema
NameRequiredDescriptionDefault
commandYes

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does well: it discloses the screening mechanism (pattern-based, known-catastrophic patterns), gives examples, and explicitly states it is not a sandbox, clarifying that successful screening does not guarantee safety. It doesn't mention execution environment, output format, or side effects, but the core behavioral trait is clearly communicated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the action and followed by the crucial limitation. No wasted words; every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no annotations or output schema, the description covers purpose, mechanism, examples, and a key limitation. It could mention execution context (e.g., working directory, permissions) or return behavior, but is largely complete for an agent to invoke it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Only one parameter (command) with 0% schema description coverage, so the schema provides no semantic detail. The description implies a shell command string via 'Run a shell command', which is minimal but sufficient for a single obvious parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (run) and resource (shell command) and adds the screening scope, distinguishing it from the sibling write/delete tools. However, it does not explicitly differentiate itself from safe_delete or safe_write beyond implied scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the name and description (use for running shell commands, screening is done), but there is no explicit when-to-use, when-not-to-use, or comparison to siblings. The safety net caveat hints at limits but doesn't route the agent to alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

safe_writeA

Write content to a file, refusing system-critical or user-protected paths. If the file already exists, requires overwrite:true and automatically backs up the previous version to the quarantine folder first.

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to write
contentYes
overwriteNo

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does well: it discloses path refusal rules, the overwrite precondition, and that the previous version is automatically backed up to a quarantine folder. It omits error behavior, encoding/atomicity, and permission requirements, but the destructive-side effects are unusually well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero filler, front-loaded with the primary action followed by the safety and overwrite rules in priority order. Every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 3-parameter mutation tool with no annotations and no output schema, the description covers the key decision points (refused paths, overwrite requirement, backup behavior). It would be fully complete with a note on return/error signaling, but an agent can call it correctly from this text.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 33% (only 'path' is documented), so the description must compensate. It explains the otherwise-bare 'overwrite' boolean's semantics (required only when the file exists) and implicitly defines 'content' via 'Write content to a file'. This is more than the schema provides, though 'content' formatting/encoding is left unaddressed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Write content to a file') and immediately narrows scope with 'refusing system-critical or user-protected paths'. This makes it trivially distinguishable from the write-free siblings safe_delete and safe_execute.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states the condition that selects the overwrite path ('If the file already exists, requires overwrite:true') and the exclusion (system-critical/user-protected paths are refused). It stops short of naming when to prefer this over a sibling like safe_execute, so it is clear context without full alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedsafe_delete
    • First observedsafe_execute
    • First observedsafe_write

TDQS

A4.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a distinct action (delete, write, execute) on a different resource type. The safe_ prefix unifies them without blurring boundaries; no two tools could be mistaken for one another.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern (safe_delete, safe_write, safe_execute) with the same prefix. Predictable and readable.

Tool Count3/5

Only three tools covering delete, write, and execute. This is thin for a safety layer that would typically also cover safe_read, safe_list, or safe_move; the scope feels underdeveloped rather than tightly focused.

Completeness3/5

Covers three destructive operations but lacks read, list, or move/rename guards, which are common file operations. No API to inspect quarantine, restore files, or configure protected paths, creating dead ends for recovery workflows.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Stops your AI from re-introducing bugs, leaking provider keys, or weakening tests. Bug fixes become permanent regression guards; blocked mistakes become AI lessons the agent reads and learns from before its next edit.
    6
    2
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides a human-in-the-loop security layer for AI agents by intercepting file operations, explaining them with a local LLM, and enforcing a deterministic policy that requires user approval for risky actions.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    A local-first MCP safety layer that blocks dangerous files and redacts secrets before AI agents can access them, ensuring safe vibe coding.
    4 npm
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    A runtime gate for coding agents. Blocks the tool calls that wreck a repo (force-push main, rm -rf, secret exfiltration, CI wipe) and lets normal build and commit work through. Machine-checked git-branch core (z3); the rest is high-precision heuristics. Tested on 3,790 real CI commands, 0 false blocks.
    1
    MIT