AgentGuard MCP
Integrates with Auth0 for machine and human identity: agent runtimes authenticate as Auth0 Machine-to-Machine applications, OAuth scopes authorize protected tools, and human administrators authenticate separately to review sensitive actions.
Uses Supabase to persist security data including approval requests, authorization decisions, execution traces, and audit event records.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
AgentGuard
AgentGuard stops an AI agent from taking an irreversible action it is not allowed to take, even when the agent calls the tool anyway. It sits between a tool call and its real-world effect. In this build, the action is an AI support agent issuing a refund (simulated USD).
Try the demo · Inspect the evidence · MCP backend repository · Creator case study
For reviewers | Where |
What it does and why | |
How it prevents unauthorized or irreversible actions | |
Results, tests and how to reproduce them | |
What it does not do yet |
Project overview
The problem. Tool-using agents act first and notice the risk later. Once money moves, a later refusal cannot undo it. Most guardrails today live in the prompt or in a single "check the scope, review anything over $X" rule. Those fail under ordinary conditions: a retry, a large refund split into small ones, a replayed approval, or a different agent reusing someone else's approval.
What AgentGuard does. The agent never touches money directly. Every refund request goes through:
a Python MCP server that verifies the agent's Auth0 identity and OAuth scope, and
PostgreSQL functions that enforce the spending policy, record every decision, and are the only path to writing a receipt.
Requests within policy run on their own. Anything beyond policy is stored and waits for a human, who sees the exact request and must have just re-authenticated with a passkey or MFA.
This repository contains the Next.js website, the public demo and the protected operator dashboard. The MCP service and database migrations live in the companion repository. Together they form the complete system.
flowchart LR
Agent[Agent with Auth0 token] --> MCP[Python MCP checks identity and scope]
MCP --> DB[(PostgreSQL checks budget and records effects)]
DB -->|Beyond policy: request waits| Dashboard[Protected dashboard]
Human[Human operator with recent passkey] --> Dashboard
Dashboard -->|Approve the exact stored request| DB
MCP -->|Only the original agent executes, once| DBRelated MCP server: AgentGuard MCP
Safety approach
Each control is enforced outside the model, in code or in the database, so it holds even if the agent is confused, manipulated or retrying.
Risk | Control | Where it is enforced |
Agent without permission tries a refund | Requires the | MCP server (Auth0 token verification) |
Many small refunds add up to a large loss | Shared $500 rolling 24-hour autonomous budget across all agents. A request beyond the remaining budget waits for review, even if it is small | PostgreSQL function, in one transaction |
High-impact action with no human check | Request is stored and held. Nothing executes until a verified operator approves it | PostgreSQL + protected dashboard |
Approval by a stale or stolen session | Approve and resume require a passkey or MFA event in the last five minutes, plus the configured verified operator | Next.js dashboard (Auth0) |
Agent approves its own request | Machine | MCP server |
Approval reused or replayed | An approval is bound to the exact stored transaction and to the original requesting agent, and executes once | PostgreSQL |
Retry or duplicate submission | A stable request ID returns the original result. The same ID with changed arguments is rejected | PostgreSQL |
Something looks wrong mid-incident | Operators can cancel pending or approved requests and pause all execution | PostgreSQL + dashboard |
No record of what happened | Every review and execution commits together with its audit event | PostgreSQL |
The design rule: a receipt can only be written by the database function, in the same transaction as the checks that allow it. There is no other write path for the agent to use.
Supporting evidence
1. Reproducible evaluation: 10 fixed attack and failure scenarios
The same scenario steps run against three implementations in an empty in-memory PostgreSQL database, using AgentGuard's real schema and migrations. A scenario passes when the resulting ledger matches the expected effect.
Scenario | No guardrails | Scope + "$500 review" rule | AgentGuard |
Routine refund ($100) | ✅ | ✅ | ✅ |
Agent without refund scope | ❌ | ✅ | ✅ |
Above threshold, executed without review | ❌ | ✅ | ✅ |
Two small requests exceed the shared budget | ❌ | ❌ | ✅ |
Identical submission retried | ❌ | ❌ | ✅ |
Same request ID with a changed amount | ❌ | ❌ | ✅ |
Approved refund replayed | ❌ | ❌ | ✅ |
Different agent executes someone else's approval | ❌ | ❌ | ✅ |
Approved request cancelled before execution | ❌ | ❌ | ✅ |
Execution attempted while paused | ❌ | ❌ | ✅ |
Total | 1/10 | 3/10 | 10/10 |
All seven SQL assertion files also pass (approval binding, atomic review rollback, execution controls, idempotency, audit rollback and review expiry).
Reproduce it (Node.js 24+, no accounts or credentials needed):
git clone https://github.com/haisamar/agentguard-mcp.git
cd agentguard-mcp/evaluation
npm ci --ignore-scripts
npm run --silent evaluateSee the evaluation guide for setup details and what the baselines represent.
2. Hosted end-to-end runs
November 9 hosted rehearsal: fresh Supabase database, separate Auth0 credentials, protected Vercel previews. Execution was withheld until a real passkey approval, one $758 simulated receipt was recorded, and the replay was denied.
November 6 hosted report: 22 checks on named deployments, including human review after passkey sign-in, a single receipt, denied replay, cancellation and pause/resume.
Concurrency trial: eight identical concurrent submissions produced exactly one receipt in one case and one pending approval in the other.
Administrator access checks: signed-out, wrong-subject and unverified dashboard requests were denied, and all ten approve/resume attempts under disallowed session conditions stopped before any write.
The full index is in SUBMISSION-EVIDENCE.md. CI runs on every push (see the badges above). The backend re-runs this 10-scenario evaluation and the Python test suite from hash-pinned dependencies; the frontend runs lint, type checks, tests and a production build.
3. Try it yourself in two minutes
Open Human review in the public demo. The $755 request waits with zero receipts. Simulate approval and execution, then try replaying the approval. The ledger still has one receipt.
Try Split the budget and Machine self-approval to see the denial paths. The public walkthrough uses guided, synthetic examples and needs no account.
Reusing the pattern
The refund is one example of an irreversible action. The same four pieces apply to others, such as deleting data, sending payments, emailing customers or changing production systems:
Scope: give each agent its own identity and only the permissions it needs.
Shared limit: put the budget or rate limit in the database, across agents, not in the prompt.
Hold and bind: store high-impact requests, and bind any approval to the exact stored action and the original agent, executable once.
Re-authenticated human: require a fresh passkey or MFA to approve.
The policy lives in plain SQL migrations in the MCP repository, so another team can read, test and adapt it without the frontend.
Run the frontend locally
Use Node.js 24 and the committed npm lockfile.
npm ci
npm run devVisit http://localhost:3000. The public routes are /, /demo, /evidence,
and /about. To exercise /dashboard, create an untracked .env.local using
the settings below. Use a dedicated test environment for writes.
APP_BASE_URL=http://localhost:3000
AUTH0_DOMAIN=
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=
AUTH0_SECRET=
AGENTGUARD_ADMIN_EMAIL=
AGENTGUARD_ADMIN_SUB=
SUPABASE_URL=
SUPABASE_SECRET_KEY=Register http://localhost:3000/auth/callback and the base URL as allowed
callback and logout URLs respectively in the Auth0 Regular Web Application.
Generate a unique session secret with openssl rand -hex 32. Apply the backend
schema and migrations
before using the dashboard. Keep both server secrets in the environment.
If the dashboard denies access, check the verified email and exact Auth0 subject. For an approval or resume prompt, use Re-authenticate with a passkey. If the database is unavailable, check the AgentGuard project status and server configuration. The dashboard retries only transient read failures.
npm run lint
npm run typecheck
npm test
npm run buildSee dependency verification for version constraints and backend hosting for the separate Vercel MCP service.
Limitations
Simulated money. Refunds write to a simulated USD ledger. Payment-provider integration remains future work.
One action type. This build protects refunds. Other irreversible actions need their own scopes, limits and review rules (see Reusing the pattern).
Trust boundary. AgentGuard trusts the identity provider, the backend credentials and privileged database operators. Audit records are persisted in PostgreSQL and can be altered by those operators; the log is not tamper-proof against them.
Scope of the evaluation. The ten-case comparison uses fixed scenarios, one database connection, synthetic identities and illustrative baselines. It measures whether the safeguards hold, not how a model behaves. The concurrency trial covers only the documented cases.
Access testing. The hosted access test denied the same verified user before configuring that user as the rehearsal administrator. A separate verified non-admin account was not tested against production.
Availability. Free hosting can pause or reach usage limits. The public walkthrough works independently of the database; the live dashboard depends on Auth0 and Supabase.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Identity, authorization, audit trails, and revocable permissions for AI agents accessing MCP tools.
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
IAM for AI agents, providing secure credential management, individual agent identities, scoped credential access, approval controls and audit logs. Connect via MCP using OAuth or an agent token.
MCP enforcement layer that intercepts AI agent actions and blocks rule violations before execution.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA governance and control layer for MCP tools that manages tool requests as intents through policy-based approval, queuing, or blocking. It enables secure human oversight and audit trails for consequential agent actions across platforms like Claude Desktop and Cursor.1MIT No Attribution
- AlicenseNot gradedqualityBmaintenanceA protected Model Context Protocol server that gives AI agents distinct machine identities, enforces least-privilege OAuth permissions, applies contextual authorization policies, and pauses sensitive actions for human approval.MIT
- AlicenseNot gradedqualityAmaintenanceA policy-based security layer for AI agents and MCP tools that evaluates tool requests against security policies before allowing, denying, or requiring human approval for execution.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables MCP-compatible AI agents to safely act on business backends by enforcing per-agent permissions, autonomy thresholds, human approval with review-and-edit, and full audit trails.MIT