MCP Gatekeeper
Enables policy-enforced access to dangerous tools like file read/write/delete and shell execution, with approval workflows, risk classification, and audit logging.
README
MCP Gatekeeper
A policy-enforced MCP server with approval workflows, risk classification, and audit logging.
Built for the Manufact (mcp-use) Hackathon at Y Combinator, Feb 2026.
What It Does
MCP Gatekeeper wraps "dangerous" tools (file read/write/delete, shell exec) with a policy engine that classifies every action by risk level and enforces approval workflows:
| Tool | Risk Level | Behavior |
|---|---|---|
read_file |
SAFE | Executes immediately |
write_file |
SENSITIVE | Requires approval before execution |
delete_file |
DANGEROUS | Blocked by default, can be approved |
run_shell |
DANGEROUS | Always blocked, never approvable |
All file operations are sandboxed to ./sandbox/ with path traversal protection.
Key Features
- Policy engine with configurable risk levels (edit
policy.json) - Approval queue - pending actions with approve/deny workflow
- Audit log - every action and decision is recorded
- Sandbox - filesystem operations restricted to
./sandbox/ - HTML Dashboard - embedded MCP App UI with risk badges
- 12 MCP tools exposed for full workflow control
Quick Start
# Install dependencies
pip install fastmcp mcp-use
# Run the server
python server.py
Git Safety (Recommended)
This repo includes a .gitignore and an optional pre-commit hook to prevent accidentally committing node_modules/, __pycache__/, .env*, and *.log.
./scripts/setup-githooks.sh
How to Test
Option 1: mcp-use Inspector (Recommended)
Go to the Manufact Inspector and connect with:
- Transport: stdio
- Command:
python - Args:
server.py - Working directory: path to this project
Or use the local inspector:
pip install fastmcp
fastmcp dev server.py
Option 2: Automated Demo Script (mcp-use)
pip install mcp-use
python test_demo.py
This runs through the full workflow automatically using mcp-use's MCPClient.
Option 3: Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"gatekeeper": {
"command": "python",
"args": ["/full/path/to/server.py"]
}
}
}
Demo Script (step by step)
Run these tool calls in order in the Inspector to see the full flow:
1. get_policy()
→ See risk levels for all tools
2. read_file(path="test.txt")
→ SAFE: auto-executes (file not found, that's OK)
3. write_file(path="hello.txt", content="Hello Hackathon!")
→ SENSITIVE: returns APPROVAL_REQUIRED + action_id
4. list_pending()
→ Shows the pending write action
5. approve(action_id="<id from step 3>")
→ Executes the write, file is created
6. read_file(path="hello.txt")
→ SAFE: reads "Hello Hackathon!"
7. delete_file(path="hello.txt")
→ DANGEROUS: returns APPROVAL_REQUIRED + action_id
8. deny(action_id="<id from step 7>")
→ Denies the delete, file is preserved
9. run_shell(command="ls -la")
→ DANGEROUS: BLOCKED permanently
10. read_file(path="../../etc/passwd")
→ BLOCKED: path traversal detected
11. audit_log()
→ Full history of all actions and decisions
12. get_dashboard()
→ Formatted overview of everything
13. get_dashboard_ui()
→ HTML widget with risk badges, pending queue, audit table
Tools Reference
| Tool | Description |
|---|---|
read_file(path) |
Read a file from sandbox |
write_file(path, content) |
Write a file (needs approval) |
delete_file(path) |
Delete a file (needs approval) |
run_shell(command) |
Shell exec (always blocked) |
list_pending() |
Show pending approval queue |
approve(action_id) |
Approve and execute a pending action |
deny(action_id) |
Deny a pending action |
audit_log(limit=25) |
View decision history |
get_policy() |
View current policy config |
get_dashboard() |
Text dashboard overview |
get_dashboard_ui() |
HTML dashboard (MCP App UI) |
Project Structure
mcp-quick/
├── server.py # MCP server (FastMCP) - all tools + policy engine
├── policy.json # Configurable policy rules
├── mcp_config.json # mcp-use client configuration
├── test_demo.py # Automated demo using mcp-use MCPClient
├── requirements.txt # Python dependencies
├── README.md # This file
└── sandbox/ # Sandboxed filesystem (all ops happen here)
Customizing Policy
Edit policy.json to change behavior:
{
"write_file": {
"risk_level": "SAFE",
"default_action": "allow",
"allow_approval": false
}
}
risk_level:SAFE|SENSITIVE|DANGEROUSdefault_action:allow|require_approval|blockallow_approval:true|false(can users approve blocked actions?)
Tech Stack
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。