Zero-Trust Reverse Proxy & Real-Time Human-in-the-Loop Gateway for Autonomous AI Coding Agents and Model Context Protocol (MCP) Tool Calls.
Autonomous AI coding agents (such as Cursor, Claude Desktop, and CLI agents) are increasingly equipped with broad write permissions to local filesystems and shell execution environments. When prompt injection attacks, supply-chain vulnerabilities, or agent hallucinations occur, an agent can silently modify critical code, alter .env secrets, or run destructive terminal commands.
Warden-AI acts as an air-gapped security harness between autonomous AI agents and your local environment. It intercepts tool execution requests, freezes the agent's HTTP connection in memory via the Async Hold Pattern, and forces all filesystem mutations and terminal commands through a human-in-the-loop React approval dashboard before any code touches your disk.
flowchart LR
A[Autonomous AI Agent<br/>Cursor / MCP Client] -->|POST /api/mcp/execute| B(Warden-AI Reverse Proxy)
subgraph "Zero-Trust Gateway"
B -->|Async Promise Hold| C[Pending Requests Map]
B -->|Insert 'pending'| D[(SQLite Audit Trail<br/>WAL Mode)]
B -->|WebSocket Broadcast| E[WebSocket Server]
end
E -->|Real-Time Event| F[React Command Center]
subgraph "Human-in-the-Loop Operator"
F -->|Inspect Visual Diff| G{Human Decision}
G -->|Approve| H[Emit 'approved']
G -->|Reject| I[Emit 'rejected']
end
H -->|WS Message| E
I -->|WS Message| E
E -->|Resolve Promise| C
C -->|HTTP 200 Success| A
C -->|HTTP 403 Forbidden| A
- The Async Hold Pattern: Traps incoming agent HTTP tool calls inside unresolved JavaScript promises. Zero polling overhead, sub-millisecond dispatch, and fully transparent to MCP clients.
- Side-by-Side Payload Diff Inspector: Embedded visual diff engine (
react-diff-viewer-continued) highlights proposed additions and deletions before execution. - Real-Time Control Plane: Bidirectional WebSocket stream instantly notifies the operator and unblocks waiting CLI processes upon human approval.
- Immutable SQLite Audit Trail: Every single tool call is cryptographically timestamped and persisted locally in SQLite (
audit_logs) with status, agent name, and exact payload parameters. - Zero Cloud Dependencies: 100% local execution. No telemetry, no external database dependencies, and no Docker requirement.
- Newcomer-Proof DevEx & Preflight Healthcheck: Built-in bootloader verifies Git availability, workspace write permissions, Docker daemon health, and validates environment variables via Zod before booting.
Warden-AI/
βββ .env.example # Canonical environment variable template
βββ docker-compose.yml # One-command orchestration for all services
βββ package.json # Root orchestration & bootstrap scripts
βββ backend/
β βββ Dockerfile # Multi-stage Node 20 Alpine build
β βββ .dockerignore
β βββ src/
β β βββ index.ts # Express & WebSocket server entrypoint
β β βββ cli/
β β β βββ healthcheck.ts # Preflight bootloader verification suite
β β βββ config/
β β β βββ env.ts # Zod environment schema & path validation
β β βββ db/
β β β βββ client.ts # SQLite audit trail initialization & queries
β β βββ proxy/
β β β βββ interceptor.ts # Async request holding logic & MCP route
β β βββ security/
β β β βββ honeypot.ts # Cryptographic decoy honeypots & IDS quarantine
β β βββ utils/
β β β βββ model-loader.ts# Graceful model loader with terminal feedback
β β βββ ws/
β β βββ socket.ts # WebSocket server & approval dispatcher
β βββ scripts/
β β βββ test-agent.ts # Mock autonomous AI agent simulator
β β βββ test-honeypot-breach.ts # IDS intrusion & session lockout test
β βββ package.json
β βββ tsconfig.json
βββ frontend/
β βββ Dockerfile # Multi-stage Vite build β Nginx serving
β βββ .dockerignore
β βββ nginx.conf # Nginx reverse proxy for API & WebSocket
β βββ src/
β β βββ App.tsx # Main Zero-Trust Command Center UI
β β βββ components/
β β β βββ RequestCard.tsx# Intercepted action card & decision gates
β β β βββ DiffViewer.tsx # Visual payload & code diff inspector
β β βββ hooks/
β β βββ useWebSocket.ts# Real-time WebSocket state management
β βββ package.json
β βββ vite.config.ts
β βββ tailwind.config.js
β βββ tsconfig.json
βββ README.md
- Node.js: v18.0.0 or newer
- Git: Installed and accessible in system
$PATH - npm or pnpm / yarn
git clone https://github.com/hariom123-dev/Warden-AI.git
cd Warden-AIOptional: Copy the environment configuration template:
cp .env.example .env(If omitted, sane local defaults will be applied automatically.)
cd backend
npm install
npm run bootstrap # Runs preflight healthcheck (Git, Docker, write access, env)
npm run devServer will listen on
http://localhost:3001and mount the WebSocket control stream. Note:npm run devandnpm startautomatically run the healthcheck preflight viapredev/prestart.
cd frontend
npm install
npm run devOpen your browser to
http://localhost:5173. The dashboard will display "System Secure: No pending AI actions".
cd backend
npm run test:agent- Terminal 3 pauses and holds: The agent prints
STATUS: WAITING FOR HUMAN OPERATOR APPROVALwith an active timer. - Dashboard lights up: The intercepted tool call pops up in the React dashboard with the file path (
src/core/auth.ts) and proposed code diff. - Approve or Reject: Click "Approve Action" to unblock the agent with HTTP 200, or "Reject Action" to abort the operation with HTTP 403.
- Docker v20+ and Docker Compose v2+
git clone https://github.com/hariom123-dev/Warden-AI.git
cd Warden-AI
docker compose up --build| Service | URL |
|---|---|
| Security Dashboard | http://localhost:5173 |
| Backend API / WebSocket | http://localhost:3001 |
# Stop all services
docker compose down
# Stop and remove persisted SQLite data
docker compose down -vNote: The SQLite audit trail is persisted in a Docker volume (
warden-data). Usedocker compose down -vto remove it when starting fresh.
All requests are logged immutably to audit.db using Write-Ahead Logging (WAL):
CREATE TABLE IF NOT EXISTS audit_logs (
id TEXT PRIMARY KEY,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
agent_name TEXT,
action_type TEXT,
payload TEXT,
status TEXT -- 'pending', 'approved', 'rejected'
);Contributions, issues, and feature requests are welcome! Feel free to check out the issues page.
This project is open-source software licensed under the MIT License.