Agent Context & MCP Server
This guide shows how to streamline AI assistant workflows using Aegil’s specialized agent tooling: extracting token-dense domain context with aegil context and configuring native Model Context Protocol (MCP) integration with aegil mcp.
Prerequisites
Section titled “Prerequisites”- Aegil CLI installed and on your system
PATH. - An MCP-compatible client (such as Cursor, Claude Code, Windsurf, or Antigravity) if configuring MCP tools.
Token-dense context (aegil context)
Section titled “Token-dense context (aegil context)”Standard coding agents often waste thousands of tokens scanning large directory trees and reading boilerplate files.
aegil context extracts only what an AI agent needs to understand the project:
aegil contextTo restrict the context to a single feature domain:
aegil context --feature notesWhat aegil context outputs:
Section titled “What aegil context outputs:”- Project configuration: Project name, namespace, and pinned toolchain versions from
aegil.yaml. - Domain specifications: Parsed entities, fields, validation bounds, CEL policies, and operations for the requested feature.
- Active and pending hooks: Paths to hook files, expected class names, and interface contracts.
- Strict zone boundaries: Explicit lists of what the agent may edit (Zone 1 and Zone 2) versus what is hash-locked (Zone 3).
This enables agents to start working immediately with zero prompt hallucination and minimal token consumption.
Model Context Protocol (aegil mcp)
Section titled “Model Context Protocol (aegil mcp)”Aegil includes an integrated, standard stdio Model Context Protocol (MCP) server. AI assistants that support MCP (such as Claude Code, Cursor, Windsurf, or Antigravity) can call Aegil compiler and verification tools directly.
Running the MCP server
Section titled “Running the MCP server”aegil mcpConfiguring in Claude Desktop / Cursor
Section titled “Configuring in Claude Desktop / Cursor”Add Aegil to your MCP configuration (e.g. claude_desktop_config.json or .cursor/mcp.json):
{ "mcpServers": { "aegil": { "command": "aegil", "args": ["mcp"] } }}Tools exposed via MCP:
Section titled “Tools exposed via MCP:”| Tool Name | Arguments | Description |
|---|---|---|
aegil_build |
project?: string, strict?: bool |
Compiles specs, generates code, and emits the Action Manifest with pending tasks. |
aegil_verify |
project?: string, only?: string, skipIntegration?: bool |
Executes the 5-stage automated verification harness and reports structured results. |
aegil_check |
project?: string |
Performs fast, read-only syntax, toolchain, and ownership boundary checks without writing files. |
aegil_context |
project?: string, feature?: string |
Returns a token-dense JSON payload of domain models and pending hook tasks. |
aegil_migrate |
name: string, allowDestructive?: bool |
Calculates schema diffs and commits versioned database migrations. |
What could go wrong?
Section titled “What could go wrong?”| What you see | Why | What to do |
|---|---|---|
ERR_FEATURE_NOT_FOUND |
aegil context --feature <name> referenced a feature folder that does not exist. |
Check the directory name under specs/<feature>/. |
| MCP connection refused | The aegil executable is not on your system PATH. |
Ensure aegil is installed and reachable via which aegil. |
Next steps
Section titled “Next steps”- Learn The 3-Step Agent Protocol.
- Learn Running & Debugging Locally.
- Learn 5-Stage Verification Harness.