MCP Policy Gatekeeper
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., "@MCP Policy Gatekeeper check if 'createUserAccount.js' follows our naming conventions"
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.
MCP Server as Policy Gatekeeper
Real-time policy enforcement for AI coding agents using Model Context Protocol
Prevent AI agents from violating organizational standards by intercepting and validating their actions before execution.
π― Problem
AI coding assistants can bypass:
Naming conventions (camelCase vs snake_case)
Security policies (secrets in code, destructive commands)
Compliance rules (file access, API usage)
Traditional solutions (CI/CD, code review) catch violations after the damage is done.
Related MCP server: Hivelore
β¨ Solution
MCP server that acts as a policy gatekeeper - validates every agent action in real-time:
Agent: "Create myFirst--File.txt"
β
MCP Server: β Violates snake_case policy
β
Agent: "Creating my_first_file.txt instead"π Quick Start
# Clone & setup
git clone https://github.com/yourusername/mcpServer_as_gatekeeper.git
cd mcpServer_as_gatekeeper
# Install with uv
uv init
uv add mcp
# Run server
uv run server.pyπ§ Windsurf Integration
Add to ~/.windsurf/mcp_config.json:
{
"mcpServers": {
"policy-gatekeeper": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcpServer_as_gatekeeper",
"run",
"server.py"
]
}
}
}Restart Windsurf. Done.
π Built-in Policies
1. Command Validation
β Blocks:
rm -rf /,curl | bash,chmod 777β Allows:
git,npm,docker, safe operations
2. File Naming
Enforces:
snake_casefor filesRejects:
camelCase,kebab-case, special characters
3. Sensitive Paths
Blocks:
/etc/shadow,.ssh/id_rsa,.envfiles
4. Network Security
Prevents: Command injection, data exfiltration
π§ͺ Test It
Prompt your agent:
Create a file called myTest--File.txtExpected: Agent auto-corrects to my_test_file.txt
Validate this command: rm -rf /Expected: Blocked with policy violation ORG-SEC-001
π Features
Feature | Status |
Command validation | β |
File naming enforcement | β |
Audit logging | β |
Statistics dashboard | β |
OPA integration | π Roadmap |
Secret scanning | π Roadmap |
ποΈ Architecture
βββββββββββββββββββ
β AI Agent β
β (Windsurf) β
ββββββββββ¬βββββββββ
β MCP Protocol
β
βββββββββββββββββββββββββββ
β Policy Gatekeeper β
β - Validate command β
β - Check naming rules β
β - Scan for secrets β
β - Audit log β
ββββββββββ¬βββββββββββββββββ
β
β
ALLOW / DENYποΈ Customize Policies
Edit server.py:
POLICY_RULES = {
"your_rule": {
"patterns": [r"your_regex"],
"message": "Your policy message"
}
}Restart MCP server. Policies update immediately.
π Scale Impact
For a 50-developer team:
5,000 daily policy checks (100 per dev)
~100 hours/week saved on manual enforcement
80% of violations prevented before code review
Zero failed CI builds from policy violations
π Enterprise Use Cases
Security: Block secrets, malicious commands
Compliance: Enforce SOC2/HIPAA file access rules
Quality: Consistent naming, code structure
Cost: Prevent expensive CI/CD failures
π£οΈ Roadmap
OPA/Rego integration for complex policies
Secret detection (TruffleHog integration)
RBAC (role-based validation)
Multi-team policy federation
VS Code / Cursor support
Dashboard UI for policy management
π€ Contributing
Have a policy pattern to share? PRs welcome!
Fork the repo
Add your policy to
POLICY_RULESAdd test cases
Submit PR
π License
MIT
Available Tools
5 toolscreate_fileB
Create a new file (automatically applies snake_case naming convention)
Inputs: path (required), content.
delete_fileC
Delete a file
Inputs: path (required).
list_filesC
List all files in directory
Inputs: path.
read_fileC
Read contents of a file
Inputs: path (required).
write_fileB
Write to an existing file (naming convention enforced on creation only)
Inputs: path (required), content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose targeting specific file operations: create, delete, list, read, and write. There is no overlap or ambiguity between these functions, making tool selection straightforward for an agent.
All tools follow a consistent verb_noun pattern (e.g., create_file, delete_file) using snake_case throughout. The naming is predictable and aligns perfectly with the operations performed.
With 5 tools, the server is well-scoped for file management, covering essential CRUD operations (create, read, update via write, delete) and listing. Each tool earns its place without being excessive or insufficient.
The tool set provides complete coverage for basic file operations in the domain, including create, read, update (write), delete, and list. There are no obvious gaps, and agents can perform full file lifecycle management without dead ends.
Related MCP Connectors
Enforces architectural invariants and code quality rules inside your AI agent's edit loop.
MCP enforcement layer that intercepts AI agent actions and blocks rule violations before execution.
Pre-deploy governance for AI agents: posture scores, policies, budget cap checks, trust manifests.
Checks AI-written code against your rules as it is written, and keeps a record of what it found.
Related MCP Servers
- AlicenseAqualityCmaintenanceRuntime policy enforcement for AI agents. Evaluate every agent action against your organization's policies before execution, with observe and enforce modes.11MIT
- AlicenseAqualityBmaintenanceEnforces team knowledge and workflow policies for AI coding agents by providing context, decisions, and gates before code changes are made.165Apache 2.0

corbatofficial
AlicenseAqualityDmaintenancePolicy and quality engine for AI coding agents that enforces team coding standards and provides validation gates for agent-assisted software delivery.756 npm5MIT
Rigour MCPofficial
AlicenseNot gradedqualityBmaintenanceEnables AI agents to self-govern by scanning code for hardcoded secrets, structural violations, and AI drift in real-time, providing fix packets for automatic remediation.29MIT