cordon
每家公司都想部署 AI 代理。但没有公司愿意将数据库的密钥交给代理。
Cordon 弥合了信任鸿沟。
演示
https://github.com/user-attachments/assets/153d978f-6303-443a-b49b-b4ec7ebf0452
Related MCP server: protect-mcp
问题所在
模型上下文协议 (MCP) 使得为 AI 代理提供强大的工具(数据库、文件系统、API、云基础设施)变得极其简单。
但 MCP 没有内置的安全模型。没有审计日志。没有批准工作流。没有速率限制。如今,AI 代理要么是关闭的,要么拥有完全管理员权限。两者之间没有任何中间地带。
这是阻止 AI 代理进入生产环境的最大障碍。
解决方案
Cordon 是位于 LLM 和 MCP 服务器之间的安全网关。
它充当防火墙、审计员和远程控制器——让您能够完全掌控 AI 代理可以做什么以及不能做什么。
┌─────────┐ ┌──────────┐ ┌──────────────┐
│ LLM / │ ──▶ │ Cordon │ ──▶ │ MCP Server │
│ Agent │ ◀── │ Gateway │ ◀── │ (database, │
└─────────┘ └──────────┘ │ fs, APIs) │
│ └──────────────┘
├── Policy Engine
├── Audit Logger
└── Approval Workflows无需更改基础设施。无需重写代码。只需一个配置文件。
快速入门
第 1 步 — 初始化
在您的项目内(即 claude_desktop_config.json 所在的位置)运行此命令:
npx cordon-cli init它会读取您现有的 Claude Desktop MCP 配置,生成 cordon.config.ts,并修补 Claude Desktop 以将所有工具调用通过 Cordon 路由。
第 2 步 — 启动
npx cordon-cli startCordon 启动,连接到您的 MCP 服务器,并开始拦截工具调用。重启 Claude Desktop,现在每个工具调用都会流经该网关。
手动设置
如果您更喜欢手动配置,请全局安装并创建配置:
npm install -g cordon-cli
cordon initcordon init 会生成一个 cordon.config.ts:
import { defineConfig } from 'cordon-sdk';
export default defineConfig({
servers: [
{
name: 'database',
transport: 'stdio',
command: 'npx',
args: ['-y', '@my-org/db-mcp-server'],
policy: 'read-only', // Block all write operations
},
{
name: 'github',
transport: 'stdio',
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-github'],
policy: 'approve-writes', // Reads pass; writes require approval
tools: {
delete_branch: 'block', // Never, regardless of approval
},
},
],
audit: {
enabled: true,
output: 'stdout', // or 'file'
},
approvals: {
channel: 'terminal',
timeoutMs: 60_000, // auto-deny after 60s if no response
},
});为什么选择 Cordon
无 Cordon | 有 Cordon |
代理拥有不受限制的工具访问权限 | 细粒度的工具级策略 |
无法查看代理的操作 | 每次调用的结构化审计追踪 |
“代理刚才是不是删除了一个表?” | 实时终端批准 |
读写操作被同等对待 |
|
合规团队对 AI 说不 | 审计日志可供导出 |
功能
策略引擎
按工具、按服务器或全局定义规则。工具级策略会覆盖服务器策略。
// Server-level default
policy: 'approve-writes',
// Per-tool overrides
tools: {
query: 'allow', // reads: pass through
execute: 'approve', // writes: pause for human approval
drop_table: 'block', // catastrophic: always reject
list_tables: 'log-only', // audit but don't interrupt
},人机协作批准
当工具调用需要批准时,Cordon 会暂停代理并直接在您的终端中提示您:
╔══════════════════════════════════════╗
║ ⚠ APPROVAL REQUIRED ║
╚══════════════════════════════════════╝
Server : database
Tool : execute_sql
Args :
{
"query": "DELETE FROM sessions WHERE expires_at < NOW()"
}
[A]pprove [D]eny
>代理会等待。由您决定。
审计日志
每个工具调用都记录为结构化 JSON —— 包括请求、策略决策、响应和时间。将其输出到 stdout 或写入文件,供您的合规团队使用。
{"event":"tool_call_received","callId":"...","serverName":"database","toolName":"execute_sql","timestamp":1773434469641}
{"event":"approval_requested","callId":"...","serverName":"database","toolName":"execute_sql","timestamp":1773434469641}
{"event":"tool_call_approved","callId":"...","serverName":"database","toolName":"execute_sql","timestamp":1773434471203}
{"event":"tool_call_completed","callId":"...","durationMs":34,"isError":false,"timestamp":1773434471237}只读模式
一个策略设置即可阻止服务器上的所有写操作。无需猜测什么是写操作——Cordon 会根据工具名称检测它。
policy: 'read-only' // any tool starting with write/create/update/delete/drop/execute/... is blocked隐藏工具
对于模型根本不应该看到的工具——不仅在调用时被拒绝,而且完全从 tools/list 响应中过滤掉。关闭了提示注入的攻击面:如果模型从未知道某个工具存在,它就无法被诱骗去调用它。
{
name: 'database',
policy: 'approve-writes',
tools: {
drop_table: 'block', // call attempts are rejected
internal_admin: 'hidden', // not advertised to the client at all
},
}封闭世界工具目录
声明您的上游服务器预期发布的精确工具集。当上游在未来版本中添加新工具时,Cordon 会自动阻止它,直到您明确将其提升为已知工具。
{
name: 'postgres',
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-postgres', process.env.POSTGRES_URL!],
policy: 'read-only',
knownTools: ['query', 'list_tables', 'describe_table'], // your approved surface
onUnknownTool: 'block', // default when knownTools is set
}如果下一个 Postgres MCP 版本添加了 truncate_table,Cordon 会通过 stderr 警告阻止它——无需更新策略。将 knownTools 留空以保持向后兼容的开放世界行为。
工作原理
Cordon 作为单一的聚合 MCP 代理运行。Claude Desktop 不再直接连接到您的 MCP 服务器,而是连接到 Cordon。然后由 Cordon 在内部管理您的服务器。
Before: Claude ──▶ MCP Server A (full access)
Claude ──▶ MCP Server B (full access)
After: Claude ──▶ Cordon ──▶ MCP Server A (governed)
──▶ MCP Server B (governed)您的 LLM 客户端和 MCP 服务器完全不需要更改。cordon init 会处理配置修补。
配置
策略操作
策略 | 行为 |
| 立即通过 |
| 拒绝 — 代理收到错误 |
| 暂停,等待终端人工批准 |
| 读取通过;写入需要批准 |
| 所有写操作被阻止 |
| 通过,但在审计日志中标记 |
| 从 tools/list 中过滤 — 模型永远看不到它 |
策略可以在服务器级别(所有工具的默认值)或每个工具级别(覆盖服务器默认值)设置:
{
name: 'my-server',
policy: 'approve-writes', // server default
tools: {
safe_read: 'allow', // override: always allow
nuke_db: 'block', // override: always block
},
}批准渠道
渠道 | 状态 |
| 可用 — 终端中的交互式提示 |
| 可用 — Block Kit 消息,HMAC 验证的交互 |
| v0.3 即将推出 |
| v0.3 即将推出 |
审计输出
输出 | 状态 |
| 可用 |
| 可用 — JSON 行写入本地文件 |
| 可用 — 将事件发送到 Cordon 仪表板 |
| v0.3 即将推出 |
软件包
软件包 | 描述 |
| CLI 工具 — |
| TypeScript 配置 SDK — |
| 核心代理引擎 — 策略评估器、审计记录器、批准管理器 |
路线图
[x] 具有聚合器模型的 MCP 代理(多个服务器,一个网关)
[x] 策略引擎 — allow, block, approve, approve-writes, read-only, log-only, hidden
[x] 封闭世界工具目录 —
knownTools+onUnknownTool,用于面向未来的上游表面控制[x] 带有 TTY 安全提示的终端批准渠道
[x] Slack 批准渠道 — Block Kit 消息,轮询响应
[x] 结构化 JSON 审计日志输出到 stdout、文件或托管仪表板
[x]
cordon init— 自动读取 Claude Desktop 配置并进行修补[x] 速率限制 — 滑动窗口,全局/按服务器/按工具
[x] 托管仪表板 — 审计日志历史记录、CSV/JSON 导出、GitHub OAuth
[x] Stripe 计费 — 免费版和专业版
[ ] OpenTelemetry 导出
[ ] 团队账户和集中式治理
[ ] HTTP/SSE 传输支持
示例
请参阅 examples/security-showcase,了解 Cordon 拦截试图删除生产数据库表的代理的演示。
cd examples/security-showcase
npm install
npm run demo使用场景
独立开发者 — 保护您的本地 Claude/Cursor 设置。准确查看您的代理正在调用什么,并在任何危险操作到达生产环境之前阻止它们。
初创团队 — 自信地部署代理。每个工具调用都被记录,写入操作需要批准,并且您的合规团队拥有完整的审计追踪。
企业 — 在所有 AI 代理部署中实现集中治理。策略即代码、结构化日志,以及通往 SOC2 合规审计追踪的清晰路径。
完美搭配
Agent Toolbelt — 一个类型化的现成 MCP 工具包(网页搜索、获取、文件系统等)。将其连接到 Claude Desktop,然后通过 Cordon 路由这些工具调用以进行策略强制执行和审计记录。Agent Toolbelt 为您的代理提供能力;Cordon 确保它们在使用前先征得同意。
Build & Ship MCP Tools — 引导您从头到尾构建自己的 MCP 服务器的配套课程。第 6 模块涵盖了使用 Cordon 保护您的服务器。
贡献
Cordon 是开源的,我们欢迎贡献。
git clone https://github.com/marras0914/cordon.git
cd cordon
npm install
npm run build
npm run dev许可证
MIT — 详情请参阅 LICENSE。
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 gradedqualityCmaintenancePolicy enforcement gateway for MCP tool calls, evaluating every tool invocation against declarative YAML policies (allow/deny/escalate-to-human), generating cryptographic hash-chained audit receipts, and including built-in content safety scanning.2MIT- AlicenseBqualityCmaintenanceSecurity gateway that wraps any MCP server with per-tool policies, approval gates, and optional Ed25519-signed decision receipts. Shadow mode logs every tool call without blocking; enforce mode applies block, rate-limit, and minimum-tier rules. Receipts are independently verifiable offline with no accounts needed.54699MIT
- AlicenseNot gradedqualityBmaintenanceA policy-enforcing MCP gateway that intercepts all tool calls to downstream MCP servers, applying allow/deny/ask rules with human approval and audit logging for safe access to dangerous tools.23MIT

evav-gatewayofficial
AlicenseNot gradedqualityBmaintenanceGoverned MCP gateway that lets AI agents call tools with policy enforcement, prompt-injection screening, a kill-switch, and tamper-evident signed audit logs.Apache 2.0
Related MCP Connectors
Security firewall for AI agents — scans MCP calls for injection, secrets, and risks.
Runtime permission, approval, and audit layer for AI agent tool execution.
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/marras0914/cordon'
If you have feedback or need assistance with the MCP directory API, please join our Discord server