Aegis Mcp
io.github.cleburn由 GitHub 账号 cleburn 发布v0.1.15更新于 Nov 10, 2026
Runtime governance enforcement for AI agents. Zero token overhead.
概览
一个本地 MCP 服务器,在 AI 代理执行文件写入、删除和命令执行之前,按项目治理策略进行校验和拦截。
- 可以做什么
- Aegis MCP 将项目的 .agentpolicy/ 治理文件读入自身进程内存,并在运行时校验代理操作。工具包括用于查看角色边界的 aegis_policy_summary、aegis_select_role、aegis_check_permissions,受治理的 aegis_write_file、aegis_read_file、aegis_delete_file 和 aegis_execute,以及用于质量门禁的 aegis_complete_task 和用于人工确认例外的 aegis_request_override。被拦截的操作会返回原因,并在允许时给出覆盖令牌;执行决策会记录到仅追加的 overrides.jsonl。
- 适用场景
- 适用于已有 Aegis 治理文件、希望代理的文件与命令操作接受路径权限、角色边界、敏感内容模式和质 量门禁检查的项目。也适合需要记录被拦截操作和人工确认覆盖的团队。
- 运行要求
- 以 npm 包 aegis-mcp-server 通过 stdio 在本地运行(需全局安装,因此需要 Node.js)。项目需包含 .agentpolicy/ 目录和 .mcp.json 连接配置,可由 aegis-cli 生成。未声明认证、环境变量或请求头。
安装
在 SourceWeft 中
- 打开 控制台中的 Aegis Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
aegis-mcp-server
[npm version] [License: MIT] [MCP Registry]
MCP enforcement layer for the Aegis agent governance specification.
Policy at the root. Enforcement at runtime. Accountability on every action.
What It Does
aegis-mcp-server is an MCP server that validates every agent action against your .agentpolicy/ files before it happens. Path permissions, content scanning, role boundaries, quality gates — all enforced at runtime with zero token overhead to the agent.
The agent never loads your governance files. The MCP server reads them into its own process memory and validates silently. The agent calls governed tools and gets back either a success or a blocked response with the specific reason.
Quick Start
If you generated your policy with aegis-cli, the .mcp.json connection config is already in your project root. Just install the MCP and open your agent — it connects automatically.
First Prompt
When starting a new agent session in a governed project, use this as your first prompt:
For initial builds, the Aegis CLI generates a custom handoff prompt tailored to your project — use that instead.
How It Works
Universal Mode (Default)
The MCP starts without a pre-assigned role. When the agent calls aegis_policy_summary, it receives the list of available roles — including the built-in construction role and all specialist roles from .agentpolicy/roles/. The agent presents them to the user, the user picks, and the agent calls aegis_select_role to lock in. All enforcement uses the selected role for the rest of the session.
This is the default behavior — no configuration needed beyond the .mcp.json that aegis init creates automatically.
Construction Mode
The construction role is always available for initial builds and major restructuring. When selected:
- The agent has full repository access (all paths writable and readable)
- The
.agentpolicy/files serve as the blueprint — the agent reads constitution, governance, and role files to understand the project's architecture, conventions, and quality standards - File operations run through native tools rather than governed tools, for speed
- The MCP logs the construction session start to
state/overrides.jsonlwith a timestamp andhuman_confirmed: true - When the build is complete, the agent calls
aegis_complete_taskto run quality gates and close construction mode — the closing timestamp is logged alongside the opening entry - All future sessions after construction should select a specialist role for governed operations
Construction mode is not a bypass — the agent still follows the governance files as its blueprint. It's a speed optimization for greenfield builds where enforcing write restrictions on every file would be counterproductive.
Fixed Mode
If you know which role to assign at startup:
The MCP locks to that role immediately. aegis_policy_summary returns the role's boundaries directly, skipping role selection.
Tools
Zero Token Overhead
Traditional approach: load governance files into the agent's context window. Token cost scales with policy complexity.
Aegis MCP approach: the server loads policy into its own process memory. The agent calls tools and gets structured results. A project with 200 lines of governance has the same token cost as one with 20 lines. The complexity is absorbed by the server, not the agent.
Enforcement
- Governance boundaries —
writable,read_only,forbiddenpath lists - Role scoping — agents confined to their role's writable and readable paths
- Sensitive pattern detection — content scanned against governance-defined regex patterns (content only, not path-based)
- Cross-domain boundaries — imports validated against shared interface rules
- Quality gate validation —
pre_commitflags mapped tobuild_commandsand executed - Override logging — every blocked action logged to append-only
overrides.jsonl - Immutable policies — designated rules that cannot be overridden, ever
- Construction session logging — start and end timestamps for initial builds
Override Protocol
When an action is blocked and the governance override behavior is warn_confirm_and_log:
- The blocked response includes an
override_tokenand the specific policy violated - The agent presents the violation to the user
- If the user confirms, the agent calls
aegis_request_overridewith the token and the user's rationale - The action proceeds — the override is logged with
human_confirmed: true - Normal governance resumes immediately — the override is a one-time exception
Immutable policies (e.g., HIPAA compliance, ITAR data sovereignty, audit completeness) return override_available: false and cannot be overridden. The user must modify the governance through aegis init.
Consent-Based Governance
The Aegis MCP does not override the agent's native directives. It introduces itself through tool descriptions, explains why governance is active, and asks the agent to seek user permission to route write operations through Aegis tools. The user's authority is the enforcement mechanism.
Native tools for reading, searching, and exploring the codebase work fine without governance gating. Only write, delete, and execute operations benefit from routing through Aegis.
Architecture
Three artifacts, one governance framework:
- aegis-spec — The governance standard
- aegis-cli — Generates the governance
- aegis-mcp-server — Enforces the governance
License
MIT
来源:README.md,提交 1741ab2
工具
0版本历史
1- v0.1.15最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分