Skip to content

RLASAF12/agent-gate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AgentGate πŸ”

MCP Tool Approval Gateway β€” pause any agent tool call for human review

Add human-in-the-loop approval to any AI agent in 5 minutes. No code changes to your existing agent.


What It Does

AgentGate is an MCP server that sits between your AI agent and its tool calls. When the agent wants to perform a risky action β€” delete rows, send bulk emails, push to main β€” it calls gate_request first. The action is paused. You approve or reject from a live dashboard. The agent only proceeds when you say so.

Before AgentGate: Agent deletes 12,847 database rows β†’ you find out later.
After AgentGate: Agent pauses β†’ dashboard shows you exactly what it wants to do β†’ you approve or block it.


The Problem

MCP agents now have tools that can:

  • Delete thousands of database rows
  • Send emails to tens of thousands of recipients
  • Force-push to production branches
  • Execute arbitrary shell commands

Most frameworks give you logging. None give you a pause button.

AgentGate is the pause button.


Quick Start

1. Install

git clone https://github.com/RLASAF12/agent-gate.git
cd agent-gate
npm install

2. Add to Claude Desktop

In ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "agent-gate": {
      "command": "node",
      "args": ["/path/to/agent-gate/server.js"],
      "env": {
        "AGENTGATE_SUPABASE_URL": "https://yourproject.supabase.co",
        "AGENTGATE_SUPABASE_KEY": "your-anon-key",
        "AGENTGATE_DASHBOARD_URL": "https://yourname.github.io/agent-gate/"
      }
    }
  }
}

Restart Claude Desktop. The three gate_* tools are now available.

3. Open the Dashboard

https://rlasaf12.github.io/agent-gate/

The dashboard connects to Supabase, polls every 5 seconds, and shows pending approval requests with Approve / Reject buttons.

4. Tell Your Agent When to Gate

Add instructions to your agent's system prompt:

Before executing any destructive or irreversible action (deleting data,
sending bulk messages, pushing to production), call gate_request() first.
Wait for approval via gate_check() before proceeding.

That's it. No code changes to your existing agent setup.


How It Works

Agent wants to delete rows
        β”‚
        β–Ό
  gate_request("delete_rows", "Delete 12,847 expired sessions", risk_level="critical")
        β”‚
        β–Ό
  Returns request_id β€” action is now PAUSED
        β”‚
        β–Ό
  Dashboard shows the request with full context
        β”‚
        β–Ό
  You click Approve or Reject
        β”‚
        β–Ό
  gate_check(request_id) β†’ "APPROVED β€” you may now execute"
        β”‚
        β–Ό
  Agent proceeds (or aborts on Reject)

Tools

gate_request

Submit an action for approval before executing it.

Parameter Type Required Description
tool_name string βœ“ Name of the tool being gated
action_description string βœ“ Plain-English description of what will happen
context object β€” Supporting details (row counts, recipient lists, etc.)
risk_level string β€” low / medium / high / critical (default: medium)

Returns: request_id, status: "pending", dashboard URL, next step.

gate_check

Poll for approval status. Call every 10–30 seconds.

Parameter Type Required Description
request_id string βœ“ UUID from gate_request

Returns: pending β†’ approved / rejected / expired

Auto-expires pending requests after 10 minutes (configurable via AGENTGATE_TIMEOUT_MS).

gate_list

List all currently pending requests. Useful for debugging.


Dashboard

AgentGate Dashboard

  • Live feed β€” auto-polls every 5 seconds
  • Risk badges β€” critical / high / medium / low with color coding
  • Context display β€” shows row counts, recipient counts, whatever you pass
  • One-click approve/reject β€” with optional rejection reason
  • History table β€” full decision log
  • Stats bar β€” pending count, approval rate

Fully self-contained HTML, no build step, works on GitHub Pages.


Project Structure

agent-gate/
β”œβ”€β”€ server.js          # MCP stdio server β€” the core
β”œβ”€β”€ package.json       # Dependencies (@modelcontextprotocol/sdk)
β”œβ”€β”€ dashboard/
β”‚   └── index.html     # Self-contained approval dashboard
└── README.md

Environment Variables

Variable Default Description
AGENTGATE_SUPABASE_URL built-in demo Your Supabase project URL
AGENTGATE_SUPABASE_KEY built-in demo Supabase anon key (safe for client-side)
AGENTGATE_DASHBOARD_URL GitHub Pages URL shown to agents
AGENTGATE_TIMEOUT_MS 600000 (10 min) Auto-expire timeout in milliseconds

The built-in demo credentials connect to a live Supabase instance pre-seeded with example approval requests so you can try the dashboard immediately.


Bring Your Own Supabase

  1. Create a Supabase project
  2. Run this migration:
create table gate_requests (
  id uuid primary key default gen_random_uuid(),
  tool_name text not null,
  action_description text not null,
  context jsonb default '{}',
  risk_level text not null default 'medium'
    check (risk_level in ('low','medium','high','critical')),
  status text not null default 'pending'
    check (status in ('pending','approved','rejected','expired','cancelled')),
  requested_at timestamptz not null default now(),
  decided_at timestamptz,
  decision_note text,
  agent_id text
);

alter table gate_requests enable row level security;
create policy "public_all" on gate_requests for all using (true) with check (true);
  1. Set AGENTGATE_SUPABASE_URL and AGENTGATE_SUPABASE_KEY in your MCP config

vs. agentguard

hidearmoon/agentguard is a Python library that requires code integration and framework-specific wrappers. AgentGate is framework-agnostic: it works via MCP with Claude Desktop, Cursor, Windsurf, and any MCP client. Zero changes to your existing agent code.


License

MIT β€” built by RLASAF12

About

Framework-agnostic HITL approval inbox for AI agents

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors