SentinelMCP
SentinelMCP
用于模型上下文协议(MCP)的确定性策略防火墙与运行时治理引擎
概述
SentinelMCP 是一个生产级安全网关和运行时治理框架,专为**模型上下文协议(MCP)**服务器和多代理 AI 集群 [1] 设计。随着 AI 代理通过 MCP 越来越自主地访问企业文件系统、数据库和 API,提示注入、未授权工具调用和数据泄露等安全风险急剧增加。
SentinelMCP 充当内联策略防火墙,拦截 JSON-RPC MCP 工具调用,根据声明式 AST 规则检查参数,强制执行安全限制,并记录不可篡改、可加密验证的审计跟踪。
Related MCP server: AgentGuard MCP Server
核心架构与特性
策略即代码引擎:声明式 JSON/YAML 策略定义,支持工具名称的 glob 模式匹配、参数值的正则表达式检查以及严格的参数模式验证 [2]。
加密溯源账本:仅追加的审计日志,每条执行记录通过 SHA-256 哈希链接,确保防篡改的可追溯性,满足合规和审计要求。
高性能代理网关:基于 FastAPI 和 Pydantic v2 构建,通过异步请求处理实现亚毫秒级拦截延迟。
CLI 与测试工具链:内置 CLI,用于评估工具调用是否符合策略、运行网关服务器以及验证账本完整性。
企业级 CI/CD:通过 pytest 全面测试,在 Python 3.11 和 3.12 上进行矩阵测试,并与 GitHub Actions 工作流集成。
安装
克隆仓库并以可编辑模式安装,同时包含开发依赖:
git clone https://github.com/ateeqdesktop-dot/sentinel-mcp.git
cd sentinel-mcp
pip install -e .[dev]使用方法
1. 通过 CLI 评估工具调用
您可以测试 SentinelMCP 如何根据您的安全策略评估任何 MCP 工具调用:
sentinel-mcp evaluate --tool fs_delete --args '{"path": "/home/user/document.txt"}' --policy policy.json2. 运行网关服务器
在本地启动 SentinelMCP 代理服务器:
sentinel-mcp serve --host 127.0.0.1 --port 8000 --policy policy.json3. 验证审计账本完整性
验证仅追加的审计跟踪是否未被篡改:
sentinel-mcp verify --ledger sentinel_audit.jsonl策略配置示例(policy.json)
{
"version": "1.0",
"default_action": "allow",
"rules": [
{
"id": "block-destructive-fs",
"tool_pattern": "fs_*",
"action": "deny",
"forbidden_arguments": [
"rm\\s+-rf",
"/etc/passwd",
"drop\\s+database"
]
},
{
"id": "limit-sql-queries",
"tool_pattern": "db_*",
"action": "allow",
"max_string_length": 500
}
]
}测试
使用 pytest 和代码覆盖率运行测试套件:
pytest --cov=sentinel tests/ -v许可证
根据 MIT 许可证分发。有关更多信息,请参阅 LICENSE。
参考
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for mandates, delegation, policy-gated execution, credential grants, and audit.
MCP gateway with runtime security policy, tool-call-level control, and audit of agent actions.
Security & DLP proxy for MCP: tool-poisoning scans, PII redaction on tool args/results. Beta.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceThe security runtime for MCP servers. Every tool call inspected. Every attack blocked. Every decision logged.1-
- FlicenseNot gradedqualityDmaintenanceProvides policy-driven runtime authorization and security evaluation for MCP-based agents, including MCP streaming HTTP gateway, mock MCP servers, deterministic agent demos, and audited tool invocation with redacted PostgreSQL audit chains.-
- AlicenseNot gradedqualityCmaintenanceEnforces fine-grained, context-aware access control on MCP tool calls, with a tamper-evident, replayable audit log that records denials and verifies every decision.MIT
- AlicenseNot gradedqualityBmaintenanceEnforces allow/deny/ask policies on MCP tool calls before they reach downstream servers, with tamper-evident audit logging.MIT