AgentGuard MCP
AgentGuard
面向 AI 代理的身份安全
AgentGuard 是面向自主 AI 代理的身份感知授权层。
它为每个代理赋予独立的机器身份,通过 OAuth 作用域限制访问权限,在敏感操作执行之前评估上下文策略,并在自主权限应当停止时引入一个单独认证的人工审批边界。
在线产品:
https://agentguard-eight.vercel.app
MCP 授权后端:
https://github.com/haisamar/agentguard-mcp
问题
AI 代理正越来越多地连接到真实系统:
CRM 系统
金融工具
支持平台
内部 API
数据库
MCP 服务器
但将代理连接到工具会引发一个安全问题:
仅仅因为代理可以通过身份验证,就应该允许它执行该工具支持的所有操作吗?
通常不是。
销售代理可能需要:
read CRM accounts
update opportunities
inspect support context但它不应自动拥有以下权限:
issue refunds
export customer data
modify security settings即使是合法拥有退款权限的财务代理,在发起大额退款之前也可能需要人工审批。
AgentGuard 展示了如何围绕 AI 代理执行,将身份、授权、上下文策略和人工控制分层叠加在一起。
AgentGuard 的功能
AgentGuard 将授权划分为多个安全边界:
AI Agent
↓
Machine Identity
↓
OAuth Scope Authorization
↓
Contextual Policy
↓
Human Approval if Required
↓
Controlled Execution
↓
Audit Trail仅有身份验证并不意味着拥有无限权限。
在线演示
公开演示无需身份验证即可体验:
https://agentguard-eight.vercel.app/demo
其中包含三个真实的持久化授权场景。
Related MCP server: Oakallow MCP Server
场景 1 — 人工已批准
财务代理请求一笔 $750 退款。
Finance Agent
↓
Authenticated machine identity
↓
finance:refund scope verified
↓
Refund exceeds $500 autonomous threshold
↓
APPROVAL_REQUIRED
↓
Authenticated human administrator approves
↓
Finance Agent executes approved refund
↓
ALLOW最终状态:
EXECUTED场景 2 — 人工已拒绝
同一财务代理再次请求一笔 $750 退款。
该代理拥有正确的 OAuth 权限,因此请求通过了作用域检查。
然而,上下文策略要求进行人工审批。
Finance Agent
↓
finance:refund ✓
↓
Refund > $500
↓
APPROVAL_REQUIRED
↓
Human Administrator
↓
DENY
↓
Finance Agent attempts execution
↓
DENY最终状态:
DENIED这证明了:
被授权请求某个操作,并不一定意味着代理被授权自主执行该操作。
场景 3 — 作用域被阻止
销售代理尝试发起退款。
其身份包含:
crm:read
crm:write
support:read但受保护的工具要求:
finance:refundAgentGuard 立即阻止了该请求。
Sales Agent
↓
Authenticated
↓
Missing finance:refund
↓
DENY上下文策略永远不会被评估。
永远不会进入人工审查阶段。
请求在最小权限授权边界处失败。
架构
AgentGuard 将机器身份验证、最小权限授权、上下文风险决策和人工审批分离开来,确保经过身份验证的 AI 代理永远不会自动获得无限权限。
flowchart LR
AGENT["AI Agent<br/>Sales / Finance"]
AUTH0M["Auth0<br/>Machine Identity"]
TOKEN["OAuth Access Token<br/>Scoped Permissions"]
MCP["AgentGuard MCP<br/>Protected Tools"]
SCOPE{"Scope<br/>Authorized?"}
POLICY{"Contextual<br/>Policy"}
APPROVAL["Approval Request<br/>Persisted"]
AUTH0H["Auth0<br/>Human Identity"]
HUMAN{"Human<br/>Decision"}
EXEC["Controlled<br/>Execution"]
BLOCK["Execution<br/>Blocked"]
DB[("Supabase<br/>Approvals + Audit")]
AGENT --> AUTH0M
AUTH0M --> TOKEN
TOKEN --> MCP
MCP --> SCOPE
SCOPE -->|"Missing scope"| BLOCK
SCOPE -->|"Authorized"| POLICY
POLICY -->|"Low risk"| EXEC
POLICY -->|"Forbidden"| BLOCK
POLICY -->|"Sensitive"| APPROVAL
APPROVAL --> DB
APPROVAL --> AUTH0H
AUTH0H --> HUMAN
HUMAN -->|"Approve"| EXEC
HUMAN -->|"Deny"| BLOCK
EXEC --> DB
BLOCK --> DB身份模型
AgentGuard 有意识地将机器身份与人类身份区分开来。
机器身份
每个代理运行时都会获得一个独立的 Auth0 机器对机器(Machine-to-Machine)身份。
演示包含三个运行时。
身份 | 角色 | OAuth 作用域 |
销售代理 | 营收运营 |
|
财务代理 | 财务运营 |
|
管理运行时 | 安全管理 |
|
这样可防止多个代理共享一个拥有广泛权限的凭证。
人类身份
敏感决策通过一个经过单独认证的 Auth0 用户进行审查。
人类管理员与发起请求的机器不是同一个身份。
示例:
Requested by
Finance Agent
Machine Identity
Reviewed by
Human Administrator
Human Identity这在以下两者之间建立了清晰的区分:
machine authority与:
human approval authority授权模型
AgentGuard 采用分层授权。
1. 身份验证
Auth0 确立调用代理的身份。
MCP 服务器会接收一个包含机器身份的 OAuth 访问令牌。
2. OAuth 作用域授权
每个受保护的 MCP 工具都会声明调用它所需的权限。
示例:
issue_refund
requires
finance:refund如果代理不具备所需的作用域:
DENY则无需进行策略评估,也无需升级到人工处理。
3. 上下文策略
通过 OAuth 作用域检查并不能自动保证执行。
AgentGuard 会评估所请求操作的上下文。
当前的演示规则包括:
Refund <= $500
→ ALLOW
Refund > $500
→ APPROVAL_REQUIRED
Customer data export
→ APPROVAL_REQUIRED
Customer deletion
→ DENY这将以下两者区分开来:
Can this identity request this type of operation?与:
Should this exact operation execute autonomously?4. 人在环路授权
敏感操作会被暂停并持久化。
受保护的管理员仪表板会显示待处理的请求。
经过认证的人类随后可以选择:
Approve或:
Deny该决策会被持久化,并添加到安全审计跟踪中。
5. 绑定审批的执行
人工审批不会直接执行该操作。
原始机器身份会返回并请求执行。
AgentGuard 随后验证:
Does the approval exist?
Is it APPROVED?
Does the approval belong to this agent?
Does it match this action?
Has it already been executed?只有到这时,执行才会继续。
6. 重放保护
已成功执行的审批会转换为:
EXECUTED再次尝试执行同一审批将被阻止。
EXECUTED
↓
second execution attempt
↓
DENY重放尝试会被记录为安全事件。
管理员控制台
受保护的仪表板位于:
/dashboard它需要 Auth0 认证。
管理员控制台提供:
机器身份清单
已授予的 OAuth 作用域
经过认证的人类操作员上下文
待处理的审批
批准 / 拒绝控件
授权跟踪浏览器
安全活动流
详细的审计事件检查
审批历史
机器身份与人类身份可视化
原始身份和审计上下文始终保留在认证屏障之后。
公开演示
公开演示独立位于:
/demo它被有意设计为只读。
在数据到达浏览器之前,私有安全信息会被移除。
公开演示不会暴露:
Auth0 subject IDs
machine client IDs
administrator email addresses
OAuth access tokens
Supabase credentials
raw audit metadata
private approval identifiers公共界面仅接收经过脱敏处理的场景数据。
授权跟踪浏览器
AgentGuard 包含一个交互式跟踪浏览器,可重建已持久化的安全场景。
用户可以在以下选项之间切换:
Human Approved
Human Denied
Scope Blocked每个跟踪都会可视化:
01 Agent Identity
02 Scope Check
03 Contextual Policy
04 Human Review
05 Execution这使得授权生命周期易于理解,无需访问 MCP Inspector、Auth0 仪表板或数据库。
安全活动
每个重要的授权决策都会被记录为审计事件。
示例决策包括:
ALLOW
DENY
APPROVAL_REQUIRED
APPROVED选择某个事件会打开一个详细的安全抽屉,其中包含以下信息:
Identity
Identity Type
Decision
Action
Required Scope
Reason
Approval Reference
Timestamp
Event ID
Security Metadata授权失败示例:
Sales Agent
Action
issue_refund
Decision
DENY
Required Scope
finance:refund
Granted Scopes
crm:read
crm:write
support:read
Missing Scope
finance:refund
Security Event
authorization_failure审批生命周期
敏感操作由持久化的审批记录表示。
可用状态:
PENDING
APPROVED
DENIED
EXECUTED成功流程:
PENDING
↓
APPROVED
↓
EXECUTED拒绝流程:
PENDING
↓
DENIEDAgentGuard 还区分了:
reviewed_by与:
approved_by以便被拒绝的请求能够正确表示:
status = DENIED
reviewed_by = Human Administrator
approved_by = null技术栈
AgentGuard 使用以下技术构建:
身份与授权
Auth0
OAuth 2.0
Machine-to-Machine Applications
Human Authentication
Scoped Access Tokens代理接口
Model Context Protocol
FastMCP后端
Python
Starlette
Uvicorn应用程序
Next.js 16
React
TypeScript
Tailwind CSS持久化
Supabase
PostgreSQL
Row Level Security部署
Vercel
GitHub仓库结构
agentguard/
│
├── src/
│ ├── app/
│ │ ├── dashboard/
│ │ │ ├── ApprovalButtons.tsx
│ │ │ ├── SecurityActivity.tsx
│ │ │ ├── TraceExplorer.tsx
│ │ │ ├── actions.ts
│ │ │ ├── layout.tsx
│ │ │ └── page.tsx
│ │ │
│ │ ├── demo/
│ │ │ ├── PublicTraceExplorer.tsx
│ │ │ └── page.tsx
│ │ │
│ │ └── page.tsx
│ │
│ ├── lib/
│ │ ├── agentguard-data.ts
│ │ ├── auth0.ts
│ │ └── public-demo-data.ts
│ │
│ └── proxy.ts
│
├── package.json
└── README.mdPython MCP 授权服务器单独维护:
https://github.com/haisamar/agentguard-mcp
后端 MCP 服务器
配套后端实现了:
Auth0 访问令牌验证
受保护资源的 OAuth 元数据
MCP 工具授权
必需作用域强制
上下文策略评估
审批创建
人工审批强制
绑定审批的执行
重放保护
Supabase 持久化
安全审计日志记录
后端仓库:
https://github.com/haisamar/agentguard-mcp
MCP 工具
当前安全原型包括:
search_accounts
issue_refund
list_pending_approvals
approve_action
execute_approved_refund示例:
Finance Agent
finance:refund
↓
issue_refund($100)
↓
ALLOW对比:
Finance Agent
finance:refund
↓
issue_refund($750)
↓
APPROVAL_REQUIRED对比:
Sales Agent
no finance:refund
↓
issue_refund($750)
↓
DENY数据库安全
审批和审计记录存储在 Supabase/PostgreSQL 中。
底层表已启用行级安全。
刻意不为敏感的 AgentGuard 记录定义公共浏览器策略。
服务端组件使用受保护的环境凭证。
Supabase 密钥永远不会被发送到客户端 JavaScript。
公开演示信息在传递给交互式客户端组件之前,会在服务端完成脱敏处理。
本地开发
环境要求
Node.js
Auth0 tenant
Supabase project
AgentGuard MCP backend克隆:
git clone https://github.com/haisamar/agentguard.git
cd agentguard安装:
npm install创建:
.env.local并填入你自己的环境配置。
示例变量:
SUPABASE_URL=
SUPABASE_SECRET_KEY=
AUTH0_DOMAIN=
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=
AUTH0_SECRET=
APP_BASE_URL=http://localhost:3000
AGENTGUARD_ADMIN_EMAIL=切勿提交 .env.local。
运行:
npm run dev然后打开:
http://localhost:3000路由模型
/
Public product page
/demo
Public sanitized security demo
/dashboard
Auth0-protected administrator console这种分离使得项目作为作品集项目易于审查,同时不会暴露具有特权的管理功能。
生产环境
前端部署在 Vercel 上:
https://agentguard-eight.vercel.app
生产环境认证使用 Auth0 常规 Web 应用程序,并配置了明确的生产环境回调、注销和来源 URL。
机密信息以 Vercel 环境变量的形式存储,不会提交到 Git。
展示的安全边界
AgentGuard 在一个系统中演示了多个身份安全概念:
身份验证 ≠ 授权
经过身份验证的代理仍然可能被拒绝。
最小权限
代理仅获得其角色所需的作用域。
上下文感知授权
授权可以取决于操作的细节,而不仅仅是调用者。
职责分离
机器可以请求某个操作,而由人类独立批准。
人在环路控制
自主执行可以在定义的风险边界处停止。
绑定审批的执行
审批与发起请求的身份和操作相关联。
重放保护
已执行的审批无法被重用。
可审计性
授权决策会与身份和决策上下文一起被持久化。
公开 / 私有分离
作品集查看者可以探索脱敏后的场景,而无需访问管理数据。
我想探索的内容
构建 AgentGuard 是为了探索一个问题:
当用户不总是人类时,身份安全会是什么样?
传统的应用安全通常假设人们先进行身份验证,然后直接与系统交互。
AI 代理改变了这种模式。
自主运行时可以:
call APIs
use tools
modify records
trigger workflows
take financial actions这使得身份和授权在代理层变得越来越重要。
AgentGuard 探索了诸如以下熟悉的 IAM 概念:
machine identity
OAuth scopes
least privilege
separation of duties
human approval
auditability如何应用于 AI 代理的执行。
当前范围
AgentGuard 是一个安全作品集原型,而非生产级 IAM 产品。
一些有意的边界设定包括:
上下文策略目前在代码中定义
机器身份映射到演示角色
人类管理员授权目前使用应用级允许列表
策略管理尚未拥有自己的控制平面
数据库审计记录不具备密码学不可变性
生产环境分布式锁不在原型范围内
MCP 后端部署专为受控测试而设计
审批过期功能目前尚未实现
这些限制是有意记录在案的,而非刻意隐藏。
可能的扩展
未来版本可以探索:
Auth0 role-based administration
policy-as-code
policy versioning
agent identity registry
workload identity federation
delegated authorization
resource-level authorization
organization isolation
approval expiration
time-bound privileges
step-up authentication
signed audit events
SIEM integration
policy simulation
risk scoring
dynamic authorization
production MCP deployment相关仓库
AgentGuard MCP
Python 授权服务器、策略引擎、审批强制和审计持久化:
https://github.com/haisamar/agentguard-mcp
在线项目
AgentGuard
https://agentguard-eight.vercel.app
交互式演示
https://agentguard-eight.vercel.app/demo
管理员控制台
https://agentguard-eight.vercel.app/dashboard需要认证。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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

Oakallow MCP Serverofficial
AlicenseNot gradedqualityBmaintenanceRuntime permission, approval, and audit governance for AI agent tool execution, enabling human oversight of risky actions via an MCP server.1MIT- FlicenseNot gradedqualityCmaintenanceMCP server that provides a security gateway for AI agents, enforcing allow/confirm/deny policies on tool calls and requiring human approval for risky operations, with full audit logging.
- FlicenseNot gradedqualityCmaintenanceA 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.
Related MCP Connectors
Runtime permission, approval, and audit layer for AI agent tool execution.
Security firewall for AI agents — scans MCP calls for injection, secrets, and risks.
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/haisamar/agentguard'
If you have feedback or need assistance with the MCP directory API, please join our Discord server