Aegis Mcp

io.github.cleburn由 GitHub 帳號 cleburn 發布v0.1.15更新於 Nov 10, 2026

Runtime governance enforcement for AI agents. Zero token overhead.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

一個本機 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 產生。未宣告驗證、環境變數或標頭。
安裝前請注意
它管控寫入、刪除與執行動作,政策設定錯誤可能攔阻正常作業,或在 construction 模式下授予整個儲存庫的寫入權限。覆寫需要人工確認並會被記錄;不可變政策無法覆寫,只能透過 aegis init 修改。它會讀取專案政策檔案並寫入僅可附加的 overrides.jsonl 記錄。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Aegis Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

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 Lifecycle Overview]

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

bash
# Install globallynpm install -g aegis-mcp-server

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:

Call aegis_policy_summary now. This is your governance contract — it defines yourrole, your boundaries, and which tools to use. Do not take any action until you havecalled this tool and received confirmation from the user to proceed.

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.jsonl with a timestamp and human_confirmed: true
  • When the build is complete, the agent calls aegis_complete_task to 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:

json
{  "mcpServers": {    "aegis": {      "command": "aegis-mcp",      "args": ["--project", ".", "--role", "backend"]    }  }}

The MCP locks to that role immediately. aegis_policy_summary returns the role's boundaries directly, skipping role selection.

Tools

ToolWhat it doesToken cost
aegis_policy_summaryRole boundaries and governance summary (or available roles in universal mode)~200 tokens
aegis_select_roleSelect a role (including construction) in universal modeTiny
aegis_check_permissionsPre-check if an operation is allowedTiny
aegis_write_fileGoverned write with path + content validationSame as a normal write
aegis_read_fileGoverned read with path validationSame as a normal read
aegis_delete_fileGoverned delete with path validationTiny
aegis_executeGoverned command executionCommand output only
aegis_complete_taskRun quality gates and close construction mode if activeGate results only
aegis_request_overrideExecute a blocked action after human confirmationTiny

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

[Aegis Runtime Enforcement]

  • Governance boundaries — writable, read_only, forbidden path 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_commit flags mapped to build_commands and 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

[Aegis Completion]

When an action is blocked and the governance override behavior is warn_confirm_and_log:

  1. The blocked response includes an override_token and the specific policy violated
  2. The agent presents the violation to the user
  3. If the user confirms, the agent calls aegis_request_override with the token and the user's rationale
  4. The action proceeds — the override is logged with human_confirmed: true
  5. 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

Agent ──→ aegis-mcp-server ──→ File System              │              ├── Loads .agentpolicy/ into process memory (once)              ├── Watches for policy changes (auto-reload)              ├── Validates every tool call against policy              ├── Returns success or blocked with override option              └── Logs all enforcement decisions to overrides.jsonl

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
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.15最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分