guardian-mcp
This server provides guarded, recoverable file operations and command screening for AI coding agents.
safe_delete(path, confirm?): Delete a file/directory safely; targets go to a quarantine trash folder instead of permanent unlink, with blast-radius limits and protected-path checks.
safe_write(path, content, overwrite?): Write files, refusing system-critical/user-protected paths; existing files require overwrite:true and are backed up first.
safe_execute(command): Run shell commands after blocking known catastrophic patterns (e.g., rm -rf, DROP DATABASE, disk format, fork bombs) and flagging risky ones.
list_trash(): List quarantined items with recovery IDs.
restore_trash(id): Restore a quarantined item to its original path.
purge_trash(ids?, olderThanDays?, dryRun?, confirm?): Permanently delete quarantined items; by default purges nothing unless criteria are given.
The server is a pattern/path-based safety net, not a sandbox; original client tools are not forcibly intercepted.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@guardian-mcp@guardian-mcp safely delete the node_modules folder in my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
guardian-mcp
Guardian MCP는 **AI 코딩 에이전트가 저지르는 흔한 파괴적 실수를 줄이기 위한, 복구 가능한 안전망(safety layer)**을 제공하는 MCP 서버예요. Claude Code/Desktop뿐 아니라 MCP를 지원하는 어떤 AI 에이전트/클라이언트(Cursor, Windsurf, Cline, VS Code Copilot 등)에서도 동일한 방식으로 붙일 수 있어요.
"컴퓨터 용량 좀 줄여줘" 같은 평범한 요청도, 에이전트가 그 목표를 달성하는 과정에서
/Applications를 통째로 지우거나 시스템 드라이브를 건드리는 식으로 이어질 수 있어요. 권한이 있어도 일어나는 사고예요. Guardian MCP는 삭제/덮어쓰기/특정 셸 명령을 실행하기 직전에 가로채 검사해요.
현재 상태
개인 프로젝트, v0.2.0, 아직 npm에 publish 전이에요. MCP 프로토콜 레벨 통신(initialize/tools list/tools call)은 직접 검증했지만, 실제 Claude Code/Desktop 같은 클라이언트에서 에이전트가 상시 사용하는 걸 검증한 적은 아직 없어요. 외부 보안 감사도 받지 않았고, 아래 위협 모델도 저자 본인의 분석과 테스트를 기반으로 작성한 거예요. 프로덕션의 유일한 안전장치로 쓰지 말고, 여러 방어선 중 하나로 여겨주세요.
Related MCP server: Agent File Guardian
Guardian MCP가 아닌 것
과장하지 않기 위해 먼저 명확히 할게요.
샌드박스가 아니에요. OS 권한 시스템을 대체하지 않아요.
클라이언트에 이미 있는 Bash 같은 원본 도구 실행을 강제로 가로채지 않아요. (아래 "클라이언트 설정이 왜 꼭 필요한가" 참고)
패턴 기반 명령 탐지는 우회 불가능성을 보장하지 않아요. 의도적으로 난독화된 명령은 통과할 수 있어요.
대신 이렇게 이해해 주세요: "AI 코딩 에이전트가 저지르는 흔한 파괴적 실수를 줄여주는, 복구 가능한 안전망." 막지 못하는 것까지 포함한 전체 위협 모델은 THREAT_MODEL.md에 정리했어요.
무엇을 막아주나요?
세 가지 계층으로 위험한 작업을 판단해요.
경로 가드 (
pathGuard) —/,/System,/usr,/etc,C:\Windows같은 시스템 치명적 경로와 그 하위 경로 전체, 드라이브 루트(D:\), 마운트된 볼륨 전체(/Volumes/MyDrive), 사용자의 홈 디렉토리 자체를 차단해요. 심볼릭 링크도 실제 가리키는 대상(realpath)까지 따라가서 검사하므로, 링크로 우회하는 것도 막아요.GUARDIAN_PROTECTED_PATHS환경변수로 내가 지정한 폴더도 추가로 보호할 수 있어요.패턴 가드 (
patternGuard) — 대상이 어디든 상관없이rm -rf,find -delete,DROP DATABASE,shutil.rmtree,fs.rmSync, PowerShellRemove-Item -Recurse, 포크 폭탄 같은 명확히 파괴적인 명령은 차단(BLOCK)하고,git clean -fd,docker system prune,kubectl delete처럼 흔히 안전하지만 가끔 파괴적인 명령은 확인(CONFIRM)을 요구해요.블래스트 레디어스 가드 (
blastRadius) — 삭제 대상의 파일 개수/용량이 임계치(기본 100개 / 1GB)를 넘거나, 권한 문제 등으로 정확히 측정할 수 없으면 자동 실행을 멈추고 확인을 요구해요. (측정 실패를 "괜찮겠지"하고 조용히 넘어가지 않아요.)
기준은 이래요: 명확히 위험함 → BLOCK, 위험 가능성이 있거나 판단 불가 → CONFIRM, 명확히 안전함 → ALLOW.
복구 가능성 (Quarantine / Restore)
삭제는 실제 unlink가 아니라 ~/.guardian-mcp/trash로 이동시키는 방식으로 구현되어 있어, 승인된 삭제라도 복구할 수 있어요. 덮어쓰기도 이전 버전을 같은 방식으로 백업하며, 쓰기 자체가 실패하면 자동으로 원본을 복원해요(임시 파일에 먼저 쓰고 같은 파일시스템 안에서 원자적으로 rename하는 방식이라 실패해도 원본 파일이 빈 채로 남는 상황을 방지해요).
각 quarantine 항목은 원본 경로, 격리된 경로, 시각, 타입, 크기, 작업 종류를 메타데이터(~/.guardian-mcp/trash/index.json)로 추적해요.
list_trash— 현재 격리된 항목 목록과 복구용 id 확인restore_trash— id로 원래 경로에 복구 (원래 자리에 이미 뭔가 있으면 거부)purge_trash— 진짜로 영구 삭제. 아무 기준 없이 호출하면 아무것도 지우지 않아요 (ids 또는 olderThanDays를 반드시 명시). 먼저dryRun:true로 미리보기하세요. 한 번에 20개 넘게 지우려면confirm:true필요.
주의: trash는 자동으로 비워지지 않아요. 디스크 용량을 계속 차지하니, 주기적으로 purge_trash를 직접 호출해 정리해주세요.
설치
아직 npm에 publish되지 않았어요. 아래
npx -y safe-agent-mcp는 publish 이후에나 동작해요. 그 전까지는 이 저장소를 클론해서 로컬 빌드로 등록해 쓰세요 (바로 아래 "로컬에서 등록하기" 참고).
publish 이후에는 별도 설치 없이 npx로 바로 실행할 수 있어요. (npm 패키지명은 safe-agent-mcp이며, 이 GitHub 저장소 이름 guardian-mcp와는 달라요.)
npx -y safe-agent-mcp사용 방법
로컬에서 등록하기 (아직 publish 전)
git clone https://github.com/devmango1128/guardian-mcp.git
cd guardian-mcp
npm install
npm run build그 다음 command/args를 npx 대신 로컬 빌드 경로로 지정하면 돼요:
{
"mcpServers": {
"guardian": {
"command": "node",
"args": ["/absolute/path/to/guardian-mcp/dist/index.js"],
"env": {
"GUARDIAN_PROTECTED_PATHS": "/Users/me/Documents/important-project,/Users/me/Desktop"
}
}
}
}어떤 MCP 클라이언트에서든 등록하기
Guardian MCP는 표준 MCP stdio 서버예요. mcpServers 설정 형식은 Claude Desktop, Claude Code, Cursor, Windsurf, Cline(VS Code) 등 대부분의 MCP 호환 클라이언트가 동일하게 사용해요. 클라이언트별 설정 파일 위치만 달라요:
클라이언트 | 설정 파일 |
Claude Code | 프로젝트의 |
Claude Desktop |
|
Cursor |
|
Windsurf |
|
Cline (VS Code) | VS Code settings의 |
정확한 파일 위치는 계속 바뀔 수 있으니, 사용 중인 클라이언트의 최신 MCP 설정 문서를 확인하세요. publish 이후에는 내용이 어디서든 아래처럼 동일해져요 (그 전까지는 위 로컬 등록 방식을 쓰세요):
{
"mcpServers": {
"guardian": {
"command": "npx",
"args": ["-y", "safe-agent-mcp"],
"env": {
"GUARDIAN_PROTECTED_PATHS": "/Users/me/Documents/important-project,/Users/me/Desktop",
"GUARDIAN_MAX_FILES": "100",
"GUARDIAN_MAX_BYTES": "1000000000"
}
}
}
}환경변수 | 기본값 | 설명 |
| (없음) | 콤마로 구분한 절대경로 목록. 이 경로들과 그 하위는 항상 삭제/덮어쓰기 차단 |
|
| 삭제 대상 파일 개수가 이 값을 넘으면 확인 요구 |
|
| 삭제 대상 총 용량이 이 값을 넘으면 확인 요구 |
|
| quarantine 폴더 위치를 다른 경로로 바꾸고 싶을 때 |
제공하는 도구
safe_delete({ path, confirm? })— 검사 통과 시 대상을 삭제하는 대신 quarantine 폴더로 이동safe_write({ path, content, overwrite? })— 기존 파일이 있으면overwrite:true필요, 자동 백업 + 실패 시 자동 복원safe_execute({ command, confirm? })— BLOCK 패턴이 없으면 실행, CONFIRM 패턴은confirm:true필요list_trash()— quarantine 목록 조회restore_trash({ id })— quarantine에서 원래 위치로 복구purge_trash({ ids?, olderThanDays?, dryRun?, confirm? })— quarantine 영구 삭제 (기본은 아무것도 안 지움)
왜 클라이언트 설정이 꼭 필요한가?
MCP 서버는 새 도구를 추가할 뿐, 클라이언트에 이미 있는 원본 도구(예: Bash)를 막지는 못해요. 즉 Guardian MCP만 설치해도 에이전트가 원래 도구로 rm -rf를 직접 실행할 길은 여전히 열려 있어요.
실질적인 보호를 위해, 사용 중인 클라이언트가 지원하는 권한/허용 설정에서 원본 파괴적 명령을 deny하고 이 서버가 제공하는 safe_* 도구만 쓰도록 유도하세요. 이 메커니즘은 클라이언트마다 이름과 형식이 달라요. 예를 들어 Claude Code는 settings.json의 permissions.deny를 사용해요:
{
"permissions": {
"deny": [
"Bash(rm -rf:*)",
"Bash(rm -fr:*)",
"Bash(diskutil eraseDisk:*)",
"Bash(mkfs*:*)"
]
}
}다른 클라이언트를 쓴다면 해당 클라이언트의 문서에서 "tool permission", "deny list", "command allowlist" 같은 기능을 찾아 비슷하게 설정하세요. 이 설정이 없다면 Guardian MCP는 "에이전트가 이 도구를 선택했을 때"만 보호한다는 점을 알아두세요.
개발
npm install
npm run build # TypeScript 컴파일
npm test # vitest — 실제 파일시스템은 격리된 임시 폴더에서만 건드려요
npm run dev # tsx로 바로 실행 (stdio)테스트 전략
실제 드라이브 삭제를 재현해서 테스트하지 않아요. 대신:
pathGuard/patternGuard의classify*()함수는 실제 파일 I/O가 전혀 없는 순수 함수라, 위험한 명령/경로 fixture 목록을 그대로 유닛 테스트에 넣어도 안전해요. Windows 경로 판정은path.win32를 직접 사용해 호스트 OS와 무관하게 순수 문자열 로직으로 테스트해요.blastRadius,safeDelete,safeWrite,quarantine은 매 테스트마다fs.mkdtempSync로 새로 만든 격리된 임시 폴더(및GUARDIAN_TRASH_DIR로 격리한 임시 trash 폴더) 안에서만 동작을 검증하고, 끝나면 정리해요.심볼릭 링크 관련 테스트는 권한 문제로 링크를 만들 수 없는 환경(예: 개발자 모드가 꺼진 Windows 러너)에서는 자동으로 skip돼요.
CI(GitHub Actions)는 ubuntu/windows/macos 매트릭스로 실행되며, 매번 새로 뜨는 일회용 러너이므로 통합 테스트를 안전하게 반복 실행할 수 있어요.
로드맵
DB 가드 (SQL 파싱 기반
DROP/DELETE차단, 커넥션 후킹)클라우드 리소스 가드 (S3 버킷 삭제, 프로덕션 인스턴스 종료 등)
trash 자동 정리 정책(옵트인)
라이선스
MIT
Available Tools
3 toolssafe_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.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to delete | |
| confirm | No |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to write | |
| content | Yes | ||
| overwrite | No |
TDQS
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.
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.
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.
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.
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.
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.
3 tool updates
v0.1.0- First observed
safe_delete - First observed
safe_execute - First observed
safe_write
TDQS
Scored across 3 tools
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.
All tools follow a consistent verb_noun pattern (safe_delete, safe_write, safe_execute) with the same prefix. Predictable and readable.
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.
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.
Maintenance
Related MCP Connectors
Fail-closed policy guardrails for AI agents running kubectl, terraform, helm, and argocd.
Deterministic runtime safety for AI agents: scan PII, gate tool actions, verify LLM output.
Protects AI coding agents from installing malicious open source packages. Every npm and PyPI package is checked against SafeDep’s real-time threat intelligence before installation.
Security gateway for AI agents: policy, approval, and audited execution, no secrets shared.
Related MCP Servers
AlicenseAqualityCmaintenanceStops 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.62Apache 2.0- AlicenseNot gradedqualityDmaintenanceProvides 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
- AlicenseNot gradedqualityAmaintenanceA local-first MCP safety layer that blocks dangerous files and redacts secrets before AI agents can access them, ensuring safe vibe coding.9 npmApache 2.0
- AlicenseNot gradedqualityAmaintenanceA 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.1MIT