Runtime security for MCP agents
Identity proves who an agent is. Aegis decides what it's allowed to do.
A deterministic capability-enforcement layer for AI agents on the Model Context Protocol. Every tool call is checked against a spec before it reaches the server. There is no LLM anywhere in the enforcement path.
The MCP server never saw the request.
The problem
Prompt injection is a when, not an if.
Any agent that reads files, web pages, tickets or email will eventually read text written by someone else. If that text tells the model to do something, sometimes the model will do it.
Asking a second model whether a call "looks right" has the same weakness as the first one. Aegis takes a different route. It doesn't try to spot the injection. It makes sure that when an injection works, it can't cause anything outside the task.
(server, tool, argument, value) set before the run starts, then enforces it with plain code.How it works
How a tool call gets evaluated
The enforcement path contains no LLM. The proposer runs once, on trusted input, before the run starts. After that, every decision takes microseconds and can be verified by reading the code.
Integration
Drops into the agent you already have.
Pass any Pydantic AI MCPToolset to wrap_toolset(). The spec can come from a plain-language request through propose_spec(), or from YAML an operator wrote, through load_spec(). Nothing else in the agent changes.
from aegis import wrap_toolset, AegisConfig, propose_spec config = AegisConfig(sandbox_root=sandbox) spec = propose_spec( f"Read {sandbox / 'notes.txt'} and summarise it", sandbox_root=sandbox, run_id=config.run_id, ) # every call through fs is now evaluated first wrap_toolset(fs, "filesystem", spec=spec, config=config)
Capabilities
What it does today
Deterministic enforcement
Every MCP tool call is checked against a capability spec before it reaches the server. Values must match exactly. No globs, no regex, no guessed scope.
Generated specs
A plain-language request becomes a minimum-capability YAML spec. It is generated once and validated before use. You can also write specs by hand.
Human approval
Intercept rules defined by the operator pause sensitive calls until someone signs off, through a callback you control. An intercept can't rescue a call that was denied.
Response inspection
Rule-based scanning catches leaked secrets before a response reaches the model: private keys, AWS keys, Luhn-valid card numbers and SSNs.
Forensic audit trail
Each decision is logged with its run_id, the spec_hash of the policy that made it, and the rule that fired. You can search for waivers and denials by rule.
OTLP export
Audit events go to your existing observability stack as OTLP spans: Datadog, Jaeger, Splunk, or any OTLP-compatible tool. If the collector is down, tool calls are never blocked.
Position in the stack
Downstream of identity. Upstream of the server.
Identity vendors answer one question: is this agent allowed in? Aegis answers the next one: once it's in, what is it allowed to do on this task? Aegis doesn't compete with your identity provider. It handles what comes after.
It works with any identity system and any observability stack, and it adds one line of code to an existing Pydantic AI agent.
Honest coverage
Mapped against the OWASP MCP Top 10
One control can't cover a ten-category taxonomy, and Aegis doesn't claim to. Here is what it covers, what it partly covers, and what you need something else for.
Writing
Notes from building it
Building agents with real tool access?
Aegis is pre-production and open source. If "prove what the agent did" is a requirement for you, I'd like to hear what your team is running into.