Agent File Guardian
Click on "Install 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., "@Agent File Guardianread workspace/config.yaml"
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.
Agent File Guardian

A small, honest gate between an AI agent and your files.
When you let an autonomous agent run on your machine, it inherits your machine's trust boundary. Agent File Guardian sits in front of file operations and runs each one through three steps before a single byte is touched:
Triage — a local LLM (via Ollama) translates the raw request into one plain sentence and a rough risk label, so you can actually read what the agent is about to do.
Policy — a deterministic rule file decides
allow/ask/deny.Approval — anything marked
askpauses for a human yes/no, and everything is written to an append-only audit log.
agent ──▶ [ triage: explain + risk ] ──▶ [ policy: allow|ask|deny ] ──▶ [ human if 'ask' ] ──▶ file
(local LLM, (plain code — (you) + audit log
advisory only) the real boundary)What this is — and what it is NOT
Please read this before trusting it with anything.
This is a human-in-the-loop ergonomics layer, not a cryptographic sandbox. It makes "review every sensitive action" practical instead of exhausting.
The local LLM never decides
allowordeny. That would make a prompt-injectable, non-deterministic component your security boundary — a bad idea. The LLM only explains. The decision lives inpolicy.yaml, in plain auditable code. If Ollama isn't running, the gate still works; you just lose the nice summaries.It does not replace OS permissions, containers, or a real secrets vault. Run agents in a sandbox too. Treat this as defense-in-depth, not the whole defense.
If that framing is wrong or can be made stronger, that's exactly the kind of issue/PR this repo is hoping for.
Related MCP server: agent-sudo-mcp
Quick start (no agent needed)
pip install pyyaml pathspec
python demo.py # interactive: you approve the 'ask' cases
python demo.py --auto # scripted approvals, prints the whole traceThe demo builds a throwaway sandbox (a workspace/ folder, a personal/
folder, and a fake .env) and sends four agent requests through the gate so you
can watch allow / ask / deny happen and see the audit log fill in.
Real use: plug it into an agent over MCP
pip install "mcp[cli]"
python -m guardian.server # speaks MCP over stdioPoint an MCP-capable agent at it instead of giving it raw filesystem tools. Example Claude Desktop config:
{
"mcpServers": {
"file-guardian": {
"command": "python",
"args": ["-m", "guardian.server"],
"env": { "GUARDIAN_POLICY": "/absolute/path/to/policy.yaml" }
}
}
}Approval prompts appear on your terminal (/dev/tty), since stdin/stdout carry
the MCP protocol. With no terminal attached, the server fails closed (denies
the ask case).
Writing policy
policy.yaml is the whole security boundary. Rules are checked top to bottom;
the first match wins, so put deny rules first. Patterns are gitignore-style
globs.
default_action: ask # allow | ask | deny — used when nothing matches
rules:
- name: "Block secrets and keys"
match_paths: ["**/.env", "**/*.key", "**/.ssh/**", "**/secrets/**"]
action: deny
- name: "Workspace reads are fine"
match_paths: ["workspace/**"]
operations: ["read", "list"]
action: allowlimits.max_write_bytes can only make a verdict stricter (an oversized allow
write is escalated to ask) — never looser.
Configuration (environment variables)
Variable | Default | Meaning |
|
| Path to the policy file |
|
| Append-only JSONL log |
|
| Local LLM endpoint |
|
| Ollama model for triage |
|
| Seconds before falling back to heuristic |
Ideas worth contributing
Honest about the gaps — these are open invitations, not finished claims:
Path-traversal hardening: resolve
../symlinks and match policy on the real path before deciding.Optional triage→escalation: let a
highLLM risk turn anallowinto anask(off by default, to keep the boundary deterministic).Better approval channels: desktop notification or phone push instead of a terminal prompt.
Per-session budgets: "allow up to N writes / this much total" within one agent run.
More operations: move/copy/chmod, and non-text files.
License
MIT — see LICENSE. Built as a proof of concept to make the idea concrete. Fork it, break it, improve it.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ShinYeol-Lee/agent-file-guardian'
If you have feedback or need assistance with the MCP directory API, please join our Discord server